From 70af7ab8e55e117e62303b407f2886f29b5500d1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 21 Dec 2013 18:11:01 +0100 Subject: vaapi: mp_msg conversions This ended up a little bit messy. In order to get a mp_log everywhere, mostly make use of the fact that va_surface already references global state anyway. --- video/out/vo_vaapi.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'video/out/vo_vaapi.c') diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c index de5e05e4ec..d05b4afd44 100644 --- a/video/out/vo_vaapi.c +++ b/video/out/vo_vaapi.c @@ -134,7 +134,7 @@ static bool alloc_swdec_surfaces(struct priv *p, int w, int h, int imgfmt) free_video_specific(p); for (int i = 0; i < MAX_OUTPUT_SURFACES; i++) { p->swdec_surfaces[i] = - va_surface_pool_get_wrapped(p->pool, p->va_image_formats, imgfmt, w, h); + va_surface_pool_get_wrapped(p->pool, imgfmt, w, h); if (!p->swdec_surfaces[i]) return false; } @@ -190,8 +190,7 @@ static bool render_to_screen(struct priv *p, struct mp_image *mpi) // 4:2:0 should work everywhere int fmt = IMGFMT_420P; p->black_surface = - va_surface_pool_get_by_imgfmt(p->pool, p->va_image_formats, - fmt, w, h); + va_surface_pool_get_by_imgfmt(p->pool, fmt, w, h); if (p->black_surface) { struct mp_image *img = mp_image_alloc(fmt, w, h); mp_image_clear(img, 0, 0, w, h); @@ -221,7 +220,7 @@ static bool render_to_screen(struct priv *p, struct mp_image *mpi) sp->dst_x, sp->dst_y, sp->dst_w, sp->dst_h, flags); - check_va_status(status, "vaAssociateSubpicture()"); + CHECK_VA_STATUS(p, "vaAssociateSubpicture()"); } } @@ -244,7 +243,7 @@ static bool render_to_screen(struct priv *p, struct mp_image *mpi) p->dst_rect.y1 - p->dst_rect.y0, NULL, 0, flags); - check_va_status(status, "vaPutSurface()"); + CHECK_VA_STATUS(p, "vaPutSurface()"); for (int n = 0; n < MAX_OSD_PARTS; n++) { struct vaapi_osd_part *part = &p->osd_parts[n]; @@ -252,7 +251,7 @@ static bool render_to_screen(struct priv *p, struct mp_image *mpi) struct vaapi_subpic *sp = &part->subpic; status = vaDeassociateSubpicture(p->display, sp->id, &surface, 1); - check_va_status(status, "vaDeassociateSubpicture()"); + CHECK_VA_STATUS(p, "vaDeassociateSubpicture()"); } } @@ -292,8 +291,7 @@ static struct mp_image *get_screenshot(struct priv *p) va_surface_in_mp_image(p->output_surfaces[p->visible_surface]); if (!surface) return NULL; - struct mp_image *img = - va_surface_download(surface, p->va_image_formats, NULL); + struct mp_image *img = va_surface_download(surface, NULL); if (!img) return NULL; struct mp_image_params params = p->image_params; @@ -334,10 +332,10 @@ static int new_subpicture(struct priv *p, int w, int h, }; status = vaCreateImage(p->display, &p->osd_format, w, h, &m.image); - if (!check_va_status(status, "vaCreateImage()")) + if (!CHECK_VA_STATUS(p, "vaCreateImage()")) goto error; status = vaCreateSubpicture(p->display, m.image.image_id, &m.subpic_id); - if (!check_va_status(status, "vaCreateSubpicture()")) + if (!CHECK_VA_STATUS(p, "vaCreateSubpicture()")) goto error; *out = m; @@ -377,7 +375,7 @@ static void draw_osd_cb(void *pctx, struct sub_bitmaps *imgs) struct vaapi_osd_image *img = &part->image; struct mp_image vaimg; - if (va_image_map(p->display, &img->image, &vaimg) < 0) + if (va_image_map(p->mpvaapi, &img->image, &vaimg) < 0) goto error; // Clear borders and regions uncovered by sub-bitmaps @@ -398,7 +396,7 @@ static void draw_osd_cb(void *pctx, struct sub_bitmaps *imgs) vaimg.stride[0], sub->stride); } - if (va_image_unmap(p->display, &img->image) < 0) + if (va_image_unmap(p->mpvaapi, &img->image) < 0) goto error; part->subpic = (struct vaapi_subpic) { @@ -496,7 +494,7 @@ static int set_equalizer(struct priv *p, const char *name, int value) attr->value = ((value + 100) * r) / 200 + attr->min_value; status = vaSetDisplayAttributes(p->display, attr, 1); - if (!check_va_status(status, "vaSetDisplayAttributes()")) + if (!CHECK_VA_STATUS(p, "vaSetDisplayAttributes()")) return VO_FALSE; return VO_TRUE; } @@ -585,13 +583,13 @@ static int preinit(struct vo *vo) if (!p->display) return -1; - p->mpvaapi = va_initialize(p->display); + p->mpvaapi = va_initialize(p->display, p->log); if (!p->mpvaapi) { vaTerminate(p->display); return -1; } - p->pool = va_surface_pool_alloc(p->display, VA_RT_FORMAT_YUV420); + p->pool = va_surface_pool_alloc(p->mpvaapi, VA_RT_FORMAT_YUV420); p->va_image_formats = p->mpvaapi->image_formats; int max_subpic_formats = vaMaxNumSubpictureFormats(p->display); @@ -601,7 +599,7 @@ static int preinit(struct vo *vo) p->va_subpic_formats, p->va_subpic_flags, &p->va_num_subpic_formats); - if (!check_va_status(status, "vaQuerySubpictureFormats()")) + if (!CHECK_VA_STATUS(p, "vaQuerySubpictureFormats()")) p->va_num_subpic_formats = 0; MP_VERBOSE(vo, "%d subpicture formats available:\n", p->va_num_subpic_formats); @@ -634,7 +632,7 @@ static int preinit(struct vo *vo) if (p->va_display_attrs) { status = vaQueryDisplayAttributes(p->display, p->va_display_attrs, &p->va_num_display_attrs); - if (!check_va_status(status, "vaQueryDisplayAttributes()")) + if (!CHECK_VA_STATUS(p, "vaQueryDisplayAttributes()")) p->va_num_display_attrs = 0; } return 0; -- cgit v1.2.3