[Mesa-dev] [PATCH] st/mesa: fix blit-based GetTexImage for non-finalized textures

Ilia Mirkin imirkin at alum.mit.edu
Sun May 1 15:00:01 UTC 2016


Nice find! An alternative way of fixing it is below. Thoughts?

diff --git a/src/mesa/state_tracker/st_cb_texture.c
b/src/mesa/state_tracker/st_cb_texture.c
index aa073b0..2d30bcd 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2115,7 +2115,7 @@ st_GetTexSubImage(struct gl_context * ctx,
    struct pipe_screen *screen = pipe->screen;
    struct st_texture_image *stImage = st_texture_image(texImage);
    struct st_texture_object *stObj = st_texture_object(texImage->TexObject);
-   struct pipe_resource *src = stObj->pt;
+   struct pipe_resource *src = stImage->pt;
    struct pipe_resource *dst = NULL;
    struct pipe_resource dst_templ;
    enum pipe_format dst_format, src_format;
@@ -2277,7 +2277,8 @@ st_GetTexSubImage(struct gl_context * ctx,

    memset(&blit, 0, sizeof(blit));
    blit.src.resource = src;
-   blit.src.level = texImage->Level + texImage->TexObject->MinLevel;
+   if (stImage->pt == stObj->pt)
+      blit.src.level = texImage->Level + texImage->TexObject->MinLevel;
    blit.src.format = src_format;
    blit.dst.resource = dst;
    blit.dst.level = 0;
@@ -2286,7 +2287,10 @@ st_GetTexSubImage(struct gl_context * ctx,
    blit.dst.box.x = 0;
    blit.src.box.y = yoffset;
    blit.dst.box.y = 0;
-   blit.src.box.z = texImage->Face + texImage->TexObject->MinLayer + zoffset;
+   if (stImage->pt == stObj->pt)
+      blit.src.box.z = texImage->Face + texImage->TexObject->MinLayer
+ zoffset;
+   else
+      blit.src.box.z = texImage->Face + zoffset;
    blit.dst.box.z = 0;
    blit.src.box.width = blit.dst.box.width = width;
    blit.src.box.height = blit.dst.box.height = height;

On Sun, May 1, 2016 at 9:35 AM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> This fixes getteximage-depth piglit failures on radeonsi.
>
> Cc: 11.1 11.2 <mesa-stable at lists.freedesktop.org>
> ---
>  src/mesa/state_tracker/st_cb_texture.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
> index aa073b0..f181266 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -2137,7 +2137,8 @@ st_GetTexSubImage(struct gl_context * ctx,
>        goto fallback;
>     }
>
> -   if (!stImage->pt || !src) {
> +   /* Handle non-finalized textures. */
> +   if (!stImage->pt || stImage->pt != stObj->pt || !src) {
>        goto fallback;
>     }
>
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list