From 025caa9fb502b0c8a274ec4c3f4be37a27275141 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 24 Apr 2012 00:48:14 +0200 Subject: vo_gl: refuse to use software renderer, unless explicitly requested vo_gl will now fail at initialization if a software renderer is detected. This is the same behavior as vo_gl_nosw. Making this the default behavior is preferable, because it will simplify positioning vo_gl in the VO autoprobe list (video_out_drivers[]). Also, vo_gl_nosw exists only if X11 support is configured. Move gl in place of gl_nosw. Add the "sw" suboption to vo_gl to allow using vo_gl even if a software renderer is detected. vo_gl_nosw is now completely equivalent to vo_gl. It is kept in order not to break too many user configurations, but should be considered deprecated. --- libvo/video_out.c | 14 ++++++++------ libvo/vo_gl.c | 26 +++++++++++--------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/libvo/video_out.c b/libvo/video_out.c index 540fedb132..9b06794c61 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -171,20 +171,17 @@ const struct vo_driver *video_out_drivers[] = #endif #ifdef CONFIG_GL &video_out_gl3, +#if !defined CONFIG_GL_COCOA + &video_out_gl, #endif -#ifdef CONFIG_X11 -#ifdef CONFIG_GL - &video_out_gl_nosw, #endif +#ifdef CONFIG_X11 &video_out_x11, &video_out_xover, #endif #ifdef CONFIG_SDL &video_out_sdl, #endif -#if (defined CONFIG_GL && !defined CONFIG_GL_COCOA) - &video_out_gl, -#endif #ifdef CONFIG_DGA &video_out_dga, #endif @@ -247,6 +244,11 @@ const struct vo_driver *video_out_drivers[] = #endif #ifdef CONFIG_MD5SUM &video_out_md5sum, +#endif +#ifdef CONFIG_X11 +#ifdef CONFIG_GL + &video_out_gl_nosw, +#endif #endif NULL }; diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index adb5c55a74..1d8a22f77b 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -45,8 +45,6 @@ #include "fastmemcpy.h" #include "sub/ass_mp.h" -static int preinit_nosw(struct vo *vo, const char *arg); - //! How many parts the OSD may consist of at most #define MAX_OSD_PARTS 20 @@ -1187,7 +1185,7 @@ static int backend_valid(void *arg) return mpgl_find_backend(*(const char **)arg) >= 0; } -static int preinit_internal(struct vo *vo, const char *arg, int allow_sw) +static int preinit(struct vo *vo, const char *arg) { struct gl_priv *p = talloc_zero(vo, struct gl_priv); vo->priv = p; @@ -1210,11 +1208,13 @@ static int preinit_internal(struct vo *vo, const char *arg, int allow_sw) p->eosd = eosd_packer_create(vo); + int allow_sw = 0; + char *backend_arg = NULL; + //essentially unused; for legacy warnings only int user_colorspace = 0; int levelconv = -1; int aspect = -1; - char *backend_arg = NULL; const opt_t subopts[] = { {"manyfmts", OPT_ARG_BOOL, &p->many_fmts, NULL}, @@ -1239,6 +1239,7 @@ static int preinit_internal(struct vo *vo, const char *arg, int allow_sw) {"mipmapgen", OPT_ARG_BOOL, &p->mipmap_gen, NULL}, {"osdcolor", OPT_ARG_INT, &p->osd_color, NULL}, {"stereo", OPT_ARG_INT, &p->stereo_mode, NULL}, + {"sw", OPT_ARG_BOOL, &allow_sw, NULL}, {"backend", OPT_ARG_MSTRZ,&backend_arg, backend_valid}, // Removed options. // They are only parsed to notify the user about the replacements. @@ -1315,6 +1316,8 @@ static int preinit_internal(struct vo *vo, const char *arg, int allow_sw) " 1: side-by-side to red-cyan stereo\n" " 2: side-by-side to green-magenta stereo\n" " 3: side-by-side to quadbuffer stereo\n" + " sw\n" + " allow using a software renderer, if such is detected\n" " backend=\n" " auto: auto-select (default)\n" " cocoa: Cocoa/OSX\n" @@ -1386,11 +1389,6 @@ err_out: return -1; } -static int preinit(struct vo *vo, const char *arg) -{ - return preinit_internal(vo, arg, 1); -} - static int control(struct vo *vo, uint32_t request, void *data) { struct gl_priv *p = vo->priv; @@ -1511,11 +1509,9 @@ const struct vo_driver video_out_gl = { .uninit = uninit, }; -static int preinit_nosw(struct vo *vo, const char *arg) -{ - return preinit_internal(vo, arg, 0); -} - +// "-vo gl" used to accept software renderers by default. This is not the case +// anymore: you have to use "-vo gl:sw" to get this. This means gl and gl_nosw +// are exactly the same thing now. Keep gl_nosw to not break user configs. const struct vo_driver video_out_gl_nosw = { .is_new = true, @@ -1525,7 +1521,7 @@ const struct vo_driver video_out_gl_nosw = "Reimar Doeffinger ", "" }, - .preinit = preinit_nosw, + .preinit = preinit, .config = config, .control = control, .draw_slice = draw_slice, -- cgit v1.2.3