[Mesa-dev] [PATCH 1/3] intel: add and handle offset field in regions.

Gwenole Beauchesne gb.devel at gmail.com
Fri Apr 20 09:39:03 PDT 2012


Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c  |    1 +
 src/mesa/drivers/dri/i965/gen7_wm_surface_state.c |    1 +
 src/mesa/drivers/dri/intel/intel_regions.c        |    1 +
 src/mesa/drivers/dri/intel/intel_regions.h        |    1 +
 4 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 69af0ee..599c363 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -659,6 +659,7 @@ brw_update_texture_surface( struct gl_context *ctx, GLuint unit )
 	       BRW_SURFACE_FORMAT_SHIFT));
 
    surf[1] = intelObj->mt->region->bo->offset; /* reloc */
+   surf[1] += intelObj->mt->region->offset;
 
    surf[2] = ((intelObj->_MaxLevel - tObj->BaseLevel) << BRW_SURFACE_LOD_SHIFT |
 	      (width - 1) << BRW_SURFACE_WIDTH_SHIFT |
diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
index cbccd2b..187eab3 100644
--- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
@@ -165,6 +165,7 @@ gen7_update_texture_surface(struct gl_context *ctx, GLuint unit)
     */
 
    surf->ss1.base_addr = intelObj->mt->region->bo->offset; /* reloc */
+   surf->ss1.base_addr += intelObj->mt->region->offset;
 
    surf->ss2.width = width - 1;
    surf->ss2.height = height - 1;
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index abea2bd..25780b9 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -176,6 +176,7 @@ intel_region_alloc_internal(struct intel_screen *screen,
    region->pitch = pitch;
    region->refcount = 1;
    region->bo = buffer;
+   region->offset = 0;
    region->tiling = tiling;
    region->screen = screen;
 
diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h
index 4ea970a..f1f9ae9 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.h
+++ b/src/mesa/drivers/dri/intel/intel_regions.h
@@ -55,6 +55,7 @@ struct intel_buffer_object;
 struct intel_region
 {
    drm_intel_bo *bo;  /**< buffer manager's buffer */
+   GLuint offset;   /**< Offset (in bytes) relative to bo base */
    GLuint refcount; /**< Reference count for region */
    GLuint cpp;      /**< bytes per pixel */
    GLuint width;    /**< in pixels */
-- 
1.7.5.4



More information about the mesa-dev mailing list