intel_egl.h File Reference

Include dependency graph for intel_egl.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  egl_drm_device
struct  egl_drm_context
struct  egl_drm_drawable
struct  egl_drm_frontbuffer

Functions

int intel_create_device (struct egl_drm_device *device)
int intel_destroy_device (struct egl_drm_device *device)
int intel_create_context (struct egl_drm_context *context, const __GLcontextModes *visual, void *sharedContextPrivate)
int intel_destroy_context (struct egl_drm_context *context)
int intel_create_drawable (struct egl_drm_drawable *drawable, const __GLcontextModes *visual)
int intel_destroy_drawable (struct egl_drm_drawable *drawable)
void intel_make_current (struct egl_drm_context *context, struct egl_drm_drawable *draw, struct egl_drm_drawable *read)
void intel_swap_buffers (struct egl_drm_drawable *draw)
void intel_bind_frontbuffer (struct egl_drm_drawable *draw, struct egl_drm_frontbuffer *front)


Function Documentation

void intel_bind_frontbuffer ( struct egl_drm_drawable draw,
struct egl_drm_frontbuffer front 
)

Definition at line 221 of file intel_context.c.

References intel_device::base, egl_drm_drawable::device, intel_device::device, driBOSetReferenced(), driBOUnReference(), driGenBuffers(), egl_drm_drawable::h, egl_drm_frontbuffer::handle, egl_drm_drawable::priv, egl_drm_device::priv, st_resize_framebuffer(), intel_be_device::staticPool, and egl_drm_drawable::w.

00222 {
00223         struct intel_device *device = (struct intel_device *)draw->device->priv;
00224         struct intel_framebuffer *draw_fb = (struct intel_framebuffer *)draw->priv;
00225 
00226         if (draw_fb->front_buffer)
00227                 driBOUnReference(draw_fb->front_buffer);
00228 
00229         draw_fb->front_buffer = NULL;
00230         draw_fb->front = NULL;
00231 
00232         /* to unbind just call this function with front == NULL */
00233         if (!front)
00234                 return;
00235 
00236         draw_fb->front = front;
00237 
00238         driGenBuffers(device->base.staticPool, "front", 1, &draw_fb->front_buffer, 0, 0, 0);
00239         driBOSetReferenced(draw_fb->front_buffer, front->handle);
00240 
00241         st_resize_framebuffer(draw_fb->stfb, draw->w, draw->h);
00242 }

int intel_create_context ( struct egl_drm_context context,
const __GLcontextModes *  visual,
void *  sharedContextPrivate 
)

Definition at line 147 of file intel_context.c.

References intel_be_context::base, intel_be_device::base, intel_device::base, intel_context::base, CALLOC_STRUCT, egl_drm_context::device, intel_device::device, intel_device::dummy, intel_context::egl_context, intel_context::egl_device, intel_be_context::hardware_lock, intel_be_context::hardware_locked, intel_be_context::hardware_unlock, i915_create_context(), intel_be_init_context(), intel_create_softpipe(), intel_context::intel_device, intel_lock_hardware(), intel_locked_hardware(), intel_unlock_hardware(), intel_device::pipe, egl_drm_context::priv, egl_drm_device::priv, intel_context::st, st_create_context(), and TRUE.

00148 {
00149         struct intel_context *intel = CALLOC_STRUCT(intel_context);
00150         struct intel_device *device = (struct intel_device *)egl_context->device->priv;
00151         struct pipe_context *pipe;
00152         struct st_context *st_share = NULL;
00153 
00154         egl_context->priv = intel;
00155 
00156         intel->intel_device = device;
00157         intel->egl_context = egl_context;
00158         intel->egl_device = egl_context->device;
00159 
00160         intel->base.hardware_lock = intel_lock_hardware;
00161         intel->base.hardware_unlock = intel_unlock_hardware;
00162         intel->base.hardware_locked = intel_locked_hardware;
00163 
00164         intel_be_init_context(&intel->base, &device->base);
00165 
00166 #if 0
00167         pipe = intel_create_softpipe(intel, screen->winsys);
00168 #else
00169         pipe = i915_create_context(device->pipe, &device->base.base, &intel->base.base);
00170 #endif
00171 
00172         pipe->priv = intel;
00173 
00174         intel->st = st_create_context(pipe, visual, st_share);
00175 
00176         device->dummy = intel;
00177 
00178         return TRUE;
00179 }

