summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-10 02:14:30 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-10 02:35:02 +0200
commitbc1d0ca37d9bdfd69a945043650e0246ffeb5f94 (patch)
tree8269c9cbc1df72afb5715b77669698a0781f6250 /libvo
parentf7cc4152f7c55808c5dd6bbd49c216c9345eb686 (diff)
parente9a5e7f667d1b0c0dec0053ad9ec6f7bc3162b60 (diff)
downloadmpv-bc1d0ca37d9bdfd69a945043650e0246ffeb5f94.tar.bz2
mpv-bc1d0ca37d9bdfd69a945043650e0246ffeb5f94.tar.xz
Merge svn changes up to r30798
Diffstat (limited to 'libvo')
-rw-r--r--libvo/video_out.c6
-rw-r--r--libvo/vo_gl.c60
-rw-r--r--libvo/vo_gl2.c21
-rw-r--r--libvo/x11_common.c1
4 files changed, 80 insertions, 8 deletions
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 31f7ea3dec..08e59fcb0c 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -85,6 +85,7 @@ extern struct vo_driver video_out_xover;
extern struct vo_driver video_out_xvmc;
extern struct vo_driver video_out_vdpau;
extern struct vo_driver video_out_xv;
+extern struct vo_driver video_out_gl_nosw;
extern struct vo_driver video_out_gl;
extern struct vo_driver video_out_gl2;
extern struct vo_driver video_out_matrixview;
@@ -177,14 +178,15 @@ const struct vo_driver *video_out_drivers[] =
#ifdef CONFIG_XV
&video_out_xv,
#endif
+#ifdef CONFIG_X11
#ifdef CONFIG_GL
- &video_out_gl,
+ &video_out_gl_nosw,
#endif
-#ifdef CONFIG_X11
&video_out_x11,
&video_out_xover,
#endif
#ifdef CONFIG_GL
+ &video_out_gl,
&video_out_gl2,
#endif
#ifdef CONFIG_DGA
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 8611496a53..cf5cbcbbb2 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -36,14 +36,48 @@
static const vo_info_t info =
{
- "X11 (OpenGL)",
+ "OpenGL",
"gl",
- "Arpad Gereoffy <arpi@esp-team.scene.hu>",
+ "Reimar Doeffinger <Reimar.Doeffinger@gmx.de>",
""
};
const LIBVO_EXTERN(gl)
+
+static const vo_info_t info_nosw =
+{
+ "OpenGL no software rendering",
+ "gl_nosw",
+ "Reimar Doeffinger <Reimar.Doeffinger@gmx.de>",
+ ""
+};
+static int preinit_nosw(const char *arg);
+const struct vo_driver video_out_gl_nosw =
+{
+ .is_new = 0,
+ .info = &info_nosw,
+ .preinit = old_vo_preinit,
+ .config = old_vo_config,
+ .control = old_vo_control,
+ .draw_slice = old_vo_draw_slice,
+ .draw_osd = old_vo_draw_osd,
+ .flip_page = old_vo_flip_page,
+ .check_events = old_vo_check_events,
+ .uninit = old_vo_uninit,
+ .old_functions = &(struct vo_old_functions){
+ preinit_nosw,
+ config,
+ control,
+ draw_frame,
+ draw_slice,
+ draw_osd,
+ flip_page,
+ check_events,
+ uninit,
+ }
+};
+
#ifdef CONFIG_GL_X11
static int wsGLXAttrib[] = { GLX_RGBA,
GLX_RED_SIZE,1,
@@ -441,6 +475,12 @@ static void uninitGl(void) {
err_shown = 0;
}
+static int isSoftwareGl(void)
+{
+ const char *renderer = GetString(GL_RENDERER);
+ return strcmp(renderer, "Software Rasterizer") == 0;
+}
+
static void autodetectGlExtensions(void) {
const char *extensions = GetString(GL_EXTENSIONS);
const char *vendor = GetString(GL_VENDOR);
@@ -1041,7 +1081,7 @@ static const opt_t subopts[] = {
{NULL}
};
-static int preinit(const char *arg)
+static int preinit_internal(const char *arg, int allow_sw)
{
enum MPGLType gltype = GLTYPE_X11;
// set defaults
@@ -1150,11 +1190,13 @@ static int preinit(const char *arg)
}
if (!init_mpglcontext(&glctx, gltype))
goto err_out;
- if (use_yuv == -1) {
+ if (use_yuv == -1 || !allow_sw) {
if (create_window(320, 200, VOFLAG_HIDDEN, NULL) < 0)
goto err_out;
if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED)
goto err_out;
+ if (!allow_sw && isSoftwareGl())
+ goto err_out;
autodetectGlExtensions();
}
if (many_fmts)
@@ -1170,6 +1212,16 @@ err_out:
return -1;
}
+static int preinit(const char *arg)
+{
+ return preinit_internal(arg, 1);
+}
+
+static int preinit_nosw(const char *arg)
+{
+ return preinit_internal(arg, 0);
+}
+
static const struct {
const char *name;
int *value;
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c
index ae04cf4139..743289840e 100644
--- a/libvo/vo_gl2.c
+++ b/libvo/vo_gl2.c
@@ -844,7 +844,7 @@ static int preinit(const char *arg)
#ifdef CONFIG_GL_WIN32
gltype = GLTYPE_W32;
#endif
- use_yuv = 0;
+ use_yuv = -1;
use_glFinish = 1;
if (subopt_parse(arg, subopts) != 0) {
mp_msg(MSGT_VO, MSGL_FATAL,
@@ -863,8 +863,25 @@ static int preinit(const char *arg)
"\n" );
return -1;
}
- if(!init_mpglcontext(&glctx, gltype)) return -1;
+ if(!init_mpglcontext(&glctx, gltype)) goto err_out;
+ if (use_yuv == -1) {
+ const char *extensions;
+#ifdef CONFIG_GL_WIN32
+ if (config_w32(320, 200, 320, 200, VOFLAG_HIDDEN, "", 0) == -1)
+#else
+ if (config_glx(320, 200, 320, 200, VOFLAG_HIDDEN, "", 0) == -1)
+#endif
+ goto err_out;
+ if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED)
+ goto err_out;
+ extensions = GetString(GL_EXTENSIONS);
+ use_yuv = strstr(extensions, "GL_ARB_fragment_program") ? 2 : 0;
+ }
return 0;
+
+err_out:
+ uninit();
+ return -1;
}
static int control(uint32_t request, void *data)
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 91431207a3..a7ac744af8 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -746,6 +746,7 @@ void vo_x11_uninit(struct vo *vo)
XEvent xev;
XUnmapWindow(x11->display, x11->window);
+ XSelectInput(x11->display, x11->window, StructureNotifyMask);
XDestroyWindow(x11->display, x11->window);
do
{