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/gl_hwdec_vaglx.c | 10 ++++++---- video/out/vo_vaapi.c | 32 +++++++++++++++----------------- 2 files changed, 21 insertions(+), 21 deletions(-) (limited to 'video/out') diff --git a/video/out/gl_hwdec_vaglx.c b/video/out/gl_hwdec_vaglx.c index 53beceb197..47e7bb6e07 100644 --- a/video/out/gl_hwdec_vaglx.c +++ b/video/out/gl_hwdec_vaglx.c @@ -29,6 +29,7 @@ #include "video/hwdec.h" struct priv { + struct mp_log *log; struct mp_vaapi_ctx *ctx; VADisplay *display; GLuint gl_texture; @@ -42,7 +43,7 @@ static void destroy_texture(struct gl_hwdec *hw) if (p->vaglx_surface) { status = vaDestroySurfaceGLX(p->display, p->vaglx_surface); - check_va_status(status, "vaDestroySurfaceGLX()"); + CHECK_VA_STATUS(p, "vaDestroySurfaceGLX()"); p->vaglx_surface = NULL; } @@ -65,10 +66,11 @@ 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->display = vaGetDisplayGLX(hw->mpgl->vo->x11->display); if (!p->display) return -1; - p->ctx = va_initialize(p->display); + p->ctx = va_initialize(p->display, p->log); if (!p->ctx) { vaTerminate(p->display); return -1; @@ -98,7 +100,7 @@ static int reinit(struct gl_hwdec *hw, const struct mp_image_params *params) status = vaCreateSurfaceGLX(p->display, GL_TEXTURE_2D, p->gl_texture, &p->vaglx_surface); - return check_va_status(status, "vaCreateSurfaceGLX()") ? 0 : -1; + return CHECK_VA_STATUS(p, "vaCreateSurfaceGLX()") ? 0 : -1; } static int map_image(struct gl_hwdec *hw, struct mp_image *hw_image, @@ -113,7 +115,7 @@ static int map_image(struct gl_hwdec *hw, struct mp_image *hw_image, status = vaCopySurfaceGLX(p->display, p->vaglx_surface, va_surface_id_in_mp_image(hw_image), va_get_colorspace_flag(hw_image->colorspace)); - if (!check_va_status(status, "vaCopySurfaceGLX()")) + if (!CHECK_VA_STATUS(p, "vaCopySurfaceGLX()")) return -1; out_textures[0] = p->gl_texture; 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