int intel_create_device ( struct egl_drm_device device  ) 

Definition at line 44 of file intel_device.c.

References intel_be_device::base, intel_device::base, CALLOC_STRUCT, card_extensions, intel_device::device, egl_drm_device::deviceID, intel_device::deviceID, egl_drm_device::drmFD, FALSE, i915_create_screen(), intel_be_init_device(), intel_device::pipe, egl_drm_device::priv, and TRUE.

00045 {
00046         struct intel_device *intel_device;
00047 
00048         /* Allocate the private area */
00049         intel_device = CALLOC_STRUCT(intel_device);
00050         if (!intel_device)
00051                 return FALSE;
00052 
00053         device->priv = (void *)intel_device;
00054         intel_device->device = device;
00055 
00056         intel_device->deviceID = device->deviceID;
00057 
00058         intel_be_init_device(&intel_device->base, device->drmFD, intel_device->deviceID);
00059 
00060         intel_device->pipe = i915_create_screen(&intel_device->base.base, intel_device->deviceID);
00061 
00062         /* hack */
00063         driInitExtensions(NULL, card_extensions, GL_FALSE);
00064 
00065         return TRUE;
00066 }

int intel_create_drawable ( struct egl_drm_drawable drawable,
const __GLcontextModes *  visual 
)

Definition at line 82 of file intel_device.c.

References CALLOC_STRUCT, egl_drm_drawable::device, intel_framebuffer::device, egl_drm_drawable::h, PIPE_FORMAT_A8R8G8B8_UNORM, PIPE_FORMAT_NONE, PIPE_FORMAT_R5G6B5_UNORM, PIPE_FORMAT_S8Z24_UNORM, PIPE_FORMAT_Z16_UNORM, egl_drm_drawable::priv, egl_drm_device::priv, st_create_framebuffer(), intel_framebuffer::stfb, and egl_drm_drawable::w.

00084 {
00085         enum pipe_format colorFormat, depthFormat, stencilFormat;
00086         struct intel_framebuffer *intelfb = CALLOC_STRUCT(intel_framebuffer);
00087 
00088         if (!intelfb)
00089                 return GL_FALSE;
00090 
00091         intelfb->device = drawable->device->priv;
00092 
00093         if (visual->redBits == 5)
00094                 colorFormat = PIPE_FORMAT_R5G6B5_UNORM;
00095         else
00096                 colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM;
00097 
00098         if (visual->depthBits == 16)
00099                 depthFormat = PIPE_FORMAT_Z16_UNORM;
00100         else if (visual->depthBits == 24)
00101                 depthFormat = PIPE_FORMAT_S8Z24_UNORM;
00102         else
00103                 depthFormat = PIPE_FORMAT_NONE;
00104 
00105         if (visual->stencilBits == 8)
00106                 stencilFormat = PIPE_FORMAT_S8Z24_UNORM;
00107         else
00108                 stencilFormat = PIPE_FORMAT_NONE;
00109 
00110         intelfb->stfb = st_create_framebuffer(visual,
00111                         colorFormat,
00112                         depthFormat,
00113                         stencilFormat,
00114                         drawable->w,
00115                         drawable->h,
00116                         (void*) intelfb);
00117 
00118         if (!intelfb->stfb) {
00119                 free(intelfb);
00120                 return GL_FALSE;
00121         }
00122 
00123         drawable->priv = (void *) intelfb;
00124         return GL_TRUE;
00125 }

int intel_destroy_context ( struct egl_drm_context context  ) 

Definition at line 182 of file intel_context.c.

