intel_be_context.c File Reference

Include dependency graph for intel_be_context.c:

Go to the source code of this file.

Functions

static struct intel_be_contextintel_be_context (struct i915_winsys *sws)
static struct i915_batchbufferintel_i915_batch_get (struct i915_winsys *sws)
static void intel_i915_batch_reloc (struct i915_winsys *sws, struct pipe_buffer *buf, unsigned access_flags, unsigned delta)
static void intel_i915_batch_flush (struct i915_winsys *sws, struct pipe_fence_handle **fence)
boolean intel_be_init_context (struct intel_be_context *intel, struct intel_be_device *device)
 Intialize a allocated intel_be_context struct.
void intel_be_destroy_context (struct intel_be_context *intel)
 Destroy a intel_be_context.


Function Documentation

static struct intel_be_context* intel_be_context ( struct i915_winsys sws  )  [static, read]

Definition at line 12 of file intel_be_context.c.

00013 {
00014         return (struct intel_be_context *)sws;
00015 }

void intel_be_destroy_context ( struct intel_be_context intel  ) 

Destroy a intel_be_context.

Does not free the struct that is up to the winsys.

Definition at line 104 of file intel_be_context.c.

References intel_be_context::batch, and intel_be_batchbuffer_free().

00105 {
00106         intel_be_batchbuffer_free(intel->batch);
00107 }

boolean intel_be_init_context ( struct intel_be_context intel,
struct intel_be_device device 
)

Intialize a allocated intel_be_context struct.

Remember to set the hardware_* functions.

Definition at line 85 of file intel_be_context.c.

References assert, intel_be_context::base, intel_be_context::batch, i915_winsys::batch_flush, i915_winsys::batch_get, i915_winsys::batch_reloc, intel_be_context::device, intel_be_batchbuffer_alloc(), intel_i915_batch_flush(), intel_i915_batch_get(), and intel_i915_batch_reloc().

00086 {
00087         assert(intel);
00088         assert(device);
00089 
00090         intel->device = device;
00091 
00092         /* TODO move framebuffer createion to the driver */
00093 
00094         intel->base.batch_get = intel_i915_batch_get;
00095         intel->base.batch_reloc = intel_i915_batch_reloc;
00096         intel->base.batch_flush = intel_i915_batch_flush;
00097 
00098         intel->batch = intel_be_batchbuffer_alloc(intel);
00099 
00100         return true;
00101 }

static void intel_i915_batch_flush ( struct i915_winsys sws,
struct pipe_fence_handle **  fence 
) [static]

Definition at line 54 of file intel_be_context.c.

References assert, intel_be_context::batch, driFenceUnReference(), intel_be_batchbuffer_flush(), and intel_be_context().

00056 {
00057         struct intel_be_context *intel = intel_be_context(sws);
00058 
00059         union {
00060                 struct _DriFenceObject *dri;
00061                 struct pipe_fence_handle *pipe;
00062         } fu;
00063 
00064         if (fence)
00065                 assert(!*fence);
00066 
00067         fu.dri = intel_be_batchbuffer_flush(intel->batch);
00068 
00069         if (!fu.dri) {
00070                 assert(0);
00071                 *fence = NULL;
00072                 return;
00073         }
00074 
00075         if (fu.dri) {
00076                 if (fence)
00077                         *fence = fu.pipe;
00078                 else
00079                         driFenceUnReference(&fu.dri);
00080         }
00081 
00082 }

static struct i915_batchbuffer* intel_i915_batch_get ( struct i915_winsys sws  )  [static, read]

Definition at line 21 of file intel_be_context.c.

References intel_be_batchbuffer::base, intel_be_context::batch, and intel_be_context().

00022 {
00023         struct intel_be_context *intel = intel_be_context(sws);
00024         return &intel->batch->base;
00025 }

static void intel_i915_batch_reloc ( struct i915_winsys sws,
struct pipe_buffer buf,
unsigned  access_flags,
unsigned  delta 
) [static]

Definition at line 27 of file intel_be_context.c.

References intel_be_context::batch, dri_bo(), I915_BUFFER_ACCESS_READ, I915_BUFFER_ACCESS_WRITE, intel_be_context(), and intel_be_offset_relocation().

00031 {
00032         struct intel_be_context *intel = intel_be_context(sws);
00033 
00034         unsigned flags = DRM_BO_FLAG_MEM_TT;
00035         unsigned mask = DRM_BO_MASK_MEM;
00036 
00037         if (access_flags & I915_BUFFER_ACCESS_WRITE) {
00038                 flags |= DRM_BO_FLAG_WRITE;
00039                 mask |= DRM_BO_FLAG_WRITE;
00040         }
00041 
00042         if (access_flags & I915_BUFFER_ACCESS_READ) {
00043                 flags |= DRM_BO_FLAG_READ;
00044                 mask |= DRM_BO_FLAG_READ;
00045         }
00046 
00047         intel_be_offset_relocation(intel->batch,
00048                                 delta,
00049                                 dri_bo(buf),
00050                                 flags,
00051                                 mask);
00052 }


Generated on Tue Sep 29 06:25:45 2009 for Gallium3D by  doxygen 1.5.4