summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-20 22:26:57 +0200
committerwm4 <wm4@nowhere>2015-06-20 22:26:57 +0200
commit991af7dfb10c514a10d84f5a3e2698e646eb53d4 (patch)
tree03816e23f1b58bad4b6ca0249006d953096acd0a /video
parentb17b8ff7fe91be294ffb229c0c143da7a6425fca (diff)
downloadmpv-991af7dfb10c514a10d84f5a3e2698e646eb53d4.tar.bz2
mpv-991af7dfb10c514a10d84f5a3e2698e646eb53d4.tar.xz
video: reduce error message when loading hwdec backend fails
When using --hwdec=auto, about half of all systems will print: "[vdpau] Error when calling vdp_device_create_x11: 1" this happens because usually mpv will be linked against both vdpau and vaapi libs, but the drivers are not necessarily available. Then trying to load a driver will fail. This is a normal part of probing, but the error messages were printed anyway. Silence them by explicitly distinguishing probing. This pretty much goes through all the layers. We actually consider loading hw backends for vo_opengl always "auto probed", even if a hw backend is explicitly requested. In this case vd_lavc will print a warning message anyway (adjust this message a bit).
Diffstat (limited to 'video')
-rw-r--r--video/decode/vaapi.c2
-rw-r--r--video/decode/vd_lavc.c7
-rw-r--r--video/out/gl_hwdec.c2
-rw-r--r--video/out/gl_hwdec_vaglx.c2
-rw-r--r--video/out/gl_hwdec_vdpau.c2
-rw-r--r--video/out/vo_vaapi.c2
-rw-r--r--video/out/vo_vdpau.c2
-rw-r--r--video/vaapi.c5
-rw-r--r--video/vaapi.h2
-rw-r--r--video/vdpau.c18
-rw-r--r--video/vdpau.h3
11 files changed, 28 insertions, 19 deletions
diff --git a/video/decode/vaapi.c b/video/decode/vaapi.c
index bcc03aeaa4..0a9250c900 100644
--- a/video/decode/vaapi.c
+++ b/video/decode/vaapi.c
@@ -307,7 +307,7 @@ static bool create_va_dummy_ctx(struct priv *p)
VADisplay *display = vaGetDisplay(p->x11_display);
if (!display)
goto destroy_ctx;
- p->ctx = va_initialize(display, p->log);
+ p->ctx = va_initialize(display, p->log, true);
if (!p->ctx) {
vaTerminate(display);
goto destroy_ctx;
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index bbe6734c19..7c5c4ec8dc 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -252,10 +252,11 @@ static struct vd_lavc_hwdec *probe_hwdec(struct dec_video *vd, bool autoprobe,
if (r >= 0) {
return hwdec;
} else if (r == HWDEC_ERR_NO_CODEC) {
- MP_VERBOSE(vd, "Hardware decoder '%s' not found in "
- "libavcodec.\n", decoder);
+ MP_VERBOSE(vd, "Hardware decoder '%s' not found in libavcodec.\n",
+ decoder);
} else if (r == HWDEC_ERR_NO_CTX && !autoprobe) {
- MP_WARN(vd, "VO does not support requested hardware decoder.\n");
+ MP_WARN(vd, "VO does not support requested hardware decoder, or "
+ "loading it failed.\n");
}
return NULL;
}
diff --git a/video/out/gl_hwdec.c b/video/out/gl_hwdec.c
index 9f6928bebd..678ff184df 100644
--- a/video/out/gl_hwdec.c
+++ b/video/out/gl_hwdec.c
@@ -60,7 +60,7 @@ static struct gl_hwdec *load_hwdec_driver(struct mp_log *log, GL *gl,
};
if (hwdec->driver->create(hwdec) < 0) {
talloc_free(hwdec);
- mp_err(log, "Couldn't load hwdec driver '%s'\n", drv->api_name);
+ mp_verbose(log, "Couldn't load hwdec driver '%s'\n", drv->api_name);
return NULL;
}
return hwdec;
diff --git a/video/out/gl_hwdec_vaglx.c b/video/out/gl_hwdec_vaglx.c
index 86ec3b5183..00fecffb31 100644
--- a/video/out/gl_hwdec_vaglx.c
+++ b/video/out/gl_hwdec_vaglx.c
@@ -90,7 +90,7 @@ static int create(struct gl_hwdec *hw)
p->display = vaGetDisplay(x11disp);
if (!p->display)
return -1;
- p->ctx = va_initialize(p->display, p->log);
+ p->ctx = va_initialize(p->display, p->log, true);
if (!p->ctx) {
vaTerminate(p->display);
return -1;
diff --git a/video/out/gl_hwdec_vdpau.c b/video/out/gl_hwdec_vdpau.c
index bb502ade11..851f79393d 100644
--- a/video/out/gl_hwdec_vdpau.c
+++ b/video/out/gl_hwdec_vdpau.c
@@ -109,7 +109,7 @@ static int create(struct gl_hwdec *hw)
struct priv *p = talloc_zero(hw, struct priv);
hw->priv = p;
p->log = hw->log;
- p->ctx = mp_vdpau_create_device_x11(hw->log, x11disp);
+ p->ctx = mp_vdpau_create_device_x11(hw->log, x11disp, true);
if (!p->ctx)
return -1;
if (mp_vdpau_handle_preemption(p->ctx, &p->preemption_counter) < 1)
diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c
index b34acb1052..69097021fd 100644
--- a/video/out/vo_vaapi.c
+++ b/video/out/vo_vaapi.c
@@ -600,7 +600,7 @@ static int preinit(struct vo *vo)
if (!p->display)
goto fail;
- p->mpvaapi = va_initialize(p->display, p->log);
+ p->mpvaapi = va_initialize(p->display, p->log, false);
if (!p->mpvaapi) {
vaTerminate(p->display);
p->display = NULL;
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index 495e65a9b9..26ff5454dc 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -954,7 +954,7 @@ static int preinit(struct vo *vo)
if (!vo_x11_init(vo))
return -1;
- vc->mpvdp = mp_vdpau_create_device_x11(vo->log, vo->x11->display);
+ vc->mpvdp = mp_vdpau_create_device_x11(vo->log, vo->x11->display, false);
if (!vc->mpvdp) {
vo_x11_uninit(vo);
return -1;
diff --git a/video/vaapi.c b/video/vaapi.c
index 8b95dde85d..df2022ce01 100644
--- a/video/vaapi.c
+++ b/video/vaapi.c
@@ -114,12 +114,15 @@ static void va_get_formats(struct mp_vaapi_ctx *ctx)
ctx->image_formats = formats;
}
-struct mp_vaapi_ctx *va_initialize(VADisplay *display, struct mp_log *plog)
+struct mp_vaapi_ctx *va_initialize(VADisplay *display, struct mp_log *plog,
+ bool probing)
{
struct mp_vaapi_ctx *res = NULL;
struct mp_log *log = mp_log_new(NULL, plog, "/vaapi");
int major_version, minor_version;
int status = vaInitialize(display, &major_version, &minor_version);
+ if (status != VA_STATUS_SUCCESS && probing)
+ goto error;
if (!check_va_status(log, status, "vaInitialize()"))
goto error;
diff --git a/video/vaapi.h b/video/vaapi.h
index 34450f8c60..e3310bcee0 100644
--- a/video/vaapi.h
+++ b/video/vaapi.h
@@ -111,7 +111,7 @@ bool check_va_status(struct mp_log *log, VAStatus status, const char *msg);
int va_get_colorspace_flag(enum mp_csp csp);
-struct mp_vaapi_ctx *va_initialize(VADisplay *display, struct mp_log *log);
+struct mp_vaapi_ctx * va_initialize(VADisplay *display, struct mp_log *plog, bool probing);
void va_destroy(struct mp_vaapi_ctx *ctx);
enum mp_imgfmt va_fourcc_to_imgfmt(uint32_t fourcc);
diff --git a/video/vdpau.c b/video/vdpau.c
index 339fb59d54..55ca8d95ce 100644
--- a/video/vdpau.c
+++ b/video/vdpau.c
@@ -113,7 +113,7 @@ static void preemption_callback(VdpDevice device, void *context)
pthread_mutex_unlock(&ctx->preempt_lock);
}
-static int win_x11_init_vdpau_procs(struct mp_vdpau_ctx *ctx)
+static int win_x11_init_vdpau_procs(struct mp_vdpau_ctx *ctx, bool probing)
{
Display *x11 = ctx->x11;
VdpStatus vdp_st;
@@ -142,11 +142,14 @@ static int win_x11_init_vdpau_procs(struct mp_vdpau_ctx *ctx)
vdp_st = vdp_device_create_x11(x11, DefaultScreen(x11), &ctx->vdp_device,
&get_proc_address);
if (vdp_st != VDP_STATUS_OK) {
- if (ctx->is_preempted)
+ if (ctx->is_preempted) {
MP_DBG(ctx, "Error calling vdp_device_create_x11 while preempted: %d\n",
vdp_st);
- else
- MP_ERR(ctx, "Error when calling vdp_device_create_x11: %d\n", vdp_st);
+ } else {
+ int lev = probing ? MSGL_V : MSGL_ERR;
+ mp_msg(ctx->log, lev, "Error when calling vdp_device_create_x11: %d\n",
+ vdp_st);
+ }
return -1;
}
@@ -182,7 +185,7 @@ static int handle_preemption(struct mp_vdpau_ctx *ctx)
if (ctx->last_preemption_retry_fail &&
mp_time_sec() - ctx->last_preemption_retry_fail < 1.0)
return -1;
- if (win_x11_init_vdpau_procs(ctx) < 0) {
+ if (win_x11_init_vdpau_procs(ctx, false) < 0) {
ctx->last_preemption_retry_fail = mp_time_sec();
return -1;
}
@@ -369,7 +372,8 @@ struct mp_image *mp_vdpau_get_video_surface(struct mp_vdpau_ctx *ctx,
return mp_vdpau_get_surface(ctx, chroma, 0, false, w, h);
}
-struct mp_vdpau_ctx *mp_vdpau_create_device_x11(struct mp_log *log, Display *x11)
+struct mp_vdpau_ctx *mp_vdpau_create_device_x11(struct mp_log *log, Display *x11,
+ bool probing)
{
struct mp_vdpau_ctx *ctx = talloc_ptrtype(NULL, ctx);
*ctx = (struct mp_vdpau_ctx) {
@@ -389,7 +393,7 @@ struct mp_vdpau_ctx *mp_vdpau_create_device_x11(struct mp_log *log, Display *x11
mark_vdpau_objects_uninitialized(ctx);
- if (win_x11_init_vdpau_procs(ctx) < 0) {
+ if (win_x11_init_vdpau_procs(ctx, probing) < 0) {
mp_vdpau_destroy(ctx);
return NULL;
}
diff --git a/video/vdpau.h b/video/vdpau.h
index 2304ecd0d6..2e9269a420 100644
--- a/video/vdpau.h
+++ b/video/vdpau.h
@@ -79,7 +79,8 @@ struct mp_vdpau_ctx {
int getimg_w, getimg_h;
};
-struct mp_vdpau_ctx *mp_vdpau_create_device_x11(struct mp_log *log, Display *x11);
+struct mp_vdpau_ctx *mp_vdpau_create_device_x11(struct mp_log *log, Display *x11,
+ bool probing);
void mp_vdpau_destroy(struct mp_vdpau_ctx *ctx);
int mp_vdpau_handle_preemption(struct mp_vdpau_ctx *ctx, uint64_t *counter);