From 019560c127778dc3b08bdc7c3acdc68dbbb80ea0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 13 Feb 2014 14:33:57 -0800 Subject: i965: Drop some duplicated code in DRI winsys BO updates. The only DRI2 vs DRI3 delta was just how to decide about frontbuffer-ness for doing the upsample. v2: Fix missing singlesample_mt->region->name update in the merged code, which would have broken the DRI2 don't-recreate-the-miptree optimization. Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_context.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/mesa/drivers/dri/i965/brw_context.c') diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 021287ee234..ba2f971bcc1 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -1302,11 +1302,14 @@ intel_process_dri2_buffer(struct brw_context *brw, return; } - rb->mt = intel_miptree_create_for_dri2_buffer(brw, - buffer->attachment, - intel_rb_format(rb), - num_samples, - region); + intel_update_winsys_renderbuffer_miptree(brw, rb, region); + + if (brw->is_front_buffer_rendering && + (buffer->attachment == __DRI_BUFFER_FRONT_LEFT || + buffer->attachment == __DRI_BUFFER_FAKE_FRONT_LEFT) && + rb->Base.Base.NumSamples > 1) { + intel_miptree_upsample(brw, rb->mt); + } assert(rb->mt); @@ -1359,12 +1362,13 @@ intel_update_image_buffer(struct brw_context *intel, return; } - intel_miptree_release(&rb->mt); - rb->mt = intel_miptree_create_for_image_buffer(intel, - buffer_type, - intel_rb_format(rb), - num_samples, - region); + intel_update_winsys_renderbuffer_miptree(intel, rb, region); + + if (intel->is_front_buffer_rendering && + buffer_type == __DRI_IMAGE_BUFFER_FRONT && + rb->Base.Base.NumSamples > 1) { + intel_miptree_upsample(intel, rb->mt); + } } static void -- cgit v1.2.3