summaryrefslogtreecommitdiffstats
path: root/video/out/vo_vdpau.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/vo_vdpau.c')
-rw-r--r--video/out/vo_vdpau.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index 3bb234f401..72a08adac7 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -104,6 +104,7 @@ struct vdpctx {
VdpRect src_rect_vid;
VdpRect out_rect_vid;
struct mp_osd_res osd_rect;
+ VdpBool supports_a8;
int surface_num; // indexes output_surfaces
int query_surface_num;
@@ -650,13 +651,15 @@ static void generate_osd_part(struct vo *vo, struct sub_bitmaps *imgs)
CHECK_VDP_WARNING(vo, "OSD: error when creating surface");
}
if (imgs->scaled) {
- char zeros[sfc->packer->used_width * format_size];
- memset(zeros, 0, sizeof(zeros));
+ char *zeros = calloc(sfc->packer->used_width, format_size);
+ if (!zeros)
+ return;
vdp_st = vdp->bitmap_surface_put_bits_native(sfc->surface,
&(const void *){zeros}, &(uint32_t){0},
&(VdpRect){0, 0, sfc->packer->used_width,
sfc->packer->used_height});
CHECK_VDP_WARNING(vo, "OSD: error uploading OSD bitmap");
+ free(zeros);
}
if (sfc->surface == VDP_INVALID_HANDLE)
@@ -711,8 +714,8 @@ static void draw_osd(struct vo *vo)
if (!status_ok(vo))
return;
- static const bool formats[SUBBITMAP_COUNT] = {
- [SUBBITMAP_LIBASS] = true,
+ bool formats[SUBBITMAP_COUNT] = {
+ [SUBBITMAP_LIBASS] = vc->supports_a8,
[SUBBITMAP_RGBA] = true,
};
@@ -1069,6 +1072,9 @@ static int preinit(struct vo *vo)
vc->vdp_device = vc->mpvdp->vdp_device;
vc->vdp = &vc->mpvdp->vdp;
+ vc->vdp->bitmap_surface_query_capabilities(vc->vdp_device, VDP_RGBA_FORMAT_A8,
+ &vc->supports_a8, &(uint32_t){0}, &(uint32_t){0});
+
vc->video_eq.capabilities = MP_CSP_EQ_CAPS_COLORMATRIX;
return 0;