gallium/auxiliary/vl: Include src region in scale_y calculation
authorThong Thai <thong.thai@amd.com>
Tue, 15 Sep 2020 22:55:45 +0000 (18:55 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 21 Sep 2020 18:59:36 +0000 (18:59 +0000)
Signed-off-by: Thong Thai <thong.thai@amd.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3521
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6736>

src/gallium/auxiliary/vl/vl_compositor_cs.c

index 0706cc8..029449f 100644 (file)
@@ -711,10 +711,12 @@ draw_layers(struct vl_compositor       *c,
 
          drawn.area = calc_drawn_area(s, layer);
          drawn.scale_x = layer->viewport.scale[0] /
-                  (float)layer->sampler_views[0]->texture->width0;
+                  (float)layer->sampler_views[0]->texture->width0 * 
+                  (layer->src.br.x - layer->src.tl.x);
          drawn.scale_y = layer->viewport.scale[1] /
                   ((float)layer->sampler_views[0]->texture->height0 * 
-                   (s->interlaced ? 2.0 : 1.0));
+                   (s->interlaced ? 2.0 : 1.0) * 
+                   (layer->src.br.y - layer->src.tl.y));
 
          drawn.translate_x = (int)layer->viewport.translate[0];
          drawn.translate_y = (int)layer->viewport.translate[1];