[Mesa-dev] [PATCH 2/5] i965: Use mipmap's level to resolve directly to surface

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Mon Dec 9 08:03:31 PST 2013


Remove legacy code when recreating a single-layer miptree from a level
of the source texture using tile_x and tile_y offsets. Save the level field
in intel_texture_object so we can resolve this direcly in the hardware.

Signed-off-by: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
---
 src/mesa/drivers/dri/i965/intel_tex_image.c |   30 +++++++--------------------
 src/mesa/drivers/dri/i965/intel_tex_obj.h   |    5 +++++
 2 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index cc50f84..0bf6e46 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -213,16 +213,14 @@ intel_set_texture_image_region(struct gl_context *ctx,
 			       GLenum internalFormat,
 			       gl_format format,
                                uint32_t offset,
+                               GLuint level,
                                GLuint width,
-                               GLuint height,
-                               GLuint tile_x,
-                               GLuint tile_y)
+                               GLuint height)
 {
    struct brw_context *brw = brw_context(ctx);
    struct intel_texture_image *intel_image = intel_texture_image(image);
    struct gl_texture_object *texobj = image->TexObject;
    struct intel_texture_object *intel_texobj = intel_texture_object(texobj);
-   uint32_t draw_x, draw_y;
 
    _mesa_init_teximage_fields(&brw->ctx, image,
 			      width, height, 1,
@@ -239,21 +237,7 @@ intel_set_texture_image_region(struct gl_context *ctx,
    intel_region_reference(&intel_image->mt->region, region);
    intel_image->mt->total_width = width;
    intel_image->mt->total_height = height;
-   intel_image->mt->level[0].slice[0].x_offset = tile_x;
-   intel_image->mt->level[0].slice[0].y_offset = tile_y;
-
-   intel_miptree_get_tile_offsets(intel_image->mt, 0, 0, &draw_x, &draw_y);
-
-   /* From "OES_EGL_image" error reporting. We report GL_INVALID_OPERATION
-    * for EGL images from non-tile aligned sufaces in gen4 hw and earlier which has
-    * trouble resolving back to destination image due to alignment issues.
-    */
-   if (!brw->has_surface_tile_offset &&
-       (draw_x != 0 || draw_y != 0)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, __func__);
-      intel_miptree_release(&intel_image->mt);
-      return;
-   }
+   intel_texobj->level = level;
 
    intel_texobj->needs_validate = true;
 
@@ -316,9 +300,9 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
    intel_miptree_make_shareable(brw, rb->mt);
    intel_set_texture_image_region(ctx, texImage, rb->mt->region, target,
                                   internalFormat, texFormat, 0,
+                                  0,
                                   rb->mt->region->width,
-                                  rb->mt->region->height,
-                                  0, 0);
+                                  rb->mt->region->height);
    _mesa_unlock_texture(&brw->ctx, texObj);
 }
 
@@ -376,8 +360,8 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
    intel_set_texture_image_region(ctx, texImage, image->region,
 				  target, image->internal_format,
                                   image->format, image->offset,
-                                  image->width,  image->height,
-                                  image->tile_x, image->tile_y);
+                                  image->level,
+                                  image->width,  image->height);
 }
 
 void
diff --git a/src/mesa/drivers/dri/i965/intel_tex_obj.h b/src/mesa/drivers/dri/i965/intel_tex_obj.h
index b949912..ea8ec9c 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_obj.h
+++ b/src/mesa/drivers/dri/i965/intel_tex_obj.h
@@ -44,6 +44,11 @@ struct intel_texture_object
    unsigned int validated_first_level;
    unsigned int validated_last_level;
 
+   /* Used by EGLImages. This is provided if we want to resolve directly to
+    * a miptree's level.
+    */
+   unsigned int level;
+
    /* On validation any active images held in main memory or in other
     * regions will be copied to this region and the old storage freed.
     */
-- 
1.7.9.5



More information about the mesa-dev mailing list