From 9e0b84c32173573cf5e5a09804d399a24a44c7ca Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 21 Dec 2013 18:05:23 +0100 Subject: vdpau: mp_msg conversions --- video/decode/vdpau.c | 13 ++++--- video/decode/vdpau_old.c | 12 +++--- video/out/gl_hwdec_vdpau.c | 14 ++++--- video/out/vo_vdpau.c | 93 +++++++++++++++++++++++----------------------- video/vdpau.c | 8 ++-- video/vdpau.h | 10 ++--- 6 files changed, 77 insertions(+), 73 deletions(-) diff --git a/video/decode/vdpau.c b/video/decode/vdpau.c index c7a5361c15..4b207f05fc 100644 --- a/video/decode/vdpau.c +++ b/video/decode/vdpau.c @@ -30,6 +30,7 @@ #include "video/hwdec.h" struct priv { + struct mp_log *log; struct mp_vdpau_ctx *mpvdp; struct vdp_functions *vdp; VdpDevice vdp_device; @@ -110,7 +111,7 @@ static bool create_vdp_decoder(struct lavc_ctx *ctx) const struct hwdec_profile_entry *pe = hwdec_find_profile(ctx, profiles); if (!pe) { - mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Unsupported codec or profile.\n"); + MP_ERR(p, "Unsupported codec or profile.\n"); goto fail; } @@ -119,14 +120,13 @@ static bool create_vdp_decoder(struct lavc_ctx *ctx) vdp_st = vdp->decoder_query_capabilities(p->vdp_device, pe->hw_profile, &supported, &maxl, &maxm, &maxw, &maxh); - CHECK_ST_WARNING("Querying VDPAU decoder capabilities"); + CHECK_VDP_WARNING(p, "Querying VDPAU decoder capabilities"); if (!supported) { - mp_msg(MSGT_VO, MSGL_ERR, - "[vdpau] Codec or profile not supported by hardware.\n"); + MP_ERR(p, "Codec or profile not supported by hardware.\n"); goto fail; } if (p->vid_width > maxw || p->vid_height > maxh) { - mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Video too large.\n"); + MP_ERR(p, "Video too large.\n"); goto fail; } @@ -135,7 +135,7 @@ static bool create_vdp_decoder(struct lavc_ctx *ctx) vdp_st = vdp->decoder_create(p->vdp_device, pe->hw_profile, p->vid_width, p->vid_height, maxrefs, &p->context.decoder); - CHECK_ST_WARNING("Failed creating VDPAU decoder"); + CHECK_VDP_WARNING(p, "Failed creating VDPAU decoder"); if (vdp_st != VDP_STATUS_OK) goto fail; return true; @@ -189,6 +189,7 @@ static int init(struct lavc_ctx *ctx) { struct priv *p = talloc_ptrtype(NULL, p); *p = (struct priv) { + .log = mp_log_new(p, ctx->log, "vdpau"), .mpvdp = ctx->hwdec_info->vdpau_ctx, }; ctx->hwdec_priv = p; diff --git a/video/decode/vdpau_old.c b/video/decode/vdpau_old.c index 8b7950c876..9e03026221 100644 --- a/video/decode/vdpau_old.c +++ b/video/decode/vdpau_old.c @@ -34,6 +34,7 @@ #include "video/decode/dec_video.h" struct priv { + struct mp_log *log; struct mp_vdpau_ctx *mpvdp; struct vdp_functions *vdp; VdpDevice vdp_device; @@ -96,8 +97,8 @@ static bool create_vdp_decoder(struct lavc_ctx *ctx, int max_refs) break; case IMGFMT_VDPAU_H264: vdp_decoder_profile = VDP_DECODER_PROFILE_H264_HIGH; - mp_msg(MSGT_VO, MSGL_V, "[vdpau] Creating H264 hardware decoder " - "for %d reference frames.\n", max_refs); + MP_VERBOSE(p, "Creating H264 hardware decoder " + "for %d reference frames.\n", max_refs); break; case IMGFMT_VDPAU_WMV3: vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_MAIN; @@ -109,13 +110,13 @@ static bool create_vdp_decoder(struct lavc_ctx *ctx, int max_refs) vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP; break; default: - mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Unknown image format!\n"); + MP_ERR(p, "Unknown image format!\n"); goto fail; } vdp_st = vdp->decoder_create(p->vdp_device, vdp_decoder_profile, p->vid_width, p->vid_height, max_refs, &p->decoder); - CHECK_ST_WARNING("Failed creating VDPAU decoder"); + CHECK_VDP_WARNING(p, "Failed creating VDPAU decoder"); if (vdp_st != VDP_STATUS_OK) goto fail; p->decoder_max_refs = max_refs; @@ -152,7 +153,7 @@ static void draw_slice_hwdec(struct AVCodecContext *s, (void *)&rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers); - CHECK_ST_WARNING("Failed VDPAU decoder rendering"); + CHECK_VDP_WARNING(p, "Failed VDPAU decoder rendering"); } static void release_surface(void *ptr) @@ -222,6 +223,7 @@ static int init(struct lavc_ctx *ctx) { struct priv *p = talloc_ptrtype(NULL, p); *p = (struct priv) { + .log = mp_log_new(p, ctx->log, "vdpau"), .mpvdp = ctx->hwdec_info->vdpau_ctx, }; ctx->hwdec_priv = p; diff --git a/video/out/gl_hwdec_vdpau.c b/video/out/gl_hwdec_vdpau.c index 6cfd7c91d5..07e406d9ba 100644 --- a/video/out/gl_hwdec_vdpau.c +++ b/video/out/gl_hwdec_vdpau.c @@ -31,6 +31,7 @@ static int reinit(struct gl_hwdec *hw, const struct mp_image_params *params); struct priv { + struct mp_log *log; struct mp_vdpau_ctx *ctx; uint64_t preemption_counter; struct mp_image_params image_params; @@ -86,12 +87,12 @@ static void destroy_objects(struct gl_hwdec *hw) if (p->vdp_surface != VDP_INVALID_HANDLE) { vdp_st = vdp->output_surface_destroy(p->vdp_surface); - CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy"); + CHECK_VDP_WARNING(p, "Error when calling vdp_output_surface_destroy"); } if (p->video_mixer != VDP_INVALID_HANDLE) { vdp_st = vdp->video_mixer_destroy(p->video_mixer); - CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy"); + CHECK_VDP_WARNING(p, "Error when calling vdp_video_mixer_destroy"); } glCheckError(gl, hw->log, "Before uninitializing OpenGL interop"); @@ -126,6 +127,7 @@ static int create(struct gl_hwdec *hw) return -1; struct priv *p = talloc_zero(hw, struct priv); hw->priv = p; + p->log = hw->log; p->ctx = mp_vdpau_create_device_x11(hw->log, hw->mpgl->vo->x11); if (!p->ctx) return -1; @@ -168,7 +170,7 @@ static int reinit(struct gl_hwdec *hw, const struct mp_image_params *params) VDP_NUM_MIXER_PARAMETER, parameters, parameter_values, &p->video_mixer); - CHECK_ST_ERROR("Error when calling vdp_video_mixer_create"); + CHECK_VDP_ERROR(p, "Error when calling vdp_video_mixer_create"); struct mp_csp_params cparams = MP_CSP_PARAMS_DEFAULTS; cparams.colorspace.levels_in = params->colorlevels; @@ -180,12 +182,12 @@ static int reinit(struct gl_hwdec *hw, const struct mp_image_params *params) VdpVideoMixerAttribute csc_attr = VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX; vdp_st = vdp->video_mixer_set_attribute_values(p->video_mixer, 1, &csc_attr, &(const void *){matrix}); - CHECK_ST_WARNING("Error when setting vdpau colorspace conversion matrix"); + CHECK_VDP_WARNING(p, "Error when setting vdpau colorspace conversion matrix"); vdp_st = vdp->output_surface_create(p->ctx->vdp_device, VDP_RGBA_FORMAT_B8G8R8A8, params->w, params->h, &p->vdp_surface); - CHECK_ST_ERROR("Error when calling vdp_output_surface_create"); + CHECK_VDP_ERROR(p, "Error when calling vdp_output_surface_create"); gl->GenTextures(1, &p->gl_texture); gl->BindTexture(GL_TEXTURE_2D, p->gl_texture); @@ -231,7 +233,7 @@ static int map_image(struct gl_hwdec *hw, struct mp_image *hw_image, 0, NULL, video_surface, 0, NULL, video_rect, p->vdp_surface, NULL, NULL, 0, NULL); - CHECK_ST_ERROR("Error when calling vdp_video_mixer_render"); + CHECK_VDP_ERROR(p, "Error when calling vdp_video_mixer_render"); gl->VDPAUMapSurfacesNV(1, &p->vdpgl_surface); out_textures[0] = p->gl_texture; diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index 07bb151e88..9e92b29bc6 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -167,7 +167,7 @@ static int change_vdptime_sync(struct vo *vo, int64_t *t) VdpStatus vdp_st; VdpTime vdp_time; vdp_st = vdp->presentation_queue_get_time(vc->flip_queue, &vdp_time); - CHECK_ST_ERROR("Error when calling vdp_presentation_queue_get_time"); + CHECK_VDP_ERROR(vo, "Error when calling vdp_presentation_queue_get_time"); uint64_t t1 = *t; uint64_t t2 = mp_time_us(); uint64_t old = vc->last_vdp_time + (t1 - vc->last_sync_update) * 1000ULL; @@ -232,8 +232,8 @@ static int render_video_to_output_surface(struct vo *vo, vdp_st = vdp->presentation_queue_block_until_surface_idle(vc->flip_queue, output_surface, &dummy); - CHECK_ST_WARNING("Error when calling " - "vdp_presentation_queue_block_until_surface_idle"); + CHECK_VDP_WARNING(vo, "Error when calling " + "vdp_presentation_queue_block_until_surface_idle"); if (vc->rgb_mode) { int flags = VDP_OUTPUT_SURFACE_RENDER_ROTATE_0; @@ -241,14 +241,14 @@ static int render_video_to_output_surface(struct vo *vo, NULL, vc->black_pixel, NULL, NULL, NULL, flags); - CHECK_ST_WARNING("Error clearing screen"); + CHECK_VDP_WARNING(vo, "Error clearing screen"); vdp_st = vdp->output_surface_render_output_surface(output_surface, output_rect, bv[dp/2].rgb_surface, video_rect, NULL, NULL, flags); - CHECK_ST_WARNING("Error when calling " - "vdp_output_surface_render_output_surface"); + CHECK_VDP_WARNING(vo, "Error when calling " + "vdp_output_surface_render_output_surface"); return 0; } @@ -270,7 +270,7 @@ static int render_video_to_output_surface(struct vo *vo, bv[dp/2].surface, 1, future_fields, video_rect, output_surface, NULL, output_rect, 0, NULL); - CHECK_ST_WARNING("Error when calling vdp_video_mixer_render"); + CHECK_VDP_WARNING(vo, "Error when calling vdp_video_mixer_render"); return 0; } @@ -420,8 +420,8 @@ static void resize(struct vo *vo) for (int i = 0; i < vc->num_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"); + CHECK_VDP_WARNING(vo, "Error when calling " + "vdp_output_surface_destroy"); } for (int i = 0; i < vc->num_output_surfaces; i++) { vdp_st = vdp->output_surface_create(vc->vdp_device, @@ -429,7 +429,7 @@ static void resize(struct vo *vo) vc->output_surface_width, vc->output_surface_height, &vc->output_surfaces[i]); - CHECK_ST_WARNING("Error when calling vdp_output_surface_create"); + CHECK_VDP_WARNING(vo, "Error when calling vdp_output_surface_create"); MP_DBG(vo, "vdpau out create: %u\n", vc->output_surfaces[i]); } @@ -448,8 +448,8 @@ static int win_x11_init_vdpau_flip_queue(struct vo *vo) vdp_st = vdp->presentation_queue_target_create_x11(vc->vdp_device, x11->window, &vc->flip_target); - CHECK_ST_ERROR("Error when calling " - "vdp_presentation_queue_target_create_x11"); + CHECK_VDP_ERROR(vo, "Error when calling " + "vdp_presentation_queue_target_create_x11"); } /* Emperically this seems to be the first call which fails when we @@ -467,7 +467,7 @@ static int win_x11_init_vdpau_flip_queue(struct vo *vo) vdp->get_error_string(vdp_st)); return -1; } else - CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create"); + CHECK_VDP_ERROR(vo, "Error when calling vdp_presentation_queue_create"); } if (vc->colorkey.a > 0) { @@ -479,12 +479,12 @@ static int win_x11_init_vdpau_flip_queue(struct vo *vo) }; vdp_st = vdp->presentation_queue_set_background_color(vc->flip_queue, &color); - CHECK_ST_WARNING("Error setting colorkey"); + CHECK_VDP_WARNING(vo, "Error setting colorkey"); } VdpTime vdp_time; vdp_st = vdp->presentation_queue_get_time(vc->flip_queue, &vdp_time); - CHECK_ST_ERROR("Error when calling vdp_presentation_queue_get_time"); + CHECK_VDP_ERROR(vo, "Error when calling vdp_presentation_queue_get_time"); vc->last_vdp_time = vdp_time; vc->last_sync_update = mp_time_us(); @@ -603,7 +603,7 @@ static int create_vdp_mixer(struct vo *vo, VdpChromaType vdp_chroma_type) vdp_st = vdp->video_mixer_query_feature_support(vc->vdp_device, hqscaling_feature, &hqscaling_available); - CHECK_ST_ERROR("Error when calling video_mixer_query_feature_support"); + CHECK_VDP_ERROR(vo, "Error when calling video_mixer_query_feature_support"); if (hqscaling_available) features[feature_count++] = hqscaling_feature; else @@ -615,7 +615,7 @@ static int create_vdp_mixer(struct vo *vo, VdpChromaType vdp_chroma_type) VDP_NUM_MIXER_PARAMETER, parameters, parameter_values, &vc->video_mixer); - CHECK_ST_ERROR("Error when calling vdp_video_mixer_create"); + CHECK_VDP_ERROR(vo, "Error when calling vdp_video_mixer_create"); for (i = 0; i < feature_count; i++) feature_enables[i] = VDP_TRUE; @@ -627,7 +627,7 @@ static int create_vdp_mixer(struct vo *vo, VdpChromaType vdp_chroma_type) vdp_st = vdp->video_mixer_set_feature_enables(vc->video_mixer, feature_count, features, feature_enables); - CHECK_ST_WARNING("Error calling vdp_video_mixer_set_feature_enables"); + CHECK_VDP_WARNING(vo, "Error calling vdp_video_mixer_set_feature_enables"); } if (vc->denoise) SET_VIDEO_ATTR(NOISE_REDUCTION_LEVEL, float, vc->denoise); @@ -651,27 +651,27 @@ static void free_video_specific(struct vo *vo) if (vc->video_mixer != VDP_INVALID_HANDLE) { vdp_st = vdp->video_mixer_destroy(vc->video_mixer); - CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy"); + CHECK_VDP_WARNING(vo, "Error when calling vdp_video_mixer_destroy"); } vc->video_mixer = VDP_INVALID_HANDLE; if (vc->screenshot_surface != VDP_INVALID_HANDLE) { vdp_st = vdp->output_surface_destroy(vc->screenshot_surface); - CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy"); + CHECK_VDP_WARNING(vo, "Error when calling vdp_output_surface_destroy"); } vc->screenshot_surface = VDP_INVALID_HANDLE; for (int n = 0; n < NUM_BUFFERED_VIDEO; n++) { if (vc->rgb_surfaces[n] != VDP_INVALID_HANDLE) { vdp_st = vdp->output_surface_destroy(vc->rgb_surfaces[n]); - CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy"); + CHECK_VDP_WARNING(vo, "Error when calling vdp_output_surface_destroy"); } vc->rgb_surfaces[n] = VDP_INVALID_HANDLE; } if (vc->black_pixel != VDP_INVALID_HANDLE) { vdp_st = vdp->output_surface_destroy(vc->black_pixel); - CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy"); + CHECK_VDP_WARNING(vo, "Error when calling vdp_output_surface_destroy"); } vc->black_pixel = VDP_INVALID_HANDLE; } @@ -703,16 +703,16 @@ static int initialize_vdpau_objects(struct vo *vo) format, vc->vid_width, vc->vid_height, &vc->rgb_surfaces[n]); - CHECK_ST_ERROR("Allocating RGB surface"); + CHECK_VDP_ERROR(vo, "Allocating RGB surface"); } vdp_st = vdp->output_surface_create(vc->vdp_device, OUTPUT_RGBA_FORMAT, 1, 1, &vc->black_pixel); - CHECK_ST_ERROR("Allocating clearing surface"); + CHECK_VDP_ERROR(vo, "Allocating clearing surface"); const char data[4] = {0}; vdp_st = vdp->output_surface_put_bits_native(vc->black_pixel, (const void*[]){data}, (uint32_t[]){4}, NULL); - CHECK_ST_ERROR("Initializing clearing surface"); + CHECK_VDP_ERROR(vo, "Initializing clearing surface"); } else { if (create_vdp_mixer(vo, vc->vdp_chroma_type) < 0) return -1; @@ -820,7 +820,7 @@ static struct bitmap_packer *make_packer(struct vo *vo, VdpRGBAFormat format) VdpStatus vdp_st = vdp-> bitmap_surface_query_capabilities(vc->vdp_device, format, &(VdpBool){0}, &w_max, &h_max); - CHECK_ST_WARNING("Query to get max OSD surface size failed"); + CHECK_VDP_WARNING(vo, "Query to get max OSD surface size failed"); packer->w_max = w_max; packer->h_max = h_max; return packer; @@ -865,7 +865,7 @@ static void draw_osd_part(struct vo *vo, int index) &sfc->targets[i].color, blend, VDP_OUTPUT_SURFACE_RENDER_ROTATE_0); - CHECK_ST_WARNING("OSD: Error when rendering"); + CHECK_VDP_WARNING(vo, "OSD: Error when rendering"); } } @@ -919,7 +919,7 @@ static void generate_osd_part(struct vo *vo, struct sub_bitmaps *imgs) } else if (r == 1) { if (sfc->surface != VDP_INVALID_HANDLE) { vdp_st = vdp->bitmap_surface_destroy(sfc->surface); - CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy"); + CHECK_VDP_WARNING(vo, "Error when calling vdp_bitmap_surface_destroy"); } MP_VERBOSE(vo, "Allocating a %dx%d surface for OSD bitmaps.\n", sfc->packer->w, sfc->packer->h); @@ -928,7 +928,7 @@ static void generate_osd_part(struct vo *vo, struct sub_bitmaps *imgs) true, &sfc->surface); if (vdp_st != VDP_STATUS_OK) sfc->surface = VDP_INVALID_HANDLE; - CHECK_ST_WARNING("OSD: error when creating surface"); + CHECK_VDP_WARNING(vo, "OSD: error when creating surface"); } if (imgs->scaled) { char zeros[sfc->packer->used_width * format_size]; @@ -970,7 +970,7 @@ osd_skip_upload: &(const void *){b->bitmap}, &(uint32_t){b->stride}, &target->source); - CHECK_ST_WARNING("OSD: putbits failed"); + CHECK_VDP_WARNING(vo, "OSD: putbits failed"); } sfc->render_count++; } @@ -1014,7 +1014,7 @@ static int update_presentation_queue_status(struct vo *vo) vdp_st = vdp->presentation_queue_query_surface_status(vc->flip_queue, surface, &status, &vtime); - CHECK_ST_WARNING("Error calling " + CHECK_VDP_WARNING(vo, "Error calling " "presentation_queue_query_surface_status"); if (status == VDP_PRESENTATION_QUEUE_STATUS_QUEUED) break; @@ -1124,7 +1124,7 @@ static void flip_page_timed(struct vo *vo, int64_t pts_us, int duration) vdp->presentation_queue_display(vc->flip_queue, vc->output_surfaces[vc->surface_num], vo->dwidth, vo->dheight, pts); - CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display"); + CHECK_VDP_WARNING(vo, "Error when calling vdp_presentation_queue_display"); vc->last_queue_time = pts; vc->queue_time[vc->surface_num] = pts; @@ -1179,8 +1179,8 @@ static void draw_image(struct vo *vo, mp_image_t *mpi) &(const void *){mpi->planes[0]}, &(uint32_t){mpi->stride[0]}, NULL); - CHECK_ST_WARNING("Error when calling " - "output_surface_put_bits_native"); + CHECK_VDP_WARNING(vo, "Error when calling " + "output_surface_put_bits_native"); } } else { reserved_mpi = mp_vdpau_get_video_surface(vc->mpvdp, IMGFMT_VDPAU, @@ -1196,8 +1196,8 @@ static void draw_image(struct vo *vo, mp_image_t *mpi) destdata[1] = destdata[2]; vdp_st = vdp->video_surface_put_bits_y_cb_cr(surface, vc->vdp_pixel_format, destdata, mpi->stride); - CHECK_ST_WARNING("Error when calling " - "vdp_video_surface_put_bits_y_cb_cr"); + CHECK_VDP_WARNING(vo, "Error when calling " + "vdp_video_surface_put_bits_y_cb_cr"); } } if (mpi->fields & MP_IMGFIELD_ORDERED) @@ -1212,10 +1212,11 @@ static void draw_image(struct vo *vo, mp_image_t *mpi) // warning: the size and pixel format of surface must match that of the // surfaces in vc->output_surfaces -static struct mp_image *read_output_surface(struct vdpctx *vc, +static struct mp_image *read_output_surface(struct vo *vo, VdpOutputSurface surface, int width, int height) { + struct vdpctx *vc = vo->priv; VdpStatus vdp_st; struct vdp_functions *vdp = vc->vdp; struct mp_image *image = mp_image_alloc(IMGFMT_BGR32, width, height); @@ -1226,7 +1227,7 @@ static struct mp_image *read_output_surface(struct vdpctx *vc, uint32_t dst_pitches[] = { image->stride[0] }; vdp_st = vdp->output_surface_get_bits_native(surface, NULL, dst_planes, dst_pitches); - CHECK_ST_WARNING("Error when calling vdp_output_surface_get_bits_native"); + CHECK_VDP_WARNING(vo, "Error when calling vdp_output_surface_get_bits_native"); return image; } @@ -1242,13 +1243,13 @@ static struct mp_image *get_screenshot(struct vo *vo) OUTPUT_RGBA_FORMAT, vc->vid_width, vc->vid_height, &vc->screenshot_surface); - CHECK_ST_WARNING("Error when calling vdp_output_surface_create"); + CHECK_VDP_WARNING(vo, "Error when calling vdp_output_surface_create"); } VdpRect rc = { .x1 = vc->vid_width, .y1 = vc->vid_height }; render_video_to_output_surface(vo, vc->screenshot_surface, &rc, &rc); - struct mp_image *image = read_output_surface(vc, vc->screenshot_surface, + struct mp_image *image = read_output_surface(vo, vc->screenshot_surface, vc->vid_width, vc->vid_height); mp_image_set_display_size(image, vo->aspdat.prew, vo->aspdat.preh); @@ -1261,7 +1262,7 @@ static struct mp_image *get_window_screenshot(struct vo *vo) struct vdpctx *vc = vo->priv; int last_surface = WRAP_ADD(vc->surface_num, -1, vc->num_output_surfaces); VdpOutputSurface screen = vc->output_surfaces[last_surface]; - struct mp_image *image = read_output_surface(vo->priv, screen, + struct mp_image *image = read_output_surface(vo, screen, vc->output_surface_width, vc->output_surface_height); mp_image_set_size(image, vo->dwidth, vo->dheight); @@ -1292,12 +1293,12 @@ static void destroy_vdpau_objects(struct vo *vo) if (vc->flip_queue != VDP_INVALID_HANDLE) { vdp_st = vdp->presentation_queue_destroy(vc->flip_queue); - CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy"); + CHECK_VDP_WARNING(vo, "Error when calling vdp_presentation_queue_destroy"); } if (vc->flip_target != VDP_INVALID_HANDLE) { vdp_st = vdp->presentation_queue_target_destroy(vc->flip_target); - CHECK_ST_WARNING("Error when calling " + CHECK_VDP_WARNING(vo, "Error when calling " "vdp_presentation_queue_target_destroy"); } @@ -1305,14 +1306,14 @@ static void destroy_vdpau_objects(struct vo *vo) if (vc->output_surfaces[i] == VDP_INVALID_HANDLE) continue; vdp_st = vdp->output_surface_destroy(vc->output_surfaces[i]); - CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy"); + CHECK_VDP_WARNING(vo, "Error when calling vdp_output_surface_destroy"); } for (int i = 0; i < MAX_OSD_PARTS; i++) { struct osd_bitmap_surface *sfc = &vc->osd_surfaces[i]; if (sfc->surface != VDP_INVALID_HANDLE) { vdp_st = vdp->bitmap_surface_destroy(sfc->surface); - CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy"); + CHECK_VDP_WARNING(vo, "Error when calling vdp_bitmap_surface_destroy"); } } @@ -1421,7 +1422,7 @@ static int control(struct vo *vo, uint32_t request, void *data) vdp_st = vdp->video_mixer_set_feature_enables(vc->video_mixer, 1, features, feature_enables); - CHECK_ST_WARNING("Error changing deinterlacing settings"); + CHECK_VDP_WARNING(vo, "Error changing deinterlacing settings"); } vo->want_redraw = true; return VO_TRUE; diff --git a/video/vdpau.c b/video/vdpau.c index a9991e2b12..e543a2553c 100644 --- a/video/vdpau.c +++ b/video/vdpau.c @@ -161,7 +161,7 @@ struct mp_image *mp_vdpau_get_video_surface(struct mp_vdpau_ctx *ctx, int fmt, if (!e->in_use && e->surface != VDP_INVALID_HANDLE) { if (e->fmt != fmt || e->chroma != chroma || e->w != w || e->h != h) { vdp_st = vdp->video_surface_destroy(e->surface); - CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy"); + CHECK_VDP_WARNING(ctx, "Error when calling vdp_video_surface_destroy"); e->surface = VDP_INVALID_HANDLE; } } @@ -191,7 +191,7 @@ struct mp_image *mp_vdpau_get_video_surface(struct mp_vdpau_ctx *ctx, int fmt, } else { vdp_st = vdp->video_surface_create(ctx->vdp_device, chroma, w, h, &e->surface); - CHECK_ST_WARNING("Error when calling vdp_video_surface_create"); + CHECK_VDP_WARNING(ctx, "Error when calling vdp_video_surface_create"); } return create_ref(e); } @@ -232,13 +232,13 @@ void mp_vdpau_destroy(struct mp_vdpau_ctx *ctx) assert(!ctx->video_surfaces[i].in_use); if (ctx->video_surfaces[i].surface != VDP_INVALID_HANDLE) { vdp_st = vdp->video_surface_destroy(ctx->video_surfaces[i].surface); - CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy"); + CHECK_VDP_WARNING(ctx, "Error when calling vdp_video_surface_destroy"); } } if (ctx->vdp_device != VDP_INVALID_HANDLE) { vdp_st = vdp->device_destroy(ctx->vdp_device); - CHECK_ST_WARNING("Error when calling vdp_device_destroy"); + CHECK_VDP_WARNING(ctx, "Error when calling vdp_device_destroy"); } talloc_free(ctx); diff --git a/video/vdpau.h b/video/vdpau.h index 069b9a0f55..7b8d4099b5 100644 --- a/video/vdpau.h +++ b/video/vdpau.h @@ -9,20 +9,18 @@ #include "common/msg.h" -#define CHECK_ST_ERROR(message) \ +#define CHECK_VDP_ERROR(ctx, message) \ do { \ if (vdp_st != VDP_STATUS_OK) { \ - mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] %s: %s\n", \ - message, vdp->get_error_string(vdp_st)); \ + MP_ERR(ctx, "%s: %s\n", message, vdp->get_error_string(vdp_st)); \ return -1; \ } \ } while (0) -#define CHECK_ST_WARNING(message) \ +#define CHECK_VDP_WARNING(ctx, message) \ do { \ if (vdp_st != VDP_STATUS_OK) \ - mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] %s: %s\n", \ - message, vdp->get_error_string(vdp_st)); \ + MP_WARN(ctx, "%s: %s\n", message, vdp->get_error_string(vdp_st)); \ } while (0) struct vdp_functions { -- cgit v1.2.3