summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/GL/internal/dri_interface.h75
-rw-r--r--src/glx/x11/XF86dri.c9
-rw-r--r--src/glx/x11/glxclient.h28
-rw-r--r--src/glx/x11/glxcmds.c60
-rw-r--r--src/glx/x11/glxext.c155
-rw-r--r--src/glx/x11/xf86dri.h6
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c139
-rw-r--r--src/mesa/drivers/dri/common/dri_util.h24
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_xmesa.c22
-rw-r--r--src/mesa/drivers/dri/i810/i810screen.c23
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c33
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c22
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.c22
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.c22
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_screen.c22
-rw-r--r--src/mesa/drivers/dri/r128/r128_screen.c22
-rw-r--r--src/mesa/drivers/dri/r200/r200_ioctl.c6
-rw-r--r--src/mesa/drivers/dri/r200/r200_ioctl.h6
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c25
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c22
-rw-r--r--src/mesa/drivers/dri/sis/sis_screen.c23
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_screen.c22
-rw-r--r--src/mesa/drivers/dri/trident/trident_context.c24
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.c3
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.h1
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c23
26 files changed, 405 insertions, 434 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 97edec0ca9..8a6984de68 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -57,7 +57,6 @@ typedef struct __DRIframebufferRec __DRIframebuffer;
typedef struct __DRIversionRec __DRIversion;
typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods;
typedef unsigned long __DRIid;
-typedef void __DRInativeDisplay;
/*@}*/
@@ -73,7 +72,7 @@ typedef void __DRInativeDisplay;
*
* \sa glXGetScreenDriver, glXGetProcAddress, glXGetDriverConfig
*/
-typedef const char * (* PFNGLXGETSCREENDRIVERPROC) (__DRInativeDisplay *dpy, int scrNum);
+typedef const char * (* PFNGLXGETSCREENDRIVERPROC) (__DRIscreen *screen);
/**
* Type of a pointer to \c glXGetDriverConfig, as returned by
@@ -115,8 +114,8 @@ typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) ( void *psc, const char * name );
#define __DRI_INTERFACE_VERSION 20070105
-typedef void *(CREATENEWSCREENFUNC)(__DRInativeDisplay *dpy, int scrn,
- __DRIscreen *psc, const __GLcontextModes * modes,
+typedef void *(CREATENEWSCREENFUNC)(int scr, __DRIscreen *psc,
+ const __GLcontextModes * modes,
const __DRIversion * ddx_version, const __DRIversion * dri_version,
const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer,
void * pSAREA, int fd, int internal_api_version,
@@ -174,11 +173,6 @@ struct __DRIinterfaceMethodsRec {
*/
void (*destroyContextModes)( __GLcontextModes * modes );
- /**
- * Get the \c __DRIscreen for a given display and screen number.
- */
- __DRIscreen *(*getScreen)(__DRInativeDisplay *dpy, int screenNum);
-
/**
* \name Client/server protocol functions.
@@ -192,33 +186,31 @@ struct __DRIinterfaceMethodsRec {
/**
* Create the server-side portion of the GL context.
*/
- GLboolean (* createContext)( __DRInativeDisplay *dpy, int screenNum,
+ GLboolean (* createContext)( __DRIscreen *screen,
int configID, void * contextID, drm_context_t * hw_context );
/**
* Destroy the server-side portion of the GL context.
*/
- GLboolean (* destroyContext)( __DRInativeDisplay *dpy, int screenNum,
- __DRIid context );
+ GLboolean (* destroyContext)( __DRIscreen *screen, __DRIid context );
/**
* Create the server-side portion of the drawable.
*/
- GLboolean (*createDrawable)( __DRInativeDisplay * ndpy, int screen,
+ GLboolean (*createDrawable)( __DRIscreen *screen,
__DRIid drawable, drm_drawable_t * hHWDrawable );
/**
* Destroy the server-side portion of the drawable.
*/
- GLboolean (*destroyDrawable)( __DRInativeDisplay * ndpy, int screen,
- __DRIid drawable );
+ GLboolean (*destroyDrawable)( __DRIscreen *screen, __DRIid drawable );
/**
* This function is used to get information about the position, size, and
* clip rects of a drawable.
*/
- GLboolean (* getDrawableInfo) ( __DRInativeDisplay *dpy, int scrn,
- __DRIid draw, unsigned int * index, unsigned int * stamp,
+ GLboolean (* getDrawableInfo) ( __DRIscreen *screen, __DRIid drawable,
+ unsigned int * index, unsigned int * stamp,
int * x, int * y, int * width, int * height,
int * numClipRects, drm_clip_rect_t ** pClipRects,
int * backX, int * backY,
@@ -242,8 +234,8 @@ struct __DRIinterfaceMethodsRec {
* the rate of the "media stream counter". In practical terms, this is
* the frame refresh rate of the display.
*/
- GLboolean (*getMSCRate)(__DRInativeDisplay * dpy, __DRIid drawable,
- int32_t * numerator, int32_t * denominator);
+ GLboolean (*getMSCRate)(__DRIdrawable *draw,
+ int32_t * numerator, int32_t * denominator);
/*@}*/
/**
@@ -260,11 +252,10 @@ struct __DRIinterfaceMethodsRec {
* drawable was actually done directly to the front buffer (instead
* of backing storage, for example)
*/
- void (*reportDamage)(__DRInativeDisplay * dpy, int screen,
- __DRIid drawable,
+ void (*reportDamage)(__DRIdrawable *draw,
int x, int y,
drm_clip_rect_t *rects, int num_rects,
- int front_buffer);
+ GLboolean front_buffer);
};
@@ -304,13 +295,14 @@ struct __DRIscreenRec {
/**
* Method to destroy the private DRI screen data.
*/
- void (*destroyScreen)(__DRInativeDisplay *dpy, int scrn, void *screenPrivate);
+ void (*destroyScreen)(void *screenPrivate);
/**
* Method to create the private DRI drawable data and initialize the
* drawable dependent methods.
*/
- void *(*createNewDrawable)(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
+ void *(*createNewDrawable)(__DRIscreen *screen,
+ const __GLcontextModes *modes,
__DRIid draw, __DRIdrawable *pdraw,
int renderType, const int *attrs);
@@ -345,13 +337,13 @@ struct __DRIscreenRec {
* \since Internal API version 20030815.
*/
/*@{*/
- void *(*allocateMemory)(__DRInativeDisplay *dpy, int scrn, GLsizei size,
+ void *(*allocateMemory)(__DRIscreen *screen, GLsizei size,
GLfloat readfreq, GLfloat writefreq,
GLfloat priority);
- void (*freeMemory)(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer);
+ void (*freeMemory)(__DRIscreen *screen, GLvoid *pointer);
- GLuint (*memoryOffset)(__DRInativeDisplay *dpy, int scrn, const GLvoid *pointer);
+ GLuint (*memoryOffset)(__DRIscreen *screen, const GLvoid *pointer);
/*@}*/
/**
@@ -360,7 +352,8 @@ struct __DRIscreenRec {
*
* \since Internal API version 20031201.
*/
- void * (*createNewContext)(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
+ void * (*createNewContext)(__DRIscreen *screen,
+ const __GLcontextModes *modes,
int render_type,
void *sharedPrivate, __DRIcontext *pctx);
@@ -385,7 +378,7 @@ struct __DRIcontextRec {
/**
* Method to destroy the private DRI context data.
*/
- void (*destroyContext)(__DRInativeDisplay *dpy, int scrn, void *contextPrivate);
+ void (*destroyContext)(void *contextPrivate);
/**
* Opaque pointer to private per context direct rendering data.
@@ -399,8 +392,7 @@ struct __DRIcontextRec {
*
* \since Internal API version 20050727.
*/
- GLboolean (*bindContext)(__DRInativeDisplay *dpy, int scrn,
- __DRIdrawable *pdraw,
+ GLboolean (*bindContext)(__DRIdrawable *pdraw,
__DRIdrawable *pread,
__DRIcontext *ctx);
@@ -409,8 +401,7 @@ struct __DRIcontextRec {
*
* \since Internal API version 20050727.
*/
- GLboolean (*unbindContext)(__DRInativeDisplay *dpy, int scrn,
- __DRIcontext *ctx);
+ GLboolean (*unbindContext)(__DRIcontext *ctx);
};
/**
@@ -423,12 +414,12 @@ struct __DRIdrawableRec {
/**
* Method to destroy the private DRI drawable data.
*/
- void (*destroyDrawable)(__DRInativeDisplay *dpy, void *drawablePrivate);
+ void (*destroyDrawable)(void *drawablePrivate);
/**
* Method to swap the front and back buffers.
*/
- void (*swapBuffers)(__DRInativeDisplay *dpy, void *drawablePrivate);
+ void (*swapBuffers)(void *drawablePrivate);
/**
* Opaque pointer to private per drawable direct rendering data.
@@ -442,14 +433,14 @@ struct __DRIdrawableRec {
*
* \since Internal API version 20030317.
*/
- int (*getSBC)(__DRInativeDisplay *dpy, void *drawablePrivate, int64_t *sbc );
+ int (*getSBC)(void *drawablePrivate, int64_t *sbc );
/**
* Wait for the SBC to be greater than or equal target_sbc.
*
* \since Internal API version 20030317.
*/
- int (*waitForSBC)( __DRInativeDisplay * dpy, void *drawablePriv,
+ int (*waitForSBC)( void *drawablePriv,
int64_t target_sbc,
int64_t * msc, int64_t * sbc );
@@ -461,7 +452,7 @@ struct __DRIdrawableRec {
*
* \since Internal API version 20030317.
*/
- int (*waitForMSC)( __DRInativeDisplay * dpy, void *drawablePriv,
+ int (*waitForMSC)( void *drawablePriv,
int64_t target_msc, int64_t divisor, int64_t remainder,
int64_t * msc, int64_t * sbc );
@@ -474,7 +465,7 @@ struct __DRIdrawableRec {
*
* \since Internal API version 20030317.
*/
- int64_t (*swapBuffersMSC)(__DRInativeDisplay *dpy, void *drawablePrivate,
+ int64_t (*swapBuffersMSC)(void *drawablePrivate,
int64_t target_msc,
int64_t divisor, int64_t remainder);
@@ -483,14 +474,14 @@ struct __DRIdrawableRec {
*
* \since Internal API version 20030317.
*/
- int (*frameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate, GLboolean enable);
+ int (*frameTracking)(void *drawablePrivate, GLboolean enable);
/**
* Retrieve frame usage information.
*
* \since Internal API version 20030317.
*/
- int (*queryFrameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate,
+ int (*queryFrameTracking)(void *drawablePrivate,
int64_t * sbc, int64_t * missedFrames,
float * lastMissedUsage, float * usage );
@@ -507,7 +498,7 @@ struct __DRIdrawableRec {
*
* \since Internal API version 20060314.
*/
- void (*copySubBuffer)(__DRInativeDisplay *dpy, void *drawablePrivate,
+ void (*copySubBuffer)(void *drawablePrivate,
int x, int y, int w, int h);
};
diff --git a/src/glx/x11/XF86dri.c b/src/glx/x11/XF86dri.c
index 721bb3e65a..b44ebaf329 100644
--- a/src/glx/x11/XF86dri.c
+++ b/src/glx/x11/XF86dri.c
@@ -375,10 +375,9 @@ PUBLIC Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext)
context, hHWContext );
}
-PUBLIC GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen,
+PUBLIC GLboolean XF86DRIDestroyContext(Display *dpy, int screen,
__DRIid context )
{
- Display * const dpy = (Display *) ndpy;
XExtDisplayInfo *info = find_display (dpy);
xXF86DRIDestroyContextReq *req;
@@ -397,10 +396,9 @@ PUBLIC GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen,
return True;
}
-PUBLIC GLboolean XF86DRICreateDrawable( __DRInativeDisplay * ndpy, int screen,
+PUBLIC GLboolean XF86DRICreateDrawable(Display *dpy, int screen,
__DRIid drawable, drm_drawable_t * hHWDrawable )
{
- Display * const dpy = (Display *) ndpy;
XExtDisplayInfo *info = find_display (dpy);
xXF86DRICreateDrawableReply rep;
xXF86DRICreateDrawableReq *req;
@@ -432,10 +430,9 @@ static int noopErrorHandler(Display *dpy, XErrorEvent *xerr)
return 0;
}
-PUBLIC GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
+PUBLIC GLboolean XF86DRIDestroyDrawable(Display *dpy, int screen,
__DRIid drawable )
{
- Display * const dpy = (Display *) ndpy;
XExtDisplayInfo *info = find_display (dpy);
xXF86DRIDestroyDrawableReq *req;
int (*oldXErrorHandler)(Display *, XErrorEvent *);
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index 3dbdc306da..7ed4549658 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -72,7 +72,9 @@
#define __GLX_MAX_TEXTURE_UNITS 32
+typedef struct __GLXscreenConfigsRec __GLXscreenConfigs;
typedef struct __GLXcontextRec __GLXcontext;
+typedef struct __GLXdrawableRec __GLXdrawable;
typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate;
typedef struct _glapi_table __GLapi;
@@ -80,6 +82,9 @@ typedef struct _glapi_table __GLapi;
#ifdef GLX_DIRECT_RENDERING
+#define containerOf(ptr, type, member) \
+ (type *)( (char *)ptr - offsetof(type,member) )
+
#include <GL/internal/dri_interface.h>
@@ -240,6 +245,7 @@ struct __GLXcontextRec {
* Screen number.
*/
GLint screen;
+ __GLXscreenConfigs *psc;
/**
* \c GL_TRUE if the context was created with ImportContext, which
@@ -445,7 +451,7 @@ extern void __glFreeAttributeState(__GLXcontext *);
* One of these records exists per screen of the display. It contains
* a pointer to the config data for that screen (if the screen supports GL).
*/
-typedef struct __GLXscreenConfigsRec {
+struct __GLXscreenConfigsRec {
/**
* GLX extension string reported by the X-server.
*/
@@ -463,6 +469,8 @@ typedef struct __GLXscreenConfigsRec {
*/
__DRIscreen driScreen;
__glxHashTable *drawHash;
+ Display *dpy;
+ int scr;
#endif
/**
@@ -482,7 +490,7 @@ typedef struct __GLXscreenConfigsRec {
GLboolean ext_list_first_time;
/*@}*/
-} __GLXscreenConfigs;
+};
/**
* Per display private data. One of these records exists for each display
@@ -535,6 +543,18 @@ struct __GLXdisplayPrivateRec {
#endif
};
+#ifdef GLX_DIRECT_RENDERING
+
+struct __GLXdrawableRec {
+ XID drawable;
+ __GLXscreenConfigs *psc;
+ __DRIdrawable driDrawable;
+};
+
+#endif
+
+
+
void __glXFreeContext(__GLXcontext*);
extern GLubyte *__glXFlushRenderBuffer(__GLXcontext*, GLubyte*);
@@ -694,7 +714,7 @@ extern int __glXGetInternalVersion(void);
/* Get the unadjusted system time */
extern int __glXGetUST( int64_t * ust );
-extern Bool __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
- int32_t * numerator, int32_t * denominator);
+extern GLboolean __glXGetMscRateOML(__DRIdrawable *draw,
+ int32_t * numerator, int32_t * denominator);
#endif /* !__GLX_client_h__ */
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index 0951493726..45ee93c5c3 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -105,7 +105,7 @@ static void GarbageCollectDRIDrawables(Display *dpy, int screen)
if (!windowExistsFlag) {
/* Destroy the local drawable data, if the drawable no
longer exists in the Xserver */
- (*pdraw->destroyDrawable)(dpy, pdraw->private);
+ (*pdraw->destroyDrawable)(pdraw->private);
Xfree(pdraw);
}
} while (__glxHashNext(sc->drawHash, &draw, (void *)&pdraw) == 1);
@@ -127,7 +127,7 @@ static __DRIdrawable *
GetDRIDrawable( Display *dpy, GLXDrawable drawable, int * const scrn_num )
{
__GLXdisplayPrivate * const priv = __glXInitialize(dpy);
- __DRIdrawable * const pdraw;
+ __GLXdrawable * const pdraw;
const unsigned screen_count = ScreenCount(dpy);
unsigned i;
__GLXscreenConfigs *sc;
@@ -140,7 +140,7 @@ GetDRIDrawable( Display *dpy, GLXDrawable drawable, int * const scrn_num )
if (__glxHashLookup(sc->drawHash, drawable, (void *) &pdraw) == 0) {
if (scrn_num != NULL)
*scrn_num = i;
- return pdraw;
+ return &pdraw->driDrawable;
}
}
@@ -402,12 +402,14 @@ CreateContext(Display *dpy, XVisualInfo *vis,
void * const shared = (shareList != NULL)
? shareList->driContext.private : NULL;
gc->driContext.private =
- (*psc->driScreen.createNewContext)( dpy, mode, renderType,
+ (*psc->driScreen.createNewContext)( &psc->driScreen,
+ mode, renderType,
shared,
&gc->driContext );
if (gc->driContext.private) {
gc->isDirect = GL_TRUE;
gc->screen = mode->screen;
+ gc->psc = psc;
gc->vid = mode->visualID;
gc->fbconfigID = mode->fbconfigID;
gc->mode = mode;
@@ -520,8 +522,7 @@ DestroyContext(Display *dpy, GLXContext gc)
/* Destroy the direct rendering context */
if (gc->isDirect) {
if (gc->driContext.private) {
- (*gc->driContext.destroyContext)(dpy, gc->screen,
- gc->driContext.private);
+ (*gc->driContext.destroyContext)(gc->driContext.private);
gc->driContext.private = NULL;
}
GarbageCollectDRIDrawables(dpy, gc->screen);
@@ -849,7 +850,7 @@ PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
__DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, NULL );
if ( pdraw != NULL ) {
- (*pdraw->swapBuffers)(dpy, pdraw->private);
+ (*pdraw->swapBuffers)(pdraw->private);
return;
}
#endif
@@ -1835,7 +1836,7 @@ static GLint __glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable)
if ( (pdraw != NULL) && (pdraw->frameTracking != NULL)
&& __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) {
- status = pdraw->frameTracking( dpy, pdraw->private, GL_TRUE );
+ status = pdraw->frameTracking( pdraw->private, GL_TRUE );
}
#else
(void) dpy;
@@ -1855,7 +1856,7 @@ static GLint __glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable)
if ( (pdraw != NULL) && (pdraw->frameTracking != NULL)
&& __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) {
- status = pdraw->frameTracking( dpy, pdraw->private, GL_FALSE );
+ status = pdraw->frameTracking( pdraw->private, GL_FALSE );
}
#else
(void) dpy;
@@ -1879,7 +1880,7 @@ static GLint __glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable,
int64_t sbc, missedFrames;
float lastMissedUsage;
- status = pdraw->queryFrameTracking( dpy, pdraw->private, &sbc,
+ status = pdraw->queryFrameTracking( pdraw->private, &sbc,
&missedFrames, &lastMissedUsage,
usage );
}
@@ -1906,7 +1907,7 @@ static GLint __glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable,
&& __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) {
float usage;
- status = pdraw->queryFrameTracking( dpy, pdraw->private, sbc,
+ status = pdraw->queryFrameTracking( pdraw->private, sbc,
missedFrames, lastMissedUsage,
& usage );
}
@@ -1973,7 +1974,7 @@ static int __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count
int64_t msc;
int64_t sbc;
- ret = (*pdraw->waitForMSC)( gc->currentDpy, pdraw->private,
+ ret = (*pdraw->waitForMSC)( pdraw->private,
0, divisor, remainder,
& msc, & sbc );
*count = (unsigned) msc;
@@ -2142,7 +2143,7 @@ static Bool __glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable,
return ( (pdraw && pdraw->getSBC && psc->driScreen.getMSC)
&& __glXExtensionBitIsEnabled( psc, OML_sync_control_bit )
&& ((*psc->driScreen.getMSC)( psc->driScreen.private, msc ) == 0)
- && ((*pdraw->getSBC)( dpy, psc->driScreen.private, sbc ) == 0)
+ && ((*pdraw->getSBC)( psc->driScreen.private, sbc ) == 0)
&& (__glXGetUST( ust ) == 0) );
}
#else
@@ -2172,24 +2173,25 @@ static Bool __glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable,
* when GLX_OML_sync_control appears in the client extension string.
*/
-Bool __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
- int32_t * numerator, int32_t * denominator)
+GLboolean __glXGetMscRateOML(__DRIdrawable *draw,
+ 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 screen_num;
int i;
- if (GetDRIDrawable( dpy, drawable, & screen_num) != NULL
- && XF86VidModeQueryVersion( dpy, & i, & i )
- && XF86VidModeGetModeLine( dpy, screen_num, & dot_clock,
- & mode_line ) ) {
+ 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;
@@ -2231,13 +2233,11 @@ Bool __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
*numerator = n;
*denominator = d;
- (void) drawable;
return True;
}
}
#else
- (void) dpy;
- (void) drawable;
+ (void) draw;
(void) numerator;
(void) denominator;
#endif
@@ -2266,7 +2266,7 @@ static int64_t __glXSwapBuffersMscOML(Display *dpy, GLXDrawable drawable,
if ( (pdraw != NULL) && (pdraw->swapBuffersMSC != NULL)
&& __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) ) {
- return (*pdraw->swapBuffersMSC)(dpy, pdraw->private, target_msc,
+ return (*pdraw->swapBuffersMSC)(pdraw->private, target_msc,
divisor, remainder);
}
#else
@@ -2301,7 +2301,7 @@ static Bool __glXWaitForMscOML(Display * dpy, GLXDrawable drawable,
if ( (pdraw != NULL) && (pdraw->waitForMSC != NULL)
&& __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) ) {
- ret = (*pdraw->waitForMSC)( dpy, pdraw->private, target_msc,
+ ret = (*pdraw->waitForMSC)( pdraw->private, target_msc,
divisor, remainder, msc, sbc );
/* __glXGetUST returns zero on success and non-zero on failure.
@@ -2341,7 +2341,7 @@ static Bool __glXWaitForSbcOML(Display * dpy, GLXDrawable drawable,
if ( (pdraw != NULL) && (pdraw->waitForSBC != NULL)
&& __glXExtensionBitIsEnabled( psc, OML_sync_control_bit )) {
- ret = (*pdraw->waitForSBC)( dpy, pdraw->private, target_sbc, msc, sbc );
+ ret = (*pdraw->waitForSBC)( pdraw->private, target_sbc, msc, sbc );
/* __glXGetUST returns zero on success and non-zero on failure.
* This function returns True on success and False on failure.
@@ -2374,7 +2374,7 @@ PUBLIC void *glXAllocateMemoryMESA(Display *dpy, int scrn,
if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) {
if (psc && psc->driScreen.private && psc->driScreen.allocateMemory) {
- return (*psc->driScreen.allocateMemory)( dpy, scrn, size,
+ return (*psc->driScreen.allocateMemory)( &psc->driScreen, size,
readFreq, writeFreq,
priority );
}
@@ -2399,7 +2399,7 @@ PUBLIC void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) {
if (psc && psc->driScreen.private && psc->driScreen.freeMemory) {
- (*psc->driScreen.freeMemory)( dpy, scrn, pointer );
+ (*psc->driScreen.freeMemory)( &psc->driScreen, pointer );
}
}
#else
@@ -2418,7 +2418,7 @@ PUBLIC GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) {
if (psc && psc->driScreen.private && psc->driScreen.memoryOffset) {
- return (*psc->driScreen.memoryOffset)( dpy, scrn, pointer );
+ return (*psc->driScreen.memoryOffset)( &psc->driScreen, pointer );
}
}
#else
@@ -2499,7 +2499,7 @@ static void __glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable,
if ( pdraw != NULL ) {
__GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen );
if ( __glXExtensionBitIsEnabled( psc, MESA_copy_sub_buffer_bit ) ) {
- (*pdraw->copySubBuffer)(dpy, pdraw->private, x, y, width, height);
+ (*pdraw->copySubBuffer)(pdraw->private, x, y, width, height);
}
return;
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index 7f0428c0a9..2ff73685e3 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -109,10 +109,6 @@ static int _mesa_sparc_needs_init = 1;
#define INIT_MESA_SPARC
#endif
-#ifdef GLX_DIRECT_RENDERING
-static __DRIscreen *__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn);
-#endif /* GLX_DIRECT_RENDERING */
-
static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw,
GLXDrawable read, GLXContext gc);
@@ -364,8 +360,7 @@ static void FreeScreenConfigs(__GLXdisplayPrivate *priv)
#ifdef GLX_DIRECT_RENDERING
/* Free the direct rendering per screen data */
if (psc->driScreen.private)
- (*psc->driScreen.destroyScreen)(priv->dpy, i,
- psc->driScreen.private);
+ (*psc->driScreen.destroyScreen)(psc->driScreen.private);
psc->driScreen.private = NULL;
__glxHashDestroy(psc->drawHash);
#endif
@@ -710,7 +705,7 @@ static __DRIfuncPtr get_proc_address( const char * proc_name )
}
#ifdef XDAMAGE_1_1_INTERFACE
-static GLboolean has_damage_post(__DRInativeDisplay *dpy)
+static GLboolean has_damage_post(Display *dpy)
{
static GLboolean inited = GL_FALSE;
static GLboolean has_damage;
@@ -732,8 +727,7 @@ static GLboolean has_damage_post(__DRInativeDisplay *dpy)
}
#endif /* XDAMAGE_1_1_INTERFACE */
-static void __glXReportDamage(__DRInativeDisplay *dpy, int screen,
- __DRIid drawable,
+static void __glXReportDamage(__DRIdrawable *driDraw,
int x, int y,
drm_clip_rect_t *rects, int num_rects,
GLboolean front_buffer)
@@ -743,6 +737,11 @@ static void __glXReportDamage(__DRInativeDisplay *dpy, int screen,
XserverRegion region;
int i;
int x_off, y_off;
+ __GLXdrawable *glxDraw =
+ containerOf(driDraw, __GLXdrawable, driDrawable);
+ __GLXscreenConfigs *psc = glxDraw->psc;
+ Display *dpy = psc->dpy;
+ Drawable drawable;
if (!has_damage_post(dpy))
return;
@@ -750,10 +749,11 @@ static void __glXReportDamage(__DRInativeDisplay *dpy, int screen,
if (front_buffer) {
x_off = x;
y_off = y;
- drawable = RootWindow(dpy, screen);
+ drawable = RootWindow(dpy, psc->scr);
} else{
x_off = 0;
y_off = 0;
+ drawable = glxDraw->drawable;
}
xrects = malloc(sizeof(XRectangle) * num_rects);
@@ -773,6 +773,69 @@ static void __glXReportDamage(__DRInativeDisplay *dpy, int screen,
#endif
}
+static GLboolean
+__glXDRICreateContext(__DRIscreen *screen, int configID,
+ void *pid, drm_context_t *hHWContext)
+{
+ __GLXscreenConfigs *psc =
+ containerOf(screen, __GLXscreenConfigs, driScreen);
+ Display *dpy = psc->dpy;
+
+ return XF86DRICreateContextWithConfig(dpy, psc->scr,
+ configID, pid, hHWContext);
+}
+
+static GLboolean
+__glXDRIDestroyContext(__DRIscreen *screen, __DRIid context_id)
+{
+ __GLXscreenConfigs *psc =
+ containerOf(screen, __GLXscreenConfigs, driScreen);
+ Display *dpy = psc->dpy;
+
+ return XF86DRIDestroyContext(dpy, psc->scr, context_id);
+}
+
+static GLboolean
+__glXDRICreateDrawable( __DRIscreen *screen,
+ __DRIid drawable, drm_drawable_t *hHWDrawable )
+{
+ __GLXscreenConfigs *psc =
+ containerOf(screen, __GLXscreenConfigs, driScreen);
+ Display *dpy = psc->dpy;
+
+ return XF86DRICreateDrawable(dpy, psc->scr, drawable, hHWDrawable);
+}
+
+static GLboolean
+__glXDRIDestroyDrawable(__DRIscreen *screen, __DRIid drawable)
+{
+ __GLXscreenConfigs *psc =
+ containerOf(screen, __GLXscreenConfigs, driScreen);
+ Display *dpy = psc->dpy;
+
+ return XF86DRIDestroyDrawable(dpy, psc->scr, drawable);
+}
+
+static GLboolean
+__glXDRIGetDrawableInfo(__DRIscreen *screen, __DRIid drawable,
+ unsigned int *index, unsigned int *stamp,
+ int *X, int *Y, int *W, int *H,
+ int *numClipRects, drm_clip_rect_t ** pClipRects,
+ int *backX, int *backY,
+ int *numBackClipRects, drm_clip_rect_t **pBackClipRects)
+{
+ __GLXscreenConfigs *psc =
+ containerOf(screen, __GLXscreenConfigs, driScreen);
+ Display *dpy = psc->dpy;
+
+ return XF86DRIGetDrawableInfo(dpy, psc->scr, drawable,
+ index, stamp, X, Y, W, H,
+ numClipRects, pClipRects,
+ backX, backY,
+ numBackClipRects, pBackClipRects);
+}
+
+
/**
* Table of functions exported by the loader to the driver.
*/
@@ -782,14 +845,12 @@ static const __DRIinterfaceMethods interface_methods = {
_gl_context_modes_create,
_gl_context_modes_destroy,
- __glXFindDRIScreen,
-
- XF86DRICreateContextWithConfig,
- XF86DRIDestroyContext,
+ __glXDRICreateContext,
+ __glXDRIDestroyContext,
- XF86DRICreateDrawable,
- XF86DRIDestroyDrawable,
- XF86DRIGetDrawableInfo,
+ __glXDRICreateDrawable,
+ __glXDRIDestroyDrawable,
+ __glXDRIGetDrawableInfo,
__glXGetUST,
__glXGetMscRateOML,
@@ -941,7 +1002,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
err_msg = "InitDriver";
err_extra = NULL;
- psp = (*createNewScreen)(dpy, scrn,
+ psp = (*createNewScreen)(scrn,
&psc->driScreen,
psc->configs,
& ddx_version,
@@ -1169,6 +1230,8 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv)
UnlockDisplay(dpy);
#ifdef GLX_DIRECT_RENDERING
+ psc->scr = i;
+ psc->dpy = dpy;
/* Create drawable hash */
psc->drawHash = __glxHashCreate();
if ( psc->drawHash == NULL ) {
@@ -1514,33 +1577,6 @@ PUBLIC GLXDrawable glXGetCurrentDrawable(void)
/************************************************************************/
-#ifdef GLX_DIRECT_RENDERING
-/* Return the DRI per screen structure */
-__DRIscreen *__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn)
-{
- __DRIscreen *pDRIScreen = NULL;
- XExtDisplayInfo *info = __glXFindDisplay(dpy);
- XExtData **privList, *found;
- __GLXdisplayPrivate *dpyPriv;
- XEDataObject dataObj;
-
- __glXLock();
- dataObj.display = dpy;
- privList = XEHeadOfExtensionList(dataObj);
- found = XFindOnExtensionList(privList, info->codes->extension);
- __glXUnlock();
-
- if (found) {
- dpyPriv = (__GLXdisplayPrivate *)found->private_data;
- pDRIScreen = &dpyPriv->screenConfigs[scrn].driScreen;
- }
-
- return pDRIScreen;
-}
-#endif
-
-/************************************************************************/
-
static Bool SendMakeCurrentRequest( Display *dpy, CARD8 opcode,
GLXContextID gc, GLXContextTag old_gc, GLXDrawable draw, GLXDrawable read,
xGLXMakeCurrentReply * reply );
@@ -1629,7 +1665,7 @@ static __DRIdrawable *
FetchDRIDrawable( Display *dpy, GLXDrawable drawable, GLXContext gc)
{
__GLXdisplayPrivate * const priv = __glXInitialize(dpy);
- __DRIdrawable *pdraw;
+ __GLXdrawable *pdraw;
__GLXscreenConfigs *sc;
void *empty_attribute_list = NULL;
@@ -1638,34 +1674,37 @@ FetchDRIDrawable( Display *dpy, GLXDrawable drawable, GLXContext gc)
sc = &priv->screenConfigs[gc->screen];
if (__glxHashLookup(sc->drawHash, drawable, (void *) &pdraw) == 0)
- return pdraw;
+ return &pdraw->driDrawable;
/* Allocate a new drawable */
- pdraw = (__DRIdrawable *)Xmalloc(sizeof(__DRIdrawable));
+ pdraw = Xmalloc(sizeof(*pdraw));
if (!pdraw)
return NULL;
+ pdraw->drawable = drawable;
+ pdraw->psc = sc;
+
/* Create a new drawable */
- pdraw->private =
- (*sc->driScreen.createNewDrawable)(dpy,
+ pdraw->driDrawable.private =
+ (*sc->driScreen.createNewDrawable)(&sc->driScreen,
gc->mode,
- drawable, pdraw,
+ drawable, &pdraw->driDrawable,
GLX_WINDOW_BIT,
empty_attribute_list);
- if (!pdraw->private) {
+ if (!pdraw->driDrawable.private) {
/* ERROR!!! */
Xfree(pdraw);
return NULL;
}
if (__glxHashInsert(sc->drawHash, drawable, pdraw)) {
- (*pdraw->destroyDrawable)(dpy, pdraw->private);
+ (*pdraw->driDrawable.destroyDrawable)(pdraw->driDrawable.private);
Xfree(pdraw);
return NULL;
}
- return pdraw;
+ return &pdraw->driDrawable;
}
static Bool BindContextWrapper( Display *dpy, GLXContext gc,
@@ -1674,15 +1713,13 @@ static Bool BindContextWrapper( Display *dpy, GLXContext gc,
__DRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc);
__DRIdrawable *pread = FetchDRIDrawable(dpy, read, gc);
- return (*gc->driContext.bindContext)(dpy, gc->screen, pdraw, pread,
- & gc->driContext);
+ return (*gc->driContext.bindContext)(pdraw, pread, &gc->driContext);
}
static Bool UnbindContextWrapper( GLXContext gc )
{
- return (*gc->driContext.unbindContext)(gc->currentDpy, gc->screen,
- &gc->driContext );
+ return (*gc->driContext.unbindContext)(&gc->driContext);
}
#endif /* GLX_DIRECT_RENDERING */
@@ -1794,7 +1831,7 @@ USED static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw,
if (oldGC->isDirect) {
if (oldGC->driContext.private) {
(*oldGC->driContext.destroyContext)
- (dpy, oldGC->screen, oldGC->driContext.private);
+ (oldGC->driContext.private);
oldGC->driContext.private = NULL;
}
}
diff --git a/src/glx/x11/xf86dri.h b/src/glx/x11/xf86dri.h
index 0a2bb24971..ddac7db266 100644
--- a/src/glx/x11/xf86dri.h
+++ b/src/glx/x11/xf86dri.h
@@ -94,13 +94,13 @@ Bool XF86DRICreateContext( Display *dpy, int screen, Visual *visual,
Bool XF86DRICreateContextWithConfig( Display *dpy, int screen, int configID,
XID *ptr_to_returned_context_id, drm_context_t *hHWContext );
-extern GLboolean XF86DRIDestroyContext( __DRInativeDisplay *dpy, int screen,
+extern GLboolean XF86DRIDestroyContext( Display *dpy, int screen,
__DRIid context_id );
-extern GLboolean XF86DRICreateDrawable( __DRInativeDisplay *dpy, int screen,
+extern GLboolean XF86DRICreateDrawable( Display *dpy, int screen,
__DRIid drawable, drm_drawable_t *hHWDrawable );
-extern GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay *dpy, int screen,
+extern GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen,
__DRIid drawable);
Bool XF86DRIGetDrawableInfo( Display *dpy, int screen, Drawable drawable,
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 1f916a82ca..2b5d6f0a59 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -33,7 +33,7 @@
#include "drm_sarea.h"
#ifndef GLX_OML_sync_control
-typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRInativeDisplay *dpy, __DRIid drawable, int32_t *numerator, int32_t *denominator);
+typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRIdrawable *drawable, int32_t *numerator, int32_t *denominator);
#endif
/* This pointer *must* be set by the driver's __driCreateNewScreen funciton!
@@ -53,16 +53,16 @@ static const int empty_attribute_list[1] = { None };
static int api_ver = 0;
/* forward declarations */
-static int driQueryFrameTracking( __DRInativeDisplay *dpy, void *priv,
+static int driQueryFrameTracking( void *priv,
int64_t *sbc, int64_t *missedFrames,
float *lastMissedUsage, float *usage );
-static void *driCreateNewDrawable(__DRInativeDisplay *dpy,
- const __GLcontextModes *modes,
+static void *driCreateNewDrawable(__DRIscreen *screen,
+ const __GLcontextModes *modes,
__DRIid draw, __DRIdrawable *pdraw,
int renderType, const int *attrs);
-static void driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate);
+static void driDestroyDrawable(void *drawablePrivate);
/**
@@ -96,8 +96,7 @@ __driUtilMessage(const char *f, ...)
/**
* Unbind context.
*
- * \param dpy the display handle.
- * \param scrn the screen number.
+ * \param scrn the screen.
* \param gc context.
*
* \return \c GL_TRUE on success, or \c GL_FALSE on failure.
@@ -110,10 +109,8 @@ __driUtilMessage(const char *f, ...)
* While casting the opaque private pointers associated with the parameters
* into their respective real types it also assures they are not \c NULL.
*/
-static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn,
- __DRIcontext *ctx)
+static GLboolean driUnbindContext(__DRIcontext *ctx)
{
- __DRIscreen *pDRIScreen;
__DRIcontextPrivate *pcp;
__DRIscreenPrivate *psp;
__DRIdrawablePrivate *pdp;
@@ -124,19 +121,11 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn,
** calling driUnbindContext.
*/
- if (ctx == NULL) {
- /* ERROR!!! */
- return GL_FALSE;
- }
+ if (ctx == NULL)
+ return GL_FALSE;
- pDRIScreen = (*dri_interface->getScreen)(dpy, scrn);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- psp = (__DRIscreenPrivate *)pDRIScreen->private;
pcp = (__DRIcontextPrivate *)ctx->private;
+ psp = (__DRIscreenPrivate *)pcp->driScreenPriv;
pdp = (__DRIdrawablePrivate *)pcp->driDrawablePriv;
prp = (__DRIdrawablePrivate *)pcp->driReadablePriv;
@@ -179,16 +168,14 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn,
* for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent
* function.
*/
-static GLboolean DoBindContext(__DRInativeDisplay *dpy,
- __DRIdrawable *pdraw,
+static GLboolean DoBindContext(__DRIdrawable *pdraw,
__DRIdrawable *pread,
- __DRIcontext *ctx,
- __DRIscreenPrivate *psp)
+ __DRIcontext *ctx)
{
__DRIdrawablePrivate *pdp;
__DRIdrawablePrivate *prp;
__DRIcontextPrivate * const pcp = ctx->private;
-
+ __DRIscreenPrivate *psp = pcp->driScreenPriv;
pdp = (__DRIdrawablePrivate *) pdraw->private;
prp = (__DRIdrawablePrivate *) pread->private;
@@ -230,31 +217,19 @@ static GLboolean DoBindContext(__DRInativeDisplay *dpy,
* for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent
* function.
*/
-static GLboolean driBindContext(__DRInativeDisplay *dpy, int scrn,
- __DRIdrawable *pdraw,
+static GLboolean driBindContext(__DRIdrawable *pdraw,
__DRIdrawable *pread,
__DRIcontext * ctx)
{
- __DRIscreen *pDRIScreen;
-
/*
** Assume error checking is done properly in glXMakeCurrent before
** calling driBindContext.
*/
- if (ctx == NULL || pdraw == None || pread == None) {
- /* ERROR!!! */
- return GL_FALSE;
- }
-
- pDRIScreen = (*dri_interface->getScreen)(dpy, scrn);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- /* ERROR!!! */
+ if (ctx == NULL || pdraw == None || pread == None)
return GL_FALSE;
- }
- return DoBindContext( dpy, pdraw, pread, ctx,
- (__DRIscreenPrivate *)pDRIScreen->private );
+ return DoBindContext( pdraw, pread, ctx );
}
/*@}*/
@@ -311,7 +286,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
- if (! (*dri_interface->getDrawableInfo)(pdp->display, pdp->screen, pdp->draw,
+ if (! (*dri_interface->getDrawableInfo)(pdp->driScreenPriv->psc, pdp->draw,
&pdp->index, &pdp->lastStamp,
&pdp->x, &pdp->y, &pdp->w, &pdp->h,
&pdp->numClipRects, &pdp->pClipRects,
@@ -345,7 +320,6 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
/**
* Swap buffers.
*
- * \param dpy the display handle.
* \param drawablePrivate opaque pointer to the per-drawable private info.
*
* \internal
@@ -353,7 +327,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
*
* Is called directly from glXSwapBuffers().
*/
-static void driSwapBuffers( __DRInativeDisplay *dpy, void *drawablePrivate )
+static void driSwapBuffers(void *drawablePrivate)
{
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
drm_clip_rect_t rect;
@@ -374,8 +348,7 @@ static void driSwapBuffers( __DRInativeDisplay *dpy, void *drawablePrivate )
* front buffer, so we report the damage there rather than to the backing
* store (if any).
*/
- (*dri_interface->reportDamage)(dpy, dPriv->screen, dPriv->draw,
- dPriv->x, dPriv->y,
+ (*dri_interface->reportDamage)(dPriv->pdraw, dPriv->x, dPriv->y,
&rect, 1, GL_TRUE);
}
@@ -392,7 +365,7 @@ static int driGetMSC( void *screenPrivate, int64_t *msc )
/**
* Called directly from a number of higher-level GLX functions.
*/
-static int driGetSBC( __DRInativeDisplay *dpy, void *drawablePrivate, int64_t *sbc )
+static int driGetSBC( void *drawablePrivate, int64_t *sbc )
{
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
__DRIswapInfo sInfo;
@@ -405,8 +378,7 @@ static int driGetSBC( __DRInativeDisplay *dpy, void *drawablePrivate, int64_t *s
return status;
}
-static int driWaitForSBC( __DRInativeDisplay * dpy, void *drawablePriv,
- int64_t target_sbc,
+static int driWaitForSBC( void *drawablePriv, int64_t target_sbc,
int64_t * msc, int64_t * sbc )
{
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv;
@@ -415,8 +387,7 @@ static int driWaitForSBC( __DRInativeDisplay * dpy, void *drawablePriv,
msc, sbc );
}
-static int driWaitForMSC( __DRInativeDisplay * dpy, void *drawablePriv,
- int64_t target_msc,
+static int driWaitForMSC( void *drawablePriv, int64_t target_msc,
int64_t divisor, int64_t remainder,
int64_t * msc, int64_t * sbc )
{
@@ -442,8 +413,7 @@ static int driWaitForMSC( __DRInativeDisplay * dpy, void *drawablePriv,
return status;
}
-static int64_t driSwapBuffersMSC( __DRInativeDisplay * dpy, void *drawablePriv,
- int64_t target_msc,
+static int64_t driSwapBuffersMSC( void *drawablePriv, int64_t target_msc,
int64_t divisor, int64_t remainder )
{
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv;
@@ -453,25 +423,23 @@ static int64_t driSwapBuffersMSC( __DRInativeDisplay * dpy, void *drawablePriv,
remainder );
}
-static void driCopySubBuffer( __DRInativeDisplay *dpy, void *drawablePrivate,
+static void driCopySubBuffer( void *drawablePrivate,
int x, int y, int w, int h)
{
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate;
dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h);
- (void) dpy;
}
/**
* This is called via __DRIscreenRec's createNewDrawable pointer.
*/
-static void *driCreateNewDrawable(__DRInativeDisplay *dpy,
+static void *driCreateNewDrawable(__DRIscreen *screen,
const __GLcontextModes *modes,
__DRIid draw,
__DRIdrawable *pdraw,
int renderType,
const int *attrs)
{
- __DRIscreen * const pDRIScreen = (*dri_interface->getScreen)(dpy, modes->screen);
__DRIscreenPrivate *psp;
__DRIdrawablePrivate *pdp;
@@ -483,16 +451,14 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy,
*/
(void) attrs;
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return NULL;
- }
-
pdp = (__DRIdrawablePrivate *)_mesa_malloc(sizeof(__DRIdrawablePrivate));
if (!pdp) {
return NULL;
}
- if (!(*dri_interface->createDrawable)(dpy, modes->screen, draw, &pdp->hHWDrawable)) {
+ /* Ensure that modes->screen and screen are the same screen? */
+
+ if (!(*dri_interface->createDrawable)(screen, draw, &pdp->hHWDrawable)) {
_mesa_free(pdp);
return NULL;
}
@@ -511,16 +477,14 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy,
pdp->numBackClipRects = 0;
pdp->pClipRects = NULL;
pdp->pBackClipRects = NULL;
- pdp->display = dpy;
- pdp->screen = modes->screen;
- psp = (__DRIscreenPrivate *)pDRIScreen->private;
+ psp = (__DRIscreenPrivate *)screen->private;
pdp->driScreenPriv = psp;
pdp->driContextPriv = &psp->dummyContextPriv;
if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, modes,
renderType == GLX_PIXMAP_BIT)) {
- (void)(*dri_interface->destroyDrawable)(dpy, modes->screen, pdp->draw);
+ (void)(*dri_interface->destroyDrawable)(screen, pdp->draw);
_mesa_free(pdp);
return NULL;
}
@@ -551,17 +515,15 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy,
}
static void
-driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate)
+driDestroyDrawable(void *drawablePrivate)
{
__DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *) drawablePrivate;
__DRIscreenPrivate *psp;
- int scrn;
if (pdp) {
psp = pdp->driScreenPriv;
- scrn = psp->myNum;
(*psp->DriverAPI.DestroyBuffer)(pdp);
- (void)(*dri_interface->destroyDrawable)(dpy, scrn, pdp->draw);
+ (void)(*dri_interface->destroyDrawable)(psp->psc, pdp->draw);
if (pdp->pClipRects) {
_mesa_free(pdp->pClipRects);
pdp->pClipRects = NULL;
@@ -585,8 +547,6 @@ driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate)
/**
* Destroy the per-context private information.
*
- * \param dpy the display handle.
- * \param scrn the screen number.
* \param contextPrivate opaque pointer to the per-drawable private info.
*
* \internal
@@ -594,13 +554,14 @@ driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate)
* drmDestroyContext(), and finally frees \p contextPrivate.
*/
static void
-driDestroyContext(__DRInativeDisplay *dpy, int scrn, void *contextPrivate)
+driDestroyContext(void *contextPrivate)
{
__DRIcontextPrivate *pcp = (__DRIcontextPrivate *) contextPrivate;
if (pcp) {
(*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp);
- (void) (*dri_interface->destroyContext)(dpy, scrn, pcp->contextID);
+ (void) (*dri_interface->destroyContext)(pcp->driScreenPriv->psc,
+ pcp->contextID);
_mesa_free(pcp);
}
}
@@ -628,35 +589,27 @@ driDestroyContext(__DRInativeDisplay *dpy, int scrn, void *contextPrivate)
*
*/
static void *
-driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
+driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes,
int render_type, void *sharedPrivate, __DRIcontext *pctx)
{
- __DRIscreen *pDRIScreen;
__DRIcontextPrivate *pcp;
__DRIcontextPrivate *pshare = (__DRIcontextPrivate *) sharedPrivate;
__DRIscreenPrivate *psp;
void * const shareCtx = (pshare != NULL) ? pshare->driverPrivate : NULL;
- pDRIScreen = (*dri_interface->getScreen)(dpy, modes->screen);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- /* ERROR!!! */
- return NULL;
- }
-
- psp = (__DRIscreenPrivate *)pDRIScreen->private;
+ psp = (__DRIscreenPrivate *)screen->private;
pcp = (__DRIcontextPrivate *)_mesa_malloc(sizeof(__DRIcontextPrivate));
if (!pcp) {
return NULL;
}
- if (! (*dri_interface->createContext)(dpy, modes->screen, modes->fbconfigID,
- &pcp->contextID, &pcp->hHWContext)) {
+ if (! (*dri_interface->createContext)(screen, modes->fbconfigID,
+ &pcp->contextID, &pcp->hHWContext)) {
_mesa_free(pcp);
return NULL;
}
- pcp->display = dpy;
pcp->driScreenPriv = psp;
pcp->driDrawablePriv = NULL;
@@ -678,8 +631,7 @@ driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
pctx->unbindContext = driUnbindContext;
if ( !(*psp->DriverAPI.CreateContext)(modes, pcp, shareCtx) ) {
- (void) (*dri_interface->destroyContext)(dpy, modes->screen,
- pcp->contextID);
+ (void) (*dri_interface->destroyContext)(screen, pcp->contextID);
_mesa_free(pcp);
return NULL;
}
@@ -705,7 +657,7 @@ driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
* This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls
* drmClose(), and finally frees \p screenPrivate.
*/
-static void driDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPrivate)
+static void driDestroyScreen(void *screenPrivate)
{
__DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate;
@@ -760,7 +712,7 @@ static void driDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPriv
* loader that is too old to even load this driver.
*/
__DRIscreenPrivate *
-__driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
+__driUtilCreateNewScreen(int scr, __DRIscreen *psc,
__GLcontextModes * modes,
const __DRIversion * ddx_version,
const __DRIversion * dri_version,
@@ -781,8 +733,6 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
return NULL;
}
- psp->display = dpy;
- psp->myNum = scrn;
psp->psc = psc;
psp->modes = modes;
@@ -818,6 +768,7 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
psp->fbBPP = psp->fbStride * 8 / frame_buffer->width;
psp->fd = fd;
+ psp->myNum = scr;
/*
** Do not init dummy context here; actual initialization will be
@@ -873,7 +824,7 @@ int driCompareGLXAPIVersion( GLint required_version )
static int
-driQueryFrameTracking( __DRInativeDisplay * dpy, void * priv,
+driQueryFrameTracking( void * priv,
int64_t * sbc, int64_t * missedFrames,
float * lastMissedUsage, float * usage )
{
@@ -935,7 +886,7 @@ driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust,
float usage = 1.0;
- if ( (*dri_interface->getMSCRate)( dPriv->display, dPriv->draw, &n, &d ) ) {
+ if ( (*dri_interface->getMSCRate)(dPriv->pdraw, &n, &d) ) {
interval = (dPriv->pdraw->swap_interval != 0)
? dPriv->pdraw->swap_interval : 1;
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index a08eab1616..cae170c5f8 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -318,17 +318,6 @@ struct __DRIdrawablePrivateRec {
__DRIscreenPrivate *driScreenPriv;
/**
- * \name Display and screen information.
- *
- * Basically just need these for when the locking code needs to call
- * \c __driUtilUpdateDrawableInfo.
- */
- /*@{*/
- __DRInativeDisplay *display;
- int screen;
- /*@}*/
-
- /**
* Called via glXSwapBuffers().
*/
void (*swapBuffers)( __DRIdrawablePrivate *dPriv );
@@ -354,9 +343,9 @@ struct __DRIcontextPrivateRec {
void *driverPrivate;
/**
- * This context's display pointer.
+ * Pointer back to the \c __DRIcontext that contains this structure.
*/
- __DRInativeDisplay *display;
+ __DRIcontext *pctx;
/**
* Pointer to drawable currently bound to this context for drawing.
@@ -379,11 +368,6 @@ struct __DRIcontextPrivateRec {
*/
struct __DRIscreenPrivateRec {
/**
- * Display for this screen
- */
- __DRInativeDisplay *display;
-
- /**
* Current screen's number
*/
int myNum;
@@ -535,8 +519,8 @@ extern void
__driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp);
-extern __DRIscreenPrivate * __driUtilCreateNewScreen( __DRInativeDisplay *dpy,
- int scrn, __DRIscreen *psc, __GLcontextModes * modes,
+extern __DRIscreenPrivate * __driUtilCreateNewScreen( int scr, __DRIscreen *psc,
+ __GLcontextModes * modes,
const __DRIversion * ddx_version, const __DRIversion * dri_version,
const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer,
drm_sarea_t *pSAREA, int fd, int internal_api_version,
diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
index 4c5323d230..4cd5b9a208 100644
--- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c
+++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
@@ -714,16 +714,16 @@ ffbFillInModes( unsigned pixel_bits, unsigned depth_bits,
* failure.
*/
PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
+void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes ** driver_modes)
{
__DRIscreenPrivate *psp;
@@ -740,7 +740,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
return NULL;
}
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &ffbAPI);
diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c
index c0a7cdb90a..b04bc38327 100644
--- a/src/mesa/drivers/dri/i810/i810screen.c
+++ b/src/mesa/drivers/dri/i810/i810screen.c
@@ -431,17 +431,16 @@ static const struct __DriverAPIRec i810API = {
* failure.
*/
PUBLIC
-void * __driCreateNewScreen_20070105( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
+void *__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes ** driver_modes)
{
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 1, 0, 0 };
@@ -457,7 +456,7 @@ void * __driCreateNewScreen_20070105( __DRInativeDisplay *dpy, int scrn, __DRIsc
return NULL;
}
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &i810API);
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 2721a90094..7a11672a8f 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -886,18 +886,18 @@ intelFillInModes(unsigned pixel_bits, unsigned depth_bits,
* \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
* failure.
*/
-PUBLIC void *
-__driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn,
- __DRIscreen * psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes)
+PUBLIC
+void * __DRI_CREATE_NEW_SCREEN(int scrn,
+ __DRIscreen * psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes ** driver_modes)
{
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 1, 5, 0 };
@@ -913,11 +913,10 @@ __driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn,
return NULL;
}
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
- ddx_version, dri_version, drm_version,
- frame_buffer, pSAREA, fd,
- internal_api_version, &intelAPI);
-
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
+ ddx_version, dri_version, drm_version,
+ frame_buffer, pSAREA, fd,
+ internal_api_version, &intelAPI);
if (psp != NULL) {
I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv;
*driver_modes = intelFillInModes(dri_priv->cpp * 8,
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 5dac50df32..29ea07d78e 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -650,16 +650,16 @@ intelFillInModes( unsigned pixel_bits, unsigned depth_bits,
* failure.
*/
PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
+void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes ** driver_modes )
{
__DRIscreenPrivate *psp;
@@ -676,7 +676,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
return NULL;
}
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &intelAPI);
diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c
index 4e9e216e7d..52b96bf0bc 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.c
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.c
@@ -505,16 +505,16 @@ static struct __DriverAPIRec mach64API = {
* failure.
*/
PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
+void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes ** driver_modes)
{
__DRIscreenPrivate *psp;
@@ -531,7 +531,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
return NULL;
}
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &mach64API);
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c
index f4e651afa0..372d2ce433 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.c
@@ -963,16 +963,16 @@ static const struct __DriverAPIRec mgaAPI = {
* failure.
*/
PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
+void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes ** driver_modes)
{
__DRIscreenPrivate *psp;
@@ -989,7 +989,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
return NULL;
}
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &mgaAPI);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 065aa81746..cab53f41ad 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -295,16 +295,16 @@ nouveauFillInModes( unsigned pixel_bits, unsigned depth_bits,
* failure.
*/
PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes)
+void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes ** driver_modes)
{
__DRIscreenPrivate *psp;
@@ -331,7 +331,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
return NULL;
}
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &nouveauAPI);
diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c
index 880dee85c2..a84b54924a 100644
--- a/src/mesa/drivers/dri/r128/r128_screen.c
+++ b/src/mesa/drivers/dri/r128/r128_screen.c
@@ -514,16 +514,16 @@ r128FillInModes( unsigned pixel_bits, unsigned depth_bits,
* failure.
*/
PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
+void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes ** driver_modes)
{
__DRIscreenPrivate *psp;
@@ -541,7 +541,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
return NULL;
}
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &r128API);
diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c
index 2366bde525..c9c5a86172 100644
--- a/src/mesa/drivers/dri/r200/r200_ioctl.c
+++ b/src/mesa/drivers/dri/r200/r200_ioctl.c
@@ -857,7 +857,7 @@ void r200Finish( GLcontext *ctx )
* the kernel data structures, and the current context to get the
* device fd.
*/
-void *r200AllocateMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLsizei size,
+void *r200AllocateMemoryMESA(__DRIscreen *screen, GLsizei size,
GLfloat readfreq, GLfloat writefreq,
GLfloat priority)
{
@@ -899,7 +899,7 @@ void *r200AllocateMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLsizei size,
/* Called via glXFreeMemoryMESA() */
-void r200FreeMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer)
+void r200FreeMemoryMESA(__DRIscreen *screen, GLvoid *pointer)
{
GET_CURRENT_CONTEXT(ctx);
r200ContextPtr rmesa;
@@ -936,7 +936,7 @@ void r200FreeMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer)
}
/* Called via glXGetMemoryOffsetMESA() */
-GLuint r200GetMemoryOffsetMESA(__DRInativeDisplay *dpy, int scrn, const GLvoid *pointer)
+GLuint r200GetMemoryOffsetMESA(__DRIscreen *screen, const GLvoid *pointer)
{
GET_CURRENT_CONTEXT(ctx);
r200ContextPtr rmesa;
diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.h b/src/mesa/drivers/dri/r200/r200_ioctl.h
index 5ed1555f6a..bf12679947 100644
--- a/src/mesa/drivers/dri/r200/r200_ioctl.h
+++ b/src/mesa/drivers/dri/r200/r200_ioctl.h
@@ -98,10 +98,10 @@ extern void r200WaitForIdleLocked( r200ContextPtr rmesa );
extern void r200WaitForVBlank( r200ContextPtr rmesa );
extern void r200InitIoctlFuncs( struct dd_function_table *functions );
-extern void *r200AllocateMemoryMESA( __DRInativeDisplay *dpy, int scrn, GLsizei size, GLfloat readfreq,
+extern void *r200AllocateMemoryMESA( __DRIscreen *screen, GLsizei size, GLfloat readfreq,
GLfloat writefreq, GLfloat priority );
-extern void r200FreeMemoryMESA( __DRInativeDisplay *dpy, int scrn, GLvoid *pointer );
-extern GLuint r200GetMemoryOffsetMESA( __DRInativeDisplay *dpy, int scrn, const GLvoid *pointer );
+extern void r200FreeMemoryMESA( __DRIscreen *screen, GLvoid *pointer );
+extern GLuint r200GetMemoryOffsetMESA( __DRIscreen *screen, const GLvoid *pointer );
extern GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer,
GLint size );
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 682cf3a5ee..2d44532a84 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -990,17 +990,16 @@ static const struct __DriverAPIRec r200API = {
* failure.
*/
PUBLIC void *
-__driCreateNewScreen_20050727( __DRInativeDisplay *dpy,
- int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
+__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes ** driver_modes)
{
__DRIscreenPrivate *psp;
#if !RADEON_COMMON
@@ -1029,12 +1028,12 @@ __driCreateNewScreen_20050727( __DRInativeDisplay *dpy,
return NULL;
}
#if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300))
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &radeonAPI);
#elif RADEON_COMMON && defined(RADEON_COMMON_FOR_R200)
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &r200API);
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index 43422db9a8..e8a63ae51b 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -1027,16 +1027,16 @@ savageFillInModes( unsigned pixel_bits, unsigned depth_bits,
* failure.
*/
PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
+void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes ** driver_modes )
{
__DRIscreenPrivate *psp;
@@ -1053,7 +1053,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
return NULL;
}
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &savageAPI);
diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c
index 89d734ba78..a1275f0026 100644
--- a/src/mesa/drivers/dri/sis/sis_screen.c
+++ b/src/mesa/drivers/dri/sis/sis_screen.c
@@ -333,17 +333,16 @@ static struct __DriverAPIRec sisAPI = {
* failure.
*/
PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn,
- __DRIscreen *psc,
- const __GLcontextModes *modes,
- const __DRIversion *ddx_version,
- const __DRIversion *dri_version,
- const __DRIversion *drm_version,
- const __DRIframebuffer *frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes **driver_modes )
+void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
+ const __GLcontextModes *modes,
+ const __DRIversion *ddx_version,
+ const __DRIversion *dri_version,
+ const __DRIversion *drm_version,
+ const __DRIframebuffer *frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes **driver_modes)
{
__DRIscreenPrivate *psp;
@@ -359,7 +358,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn,
return NULL;
}
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &sisAPI);
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
index 1f9ff4e30c..899963d06d 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
@@ -442,16 +442,16 @@ static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits,
* failure.
*/
PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
+void *__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes ** driver_modes)
{
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 1, 1, 0 };
@@ -467,7 +467,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
return NULL;
}
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &tdfxAPI);
diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c
index 8dc7f0dc78..1d2a49e6f4 100644
--- a/src/mesa/drivers/dri/trident/trident_context.c
+++ b/src/mesa/drivers/dri/trident/trident_context.c
@@ -430,17 +430,17 @@ static struct __DriverAPIRec tridentAPI = {
};
-PUBLIC void *__driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn,
- __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
+PUBLIC void *
+__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes ** driver_modes)
{
__DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 4, 0, 0 };
@@ -456,7 +456,7 @@ PUBLIC void *__driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn,
return NULL;
}
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &tridentAPI);
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
index 7c73877720..66e92cc602 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.c
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
@@ -601,9 +601,6 @@ viaCreateContext(const __GLcontextModes *visual,
_tnl_allow_pixel_fog(ctx, GL_FALSE);
_tnl_allow_vertex_fog(ctx, GL_TRUE);
-/* vmesa->display = dpy; */
- vmesa->display = sPriv->display;
-
vmesa->hHWContext = driContextPriv->hHWContext;
vmesa->driFd = sPriv->fd;
vmesa->driHwLock = &sPriv->pSAREA->lock;
diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h
index fecd2782fb..6321713688 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.h
+++ b/src/mesa/drivers/dri/unichrome/via_context.h
@@ -289,7 +289,6 @@ struct via_context {
drm_context_t hHWContext;
drm_hw_lock_t *driHwLock;
int driFd;
- __DRInativeDisplay *display;
/**
* DRI drawable bound to this context for drawing.
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index 90f76be44d..c10b7d1a9b 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -418,17 +418,16 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer )
* failure.
*/
PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn,
- __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
+void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
+ const __GLcontextModes * modes,
+ const __DRIversion * ddx_version,
+ const __DRIversion * dri_version,
+ const __DRIversion * drm_version,
+ const __DRIframebuffer * frame_buffer,
+ drmAddress pSAREA, int fd,
+ int internal_api_version,
+ const __DRIinterfaceMethods * interface,
+ __GLcontextModes ** driver_modes)
{
__DRIscreenPrivate *psp;
@@ -448,7 +447,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn,
return NULL;
}
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
+ psp = __driUtilCreateNewScreen(scrn, psc, NULL,
ddx_version, dri_version, drm_version,
frame_buffer, pSAREA, fd,
internal_api_version, &viaAPI);