summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-05-26 08:54:09 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-05-26 09:14:12 +0300
commit2e8ef70d4fe1dab503e2112512383a6fec7b9499 (patch)
tree07e574af5e829aeffa97af7cf04c20231c0eb7f3 /libvo
parentaa07b6d578847a1dcbb6b95f7837919fe430ee30 (diff)
downloadmpv-2e8ef70d4fe1dab503e2112512383a6fec7b9499.tar.bz2
mpv-2e8ef70d4fe1dab503e2112512383a6fec7b9499.tar.xz
vo_vdpau: fix loop initializing output surfaces as invalid
The loop initializing handles in the output surface table to VDP_INVALID_HANDLE ran over indices from 0 to vc->num_output_surfaces. However it is first called before that variable is initialized. As a result later code could try to destroy the handles which still had the "non-invalid" value 0. Most likely this caused no visible effects; at least on my machine no valid surface gets handle 0, and libvdpau just returns an error for the resulting invalid calls. Change the code to loop over the whole table. Also add code to print visible warnings if libvdpau rejects a surface destroy call (some other places already had checks but not all).
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_vdpau.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
index a4a826590a..af4943ed1b 100644
--- a/libvo/vo_vdpau.c
+++ b/libvo/vo_vdpau.c
@@ -409,8 +409,11 @@ static void resize(struct vo *vo)
}
// Creation of output_surfaces
for (i = 0; i <= vc->num_output_surfaces; i++) {
- if (vc->output_surfaces[i] != VDP_INVALID_HANDLE)
- vdp->output_surface_destroy(vc->output_surfaces[i]);
+ if (vc->output_surfaces[i] != VDP_INVALID_HANDLE) {
+ vdp_st = vdp->output_surface_destroy(vc->output_surfaces[i]);
+ CHECK_ST_WARNING("Error when calling "
+ "vdp_output_surface_destroy");
+ }
vdp_st = vdp->output_surface_create(vc->vdp_device,
VDP_RGBA_FORMAT_B8G8R8A8,
vc->output_surface_width,
@@ -811,7 +814,7 @@ static void mark_vdpau_objects_uninitialized(struct vo *vo)
vc->video_mixer = VDP_INVALID_HANDLE;
vc->flip_queue = VDP_INVALID_HANDLE;
vc->flip_target = VDP_INVALID_HANDLE;
- for (int i = 0; i <= vc->num_output_surfaces; i++)
+ for (int i = 0; i <= MAX_OUTPUT_SURFACES; i++)
vc->output_surfaces[i] = VDP_INVALID_HANDLE;
vc->vdp_device = VDP_INVALID_HANDLE;
vc->eosd_surface = (struct eosd_bitmap_surface){
@@ -1211,8 +1214,10 @@ static void generate_eosd(struct vo *vo, mp_eosd_images_t *imgs)
reallocate = true;
}
if (reallocate) {
- if (sfc->surface != VDP_INVALID_HANDLE)
- vdp->bitmap_surface_destroy(sfc->surface);
+ if (sfc->surface != VDP_INVALID_HANDLE) {
+ vdp_st = vdp->bitmap_surface_destroy(sfc->surface);
+ CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy");
+ }
mp_msg(MSGT_VO, MSGL_V, "[vdpau] Allocating a %dx%d surface for "
"EOSD bitmaps.\n", sfc->w, sfc->h);
vdp_st = vdp->bitmap_surface_create(vc->vdp_device, VDP_RGBA_FORMAT_A8,