mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
Fix compilation for !GLX_DIRECT_RENDERING.
This commit is contained in:
parent
001de0ac4e
commit
286ce27193
4 changed files with 83 additions and 68 deletions
|
|
@ -342,17 +342,17 @@ struct __GLXcontextRec {
|
|||
*/
|
||||
GLint majorOpcode;
|
||||
|
||||
/**
|
||||
* Pointer to the mode used to create this context.
|
||||
*/
|
||||
const __GLcontextModes * mode;
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
/**
|
||||
* Per context direct rendering interface functions and data.
|
||||
*/
|
||||
__DRIcontext driContext;
|
||||
|
||||
/**
|
||||
* Pointer to the mode used to create this context.
|
||||
*/
|
||||
const __GLcontextModes * mode;
|
||||
|
||||
/**
|
||||
* XID for the server side drm_context_t
|
||||
*/
|
||||
|
|
@ -719,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__ */
|
||||
|
|
|
|||
|
|
@ -2169,6 +2169,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.
|
||||
|
|
@ -2186,71 +2248,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);
|
||||
__DRIdrawable *driDraw = GetDRIDrawable(dpy, drawable, NULL);
|
||||
|
||||
if (driDraw == NULL)
|
||||
return False;
|
||||
|
||||
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
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
return __driGetMscRateOML(driDraw, numerator, denominator);
|
||||
#else
|
||||
(void) draw;
|
||||
(void) dpy;
|
||||
(void) drawable;
|
||||
(void) numerator;
|
||||
(void) denominator;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -788,7 +788,7 @@ static const __DRIinterfaceMethods interface_methods = {
|
|||
__glXDRIGetDrawableInfo,
|
||||
|
||||
__glXGetUST,
|
||||
__glXGetMscRateOML,
|
||||
__driGetMscRateOML,
|
||||
|
||||
__glXReportDamage,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue