[Mesa-dev] [PATCH 12/15] intel: Use fd parameter in DRIbuffer when name is unset

Christopher James Halse Rogers christopher.halse.rogers at canonical.com
Sat Jul 20 04:40:44 PDT 2013


---
 src/mesa/drivers/dri/i915/intel_context.c | 31 +++++++++++++++++++---------
 src/mesa/drivers/dri/i965/intel_context.c | 34 +++++++++++++++++++++----------
 2 files changed, 44 insertions(+), 21 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
index f27e3d0..25a2832 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -804,24 +804,35 @@ intel_process_dri2_buffer(struct intel_context *intel,
     */
    if (rb->mt &&
        rb->mt->region &&
-       rb->mt->region->name == buffer->name)
+       rb->mt->region->name == buffer->name &&
+       rb->mt->region->name != 0)
       return;
 
    if (unlikely(INTEL_DEBUG & DEBUG_DRI)) {
       fprintf(stderr,
-	      "attaching buffer %d, at %d, cpp %d, pitch %d\n",
+	      "attaching buffer %d, at %d, cpp %d, pitch %d, fd %d\n",
 	      buffer->name, buffer->attachment,
-	      buffer->cpp, buffer->pitch);
+	      buffer->cpp, buffer->pitch, buffer->fd);
    }
 
    intel_miptree_release(&rb->mt);
-   region = intel_region_alloc_for_handle(intel->intelScreen,
-                                          buffer->cpp,
-                                          drawable->w,
-                                          drawable->h,
-                                          buffer->pitch,
-                                          buffer->name,
-                                          buffer_name);
+   if (buffer->name != 0) {
+      region = intel_region_alloc_for_handle(intel->intelScreen,
+                                             buffer->cpp,
+                                             drawable->w,
+                                             drawable->h,
+                                             buffer->pitch,
+                                             buffer->name,
+                                             buffer_name);
+   } else {
+      region = intel_region_alloc_for_fd(intel->intelScreen,
+                                         buffer->cpp,
+                                         drawable->w,
+                                         drawable->h,
+                                         buffer->pitch,
+                                         buffer->fd,
+                                         buffer_name);
+   }
    if (!region)
       return;
 
diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c
index 742bcc3..e82cb7e 100644
--- a/src/mesa/drivers/dri/i965/intel_context.c
+++ b/src/mesa/drivers/dri/i965/intel_context.c
@@ -857,31 +857,43 @@ intel_process_dri2_buffer(struct brw_context *brw,
    if (num_samples == 0) {
        if (rb->mt &&
            rb->mt->region &&
-           rb->mt->region->name == buffer->name)
+           rb->mt->region->name == buffer->name &&
+           rb->mt->region->name != 0)
           return;
    } else {
        if (rb->mt &&
            rb->mt->singlesample_mt &&
            rb->mt->singlesample_mt->region &&
-           rb->mt->singlesample_mt->region->name == buffer->name)
+           rb->mt->singlesample_mt->region->name == buffer->name &&
+           rb->mt->singlesample_mt->region->name != 0)
           return;
    }
 
    if (unlikely(INTEL_DEBUG & DEBUG_DRI)) {
       fprintf(stderr,
-	      "attaching buffer %d, at %d, cpp %d, pitch %d\n",
+	      "attaching buffer %d, at %d, cpp %d, pitch %d, fd %d\n",
 	      buffer->name, buffer->attachment,
-	      buffer->cpp, buffer->pitch);
+	      buffer->cpp, buffer->pitch, buffer->fd);
    }
 
    intel_miptree_release(&rb->mt);
-   region = intel_region_alloc_for_handle(brw->intelScreen,
-                                          buffer->cpp,
-                                          drawable->w,
-                                          drawable->h,
-                                          buffer->pitch,
-                                          buffer->name,
-                                          buffer_name);
+   if (buffer->name != 0) {
+      region = intel_region_alloc_for_handle(brw->intelScreen,
+                                             buffer->cpp,
+                                             drawable->w,
+                                             drawable->h,
+                                             buffer->pitch,
+                                             buffer->name,
+                                             buffer_name);
+   } else {
+      region = intel_region_alloc_for_fd(brw->intelScreen,
+                                         buffer->cpp,
+                                         drawable->w,
+                                         drawable->h,
+                                         buffer->pitch,
+                                         buffer->fd,
+                                         buffer_name);
+   }
    if (!region)
       return;
 
-- 
1.8.3.2



More information about the mesa-dev mailing list