From 34d3341b7998f6c72e4bb6b2f4b86fbdb8a24c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sat, 4 Jun 2022 15:07:58 +0300 Subject: [PATCH] vdpau/display: fix SPU blending offsets (cherry picked from commit 329bd3c8a3d73b77263b5d98e4e0d2a9e3f9e638) --- modules/hw/vdpau/display.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c index edd6096729..3ebc09bcdc 100644 --- a/modules/hw/vdpau/display.c +++ b/modules/hw/vdpau/display.c @@ -179,8 +179,8 @@ static void RenderRegion(vout_display_t *vd, VdpOutputSurface target, /* Create GPU surface for sub-picture */ err = vdp_bitmap_surface_create(sys->vdp, sys->device, fmt, - reg->fmt.i_visible_width, reg->fmt.i_visible_height, VDP_FALSE, - &surface); + reg->fmt.i_width, reg->fmt.i_height, + VDP_FALSE, &surface); if (err != VDP_STATUS_OK) { msg_Err(vd, "%s creation failure: %s", "bitmap surface", @@ -203,7 +203,7 @@ static void RenderRegion(vout_display_t *vd, VdpOutputSurface target, } /* Render onto main surface */ - VdpRect area = { + VdpRect dst_area = { reg->i_x * vd->fmt.i_visible_width / subpic->i_original_picture_width, reg->i_y * vd->fmt.i_visible_height @@ -213,6 +213,12 @@ static void RenderRegion(vout_display_t *vd, VdpOutputSurface target, (reg->i_y + reg->fmt.i_visible_height) * vd->fmt.i_visible_height / subpic->i_original_picture_height, }; + VdpRect src_area = { + reg->fmt.i_x_offset, + reg->fmt.i_y_offset, + reg->fmt.i_x_offset + reg->fmt.i_visible_width, + reg->fmt.i_y_offset + reg->fmt.i_visible_height, + }; VdpColor color = { 1.f, 1.f, 1.f, reg->i_alpha * subpic->i_alpha / 65535.f }; VdpOutputSurfaceRenderBlendState state = { @@ -230,8 +236,9 @@ static void RenderRegion(vout_display_t *vd, VdpOutputSurface target, .blend_constant = { 0.f, 0.f, 0.f, 0.f }, }; - err = vdp_output_surface_render_bitmap_surface(sys->vdp, target, &area, - surface, NULL, &color, &state, 0); + err = vdp_output_surface_render_bitmap_surface(sys->vdp, target, &dst_area, + surface, &src_area, &color, + &state, 0); if (err != VDP_STATUS_OK) msg_Err(vd, "blending failure: %s", vdp_get_error_string(sys->vdp, err));