Mesa (master): i965: Simplify the no-reopening-the-winsys-buffer tests.

Eric Anholt anholt at kemper.freedesktop.org
Mon Mar 24 18:31:05 UTC 2014


Module: Mesa
Branch: master
Commit: 44e944c87cafd55c00c8837d8223be074436015c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=44e944c87cafd55c00c8837d8223be074436015c

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Mar 21 15:25:49 2014 -0700

i965: Simplify the no-reopening-the-winsys-buffer tests.

The formatting was weird, and the tests were duplicated, and it is
guaranteed that mt->region exists.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_context.c |   38 +++++++++++++------------------
 1 file changed, 16 insertions(+), 22 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 3fc4416..9a76ee1 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -1264,17 +1264,14 @@ intel_process_dri2_buffer(struct brw_context *brw,
     * use of a mapping of the buffer involves a bunch of page faulting which is
     * moderately expensive.
     */
-   if (num_samples == 0) {
-       if (rb->mt &&
-           rb->mt->region &&
-           rb->mt->region->name == buffer->name)
-          return;
-   } else {
-       if (rb->singlesample_mt &&
-           rb->singlesample_mt->region &&
-           rb->singlesample_mt->region->name == buffer->name)
-          return;
-   }
+   struct intel_mipmap_tree *last_mt;
+   if (num_samples == 0)
+      last_mt = rb->mt;
+   else
+      last_mt = rb->singlesample_mt;
+
+   if (last_mt && last_mt->region->name == buffer->name)
+      return;
 
    if (unlikely(INTEL_DEBUG & DEBUG_DRI)) {
       fprintf(stderr,
@@ -1349,17 +1346,14 @@ intel_update_image_buffer(struct brw_context *intel,
    /* Check and see if we're already bound to the right
     * buffer object
     */
-   if (num_samples == 0) {
-       if (rb->mt &&
-           rb->mt->region &&
-           rb->mt->region->bo == region->bo)
-          return;
-   } else {
-       if (rb->singlesample_mt &&
-           rb->singlesample_mt->region &&
-           rb->singlesample_mt->region->bo == region->bo)
-          return;
-   }
+   struct intel_mipmap_tree *last_mt;
+   if (num_samples == 0)
+      last_mt = rb->mt;
+   else
+      last_mt = rb->singlesample_mt;
+
+   if (last_mt && last_mt->region->bo == region->bo)
+      return;
 
    intel_update_winsys_renderbuffer_miptree(intel, rb, region);
 




More information about the mesa-commit mailing list