[Mesa-dev] [PATCH 09/22] i965: Don't skip our manual detiling for user packing parameters

Chris Wilson chris at chris-wilson.co.uk
Sat Aug 5 09:40:01 UTC 2017


If the user does use the pack/unpack offsets, simply decode those into
the offset from base and proceed with our fast manual detilined copy.
This is most frequently used for subimages where the stride or width may
not match the image.
---
 src/mesa/drivers/dri/i965/intel_pixel_read.c   |  6 ++----
 src/mesa/drivers/dri/i965/intel_tex_image.c    |  8 ++++----
 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 10 ++++------
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c
index eb3166ca82..56ae678573 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
@@ -91,10 +91,6 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
     * more types.
     */
    if (!brw->has_llc || pixels == NULL || _mesa_is_bufferobj(pack->BufferObj) ||
-       pack->Alignment > 4 ||
-       pack->SkipPixels > 0 ||
-       pack->SkipRows > 0 ||
-       (pack->RowLength != 0 && pack->RowLength != width) ||
        pack->SwapBytes ||
        pack->LsbFirst ||
        pack->Invert)
@@ -157,6 +153,8 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
    xoffset += slice_offset_x;
    yoffset += slice_offset_y;
 
+   pixels = _mesa_image_address(2, pack, pixels, width, height,
+                                format, type, 0, 0, 0);
    dst_pitch = _mesa_image_row_stride(pack, width, format, type);
 
    /* For a window-system renderbuffer, the buffer is actually flipped
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index 770a9a78a8..a1d14ed02b 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -403,10 +403,6 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context *ctx,
          texImage->TexObject->Target == GL_TEXTURE_RECTANGLE) ||
        pixels == NULL ||
        _mesa_is_bufferobj(packing->BufferObj) ||
-       packing->Alignment > 4 ||
-       packing->SkipPixels > 0 ||
-       packing->SkipRows > 0 ||
-       (packing->RowLength != 0 && packing->RowLength != width) ||
        packing->SwapBytes ||
        packing->LsbFirst ||
        packing->Invert)
@@ -477,6 +473,10 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context *ctx,
    xoffset += level_x;
    yoffset += level_y;
 
+   int dims = _mesa_get_texture_dimensions(texImage->TexObject->Target);
+   pixels = _mesa_image_address(dims, packing, pixels, width, height,
+                                format, type, 0, 0, 0);
+
    uint32_t cpp = _mesa_get_format_bytes(texImage->TexFormat);
    tiled_to_linear(
       xoffset * cpp, (xoffset + width) * cpp,
diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index d6fcc93b98..c1e365f8f1 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -102,10 +102,6 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
          texImage->TexObject->Target == GL_TEXTURE_RECTANGLE) ||
        pixels == NULL ||
        _mesa_is_bufferobj(packing->BufferObj) ||
-       packing->Alignment > 4 ||
-       packing->SkipPixels > 0 ||
-       packing->SkipRows > 0 ||
-       (packing->RowLength != 0 && packing->RowLength != width) ||
        packing->SwapBytes ||
        packing->LsbFirst ||
        packing->Invert)
@@ -155,14 +151,13 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
    if (!bo->cache_coherent && image->mt->surf.tiling == ISL_TILING_Y0)
       return false;
 
-   int level = texImage->Level + texImage->TexObject->MinLevel;
-
    /* Since we are going to write raw data to the miptree, we need to resolve
     * any pending fast color clears before we start.
     */
    assert(image->mt->surf.logical_level0_px.depth == 1);
    assert(image->mt->surf.logical_level0_px.array_len == 1);
 
+   int level = texImage->Level + texImage->TexObject->MinLevel;
    intel_miptree_access_raw(brw, image->mt, level, 0, true);
 
    if (brw_batch_references(&brw->batch, bo)) {
@@ -196,6 +191,9 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
    xoffset += level_x;
    yoffset += level_y;
 
+   pixels = _mesa_image_address(dims, packing, pixels, width, height,
+                                format, type, 0, 0, 0);
+
    uint32_t cpp = _mesa_get_format_bytes(texImage->TexFormat);
    linear_to_tiled(
       xoffset * cpp, (xoffset + width) * cpp,
-- 
2.13.3



More information about the mesa-dev mailing list