References intel_context::base, intel_device::dummy, intel_be_destroy_context(), intel_context::intel_device, egl_drm_context::priv, intel_context::st, st_destroy_context(), and TRUE.

00183 {
00184         struct intel_context *intel = egl_context->priv;
00185 
00186         if (intel->intel_device->dummy == intel)
00187                 intel->intel_device->dummy = NULL;
00188 
00189         st_destroy_context(intel->st);
00190         intel_be_destroy_context(&intel->base);
00191         free(intel);
00192         return TRUE;
00193 }

int intel_destroy_device ( struct egl_drm_device device  ) 

Definition at line 69 of file intel_device.c.

References intel_device::base, intel_be_destroy_device(), egl_drm_device::priv, and TRUE.

00070 {
00071         struct intel_device *intel_device = (struct intel_device *)device->priv;
00072         
00073         intel_be_destroy_device(&intel_device->base);
00074 
00075         free(intel_device);
00076         device->priv = NULL;
00077 
00078         return TRUE;
00079 }

int intel_destroy_drawable ( struct egl_drm_drawable drawable  ) 

Definition at line 128 of file intel_device.c.

References assert, egl_drm_drawable::priv, st_unreference_framebuffer(), intel_framebuffer::stfb, and TRUE.

00129 {
00130         struct intel_framebuffer *intelfb = (struct intel_framebuffer *)drawable->priv;
00131         drawable->priv = NULL;
00132 
00133         assert(intelfb->stfb);
00134         st_unreference_framebuffer(&intelfb->stfb);
00135         free(intelfb);
00136         return TRUE;
00137 }

void intel_make_current ( struct egl_drm_context context,
struct egl_drm_drawable draw,
struct egl_drm_drawable read 
)

Definition at line 196 of file intel_context.c.

References assert, intel_context::egl_drawable, egl_drm_drawable::h, egl_drm_drawable::priv, egl_drm_context::priv, intel_context::st, st_make_current(), st_resize_framebuffer(), intel_framebuffer::stfb, and egl_drm_drawable::w.

00197 {
00198         if (context) {
00199                 struct intel_context *intel = (struct intel_context *)context->priv;
00200                 struct intel_framebuffer *draw_fb = (struct intel_framebuffer *)draw->priv;
00201                 struct intel_framebuffer *read_fb = (struct intel_framebuffer *)read->priv;
00202 
00203                 assert(draw_fb->stfb);
00204                 assert(read_fb->stfb);
00205 
00206                 st_make_current(intel->st, draw_fb->stfb, read_fb->stfb);
00207 
00208                 intel->egl_drawable = draw;
00209 
00210                 st_resize_framebuffer(draw_fb->stfb, draw->w, draw->h);
00211 
00212                 if (draw != read)
00213                         st_resize_framebuffer(read_fb->stfb, read->w, read->h);
00214 
00215         } else {
00216                 st_make_current(NULL, NULL, NULL);
00217         }
00218 }

void intel_swap_buffers ( struct egl_drm_drawable draw  ) 

Definition at line 44 of file intel_swapbuffers.c.

References assert, intel_framebuffer::front, intel_display_surface(), egl_drm_drawable::priv, st_get_framebuffer_surface(), st_notify_swapbuffers(), st_notify_swapbuffers_complete(), ST_SURFACE_BACK_LEFT, and intel_framebuffer::stfb.

00045 {
00046         struct intel_framebuffer *intel_fb = (struct intel_framebuffer *)draw->priv;
00047         struct pipe_surface *back_surf;
00048 
00049         assert(intel_fb);
00050         assert(intel_fb->stfb);
00051 
00052         back_surf = st_get_framebuffer_surface(intel_fb->stfb, ST_SURFACE_BACK_LEFT);
00053         if (back_surf) {
00054                 st_notify_swapbuffers(intel_fb->stfb);
00055                 if (intel_fb->front)
00056                         intel_display_surface(draw, back_surf);
00057                 st_notify_swapbuffers_complete(intel_fb->stfb);
00058         }
00059 }


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