1
mirror of https://github.com/mpv-player/mpv synced 2025-01-09 01:36:25 +01:00

Only prefer -vo gl over -vo x11 if hardware acceleration is available.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30761 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2010-02-27 18:16:41 +00:00
parent 05c24134de
commit e92eaa0fd8
2 changed files with 41 additions and 5 deletions

View File

@ -94,6 +94,7 @@ extern vo_functions_t video_out_xover;
extern vo_functions_t video_out_xvmc; extern vo_functions_t video_out_xvmc;
extern vo_functions_t video_out_vdpau; extern vo_functions_t video_out_vdpau;
extern vo_functions_t video_out_xv; extern vo_functions_t video_out_xv;
extern vo_functions_t video_out_gl_nosw;
extern vo_functions_t video_out_gl; extern vo_functions_t video_out_gl;
extern vo_functions_t video_out_gl2; extern vo_functions_t video_out_gl2;
extern vo_functions_t video_out_matrixview; extern vo_functions_t video_out_matrixview;
@ -186,14 +187,15 @@ const vo_functions_t* const video_out_drivers[] =
#ifdef CONFIG_XV #ifdef CONFIG_XV
&video_out_xv, &video_out_xv,
#endif #endif
#ifdef CONFIG_GL
&video_out_gl,
#endif
#ifdef CONFIG_X11 #ifdef CONFIG_X11
#ifdef CONFIG_GL
&video_out_gl_nosw,
#endif
&video_out_x11, &video_out_x11,
&video_out_xover, &video_out_xover,
#endif #endif
#ifdef CONFIG_GL #ifdef CONFIG_GL
&video_out_gl,
&video_out_gl2, &video_out_gl2,
#endif #endif
#ifdef CONFIG_DGA #ifdef CONFIG_DGA

View File

@ -47,6 +47,21 @@ static const vo_info_t info =
const LIBVO_EXTERN(gl) const LIBVO_EXTERN(gl)
static const vo_info_t info_nosw =
{
"X11 (OpenGL) no software rendering",
"gl_nosw",
"Arpad Gereoffy <arpi@esp-team.scene.hu>",
""
};
static int preinit_nosw(const char *arg);
#define info info_nosw
#define preinit preinit_nosw
const LIBVO_EXTERN(gl_nosw)
#undef info
#undef preinit
#ifdef CONFIG_GL_X11 #ifdef CONFIG_GL_X11
static int wsGLXAttrib[] = { GLX_RGBA, static int wsGLXAttrib[] = { GLX_RGBA,
GLX_RED_SIZE,1, GLX_RED_SIZE,1,
@ -444,6 +459,13 @@ static void uninitGl(void) {
err_shown = 0; err_shown = 0;
} }
static int isSoftwareGl(void)
{
const char *renderer = GetString(GL_RENDERER);
renderer = "Software Rasterizer";
return strcmp(renderer, "Software Rasterizer") == 0;
}
static void autodetectGlExtensions(void) { static void autodetectGlExtensions(void) {
const char *extensions = GetString(GL_EXTENSIONS); const char *extensions = GetString(GL_EXTENSIONS);
const char *vendor = GetString(GL_VENDOR); const char *vendor = GetString(GL_VENDOR);
@ -1052,7 +1074,7 @@ static const opt_t subopts[] = {
{NULL} {NULL}
}; };
static int preinit(const char *arg) static int preinit_internal(const char *arg, int allow_sw)
{ {
enum MPGLType gltype = GLTYPE_X11; enum MPGLType gltype = GLTYPE_X11;
// set defaults // set defaults
@ -1161,11 +1183,13 @@ static int preinit(const char *arg)
} }
if (!init_mpglcontext(&glctx, gltype)) if (!init_mpglcontext(&glctx, gltype))
goto err_out; goto err_out;
if (use_yuv == -1) { if (use_yuv == -1 || !allow_sw) {
if (create_window(320, 200, VOFLAG_HIDDEN, NULL) < 0) if (create_window(320, 200, VOFLAG_HIDDEN, NULL) < 0)
goto err_out; goto err_out;
if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED) if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED)
goto err_out; goto err_out;
if (!allow_sw && isSoftwareGl())
goto err_out;
autodetectGlExtensions(); autodetectGlExtensions();
} }
if (many_fmts) if (many_fmts)
@ -1181,6 +1205,16 @@ err_out:
return -1; 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 { static const struct {
const char *name; const char *name;
int *value; int *value;