1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-01 14:50:07 +00:00

vo_opengl: rework --opengl-dumb-mode

It's now possible to request non-dumb mode as a user, even when not
using any non-dumb features. This change is mostly intended for testing,
so I can easily switch between dumb and non-dumb mode on default
settings. The default behavior is unaffected.
This commit is contained in:
Niklas Haas 2017-07-07 14:46:46 +02:00
parent 9a49a35453
commit 7c1db05cbb
No known key found for this signature in database
GPG Key ID: 9A09076581B27402
3 changed files with 15 additions and 8 deletions

View File

@ -54,6 +54,8 @@ Interface changes
vf/af commands too) vf/af commands too)
- remove --demuxer-lavf-cryptokey. Use --demux-lavf-o=cryptokey=<hex> or - remove --demuxer-lavf-cryptokey. Use --demux-lavf-o=cryptokey=<hex> or
--demux-lavf-o=decryption_key=<hex> instead (whatever fits your situation). --demux-lavf-o=decryption_key=<hex> instead (whatever fits your situation).
- rename --opengl-dumb-mode=no to --opengl-dumb-mode=auto, and make `no`
always disable it (unless forced on by hardware limitation).
--- mpv 0.25.0 --- --- mpv 0.25.0 ---
- remove opengl-cb dxva2 dummy hwdec interop - remove opengl-cb dxva2 dummy hwdec interop
(see git "vo_opengl: remove dxva2 dummy hwdec backend") (see git "vo_opengl: remove dxva2 dummy hwdec backend")

View File

@ -4845,17 +4845,17 @@ The following video options are currently all specific to ``--vo=opengl`` and
flipping GL front and backbuffers immediately (i.e. it doesn't call it flipping GL front and backbuffers immediately (i.e. it doesn't call it
in display-sync mode). in display-sync mode).
``--opengl-dumb-mode=<yes|no>`` ``--opengl-dumb-mode=<yes|no|auto>``
This mode is extremely restricted, and will disable most extended OpenGL This mode is extremely restricted, and will disable most extended OpenGL
features. This includes high quality scalers and custom shaders! features. That includes high quality scalers and custom shaders!
It is intended for hardware that does not support FBOs (including GLES, It is intended for hardware that does not support FBOs (including GLES,
which supports it insufficiently), or to get some more performance out of which supports it insufficiently), or to get some more performance out of
bad or old hardware. bad or old hardware.
This mode is forced automatically if needed, and this option is mostly This mode is forced automatically if needed, and this option is mostly
useful for debugging. It's also enabled automatically if nothing uses useful for debugging. The default of ``auto`` will enable it automatically
features which require FBOs. if nothing uses features which require FBOs.
This option might be silently removed in the future. This option might be silently removed in the future.

View File

@ -340,7 +340,8 @@ static int validate_window_opt(struct mp_log *log, const m_option_t *opt,
const struct m_sub_options gl_video_conf = { const struct m_sub_options gl_video_conf = {
.opts = (const m_option_t[]) { .opts = (const m_option_t[]) {
OPT_FLAG("opengl-dumb-mode", dumb_mode, 0), OPT_CHOICE("opengl-dumb-mode", dumb_mode, 0,
({"auto", 0}, {"yes", 1}, {"no", -1})),
OPT_FLOATRANGE("opengl-gamma", gamma, 0, 0.1, 2.0), OPT_FLOATRANGE("opengl-gamma", gamma, 0, 0.1, 2.0),
OPT_FLAG("gamma-auto", gamma_auto, 0), OPT_FLAG("gamma-auto", gamma_auto, 0),
OPT_CHOICE_C("target-prim", target_prim, 0, mp_csp_prim_names), OPT_CHOICE_C("target-prim", target_prim, 0, mp_csp_prim_names),
@ -3124,8 +3125,12 @@ static bool check_dumb_mode(struct gl_video *p)
struct gl_video_opts *o = &p->opts; struct gl_video_opts *o = &p->opts;
if (p->use_integer_conversion) if (p->use_integer_conversion)
return false; return false;
if (o->dumb_mode) if (o->dumb_mode > 0) // requested by user
return true; return true;
if (o->dumb_mode < 0) // disabled by user
return false;
// otherwise, use auto-detection
if (o->target_prim || o->target_trc || o->linear_scaling || if (o->target_prim || o->target_trc || o->linear_scaling ||
o->correct_downscaling || o->sigmoid_upscaling || o->interpolation || o->correct_downscaling || o->sigmoid_upscaling || o->interpolation ||
o->blend_subs || o->deband || o->unsharp) o->blend_subs || o->deband || o->unsharp)
@ -3176,12 +3181,12 @@ static void check_gl_features(struct gl_video *p)
MP_WARN(p, "Disabling PBOs (GL2.1/GLES2 unsupported).\n"); MP_WARN(p, "Disabling PBOs (GL2.1/GLES2 unsupported).\n");
} }
p->forced_dumb_mode = p->opts.dumb_mode || !have_fbo || !have_texrg; p->forced_dumb_mode = p->opts.dumb_mode > 0 || !have_fbo || !have_texrg;
bool voluntarily_dumb = check_dumb_mode(p); bool voluntarily_dumb = check_dumb_mode(p);
if (p->forced_dumb_mode || voluntarily_dumb) { if (p->forced_dumb_mode || voluntarily_dumb) {
if (voluntarily_dumb) { if (voluntarily_dumb) {
MP_VERBOSE(p, "No advanced processing required. Enabling dumb mode.\n"); MP_VERBOSE(p, "No advanced processing required. Enabling dumb mode.\n");
} else if (!p->opts.dumb_mode) { } else if (p->opts.dumb_mode <= 0) {
MP_WARN(p, "High bit depth FBOs unsupported. Enabling dumb mode.\n" MP_WARN(p, "High bit depth FBOs unsupported. Enabling dumb mode.\n"
"Most extended features will be disabled.\n"); "Most extended features will be disabled.\n");
} }