Mesa (master): gallium/auxiliary/vl: Fix compute shader scale_y for interlaced videos
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed May 20 17:54:23 UTC 2020
Module: Mesa
Branch: master
Commit: ef0d92459c3fda92fb3a42b55b7366d9b951a9bf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef0d92459c3fda92fb3a42b55b7366d9b951a9bf
Author: Thong Thai <thong.thai at amd.com>
Date: Tue May 19 18:06:55 2020 -0400
gallium/auxiliary/vl: Fix compute shader scale_y for interlaced videos
Signed-off-by: Thong Thai <thong.thai at amd.com>
Fixes: 494b7ef0c1a ("gallium/auxiliary/vl: Fix compute shader scaling for non-square pixels")
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5121>
---
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;
More information about the mesa-commit
mailing list