From ef0d92459c3fda92fb3a42b55b7366d9b951a9bf Mon Sep 17 00:00:00 2001 From: Thong Thai Date: Tue, 19 May 2020 18:06:55 -0400 Subject: [PATCH] gallium/auxiliary/vl: Fix compute shader scale_y for interlaced videos MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Thong Thai Fixes: 494b7ef0c1a ("gallium/auxiliary/vl: Fix compute shader scaling for non-square pixels") Reviewed-by: Marek Olšák Part-of: --- src/gallium/auxiliary/vl/vl_compositor.c | 4 +++- src/gallium/auxiliary/vl/vl_compositor.h | 1 + src/gallium/auxiliary/vl/vl_compositor_cs.c | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index d9d9237df78..f82c418009e 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -328,6 +328,7 @@ set_yuv_layer(struct vl_compositor_state *s, struct vl_compositor *c, assert(layer < VL_COMPOSITOR_MAX_LAYERS); + s->interlaced = buffer->interlaced; s->used_layers |= 1 << layer; sampler_views = buffer->get_sampler_view_components(buffer); for (i = 0; i < 3; ++i) { @@ -435,7 +436,7 @@ vl_compositor_clear_layers(struct vl_compositor_state *s) unsigned i, j; assert(s); - + s->interlaced = false; s->used_layers = 0; for ( i = 0; i < VL_COMPOSITOR_MAX_LAYERS; ++i) { struct vertex4f v_one = { 1.0f, 1.0f, 1.0f, 1.0f }; @@ -551,6 +552,7 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *s, assert(layer < VL_COMPOSITOR_MAX_LAYERS); + s->interlaced = buffer->interlaced; s->used_layers |= 1 << layer; sampler_views = buffer->get_sampler_view_components(buffer); for (i = 0; i < 3; ++i) { diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h index 596e055cb09..cccee01623b 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.h +++ b/src/gallium/auxiliary/vl/vl_compositor.h @@ -97,6 +97,7 @@ struct vl_compositor_state unsigned used_layers:VL_COMPOSITOR_MAX_LAYERS; struct vl_compositor_layer layers[VL_COMPOSITOR_MAX_LAYERS]; + bool interlaced; }; struct vl_compositor diff --git a/src/gallium/auxiliary/vl/vl_compositor_cs.c b/src/gallium/auxiliary/vl/vl_compositor_cs.c index bc2055bd3e1..0706cc84dad 100644 --- a/src/gallium/auxiliary/vl/vl_compositor_cs.c +++ b/src/gallium/auxiliary/vl/vl_compositor_cs.c @@ -713,7 +713,9 @@ draw_layers(struct vl_compositor *c, drawn.scale_x = layer->viewport.scale[0] / (float)layer->sampler_views[0]->texture->width0; drawn.scale_y = layer->viewport.scale[1] / - (float)layer->sampler_views[0]->texture->height0; + ((float)layer->sampler_views[0]->texture->height0 * + (s->interlaced ? 2.0 : 1.0)); + drawn.translate_x = (int)layer->viewport.translate[0]; drawn.translate_y = (int)layer->viewport.translate[1]; drawn.sampler0_w = (float)layer->sampler_views[0]->texture->width0; -- 2.30.2