intel_swapbuffers.c File Reference

Include dependency graph for intel_swapbuffers.c:

Go to the source code of this file.

Functions

static void intel_display_surface (struct egl_drm_drawable *draw, struct pipe_surface *surf)
void intel_swap_buffers (struct egl_drm_drawable *draw)


Function Documentation

static void intel_display_surface ( struct egl_drm_drawable draw,
struct pipe_surface surf 
) [static]

Definition at line 62 of file intel_swapbuffers.c.

References intel_context::base, intel_be_context::batch, BEGIN_BATCH, BR13(), pipe_surface::buffer, intel_framebuffer::device, dri_bo(), driFenceUnReference(), intel_device::dummy, intel_framebuffer::front, intel_framebuffer::front_buffer, egl_drm_frontbuffer::height, intel_be_batchbuffer_finish(), intel_be_batchbuffer_flush(), OUT_BATCH, OUT_RELOC, egl_drm_frontbuffer::pitch, egl_drm_drawable::priv, pipe_surface::stride, egl_drm_frontbuffer::width, XY_SRC_COPY_BLT_CMD, XY_SRC_COPY_BLT_WRITE_ALPHA, and XY_SRC_COPY_BLT_WRITE_RGB.

00064 {
00065         struct intel_context *intel = NULL;
00066         struct intel_framebuffer *intel_fb = (struct intel_framebuffer *)draw->priv;
00067         struct _DriFenceObject *fence;
00068 
00069         //const int srcWidth = surf->width;
00070         //const int srcHeight = surf->height;
00071 
00072         intel = intel_fb->device->dummy;
00073         if (!intel) {
00074                 printf("No dummy context\n");
00075                 return;
00076         }
00077 
00078         const int dstWidth = intel_fb->front->width;
00079         const int dstHeight = intel_fb->front->height;
00080         const int dstPitch = intel_fb->front->pitch / 4;//draw->front.cpp;
00081 
00082         const int cpp = 4;//intel_fb->front->cpp;
00083         const int srcPitch = surf->stride / cpp;
00084 
00085         int BR13, CMD;
00086         //int i;
00087 
00088         BR13 = (dstPitch * cpp) | (0xCC << 16) | (1 << 24) | (1 << 25);
00089         CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
00090                         XY_SRC_COPY_BLT_WRITE_RGB);
00091 
00092         BEGIN_BATCH(8, 2);
00093         OUT_BATCH(CMD);
00094         OUT_BATCH(BR13);
00095         OUT_BATCH((0 << 16) | 0);
00096         OUT_BATCH((dstHeight << 16) | dstWidth);
00097 
00098         OUT_RELOC(intel_fb->front_buffer,
00099                 DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
00100                 DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE, 0);
00101 
00102         OUT_BATCH((0 << 16) | 0);
00103         OUT_BATCH((srcPitch * cpp) & 0xffff);
00104         OUT_RELOC(dri_bo(surf->buffer),
00105                         DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
00106                         DRM_BO_MASK_MEM | DRM_BO_FLAG_READ, 0);
00107 
00108         fence = intel_be_batchbuffer_flush(intel->base.batch);
00109         driFenceUnReference(&fence);
00110         intel_be_batchbuffer_finish(intel->base.batch);
00111 }

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:46 2009 for Gallium3D by  doxygen 1.5.4