[vlc-commits] GLX: drop support for GLX version 1.2
Rémi Denis-Courmont
git at videolan.org
Thu Oct 25 19:01:36 CEST 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct 25 20:01:00 2012 +0300| [c9664a247522b8deb1658d1ef6e0f881267ed193] | committer: Rémi Denis-Courmont
GLX: drop support for GLX version 1.2
This is useless as we require OpenGL 1.4.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c9664a247522b8deb1658d1ef6e0f881267ed193
---
modules/video_output/xcb/glx.c | 165 +++++++++++++++-------------------------
1 file changed, 62 insertions(+), 103 deletions(-)
diff --git a/modules/video_output/xcb/glx.c b/modules/video_output/xcb/glx.c
index ce8f3ae..0ccc1c3 100644
--- a/modules/video_output/xcb/glx.c
+++ b/modules/video_output/xcb/glx.c
@@ -68,7 +68,6 @@ struct vout_display_sys_t
xcb_window_t window; /* drawable X window */
xcb_window_t glwin; /* GLX window */
bool visible; /* whether to draw */
- bool v1_3; /* whether GLX >= 1.3 is available */
GLXContext ctx;
vlc_gl_t gl;
@@ -151,7 +150,7 @@ FindWindow (vout_display_t *vd, xcb_connection_t *conn,
return screen;
}
-static bool CheckGLX (vout_display_t *vd, Display *dpy, bool *restrict pv13)
+static bool CheckGLX (vout_display_t *vd, Display *dpy)
{
int major, minor;
bool ok = false;
@@ -162,13 +161,12 @@ static bool CheckGLX (vout_display_t *vd, Display *dpy, bool *restrict pv13)
if (major != 1)
msg_Dbg (vd, "GLX extension version %d.%d unknown", major, minor);
else
- if (minor < 2)
+ if (minor < 3)
msg_Dbg (vd, "GLX extension version %d.%d too old", major, minor);
else
{
msg_Dbg (vd, "using GLX extension version %d.%d", major, minor);
ok = true;
- *pv13 = minor >= 3;
}
return ok;
}
@@ -246,7 +244,7 @@ static int Open (vlc_object_t *obj)
sys->conn = conn;
sys->ctx = NULL;
- if (!CheckGLX (vd, dpy, &sys->v1_3))
+ if (!CheckGLX (vd, dpy))
goto error;
RegisterMouseEvents (obj, conn, sys->embed->handle.xid);
@@ -263,110 +261,75 @@ static int Open (vlc_object_t *obj)
sys->window = xcb_generate_id (conn);
/* Determine our pixel format */
- if (sys->v1_3)
- { /* GLX 1.3 */
- static const int attr[] = {
- GLX_RED_SIZE, 5,
- GLX_GREEN_SIZE, 5,
- GLX_BLUE_SIZE, 5,
- GLX_DOUBLEBUFFER, True,
- GLX_X_RENDERABLE, True,
- GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
- None };
-
- xcb_get_window_attributes_reply_t *wa =
- xcb_get_window_attributes_reply (conn,
- xcb_get_window_attributes (conn, sys->embed->handle.xid),
- NULL);
- if (wa == NULL)
- goto error;
- xcb_visualid_t visual = wa->visual;
- free (wa);
-
- int nelem;
- GLXFBConfig *confs = glXChooseFBConfig (dpy, snum, attr, &nelem);
- if (confs == NULL)
- {
- msg_Err (vd, "no GLX frame buffer configurations");
- goto error;
- }
-
- GLXFBConfig conf;
- bool found = false;
+ static const int attr[] = {
+ GLX_RED_SIZE, 5,
+ GLX_GREEN_SIZE, 5,
+ GLX_BLUE_SIZE, 5,
+ GLX_DOUBLEBUFFER, True,
+ GLX_X_RENDERABLE, True,
+ GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
+ None
+ };
- for (int i = 0; i < nelem && !found; i++)
- {
- conf = confs[i];
+ xcb_get_window_attributes_reply_t *wa =
+ xcb_get_window_attributes_reply (conn,
+ xcb_get_window_attributes (conn, sys->embed->handle.xid), NULL);
+ if (wa == NULL)
+ goto error;
+ xcb_visualid_t visual = wa->visual;
+ free (wa);
- XVisualInfo *vi = glXGetVisualFromFBConfig (dpy, conf);
- if (vi == NULL)
- continue;
+ int nelem;
+ GLXFBConfig *confs = glXChooseFBConfig (dpy, snum, attr, &nelem);
+ if (confs == NULL)
+ {
+ msg_Err (vd, "no GLX frame buffer configurations");
+ goto error;
+ }
- if (vi->visualid == visual)
- found = true;
- XFree (vi);
- }
- XFree (confs);
+ GLXFBConfig conf;
+ bool found = false;
- if (!found)
- {
- msg_Err (vd, "no matching GLX frame buffer configuration");
- goto error;
- }
+ for (int i = 0; i < nelem && !found; i++)
+ {
+ conf = confs[i];
- sys->glwin = None;
- if (!CreateWindow (vd, conn, depth, 0 /* ??? */, width, height))
- sys->glwin = glXCreateWindow (dpy, conf, sys->window, NULL );
- if (sys->glwin == None)
- {
- msg_Err (vd, "cannot create GLX window");
- goto error;
- }
+ XVisualInfo *vi = glXGetVisualFromFBConfig (dpy, conf);
+ if (vi == NULL)
+ continue;
- /* Create an OpenGL context */
- sys->ctx = glXCreateNewContext (dpy, conf, GLX_RGBA_TYPE, NULL,
- True);
- if (sys->ctx == NULL)
- {
- msg_Err (vd, "cannot create GLX context");
- goto error;
- }
+ if (vi->visualid == visual)
+ found = true;
+ XFree (vi);
+ }
+ XFree (confs);
- if (!glXMakeContextCurrent (dpy, sys->glwin, sys->glwin, sys->ctx))
- goto error;
+ if (!found)
+ {
+ msg_Err (vd, "no matching GLX frame buffer configuration");
+ goto error;
}
- else
- { /* GLX 1.2 */
- int attr[] = {
- GLX_RGBA,
- GLX_RED_SIZE, 5,
- GLX_GREEN_SIZE, 5,
- GLX_BLUE_SIZE, 5,
- GLX_DOUBLEBUFFER,
- None };
-
- XVisualInfo *vi = glXChooseVisual (dpy, snum, attr);
- if (vi == NULL)
- {
- msg_Err (vd, "cannot find GLX 1.2 visual" );
- goto error;
- }
- msg_Dbg (vd, "using GLX visual ID 0x%"PRIx32, (uint32_t)vi->visualid);
- if (CreateWindow (vd, conn, depth, 0 /* ??? */, width, height) == 0)
- sys->ctx = glXCreateContext (dpy, vi, 0, True);
- XFree (vi);
- if (sys->ctx == NULL)
- {
- msg_Err (vd, "cannot create GLX context");
- goto error;
- }
+ sys->glwin = None;
+ if (!CreateWindow (vd, conn, depth, 0 /* ??? */, width, height))
+ sys->glwin = glXCreateWindow (dpy, conf, sys->window, NULL );
+ if (sys->glwin == None)
+ {
+ msg_Err (vd, "cannot create GLX window");
+ goto error;
+ }
- if (glXMakeCurrent (dpy, sys->window, sys->ctx) == False)
- goto error;
- sys->glwin = sys->window;
+ /* Create an OpenGL context */
+ sys->ctx = glXCreateNewContext (dpy, conf, GLX_RGBA_TYPE, NULL, True);
+ if (sys->ctx == NULL)
+ {
+ msg_Err (vd, "cannot create GLX context");
+ goto error;
}
+ if (!glXMakeContextCurrent (dpy, sys->glwin, sys->glwin, sys->ctx))
+ goto error;
+
const char *glx_extensions = glXQueryExtensionsString (dpy, snum);
bool is_swap_interval_set = false;
@@ -450,13 +413,9 @@ static void Close (vlc_object_t *obj)
if (sys->ctx != NULL)
{
- if (sys->v1_3)
- glXMakeContextCurrent (dpy, None, None, NULL);
- else
- glXMakeCurrent (dpy, None, NULL);
+ glXMakeContextCurrent (dpy, None, None, NULL);
glXDestroyContext (dpy, sys->ctx);
- if (sys->v1_3)
- glXDestroyWindow (dpy, sys->glwin);
+ glXDestroyWindow (dpy, sys->glwin);
}
XCloseDisplay (dpy);
More information about the vlc-commits
mailing list