/** * \brief Query DRI2 to obtain a DRIdrawable's buffers. * * To determine which DRI buffers to request, examine the renderbuffers * attached to the drawable's framebuffer. Then request the buffers with * DRI2GetBuffers() or DRI2GetBuffersWithFormat(). * * This is called from intel_update_renderbuffers(). * * \param drawable Drawable whose buffers are queried. * \param buffers [out] List of buffers returned by DRI2 query. * \param buffer_count [out] Number of buffers returned. * * \see intel_update_renderbuffers() * \see DRI2GetBuffers() * \see DRI2GetBuffersWithFormat() */ static void intel_query_dri2_buffers(struct brw_context *brw, __DRIdrawable *drawable, __DRIbuffer **buffers, int *buffer_count) { __DRIscreen *screen = brw->intelScreen->driScrnPriv; struct gl_framebuffer *fb = drawable->driverPrivate; int i = 0; unsigned attachments[8]; struct intel_renderbuffer *front_rb; struct intel_renderbuffer *back_rb; front_rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT); back_rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT); memset(attachments, 0, sizeof(attachments)); if ((brw->is_front_buffer_rendering || brw->is_front_buffer_reading || !back_rb) && front_rb) { /* If a fake front buffer is in use, then querying for * __DRI_BUFFER_FRONT_LEFT will cause the server to copy the image from * the real front buffer to the fake front buffer. So before doing the * query, we need to make sure all the pending drawing has landed in the * real front buffer. */ intel_flush(&brw->ctx); intel_flush_front(&brw->ctx); attachments[i++] = __DRI_BUFFER_FRONT_LEFT; attachments[i++] = intel_bits_per_pixel(front_rb); } else if (front_rb && brw->front_buffer_dirty) { /* We have pending front buffer rendering, but we aren't querying for a * front buffer. If the front buffer we have is a fake front buffer, * the X server is going to throw it away when it processes the query. * So before doing the query, make sure all the pending drawing has * landed in the real front buffer. */ intel_flush(&brw->ctx); intel_flush_front(&brw->ctx); } if (back_rb) { attachments[i++] = __DRI_BUFFER_BACK_LEFT; attachments[i++] = intel_bits_per_pixel(back_rb); } assert(i <= ARRAY_SIZE(attachments)); *buffers = screen->dri2.loader->getBuffersWithFormat(drawable, &drawable->w, &drawable->h, attachments, i / 2, buffer_count, drawable->loaderPrivate); }
static void intel_glFlush(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); intel_flush(ctx); intel_flush_front(ctx); if (intel->is_front_buffer_rendering) intel->need_throttle = true; }
static void intel_glFlush(struct gl_context *ctx) { struct brw_context *brw = brw_context(ctx); intel_flush(ctx); intel_flush_front(ctx); if (brw->is_front_buffer_rendering) brw->need_throttle = true; }
static void intel_glFlush(struct gl_context *ctx) { struct brw_context *brw = brw_context(ctx); intel_batchbuffer_flush(brw); intel_flush_front(ctx); if (brw_is_front_buffer_drawing(ctx->DrawBuffer)) brw->need_throttle = true; }
static void intel_glFlush(struct gl_context *ctx) { struct intel_context *intel = intel_context(ctx); intel_flush(ctx); intel_flush_front(ctx); if (_mesa_is_front_buffer_drawing(ctx->DrawBuffer)) intel->need_throttle = true; }
void intelFinish(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); intel_flush(ctx); intel_flush_front(ctx); if (intel->batch.last_bo) drm_intel_bo_wait_rendering(intel->batch.last_bo); }
void intelFinish(struct gl_context * ctx) { struct brw_context *brw = brw_context(ctx); intel_flush(ctx); intel_flush_front(ctx); if (brw->batch.last_bo) drm_intel_bo_wait_rendering(brw->batch.last_bo); }
void intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) { struct gl_framebuffer *fb = drawable->driverPrivate; struct intel_renderbuffer *rb; struct intel_context *intel = context->driverPrivate; __DRIbuffer *buffers = NULL; int i, count; const char *region_name; /* If we're rendering to the fake front buffer, make sure all the * pending drawing has landed on the real front buffer. Otherwise * when we eventually get to DRI2GetBuffersWithFormat the stale * real front buffer contents will get copied to the new fake front * buffer. */ if (intel->is_front_buffer_rendering) { intel_flush(&intel->ctx); intel_flush_front(&intel->ctx); } /* Set this up front, so that in case our buffers get invalidated * while we're getting new buffers, we don't clobber the stamp and * thus ignore the invalidate. */ drawable->lastStamp = drawable->dri2.stamp; if (unlikely(INTEL_DEBUG & DEBUG_DRI)) fprintf(stderr, "enter %s, drawable %p\n", __func__, drawable); intel_query_dri2_buffers(intel, drawable, &buffers, &count); if (buffers == NULL) return; for (i = 0; i < count; i++) { switch (buffers[i].attachment) { case __DRI_BUFFER_FRONT_LEFT: rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT); region_name = "dri2 front buffer"; break; case __DRI_BUFFER_FAKE_FRONT_LEFT: rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT); region_name = "dri2 fake front buffer"; break; case __DRI_BUFFER_BACK_LEFT: rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT); region_name = "dri2 back buffer"; break; case __DRI_BUFFER_DEPTH: case __DRI_BUFFER_HIZ: case __DRI_BUFFER_DEPTH_STENCIL: case __DRI_BUFFER_STENCIL: case __DRI_BUFFER_ACCUM: default: fprintf(stderr, "unhandled buffer attach event, attachment type %d\n", buffers[i].attachment); return; } intel_process_dri2_buffer(intel, drawable, &buffers[i], rb, region_name); } driUpdateFramebufferSize(&intel->ctx, drawable); }