void
intel_batchbuffer_reset(struct intel_context *intel)
{
- if (intel->batch.bo != NULL) {
- drm_intel_bo_unreference(intel->batch.bo);
- intel->batch.bo = NULL;
+ if (intel->batch.last_bo != NULL) {
+ drm_intel_bo_unreference(intel->batch.last_bo);
+ intel->batch.last_bo = NULL;
}
+ intel->batch.last_bo = intel->batch.bo;
+
clear_cache(intel);
intel->batch.bo = drm_intel_bo_alloc(intel->bufmgr, "batchbuffer",
void
intel_batchbuffer_free(struct intel_context *intel)
{
+ drm_intel_bo_unreference(intel->batch.last_bo);
drm_intel_bo_unreference(intel->batch.bo);
clear_cache(intel);
}
void
intelFinish(struct gl_context * ctx)
{
- struct gl_framebuffer *fb = ctx->DrawBuffer;
- int i;
+ struct intel_context *intel = intel_context(ctx);
intel_flush(ctx);
intel_flush_front(ctx);
- for (i = 0; i < fb->_NumColorDrawBuffers; i++) {
- struct intel_renderbuffer *irb;
-
- irb = intel_renderbuffer(fb->_ColorDrawBuffers[i]);
-
- if (irb && irb->region && irb->region->buffer)
- drm_intel_bo_wait_rendering(irb->region->buffer);
- }
- if (fb->_DepthBuffer) {
- /* XXX: Wait on buffer idle */
- }
+ if (intel->batch.last_bo)
+ drm_intel_bo_wait_rendering(intel->batch.last_bo);
}
void
int urb_size;
struct intel_batchbuffer {
+ /** Current batchbuffer being queued up. */
drm_intel_bo *bo;
+ /** Last BO submitted to the hardware. Used for glFinish(). */
+ drm_intel_bo *last_bo;
+
struct cached_batch_item *cached_items;
uint16_t emit, total;