[Mesa-dev] [PATCH 2/2] intel: Skip glTexSubImage fastpath if pixel unpack state is non-default

Chad Versace chad.versace at linux.intel.com
Thu Oct 11 20:16:13 PDT 2012


Fixes in piglit tests "unpack-teximage2d --pbo=* --format=GL_BGRA" on
gen6+ (test is still under review).

When the pixel unpacking state was non-default, the
intel_texsubimage_tiled_memcpy fastpath handled it incorrectly. Rather
than attempting to fix the fastpath with an even more complex and slower
arithmetic loop, it's easier to just disable the fastpath in this case.

Ideally, we would just ask a unicorn to JIT this fastpath for us in a way
that safely handles the unpacking state. Until then, it's safer if only
a small set of situations activate the fastpath.

CC: Rob Bradford <rob at linux.intel.com>
CC: Neil Roberts <neil at linux.intel.com>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 src/mesa/drivers/dri/intel/intel_tex_subimage.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index ba6267a..9d6a2d9 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -28,6 +28,7 @@
 
 #include "main/macros.h"
 #include "main/mtypes.h"
+#include "main/pack.h"
 #include "main/pbo.h"
 #include "main/texobj.h"
 #include "main/texstore.h"
@@ -197,6 +198,10 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
    /* This fastpath is restricted to a specific texture type: level 0 of
     * a 2D BGRA texture. It could be generalized to support more types by
     * varying the arithmetic loop below.
+    *
+    * The fastpath is also skipped if the pixel unpacking state is
+    * non-default because correctly handling that case would require
+    * a more complex and slower arithmetic loop.
     */
    if (!intel->has_llc ||
        format != GL_BGRA ||
@@ -205,10 +210,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
        texImage->TexObject->Target != GL_TEXTURE_2D ||
        texImage->Level != 0 ||
        pixels == NULL ||
-       packing->Alignment > 4 ||
-       packing->SkipPixels > 0 ||
-       packing->SkipRows > 0 ||
-       packing->RowLength != width)
+       !_mesa_unpack_is_default(ctx))
       return false;
 
    if (for_glTexImage)
-- 
1.7.11.7



More information about the mesa-dev mailing list