gallium: Fix VAAPI postproc blit
authorThong Thai <thong.thai@amd.com>
Mon, 7 Dec 2020 15:05:57 +0000 (10:05 -0500)
committerMarge Bot <eric+marge@anholt.net>
Mon, 7 Dec 2020 19:46:24 +0000 (19:46 +0000)
Fixes the VAAPI postproc issue mentioned in this comment
(https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6736#note_626808)
without changing the height of the underlying resource when doing the
blit.

This commit removes the 0.5 pixel center offset from the compute blit - VAAPI postproc is the only function that uses this compute blit.

Fixes: 49465babdb3 ("frontends/va/postproc: Use the actual image height when blitting")
Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7970>

src/gallium/auxiliary/util/u_compute.c
src/gallium/frontends/va/postproc.c

index bc884b6..171cea8 100644 (file)
@@ -92,8 +92,8 @@ void util_compute_blit(struct pipe_context *ctx, struct pipe_blit_info *blit_inf
    float y_scale = blit_info->src.box.height / (float)blit_info->dst.box.height;
    float z_scale = blit_info->src.box.depth / (float)blit_info->dst.box.depth;
 
-   unsigned data[] = {u_bitcast_f2u((blit_info->src.box.x + 0.5) / (float)src->width0),
-                      u_bitcast_f2u((blit_info->src.box.y + 0.5) / (float)src->height0),
+   unsigned data[] = {u_bitcast_f2u(blit_info->src.box.x / (float)src->width0),
+                      u_bitcast_f2u(blit_info->src.box.y / (float)src->height0),
                       u_bitcast_f2u(blit_info->src.box.z),
                       u_bitcast_f2u(0),
                       u_bitcast_f2u(x_scale / src->width0),
index 946761b..7ab56b5 100644 (file)
@@ -204,7 +204,6 @@ static VAStatus vlVaPostProcBlit(vlVaDriver *drv, vlVaContext *context,
 
       memset(&blit, 0, sizeof(blit));
       blit.src.resource = from->texture;
-      blit.src.resource->height0 = src_region->height;
       blit.src.format = from->format;
       blit.src.level = 0;
       blit.src.box.z = from->u.tex.first_layer;
@@ -212,7 +211,6 @@ static VAStatus vlVaPostProcBlit(vlVaDriver *drv, vlVaContext *context,
       vlVaGetBox(src, i, &blit.src.box, src_region);
 
       blit.dst.resource = dst_surfaces[i]->texture;
-      blit.dst.resource->height0 = dst_region->height;
       blit.dst.format = dst_surfaces[i]->format;
       blit.dst.level = 0;
       blit.dst.box.z = dst_surfaces[i]->u.tex.first_layer;
@@ -311,7 +309,7 @@ vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *contex
    src = src_surface->buffer;
    dst = dst_surface->buffer;
 
-   /* convert the destination buffer to progressive if we're deinterlacing 
+   /* convert the destination buffer to progressive if we're deinterlacing
       otherwise we might end up deinterlacing twice */
    if (param->num_filters && dst->interlaced) {
       vlVaSurface *surf;