[Mesa-dev] [PATCH 2/3] i965: Remove packing restrictions for tiled-memcpy

Chris Wilson chris at chris-wilson.co.uk
Wed Oct 18 11:11:13 UTC 2017


Use the core unpacking functions to convert the gl_pixelstore_attrib
into the real pixel address required for copying; thereby removing the
restrictions that the tiled-memcpy could only handle exactly matching
image transfers.

Cc: Matt Turner <mattst88 at gmail.com>
Cc: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/intel_pixel_read.c |  6 ++----
 src/mesa/drivers/dri/i965/intel_tex_image.c  | 17 +++++++----------
 2 files changed, 9 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 9cb48e5ed2..b5e636b9b2 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
@@ -90,10 +90,6 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
    if (!devinfo->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)
@@ -158,6 +154,8 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
    yoffset += slice_offset_y;
 
    int dst_pitch = _mesa_image_row_stride(pack, width, format, type);
+   pixels = _mesa_image_address(2, pack, pixels, width, height,
+                                format, type, 0, 0, 0);
 
    /* For a window-system renderbuffer, the buffer is actually flipped
     * vertically, so we need to handle that.  Since the detiling function
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index 1039d80bf3..57f2de1bc7 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -202,10 +202,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)
@@ -245,14 +241,13 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
    if (devinfo->gen < 5 && brw->has_swizzling)
       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);
 
    struct brw_bo *bo = image->mt->bo;
@@ -287,6 +282,8 @@ 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(
@@ -641,10 +638,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)
@@ -716,6 +709,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(
-- 
2.15.0.rc1



More information about the mesa-dev mailing list