summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/glcontextmodes.c28
-rw-r--r--src/glx/x11/glcontextmodes.h6
-rw-r--r--src/glx/x11/glxclient.h38
-rw-r--r--src/glx/x11/glxcmds.c171
-rw-r--r--src/glx/x11/glxext.c15
-rw-r--r--src/glx/x11/indirect.c74
-rw-r--r--src/glx/x11/indirect.h4
-rw-r--r--src/glx/x11/indirect_init.c4
-rw-r--r--src/glx/x11/xfont.c4
9 files changed, 135 insertions, 209 deletions
diff --git a/src/glx/x11/glcontextmodes.c b/src/glx/x11/glcontextmodes.c
index c1651849031..58c548a8fc1 100644
--- a/src/glx/x11/glcontextmodes.c
+++ b/src/glx/x11/glcontextmodes.c
@@ -333,7 +333,8 @@ _gl_get_context_mode_data(const __GLcontextModes *mode, int attribute,
*value_return = mode->bindToTextureRgba;
return 0;
case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
- *value_return = mode->bindToMipmapTexture;
+ *value_return = mode->bindToMipmapTexture == GL_TRUE ? GL_TRUE :
+ GL_FALSE;
return 0;
case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
*value_return = mode->bindToTextureTargets;
@@ -453,19 +454,28 @@ _gl_context_modes_destroy( __GLcontextModes * modes )
*/
__GLcontextModes *
-_gl_context_modes_find_visual( __GLcontextModes * modes, int vid )
+_gl_context_modes_find_visual(__GLcontextModes *modes, int vid)
{
- while ( modes != NULL ) {
- if ( modes->visualID == vid ) {
- break;
- }
+ __GLcontextModes *m;
- modes = modes->next;
- }
+ for (m = modes; m != NULL; m = m->next)
+ if (m->visualID == vid)
+ return m;
- return modes;
+ return NULL;
}
+__GLcontextModes *
+_gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid)
+{
+ __GLcontextModes *m;
+
+ for (m = modes; m != NULL; m = m->next)
+ if (m->fbconfigID == fbid)
+ return m;
+
+ return NULL;
+}
/**
* Determine if two context-modes are the same. This is intended to be used
diff --git a/src/glx/x11/glcontextmodes.h b/src/glx/x11/glcontextmodes.h
index 4b5c6f68b8f..afd09cd7fbd 100644
--- a/src/glx/x11/glcontextmodes.h
+++ b/src/glx/x11/glcontextmodes.h
@@ -44,8 +44,10 @@ extern int _gl_get_context_mode_data( const __GLcontextModes *mode,
extern __GLcontextModes * _gl_context_modes_create( unsigned count,
size_t minimum_size );
extern void _gl_context_modes_destroy( __GLcontextModes * modes );
-extern __GLcontextModes * _gl_context_modes_find_visual(
- __GLcontextModes * modes, int vid );
+extern __GLcontextModes *
+ _gl_context_modes_find_visual(__GLcontextModes *modes, int vid);
+extern __GLcontextModes *
+ _gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid);
extern GLboolean _gl_context_modes_are_same( const __GLcontextModes * a,
const __GLcontextModes * b );
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index b464e505fc5..05354073c45 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -233,15 +233,6 @@ struct __GLXcontextRec {
XID share_xid;
/**
- * Visual id.
- *
- * \deprecated
- * This filed has been largely been replaced by the \c mode field, but
- * the work is not quite done.
- */
- VisualID vid;
-
- /**
* Screen number.
*/
GLint screen;
@@ -351,34 +342,22 @@ struct __GLXcontextRec {
*/
GLint majorOpcode;
-#ifdef GLX_DIRECT_RENDERING
/**
- * Per context direct rendering interface functions and data.
+ * Pointer to the mode used to create this context.
*/
- __DRIcontext driContext;
+ const __GLcontextModes * mode;
+#ifdef GLX_DIRECT_RENDERING
/**
- * Pointer to the mode used to create this context.
+ * Per context direct rendering interface functions and data.
*/
- const __GLcontextModes * mode;
+ __DRIcontext driContext;
/**
* XID for the server side drm_context_t
*/
XID hwContextID;
#endif
-
- /**
- * \c GLXFBConfigID used to create this context. May be \c None. This
- * field has been replaced by the \c mode field.
- *
- * \since Internal API version 20030317.
- *
- * \deprecated
- * This filed has been largely been replaced by the \c mode field, but
- * the work is not quite done.
- */
- GLXFBConfigID fbconfigID;
/**
* The current read-drawable for this context. Will be None if this
@@ -740,7 +719,12 @@ extern int __glXGetInternalVersion(void);
/* Get the unadjusted system time */
extern int __glXGetUST( int64_t * ust );
-extern GLboolean __glXGetMscRateOML(__DRIdrawable *draw,
+extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
int32_t * numerator, int32_t * denominator);
+#ifdef GLX_DIRECT_RENDERING
+GLboolean
+__driGetMscRateOML(__DRIdrawable *draw, int32_t *numerator, int32_t *denominator);
+#endif
+
#endif /* !__GLX_client_h__ */
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index 37bfc2a67cf..7ff2bf700c9 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -101,6 +101,7 @@ static void GarbageCollectDRIDrawables(Display *dpy, __GLXscreenConfigs *sc)
longer exists in the Xserver */
(*pdraw->driDrawable.destroyDrawable)(&pdraw->driDrawable);
XF86DRIDestroyDrawable(dpy, sc->scr, draw);
+ __glxHashDelete(sc->drawHash, draw);
Xfree(pdraw);
}
} while (__glxHashNext(sc->drawHash, &draw, (void *)&pdraw) == 1);
@@ -379,17 +380,21 @@ CreateContext(Display *dpy, XVisualInfo *vis,
const __GLcontextModes * mode;
drm_context_t hwContext;
- /* The value of fbconfig cannot change because it is tested
- * later in the function.
- */
- if ( fbconfig == NULL ) {
- /* FIXME: Is it possible for the __GLcontextModes structure
- * FIXME: to not be found?
- */
- mode = _gl_context_modes_find_visual( psc->configs,
- vis->visualid );
- assert( mode != NULL );
- assert( mode->screen == screen );
+
+ if (fbconfig == NULL) {
+ mode = _gl_context_modes_find_visual(psc->visuals, vis->visualid);
+ if (mode == NULL) {
+ xError error;
+
+ error.errorCode = BadValue;
+ error.resourceID = vis->visualid;
+ error.sequenceNumber = dpy->request;
+ error.type = X_Error;
+ error.majorCode = gc->majorOpcode;
+ error.minorCode = X_GLXCreateContext;
+ _XError(dpy, &error);
+ return None;
+ }
}
else {
mode = fbconfig;
@@ -401,7 +406,7 @@ CreateContext(Display *dpy, XVisualInfo *vis,
if (!XF86DRICreateContextWithConfig(dpy, psc->scr,
- mode->fbconfigID,
+ mode->visualID,
&gc->hwContextID, &hwContext))
/* gah, handle this better */
return NULL;
@@ -416,8 +421,6 @@ CreateContext(Display *dpy, XVisualInfo *vis,
gc->isDirect = GL_TRUE;
gc->screen = mode->screen;
gc->psc = psc;
- gc->vid = mode->visualID;
- gc->fbconfigID = mode->fbconfigID;
gc->mode = mode;
}
else {
@@ -1511,13 +1514,15 @@ static int __glXQueryContextInfo(Display *dpy, GLXContext ctx)
ctx->share_xid = *pProp++;
break;
case GLX_VISUAL_ID_EXT:
- ctx->vid = *pProp++;
+ ctx->mode =
+ _gl_context_modes_find_visual(ctx->psc->visuals, *pProp++);
break;
case GLX_SCREEN:
ctx->screen = *pProp++;
break;
case GLX_FBCONFIG_ID:
- ctx->fbconfigID = *pProp++;
+ ctx->mode =
+ _gl_context_modes_find_fbconfig(ctx->psc->configs, *pProp++);
break;
case GLX_RENDER_TYPE:
ctx->renderType = *pProp++;
@@ -1542,7 +1547,7 @@ glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value)
int retVal;
/* get the information from the server if we don't have it already */
- if (!ctx->isDirect && (ctx->vid == None)) {
+ if (!ctx->isDirect && (ctx->mode == NULL)) {
retVal = __glXQueryContextInfo(dpy, ctx);
if (Success != retVal) return retVal;
}
@@ -1551,13 +1556,13 @@ glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value)
*value = (int)(ctx->share_xid);
break;
case GLX_VISUAL_ID_EXT:
- *value = (int)(ctx->vid);
+ *value = ctx->mode ? ctx->mode->visualID : None;
break;
case GLX_SCREEN:
*value = (int)(ctx->screen);
break;
case GLX_FBCONFIG_ID:
- *value = (int)(ctx->fbconfigID);
+ *value = ctx->mode ? ctx->mode->fbconfigID : None;
break;
case GLX_RENDER_TYPE:
*value = (int)(ctx->renderType);
@@ -2165,6 +2170,68 @@ static Bool __glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable,
return False;
}
+#ifdef GLX_DIRECT_RENDERING
+GLboolean
+__driGetMscRateOML(__DRIdrawable *draw, int32_t *numerator, int32_t *denominator)
+{
+#ifdef XF86VIDMODE
+ __GLXscreenConfigs *psc;
+ XF86VidModeModeLine mode_line;
+ int dot_clock;
+ int i;
+ __GLXdrawable *glxDraw;
+
+ glxDraw = containerOf(draw, __GLXdrawable, driDrawable);
+ psc = glxDraw->psc;
+ if (XF86VidModeQueryVersion(psc->dpy, &i, &i) &&
+ XF86VidModeGetModeLine(psc->dpy, psc->scr, &dot_clock, &mode_line) ) {
+ unsigned n = dot_clock * 1000;
+ unsigned d = mode_line.vtotal * mode_line.htotal;
+
+# define V_INTERLACE 0x010
+# define V_DBLSCAN 0x020
+
+ if (mode_line.flags & V_INTERLACE)
+ n *= 2;
+ else if (mode_line.flags & V_DBLSCAN)
+ d *= 2;
+
+ /* The OML_sync_control spec requires that if the refresh rate is a
+ * whole number, that the returned numerator be equal to the refresh
+ * rate and the denominator be 1.
+ */
+
+ if (n % d == 0) {
+ n /= d;
+ d = 1;
+ }
+ else {
+ static const unsigned f[] = { 13, 11, 7, 5, 3, 2, 0 };
+
+ /* This is a poor man's way to reduce a fraction. It's far from
+ * perfect, but it will work well enough for this situation.
+ */
+
+ for (i = 0; f[i] != 0; i++) {
+ while (n % f[i] == 0 && d % f[i] == 0) {
+ d /= f[i];
+ n /= f[i];
+ }
+ }
+ }
+
+ *numerator = n;
+ *denominator = d;
+
+ return True;
+ }
+ else
+ return False;
+#else
+ return False;
+#endif
+}
+#endif
/**
* Determine the refresh rate of the specified drawable and display.
@@ -2182,71 +2249,19 @@ static Bool __glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable,
* when GLX_OML_sync_control appears in the client extension string.
*/
-GLboolean __glXGetMscRateOML(__DRIdrawable *draw,
+GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
int32_t * numerator, int32_t * denominator)
{
#if defined( GLX_DIRECT_RENDERING ) && defined( XF86VIDMODE )
- __GLXdrawable *glxDraw =
- containerOf(draw, __GLXdrawable, driDrawable);
- __GLXscreenConfigs *psc = glxDraw->psc;
- Display *dpy = psc->dpy;
- __GLXdisplayPrivate * const priv = __glXInitialize(dpy);
-
-
- if ( priv != NULL ) {
- XF86VidModeModeLine mode_line;
- int dot_clock;
- int i;
-
-
- if (XF86VidModeQueryVersion( dpy, & i, & i ) &&
- XF86VidModeGetModeLine(dpy, psc->scr, &dot_clock, &mode_line) ) {
- unsigned n = dot_clock * 1000;
- unsigned d = mode_line.vtotal * mode_line.htotal;
-
-# define V_INTERLACE 0x010
-# define V_DBLSCAN 0x020
+ __DRIdrawable *driDraw = GetDRIDrawable(dpy, drawable, NULL);
- if ( (mode_line.flags & V_INTERLACE) ) {
- n *= 2;
- }
- else if ( (mode_line.flags & V_DBLSCAN) ) {
- d *= 2;
- }
-
- /* The OML_sync_control spec requires that if the refresh rate is a
- * whole number, that the returned numerator be equal to the refresh
- * rate and the denominator be 1.
- */
-
- if ( (n % d) == 0 ) {
- n /= d;
- d = 1;
- }
- else {
- static const unsigned f[] = { 13, 11, 7, 5, 3, 2, 0 };
-
-
- /* This is a poor man's way to reduce a fraction. It's far from
- * perfect, but it will work well enough for this situation.
- */
-
- for ( i = 0 ; f[i] != 0 ; i++ ) {
- while ( ((n % f[i]) == 0) && ((d % f[i]) == 0) ) {
- d /= f[i];
- n /= f[i];
- }
- }
- }
-
- *numerator = n;
- *denominator = d;
+ if (driDraw == NULL)
+ return False;
- return True;
- }
- }
+ return __driGetMscRateOML(driDraw, numerator, denominator);
#else
- (void) draw;
+ (void) dpy;
+ (void) drawable;
(void) numerator;
(void) denominator;
#endif
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index 4fcf6e5df07..b98d48d22d0 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -635,18 +635,17 @@ __glXInitializeVisualConfigFromTags( __GLcontextModes *config, int count,
#ifdef GLX_DIRECT_RENDERING
-static unsigned
+static void
filter_modes( __GLcontextModes ** server_modes,
const __GLcontextModes * driver_modes )
{
__GLcontextModes * m;
__GLcontextModes ** prev_next;
const __GLcontextModes * check;
- unsigned modes_count = 0;
- if ( driver_modes == NULL ) {
+ if (driver_modes == NULL) {
fprintf(stderr, "libGL warning: 3D driver returned no fbconfigs.\n");
- return 0;
+ return;
}
/* For each mode in server_modes, check to see if a matching mode exists
@@ -684,12 +683,9 @@ filter_modes( __GLcontextModes ** server_modes,
_gl_context_modes_destroy( m );
}
else {
- modes_count++;
prev_next = & m->next;
}
}
-
- return modes_count;
}
#ifdef XDAMAGE_1_1_INTERFACE
@@ -792,7 +788,7 @@ static const __DRIinterfaceMethods interface_methods = {
__glXDRIGetDrawableInfo,
__glXGetUST,
- __glXGetMscRateOML,
+ __driGetMscRateOML,
__glXReportDamage,
};
@@ -954,7 +950,8 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
& driver_modes );
filter_modes(&psc->configs, driver_modes);
- _gl_context_modes_destroy( driver_modes );
+ filter_modes(&psc->visuals, driver_modes);
+ _gl_context_modes_destroy(driver_modes);
}
}
}
diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c
index 0d66296ab9e..cb88c746324 100644
--- a/src/glx/x11/indirect.c
+++ b/src/glx/x11/indirect.c
@@ -9203,80 +9203,6 @@ __indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len,
}
}
-#define X_GLrop_ProgramParameter4dvNV 4185
-void
-__indirect_glProgramParameter4dNV(GLenum target, GLuint index, GLdouble x,
- GLdouble y, GLdouble z, GLdouble w)
-{
- __GLXcontext *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 44;
- emit_header(gc->pc, X_GLrop_ProgramParameter4dvNV, cmdlen);
- (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
- (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 8);
- (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 8);
- (void) memcpy((void *) (gc->pc + 28), (void *) (&z), 8);
- (void) memcpy((void *) (gc->pc + 36), (void *) (&w), 8);
- gc->pc += cmdlen;
- if (__builtin_expect(gc->pc > gc->limit, 0)) {
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- }
-}
-
-#define X_GLrop_ProgramParameter4dvNV 4185
-void
-__indirect_glProgramParameter4dvNV(GLenum target, GLuint index,
- const GLdouble * params)
-{
- __GLXcontext *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 44;
- emit_header(gc->pc, X_GLrop_ProgramParameter4dvNV, cmdlen);
- (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
- (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params), 32);
- gc->pc += cmdlen;
- if (__builtin_expect(gc->pc > gc->limit, 0)) {
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- }
-}
-
-#define X_GLrop_ProgramParameter4fvNV 4184
-void
-__indirect_glProgramParameter4fNV(GLenum target, GLuint index, GLfloat x,
- GLfloat y, GLfloat z, GLfloat w)
-{
- __GLXcontext *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 28;
- emit_header(gc->pc, X_GLrop_ProgramParameter4fvNV, cmdlen);
- (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
- (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
- (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
- (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 4);
- (void) memcpy((void *) (gc->pc + 24), (void *) (&w), 4);
- gc->pc += cmdlen;
- if (__builtin_expect(gc->pc > gc->limit, 0)) {
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- }
-}
-
-#define X_GLrop_ProgramParameter4fvNV 4184
-void
-__indirect_glProgramParameter4fvNV(GLenum target, GLuint index,
- const GLfloat * params)
-{
- __GLXcontext *const gc = __glXGetCurrentContext();
- const GLuint cmdlen = 28;
- emit_header(gc->pc, X_GLrop_ProgramParameter4fvNV, cmdlen);
- (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
- (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
- (void) memcpy((void *) (gc->pc + 12), (void *) (params), 16);
- gc->pc += cmdlen;
- if (__builtin_expect(gc->pc > gc->limit, 0)) {
- (void) __glXFlushRenderBuffer(gc, gc->pc);
- }
-}
-
#define X_GLrop_ProgramParameters4dvNV 4187
void
__indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLuint num,
diff --git a/src/glx/x11/indirect.h b/src/glx/x11/indirect.h
index 630062e2335..0719a1b3024 100644
--- a/src/glx/x11/indirect.h
+++ b/src/glx/x11/indirect.h
@@ -639,10 +639,6 @@ extern HIDDEN void __indirect_glGetVertexAttribfvNV(GLuint index, GLenum pname,
extern HIDDEN void __indirect_glGetVertexAttribivNV(GLuint index, GLenum pname, GLint * params);
extern HIDDEN GLboolean __indirect_glIsProgramNV(GLuint program);
extern HIDDEN void __indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte * program);
-extern HIDDEN void __indirect_glProgramParameter4dNV(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-extern HIDDEN void __indirect_glProgramParameter4dvNV(GLenum target, GLuint index, const GLdouble * params);
-extern HIDDEN void __indirect_glProgramParameter4fNV(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-extern HIDDEN void __indirect_glProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat * params);
extern HIDDEN void __indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble * params);
extern HIDDEN void __indirect_glProgramParameters4fvNV(GLenum target, GLuint index, GLuint num, const GLfloat * params);
extern HIDDEN void __indirect_glRequestResidentProgramsNV(GLsizei n, const GLuint * ids);
diff --git a/src/glx/x11/indirect_init.c b/src/glx/x11/indirect_init.c
index aaa70c8796a..852fe712c66 100644
--- a/src/glx/x11/indirect_init.c
+++ b/src/glx/x11/indirect_init.c
@@ -681,10 +681,6 @@ __GLapi * __glXNewIndirectAPI( void )
glAPI->GetVertexAttribivNV = __indirect_glGetVertexAttribivNV;
glAPI->IsProgramNV = __indirect_glIsProgramNV;
glAPI->LoadProgramNV = __indirect_glLoadProgramNV;
- glAPI->ProgramParameter4dNV = __indirect_glProgramParameter4dNV;
- glAPI->ProgramParameter4dvNV = __indirect_glProgramParameter4dvNV;
- glAPI->ProgramParameter4fNV = __indirect_glProgramParameter4fNV;
- glAPI->ProgramParameter4fvNV = __indirect_glProgramParameter4fvNV;
glAPI->ProgramParameters4dvNV = __indirect_glProgramParameters4dvNV;
glAPI->ProgramParameters4fvNV = __indirect_glProgramParameters4fvNV;
glAPI->RequestResidentProgramsNV = __indirect_glRequestResidentProgramsNV;
diff --git a/src/glx/x11/xfont.c b/src/glx/x11/xfont.c
index 5f23a796221..843a2298b24 100644
--- a/src/glx/x11/xfont.c
+++ b/src/glx/x11/xfont.c
@@ -34,6 +34,7 @@
called by that routine when direct rendering is enabled.
*/
+#ifdef GLX_DIRECT_RENDERING
#include "glxclient.h"
@@ -209,7 +210,6 @@ static XCharStruct *isvalid(XFontStruct *fs, int which)
return(NULL);
}
-
void DRI_glXUseXFont( Font font, int first, int count, int listbase )
{
GLXContext CC;
@@ -374,4 +374,4 @@ bm_height);
glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
}
-/* The End. */
+#endif