[Mesa-dev] [PATCH 2/4] i965: Change intel_region interface to not depend on intelScreen

Ander Conselvan de Oliveira conselvan2 at gmail.com
Tue Feb 18 08:41:51 PST 2014


From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>

The only field from intelScreen used by the intel_region code is the
drm_intel_bufmgr, so take that as a parameter instead of the whole
screen.
---
 src/mesa/drivers/dri/i965/brw_context.c       |  2 +-
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c |  4 ++--
 src/mesa/drivers/dri/i965/intel_regions.c     | 20 ++++++++++----------
 src/mesa/drivers/dri/i965/intel_regions.h     |  7 +++----
 src/mesa/drivers/dri/i965/intel_screen.c      |  9 +++++----
 5 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index ae267d8..f5b2e39 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -1285,7 +1285,7 @@ intel_process_dri2_buffer(struct brw_context *brw,
    }
 
    intel_miptree_release(&rb->mt);
-   region = intel_region_alloc_for_handle(brw->intelScreen,
+   region = intel_region_alloc_for_handle(brw->intelScreen->bufmgr,
                                           buffer->cpp,
                                           drawable->w,
                                           drawable->h,
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index c9f5bb3..13cde04 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -565,7 +565,7 @@ intel_miptree_create(struct brw_context *brw,
    bool y_or_x = tiling == (I915_TILING_Y | I915_TILING_X);
 
    mt->etc_format = etc_format;
-   mt->region = intel_region_alloc(brw->intelScreen,
+   mt->region = intel_region_alloc(brw->intelScreen->bufmgr,
 				   y_or_x ? I915_TILING_Y : tiling,
 				   mt->cpp,
 				   total_width,
@@ -581,7 +581,7 @@ intel_miptree_create(struct brw_context *brw,
                  mt->total_width, mt->total_height);
       intel_region_release(&mt->region);
 
-      mt->region = intel_region_alloc(brw->intelScreen,
+      mt->region = intel_region_alloc(brw->intelScreen->bufmgr,
                                       I915_TILING_X,
                                       mt->cpp,
                                       total_width,
diff --git a/src/mesa/drivers/dri/i965/intel_regions.c b/src/mesa/drivers/dri/i965/intel_regions.c
index 2ab36fc..3e85a75 100644
--- a/src/mesa/drivers/dri/i965/intel_regions.c
+++ b/src/mesa/drivers/dri/i965/intel_regions.c
@@ -105,7 +105,7 @@ debug_backtrace(void)
 #endif
 
 static struct intel_region *
-intel_region_alloc_internal(struct intel_screen *screen,
+intel_region_alloc_internal(drm_intel_bufmgr *bufmgr,
 			    GLuint cpp,
 			    GLuint width, GLuint height, GLuint pitch,
 			    uint32_t tiling, drm_intel_bo *buffer)
@@ -129,7 +129,7 @@ intel_region_alloc_internal(struct intel_screen *screen,
 }
 
 struct intel_region *
-intel_region_alloc(struct intel_screen *screen,
+intel_region_alloc(drm_intel_bufmgr *bufmgr,
 		   uint32_t tiling,
                    GLuint cpp, GLuint width, GLuint height,
 		   bool expect_accelerated_upload)
@@ -142,13 +142,13 @@ intel_region_alloc(struct intel_screen *screen,
    if (expect_accelerated_upload)
       flags |= BO_ALLOC_FOR_RENDER;
 
-   buffer = drm_intel_bo_alloc_tiled(screen->bufmgr, "region",
+   buffer = drm_intel_bo_alloc_tiled(bufmgr, "region",
 				     width, height, cpp,
 				     &tiling, &aligned_pitch, flags);
    if (buffer == NULL)
       return NULL;
 
-   region = intel_region_alloc_internal(screen, cpp, width, height,
+   region = intel_region_alloc_internal(bufmgr, cpp, width, height,
                                         aligned_pitch, tiling, buffer);
    if (region == NULL) {
       drm_intel_bo_unreference(buffer);
@@ -172,7 +172,7 @@ intel_region_flink(struct intel_region *region, uint32_t *name)
 }
 
 struct intel_region *
-intel_region_alloc_for_handle(struct intel_screen *screen,
+intel_region_alloc_for_handle(drm_intel_bufmgr *bufmgr,
 			      GLuint cpp,
 			      GLuint width, GLuint height, GLuint pitch,
 			      GLuint handle, const char *name)
@@ -182,7 +182,7 @@ intel_region_alloc_for_handle(struct intel_screen *screen,
    int ret;
    uint32_t bit_6_swizzle, tiling;
 
-   buffer = intel_bo_gem_create_from_name(screen->bufmgr, name, handle);
+   buffer = intel_bo_gem_create_from_name(bufmgr, name, handle);
    if (buffer == NULL)
       return NULL;
    ret = drm_intel_bo_get_tiling(buffer, &tiling, &bit_6_swizzle);
@@ -193,7 +193,7 @@ intel_region_alloc_for_handle(struct intel_screen *screen,
       return NULL;
    }
 
-   region = intel_region_alloc_internal(screen, cpp,
+   region = intel_region_alloc_internal(bufmgr, cpp,
 					width, height, pitch, tiling, buffer);
    if (region == NULL) {
       drm_intel_bo_unreference(buffer);
@@ -206,7 +206,7 @@ intel_region_alloc_for_handle(struct intel_screen *screen,
 }
 
 struct intel_region *
-intel_region_alloc_for_fd(struct intel_screen *screen,
+intel_region_alloc_for_fd(drm_intel_bufmgr *bufmgr,
                           GLuint cpp,
                           GLuint width, GLuint height, GLuint pitch,
                           GLuint size,
@@ -217,7 +217,7 @@ intel_region_alloc_for_fd(struct intel_screen *screen,
    int ret;
    uint32_t bit_6_swizzle, tiling;
 
-   buffer = drm_intel_bo_gem_create_from_prime(screen->bufmgr, fd, size);
+   buffer = drm_intel_bo_gem_create_from_prime(bufmgr, fd, size);
    if (buffer == NULL)
       return NULL;
    ret = drm_intel_bo_get_tiling(buffer, &tiling, &bit_6_swizzle);
@@ -228,7 +228,7 @@ intel_region_alloc_for_fd(struct intel_screen *screen,
       return NULL;
    }
 
-   region = intel_region_alloc_internal(screen, cpp,
+   region = intel_region_alloc_internal(bufmgr, cpp,
 					width, height, pitch, tiling, buffer);
    if (region == NULL) {
       drm_intel_bo_unreference(buffer);
diff --git a/src/mesa/drivers/dri/i965/intel_regions.h b/src/mesa/drivers/dri/i965/intel_regions.h
index 2d3f4d1..dfe1b97 100644
--- a/src/mesa/drivers/dri/i965/intel_regions.h
+++ b/src/mesa/drivers/dri/i965/intel_regions.h
@@ -47,7 +47,6 @@ extern "C" {
 #endif
 
 struct brw_context;
-struct intel_screen;
 struct intel_buffer_object;
 
 /**
@@ -81,20 +80,20 @@ struct intel_region
 /* Allocate a refcounted region.  Pointers to regions should only be
  * copied by calling intel_reference_region().
  */
-struct intel_region *intel_region_alloc(struct intel_screen *screen,
+struct intel_region *intel_region_alloc(drm_intel_bufmgr *bufmgr,
                                         uint32_t tiling,
 					GLuint cpp, GLuint width,
                                         GLuint height,
 					bool expect_accelerated_upload);
 
 struct intel_region *
-intel_region_alloc_for_handle(struct intel_screen *screen,
+intel_region_alloc_for_handle(drm_intel_bufmgr *bufmgr,
 			      GLuint cpp,
 			      GLuint width, GLuint height, GLuint pitch,
 			      unsigned int handle, const char *name);
 
 struct intel_region *
-intel_region_alloc_for_fd(struct intel_screen *screen,
+intel_region_alloc_for_fd(drm_intel_bufmgr *bufmgr,
                           GLuint cpp,
                           GLuint width, GLuint height, GLuint pitch,
                           GLuint size,
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index c94882f..768338b 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -374,7 +374,7 @@ intel_create_image_from_name(__DRIscreen *screen,
        cpp = 1;
     else
        cpp = _mesa_get_format_bytes(image->format);
-    image->region = intel_region_alloc_for_handle(intelScreen,
+    image->region = intel_region_alloc_for_handle(intelScreen->bufmgr,
 						  cpp, width, height,
 						  pitch * cpp, name, "image");
     if (image->region == NULL) {
@@ -515,7 +515,8 @@ intel_create_image(__DRIscreen *screen,
 
    cpp = _mesa_get_format_bytes(image->format);
    image->region =
-      intel_region_alloc(intelScreen, tiling, cpp, width, height, true);
+      intel_region_alloc(intelScreen->bufmgr, tiling, cpp,
+                         width, height, true);
    if (image->region == NULL) {
       free(image);
       return NULL;
@@ -662,7 +663,7 @@ intel_create_image_from_fds(__DRIscreen *screen,
    if (image == NULL)
       return NULL;
 
-   image->region = intel_region_alloc_for_fd(intelScreen,
+   image->region = intel_region_alloc_for_fd(intelScreen->bufmgr,
                                              f->planes[0].cpp, width, height, strides[0],
                                              height * strides[0], fds[0], "image");
    if (image->region == NULL) {
@@ -1366,7 +1367,7 @@ intelAllocateBuffer(__DRIscreen *screen,
       return NULL;
 
    /* The front and back buffers are color buffers, which are X tiled. */
-   intelBuffer->region = intel_region_alloc(intelScreen,
+   intelBuffer->region = intel_region_alloc(intelScreen->bufmgr,
                                             I915_TILING_X,
                                             format / 8,
                                             width,
-- 
1.8.3.2



More information about the mesa-dev mailing list