summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-25 22:06:17 +0100
committerwm4 <wm4@nowhere>2015-11-25 22:06:17 +0100
commitfa2fdaab0a190b8a2f149b6b235be4be3326bad6 (patch)
treef625b65379a65d19f5df76e09553896113c8ba75
parentb7d614aa0d910a9e426bd1bd81755e43bc95214f (diff)
downloadmpv-fa2fdaab0a190b8a2f149b6b235be4be3326bad6.tar.bz2
mpv-fa2fdaab0a190b8a2f149b6b235be4be3326bad6.tar.xz
vo_rpi: add an option to disable OSD
The OSD takes up an entire fullscreen dispmanx layer. Although the GPU should be able to handle it (possibly even without any disadvantages), it'll still be useful for debugging performance issues.
-rw-r--r--DOCS/man/vo.rst4
-rw-r--r--video/out/vo_rpi.c44
2 files changed, 29 insertions, 19 deletions
diff --git a/DOCS/man/vo.rst b/DOCS/man/vo.rst
index 440e083c16..5935044518 100644
--- a/DOCS/man/vo.rst
+++ b/DOCS/man/vo.rst
@@ -1129,6 +1129,10 @@ Available video output drivers are:
Normally it's better to kill the console framebuffer instead, which
gives better performance.
+ ``osd=<yes|no>``
+ Enabled by default. If disabled with ``no``, no OSD layer is created.
+ This also means there will be no subtitles rendered.
+
``drm`` (Direct Rendering Manager)
Video output driver using Kernel Mode Setting / Direct Rendering Manager.
Should be used when one doesn't want to install full-blown graphical
diff --git a/video/out/vo_rpi.c b/video/out/vo_rpi.c
index 4f890ad2e4..601bf72a4e 100644
--- a/video/out/vo_rpi.c
+++ b/video/out/vo_rpi.c
@@ -80,6 +80,7 @@ struct priv {
int display_nr;
int layer;
int background;
+ int enable_osd;
};
// Magic alignments (in pixels) expected by the MMAL internals.
@@ -116,6 +117,8 @@ static size_t layout_buffer(struct mp_image *mpi, MMAL_BUFFER_HEADER_T *buffer,
static void update_osd(struct vo *vo)
{
struct priv *p = vo->priv;
+ if (!p->enable_osd)
+ return;
mpgl_osd_generate(p->osd, p->osd_res, p->osd_pts, 0, 0);
@@ -240,27 +243,29 @@ static int update_display_size(struct vo *vo)
}
}
- alpha = (VC_DISPMANX_ALPHA_T){
- .flags = DISPMANX_FLAGS_ALPHA_FROM_SOURCE,
- .opacity = 0xFF,
- };
- p->osd_overlay = vc_dispmanx_element_add(p->update, p->display,
- p->osd_layer,
- &dst, 0, &src,
- DISPMANX_PROTECTION_NONE,
- &alpha, 0, 0);
- if (!p->osd_overlay) {
- MP_FATAL(vo, "Could not add DISPMANX element.\n");
- return -1;
- }
+ if (p->enable_osd) {
+ alpha = (VC_DISPMANX_ALPHA_T){
+ .flags = DISPMANX_FLAGS_ALPHA_FROM_SOURCE,
+ .opacity = 0xFF,
+ };
+ p->osd_overlay = vc_dispmanx_element_add(p->update, p->display,
+ p->osd_layer,
+ &dst, 0, &src,
+ DISPMANX_PROTECTION_NONE,
+ &alpha, 0, 0);
+ if (!p->osd_overlay) {
+ MP_FATAL(vo, "Could not add DISPMANX element.\n");
+ return -1;
+ }
- if (mp_egl_rpi_init(&p->egl, p->osd_overlay, p->w, p->h) < 0) {
- MP_FATAL(vo, "EGL/GLES initialization for OSD renderer failed.\n");
- return -1;
+ if (mp_egl_rpi_init(&p->egl, p->osd_overlay, p->w, p->h) < 0) {
+ MP_FATAL(vo, "EGL/GLES initialization for OSD renderer failed.\n");
+ return -1;
+ }
+ p->sc = gl_sc_create(p->egl.gl, vo->log),
+ p->osd = mpgl_osd_init(p->egl.gl, vo->log, vo->osd);
+ p->osd_change_counter = -1; // force initial overlay rendering
}
- p->sc = gl_sc_create(p->egl.gl, vo->log),
- p->osd = mpgl_osd_init(p->egl.gl, vo->log, vo->osd);
- p->osd_change_counter = -1; // force initial overlay rendering
p->display_fps = 0;
TV_GET_STATE_RESP_T tvstate;
@@ -660,6 +665,7 @@ static const struct m_option options[] = {
OPT_INT("display", display_nr, 0),
OPT_INT("layer", layer, 0, OPTDEF_INT(-10)),
OPT_FLAG("background", background, 0),
+ OPT_FLAG("osd", enable_osd, 0, OPTDEF_INT(1)),
{0},
};