mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
Revert pointless reindents to avoid merge conflicts.
Why are we reindenting code that's work in progress...
This commit is contained in:
parent
351de8aecc
commit
77c7f90ed4
7 changed files with 2683 additions and 2809 deletions
|
|
@ -42,266 +42,260 @@
|
|||
|
||||
static char dri2ExtensionName[] = DRI2_NAME;
|
||||
static XExtensionInfo *dri2Info;
|
||||
static
|
||||
XEXT_GENERATE_CLOSE_DISPLAY(DRI2CloseDisplay, dri2Info)
|
||||
static /* const */ XExtensionHooks dri2ExtensionHooks = {
|
||||
NULL, /* create_gc */
|
||||
NULL, /* copy_gc */
|
||||
NULL, /* flush_gc */
|
||||
NULL, /* free_gc */
|
||||
NULL, /* create_font */
|
||||
NULL, /* free_font */
|
||||
DRI2CloseDisplay, /* close_display */
|
||||
NULL, /* wire_to_event */
|
||||
NULL, /* event_to_wire */
|
||||
NULL, /* error */
|
||||
NULL, /* error_string */
|
||||
};
|
||||
static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info)
|
||||
static /* const */ XExtensionHooks dri2ExtensionHooks = {
|
||||
NULL, /* create_gc */
|
||||
NULL, /* copy_gc */
|
||||
NULL, /* flush_gc */
|
||||
NULL, /* free_gc */
|
||||
NULL, /* create_font */
|
||||
NULL, /* free_font */
|
||||
DRI2CloseDisplay, /* close_display */
|
||||
NULL, /* wire_to_event */
|
||||
NULL, /* event_to_wire */
|
||||
NULL, /* error */
|
||||
NULL, /* error_string */
|
||||
};
|
||||
|
||||
static
|
||||
XEXT_GENERATE_FIND_DISPLAY(DRI2FindDisplay, dri2Info,
|
||||
dri2ExtensionName, &dri2ExtensionHooks, 0, NULL)
|
||||
static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay, dri2Info,
|
||||
dri2ExtensionName,
|
||||
&dri2ExtensionHooks,
|
||||
0, NULL)
|
||||
|
||||
Bool DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase)
|
||||
Bool DRI2QueryExtension(Display *dpy, int *eventBase, int *errorBase)
|
||||
{
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
|
||||
if (XextHasExtension(info)) {
|
||||
*eventBase = info->codes->first_event;
|
||||
*errorBase = info->codes->first_error;
|
||||
return True;
|
||||
}
|
||||
if (XextHasExtension(info)) {
|
||||
*eventBase = info->codes->first_event;
|
||||
*errorBase = info->codes->first_error;
|
||||
return True;
|
||||
}
|
||||
|
||||
return False;
|
||||
return False;
|
||||
}
|
||||
|
||||
Bool
|
||||
DRI2QueryVersion(Display * dpy, int *major, int *minor)
|
||||
Bool DRI2QueryVersion(Display *dpy, int *major, int *minor)
|
||||
{
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2QueryVersionReply rep;
|
||||
xDRI2QueryVersionReq *req;
|
||||
XExtDisplayInfo *info = DRI2FindDisplay (dpy);
|
||||
xDRI2QueryVersionReply rep;
|
||||
xDRI2QueryVersionReq *req;
|
||||
|
||||
XextCheckExtension(dpy, info, dri2ExtensionName, False);
|
||||
XextCheckExtension (dpy, info, dri2ExtensionName, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2QueryVersion, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2QueryVersion;
|
||||
req->majorVersion = DRI2_MAJOR;
|
||||
req->minorVersion = DRI2_MINOR;
|
||||
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
*major = rep.majorVersion;
|
||||
*minor = rep.minorVersion;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2QueryVersion, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2QueryVersion;
|
||||
req->majorVersion = DRI2_MAJOR;
|
||||
req->minorVersion = DRI2_MINOR;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
*major = rep.majorVersion;
|
||||
*minor = rep.minorVersion;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return True;
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
DRI2Connect(Display * dpy, int screen,
|
||||
char **driverName, char **busId, unsigned int *sareaHandle)
|
||||
Bool DRI2Connect(Display *dpy, int screen,
|
||||
char **driverName, char **busId, unsigned int *sareaHandle)
|
||||
{
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2ConnectReply rep;
|
||||
xDRI2ConnectReq *req;
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2ConnectReply rep;
|
||||
xDRI2ConnectReq *req;
|
||||
|
||||
XextCheckExtension(dpy, info, dri2ExtensionName, False);
|
||||
XextCheckExtension (dpy, info, dri2ExtensionName, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2Connect, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2Connect;
|
||||
req->screen = screen;
|
||||
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2Connect, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2Connect;
|
||||
req->screen = screen;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
|
||||
if (rep.driverNameLength == 0 && rep.busIdLength == 0) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
if (rep.driverNameLength == 0 && rep.busIdLength == 0) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
|
||||
*driverName = Xmalloc(rep.driverNameLength + 1);
|
||||
if (*driverName == NULL) {
|
||||
_XEatData(dpy,
|
||||
((rep.driverNameLength + 3) & ~3) +
|
||||
((rep.busIdLength + 3) & ~3));
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
_XReadPad(dpy, *driverName, rep.driverNameLength);
|
||||
(*driverName)[rep.driverNameLength] = '\0';
|
||||
*driverName = Xmalloc(rep.driverNameLength + 1);
|
||||
if (*driverName == NULL) {
|
||||
_XEatData(dpy,
|
||||
((rep.driverNameLength + 3) & ~3) +
|
||||
((rep.busIdLength + 3) & ~3));
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
_XReadPad(dpy, *driverName, rep.driverNameLength);
|
||||
(*driverName)[rep.driverNameLength] = '\0';
|
||||
|
||||
*busId = Xmalloc(rep.busIdLength + 1);
|
||||
if (*busId == NULL) {
|
||||
Xfree(*driverName);
|
||||
_XEatData(dpy, ((rep.busIdLength + 3) & ~3));
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
_XReadPad(dpy, *busId, rep.busIdLength);
|
||||
(*busId)[rep.busIdLength] = '\0';
|
||||
*busId = Xmalloc(rep.busIdLength + 1);
|
||||
if (*busId == NULL) {
|
||||
Xfree(*driverName);
|
||||
_XEatData(dpy, ((rep.busIdLength + 3) & ~3));
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
_XReadPad(dpy, *busId, rep.busIdLength);
|
||||
(*busId)[rep.busIdLength] = '\0';
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return True;
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool
|
||||
DRI2AuthConnection(Display * dpy, int screen, drm_magic_t magic)
|
||||
Bool DRI2AuthConnection(Display *dpy, int screen, drm_magic_t magic)
|
||||
{
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2AuthConnectionReq *req;
|
||||
xDRI2AuthConnectionReply rep;
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2AuthConnectionReq *req;
|
||||
xDRI2AuthConnectionReply rep;
|
||||
|
||||
XextCheckExtension(dpy, info, dri2ExtensionName, False);
|
||||
XextCheckExtension (dpy, info, dri2ExtensionName, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2AuthConnection, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2AuthConnection;
|
||||
req->screen = screen;
|
||||
req->magic = magic;
|
||||
rep.authenticated = 0;
|
||||
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2AuthConnection, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2AuthConnection;
|
||||
req->screen = screen;
|
||||
req->magic = magic;
|
||||
rep.authenticated = 0;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return rep.authenticated;
|
||||
return rep.authenticated;
|
||||
}
|
||||
|
||||
void
|
||||
DRI2CreateDrawable(Display * dpy, XID drawable)
|
||||
void DRI2CreateDrawable(Display *dpy, XID drawable)
|
||||
{
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2CreateDrawableReq *req;
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2CreateDrawableReq *req;
|
||||
|
||||
XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
|
||||
XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2CreateDrawable, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2CreateDrawable;
|
||||
req->drawable = drawable;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2CreateDrawable, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2CreateDrawable;
|
||||
req->drawable = drawable;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
||||
DRI2Buffer *
|
||||
DRI2GetBuffers(Display * dpy, XID drawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments, int count, int *outCount)
|
||||
DRI2Buffer *DRI2GetBuffers(Display *dpy, XID drawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments, int count,
|
||||
int *outCount)
|
||||
{
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2GetBuffersReply rep;
|
||||
xDRI2GetBuffersReq *req;
|
||||
DRI2Buffer *buffers;
|
||||
xDRI2Buffer repBuffer;
|
||||
CARD32 *p;
|
||||
int i;
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2GetBuffersReply rep;
|
||||
xDRI2GetBuffersReq *req;
|
||||
DRI2Buffer *buffers;
|
||||
xDRI2Buffer repBuffer;
|
||||
CARD32 *p;
|
||||
int i;
|
||||
|
||||
XextCheckExtension(dpy, info, dri2ExtensionName, False);
|
||||
XextCheckExtension (dpy, info, dri2ExtensionName, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReqExtra(DRI2GetBuffers, count * 4, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2GetBuffers;
|
||||
req->drawable = drawable;
|
||||
req->count = count;
|
||||
p = (CARD32 *) & req[1];
|
||||
for (i = 0; i < count; i++)
|
||||
p[i] = attachments[i];
|
||||
LockDisplay(dpy);
|
||||
GetReqExtra(DRI2GetBuffers, count * 4, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2GetBuffers;
|
||||
req->drawable = drawable;
|
||||
req->count = count;
|
||||
p = (CARD32 *) &req[1];
|
||||
for (i = 0; i < count; i++)
|
||||
p[i] = attachments[i];
|
||||
|
||||
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return NULL;
|
||||
}
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*width = rep.width;
|
||||
*height = rep.height;
|
||||
*outCount = rep.count;
|
||||
*width = rep.width;
|
||||
*height = rep.height;
|
||||
*outCount = rep.count;
|
||||
|
||||
buffers = Xmalloc(count * sizeof buffers[0]);
|
||||
if (buffers == NULL) {
|
||||
_XEatData(dpy, rep.count * sizeof repBuffer);
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return NULL;
|
||||
}
|
||||
buffers = Xmalloc(count * sizeof buffers[0]);
|
||||
if (buffers == NULL) {
|
||||
_XEatData(dpy, rep.count * sizeof repBuffer);
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < rep.count; i++) {
|
||||
_XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
|
||||
buffers[i].attachment = repBuffer.attachment;
|
||||
buffers[i].name = repBuffer.name;
|
||||
buffers[i].pitch = repBuffer.pitch;
|
||||
buffers[i].cpp = repBuffer.cpp;
|
||||
buffers[i].flags = repBuffer.flags;
|
||||
}
|
||||
for (i = 0; i < rep.count; i++) {
|
||||
_XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
|
||||
buffers[i].attachment = repBuffer.attachment;
|
||||
buffers[i].name = repBuffer.name;
|
||||
buffers[i].pitch = repBuffer.pitch;
|
||||
buffers[i].cpp = repBuffer.cpp;
|
||||
buffers[i].flags = repBuffer.flags;
|
||||
}
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return buffers;
|
||||
return buffers;
|
||||
}
|
||||
|
||||
void
|
||||
DRI2SwapBuffers(Display * dpy, XID drawable,
|
||||
int x, int y, int width, int height)
|
||||
void DRI2SwapBuffers(Display *dpy, XID drawable,
|
||||
int x, int y, int width, int height)
|
||||
{
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2SwapBuffersReq *req;
|
||||
xDRI2SwapBuffersReply rep;
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2SwapBuffersReq *req;
|
||||
xDRI2SwapBuffersReply rep;
|
||||
|
||||
XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
|
||||
XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2SwapBuffers, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2SwapBuffers;
|
||||
req->drawable = drawable;
|
||||
req->x = x;
|
||||
req->y = y;
|
||||
req->width = width;
|
||||
req->height = height;
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2SwapBuffers, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2SwapBuffers;
|
||||
req->drawable = drawable;
|
||||
req->x = x;
|
||||
req->y = y;
|
||||
req->width = width;
|
||||
req->height = height;
|
||||
|
||||
_XReply(dpy, (xReply *) & rep, 0, xFalse);
|
||||
_XReply(dpy, (xReply *)&rep, 0, xFalse);
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
||||
void
|
||||
DRI2DestroyDrawable(Display * dpy, XID drawable)
|
||||
void DRI2DestroyDrawable(Display *dpy, XID drawable)
|
||||
{
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2DestroyDrawableReq *req;
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2DestroyDrawableReq *req;
|
||||
|
||||
XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
|
||||
XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
|
||||
|
||||
XSync(dpy, False);
|
||||
XSync(dpy, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2DestroyDrawable, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2DestroyDrawable;
|
||||
req->drawable = drawable;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2DestroyDrawable, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2DestroyDrawable;
|
||||
req->drawable = drawable;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,31 +34,34 @@
|
|||
#ifndef _DRI2_H_
|
||||
#define _DRI2_H_
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int attachment;
|
||||
unsigned int name;
|
||||
unsigned int pitch;
|
||||
unsigned int cpp;
|
||||
unsigned int flags;
|
||||
typedef struct {
|
||||
unsigned int attachment;
|
||||
unsigned int name;
|
||||
unsigned int pitch;
|
||||
unsigned int cpp;
|
||||
unsigned int flags;
|
||||
} DRI2Buffer;
|
||||
|
||||
extern Bool
|
||||
DRI2QueryExtension(Display * display, int *eventBase, int *errorBase);
|
||||
extern Bool DRI2QueryVersion(Display * display, int *major, int *minor);
|
||||
DRI2QueryExtension(Display *display, int *eventBase, int *errorBase);
|
||||
extern Bool
|
||||
DRI2Connect(Display * display, int screen,
|
||||
char **driverName, char **busId, unsigned int *sareaHandle);
|
||||
DRI2QueryVersion(Display *display, int *major, int *minor);
|
||||
extern Bool
|
||||
DRI2AuthConnection(Display * display, int screen, drm_magic_t magic);
|
||||
extern void DRI2CreateDrawable(Display * display, XID drawable);
|
||||
extern void DRI2DestroyDrawable(Display * display, XID handle);
|
||||
extern DRI2Buffer *DRI2GetBuffers(Display * dpy, XID drawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments, int count,
|
||||
int *outCount);
|
||||
DRI2Connect(Display *display, int screen,
|
||||
char **driverName, char **busId, unsigned int *sareaHandle);
|
||||
extern Bool
|
||||
DRI2AuthConnection(Display *display, int screen, drm_magic_t magic);
|
||||
extern void
|
||||
DRI2SwapBuffers(Display * dpy, XID drawable,
|
||||
int x, int y, int width, int height);
|
||||
DRI2CreateDrawable(Display *display, XID drawable);
|
||||
extern void
|
||||
DRI2DestroyDrawable(Display *display, XID handle);
|
||||
extern DRI2Buffer *
|
||||
DRI2GetBuffers(Display *dpy, XID drawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments, int count,
|
||||
int *outCount);
|
||||
extern void
|
||||
DRI2SwapBuffers(Display *dpy, XID drawable,
|
||||
int x, int y, int width, int height);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -51,302 +51,292 @@ typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate;
|
|||
typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate;
|
||||
typedef struct __GLXDRIdrawablePrivateRec __GLXDRIdrawablePrivate;
|
||||
|
||||
struct __GLXDRIdisplayPrivateRec
|
||||
{
|
||||
__GLXDRIdisplay base;
|
||||
struct __GLXDRIdisplayPrivateRec {
|
||||
__GLXDRIdisplay base;
|
||||
|
||||
/*
|
||||
/*
|
||||
** XFree86-DRI version information
|
||||
*/
|
||||
int driMajor;
|
||||
int driMinor;
|
||||
int driPatch;
|
||||
int driMajor;
|
||||
int driMinor;
|
||||
int driPatch;
|
||||
};
|
||||
|
||||
struct __GLXDRIcontextPrivateRec
|
||||
{
|
||||
__GLXDRIcontext base;
|
||||
__DRIcontext *driContext;
|
||||
__GLXscreenConfigs *psc;
|
||||
struct __GLXDRIcontextPrivateRec {
|
||||
__GLXDRIcontext base;
|
||||
__DRIcontext *driContext;
|
||||
__GLXscreenConfigs *psc;
|
||||
};
|
||||
|
||||
struct __GLXDRIdrawablePrivateRec
|
||||
{
|
||||
__GLXDRIdrawable base;
|
||||
__DRIbuffer buffers[5];
|
||||
int bufferCount;
|
||||
int width, height;
|
||||
struct __GLXDRIdrawablePrivateRec {
|
||||
__GLXDRIdrawable base;
|
||||
__DRIbuffer buffers[5];
|
||||
int bufferCount;
|
||||
int width, height;
|
||||
};
|
||||
|
||||
static void
|
||||
dri2DestroyContext(__GLXDRIcontext * context,
|
||||
__GLXscreenConfigs * psc, Display * dpy)
|
||||
static void dri2DestroyContext(__GLXDRIcontext *context,
|
||||
__GLXscreenConfigs *psc, Display *dpy)
|
||||
{
|
||||
__GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
|
||||
const __DRIcoreExtension *core = pcp->psc->core;
|
||||
__GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
|
||||
const __DRIcoreExtension *core = pcp->psc->core;
|
||||
|
||||
(*core->destroyContext) (pcp->driContext);
|
||||
(*core->destroyContext)(pcp->driContext);
|
||||
|
||||
Xfree(pcp);
|
||||
Xfree(pcp);
|
||||
}
|
||||
|
||||
static Bool
|
||||
dri2BindContext(__GLXDRIcontext * context,
|
||||
__GLXDRIdrawable * draw, __GLXDRIdrawable * read)
|
||||
static Bool dri2BindContext(__GLXDRIcontext *context,
|
||||
__GLXDRIdrawable *draw, __GLXDRIdrawable *read)
|
||||
{
|
||||
__GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
|
||||
const __DRIcoreExtension *core = pcp->psc->core;
|
||||
__GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
|
||||
const __DRIcoreExtension *core = pcp->psc->core;
|
||||
|
||||
return (*core->bindContext) (pcp->driContext,
|
||||
draw->driDrawable, read->driDrawable);
|
||||
return (*core->bindContext)(pcp->driContext,
|
||||
draw->driDrawable,
|
||||
read->driDrawable);
|
||||
}
|
||||
|
||||
static void
|
||||
dri2UnbindContext(__GLXDRIcontext * context)
|
||||
static void dri2UnbindContext(__GLXDRIcontext *context)
|
||||
{
|
||||
__GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
|
||||
const __DRIcoreExtension *core = pcp->psc->core;
|
||||
__GLXDRIcontextPrivate *pcp = (__GLXDRIcontextPrivate *) context;
|
||||
const __DRIcoreExtension *core = pcp->psc->core;
|
||||
|
||||
(*core->unbindContext) (pcp->driContext);
|
||||
(*core->unbindContext)(pcp->driContext);
|
||||
}
|
||||
|
||||
static __GLXDRIcontext *
|
||||
dri2CreateContext(__GLXscreenConfigs * psc,
|
||||
const __GLcontextModes * mode,
|
||||
GLXContext gc, GLXContext shareList, int renderType)
|
||||
static __GLXDRIcontext *dri2CreateContext(__GLXscreenConfigs *psc,
|
||||
const __GLcontextModes *mode,
|
||||
GLXContext gc,
|
||||
GLXContext shareList, int renderType)
|
||||
{
|
||||
__GLXDRIcontextPrivate *pcp, *pcp_shared;
|
||||
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
|
||||
__DRIcontext *shared = NULL;
|
||||
__GLXDRIcontextPrivate *pcp, *pcp_shared;
|
||||
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
|
||||
__DRIcontext *shared = NULL;
|
||||
|
||||
if (shareList) {
|
||||
pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
|
||||
shared = pcp_shared->driContext;
|
||||
}
|
||||
if (shareList) {
|
||||
pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
|
||||
shared = pcp_shared->driContext;
|
||||
}
|
||||
|
||||
pcp = Xmalloc(sizeof *pcp);
|
||||
if (pcp == NULL)
|
||||
return NULL;
|
||||
pcp = Xmalloc(sizeof *pcp);
|
||||
if (pcp == NULL)
|
||||
return NULL;
|
||||
|
||||
pcp->psc = psc;
|
||||
pcp->driContext =
|
||||
(*psc->dri2->createNewContext) (psc->__driScreen,
|
||||
config->driConfig, shared, pcp);
|
||||
gc->__driContext = pcp->driContext;
|
||||
pcp->psc = psc;
|
||||
pcp->driContext =
|
||||
(*psc->dri2->createNewContext)(psc->__driScreen,
|
||||
config->driConfig, shared, pcp);
|
||||
gc->__driContext = pcp->driContext;
|
||||
|
||||
if (pcp->driContext == NULL) {
|
||||
Xfree(pcp);
|
||||
return NULL;
|
||||
}
|
||||
if (pcp->driContext == NULL) {
|
||||
Xfree(pcp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pcp->base.destroyContext = dri2DestroyContext;
|
||||
pcp->base.bindContext = dri2BindContext;
|
||||
pcp->base.unbindContext = dri2UnbindContext;
|
||||
pcp->base.destroyContext = dri2DestroyContext;
|
||||
pcp->base.bindContext = dri2BindContext;
|
||||
pcp->base.unbindContext = dri2UnbindContext;
|
||||
|
||||
return &pcp->base;
|
||||
return &pcp->base;
|
||||
}
|
||||
|
||||
static void
|
||||
dri2DestroyDrawable(__GLXDRIdrawable * pdraw)
|
||||
static void dri2DestroyDrawable(__GLXDRIdrawable *pdraw)
|
||||
{
|
||||
const __DRIcoreExtension *core = pdraw->psc->core;
|
||||
const __DRIcoreExtension *core = pdraw->psc->core;
|
||||
|
||||
(*core->destroyDrawable) (pdraw->driDrawable);
|
||||
DRI2DestroyDrawable(pdraw->psc->dpy, pdraw->drawable);
|
||||
Xfree(pdraw);
|
||||
(*core->destroyDrawable)(pdraw->driDrawable);
|
||||
DRI2DestroyDrawable(pdraw->psc->dpy, pdraw->drawable);
|
||||
Xfree(pdraw);
|
||||
}
|
||||
|
||||
static __GLXDRIdrawable *
|
||||
dri2CreateDrawable(__GLXscreenConfigs * psc,
|
||||
XID xDrawable,
|
||||
GLXDrawable drawable, const __GLcontextModes * modes)
|
||||
static __GLXDRIdrawable *dri2CreateDrawable(__GLXscreenConfigs *psc,
|
||||
XID xDrawable,
|
||||
GLXDrawable drawable,
|
||||
const __GLcontextModes *modes)
|
||||
{
|
||||
__GLXDRIdrawablePrivate *pdraw;
|
||||
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
|
||||
__GLXDRIdrawablePrivate *pdraw;
|
||||
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes;
|
||||
|
||||
pdraw = Xmalloc(sizeof(*pdraw));
|
||||
if (!pdraw)
|
||||
return NULL;
|
||||
pdraw = Xmalloc(sizeof(*pdraw));
|
||||
if (!pdraw)
|
||||
return NULL;
|
||||
|
||||
pdraw->base.destroyDrawable = dri2DestroyDrawable;
|
||||
pdraw->base.xDrawable = xDrawable;
|
||||
pdraw->base.drawable = drawable;
|
||||
pdraw->base.psc = psc;
|
||||
pdraw->base.destroyDrawable = dri2DestroyDrawable;
|
||||
pdraw->base.xDrawable = xDrawable;
|
||||
pdraw->base.drawable = drawable;
|
||||
pdraw->base.psc = psc;
|
||||
|
||||
DRI2CreateDrawable(psc->dpy, xDrawable);
|
||||
DRI2CreateDrawable(psc->dpy, xDrawable);
|
||||
|
||||
/* Create a new drawable */
|
||||
pdraw->base.driDrawable =
|
||||
(*psc->dri2->createNewDrawable) (psc->__driScreen,
|
||||
config->driConfig, pdraw);
|
||||
/* Create a new drawable */
|
||||
pdraw->base.driDrawable =
|
||||
(*psc->dri2->createNewDrawable)(psc->__driScreen,
|
||||
config->driConfig, pdraw);
|
||||
|
||||
if (!pdraw->base.driDrawable) {
|
||||
DRI2DestroyDrawable(psc->dpy, drawable);
|
||||
Xfree(pdraw);
|
||||
return NULL;
|
||||
}
|
||||
if (!pdraw->base.driDrawable) {
|
||||
DRI2DestroyDrawable(psc->dpy, drawable);
|
||||
Xfree(pdraw);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &pdraw->base;
|
||||
return &pdraw->base;
|
||||
}
|
||||
|
||||
static void
|
||||
dri2SwapBuffers(__GLXDRIdrawable * pdraw)
|
||||
static void dri2SwapBuffers(__GLXDRIdrawable *pdraw)
|
||||
{
|
||||
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
||||
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
||||
|
||||
DRI2SwapBuffers(pdraw->psc->dpy, pdraw->drawable,
|
||||
0, 0, priv->width, priv->height);
|
||||
DRI2SwapBuffers(pdraw->psc->dpy, pdraw->drawable,
|
||||
0, 0, priv->width, priv->height);
|
||||
}
|
||||
|
||||
static void
|
||||
dri2DestroyScreen(__GLXscreenConfigs * psc)
|
||||
static void dri2DestroyScreen(__GLXscreenConfigs *psc)
|
||||
{
|
||||
/* Free the direct rendering per screen data */
|
||||
(*psc->core->destroyScreen) (psc->__driScreen);
|
||||
drmClose(psc->fd);
|
||||
psc->__driScreen = NULL;
|
||||
/* Free the direct rendering per screen data */
|
||||
(*psc->core->destroyScreen)(psc->__driScreen);
|
||||
drmClose(psc->fd);
|
||||
psc->__driScreen = NULL;
|
||||
}
|
||||
|
||||
static __DRIbuffer *
|
||||
dri2GetBuffers(__DRIdrawable * driDrawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments, int count,
|
||||
int *out_count, void *loaderPrivate)
|
||||
dri2GetBuffers(__DRIdrawable *driDrawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments, int count,
|
||||
int *out_count, void *loaderPrivate)
|
||||
{
|
||||
__GLXDRIdrawablePrivate *pdraw = loaderPrivate;
|
||||
DRI2Buffer *buffers;
|
||||
int i;
|
||||
__GLXDRIdrawablePrivate *pdraw = loaderPrivate;
|
||||
DRI2Buffer *buffers;
|
||||
int i;
|
||||
|
||||
buffers = DRI2GetBuffers(pdraw->base.psc->dpy, pdraw->base.xDrawable,
|
||||
width, height, attachments, count, out_count);
|
||||
if (buffers == NULL)
|
||||
return NULL;
|
||||
buffers = DRI2GetBuffers(pdraw->base.psc->dpy, pdraw->base.xDrawable,
|
||||
width, height, attachments, count, out_count);
|
||||
if (buffers == NULL)
|
||||
return NULL;
|
||||
|
||||
pdraw->width = *width;
|
||||
pdraw->height = *height;
|
||||
pdraw->width = *width;
|
||||
pdraw->height = *height;
|
||||
|
||||
/* This assumes the DRI2 buffer attachment tokens matches the
|
||||
* __DRIbuffer tokens. */
|
||||
for (i = 0; i < *out_count; i++) {
|
||||
pdraw->buffers[i].attachment = buffers[i].attachment;
|
||||
pdraw->buffers[i].name = buffers[i].name;
|
||||
pdraw->buffers[i].pitch = buffers[i].pitch;
|
||||
pdraw->buffers[i].cpp = buffers[i].cpp;
|
||||
pdraw->buffers[i].flags = buffers[i].flags;
|
||||
}
|
||||
/* This assumes the DRI2 buffer attachment tokens matches the
|
||||
* __DRIbuffer tokens. */
|
||||
for (i = 0; i < *out_count; i++) {
|
||||
pdraw->buffers[i].attachment = buffers[i].attachment;
|
||||
pdraw->buffers[i].name = buffers[i].name;
|
||||
pdraw->buffers[i].pitch = buffers[i].pitch;
|
||||
pdraw->buffers[i].cpp = buffers[i].cpp;
|
||||
pdraw->buffers[i].flags = buffers[i].flags;
|
||||
}
|
||||
|
||||
Xfree(buffers);
|
||||
Xfree(buffers);
|
||||
|
||||
return pdraw->buffers;
|
||||
return pdraw->buffers;
|
||||
}
|
||||
|
||||
static const __DRIdri2LoaderExtension dri2LoaderExtension = {
|
||||
{__DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION},
|
||||
dri2GetBuffers,
|
||||
{ __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION },
|
||||
dri2GetBuffers,
|
||||
};
|
||||
|
||||
static const __DRIextension *loader_extensions[] = {
|
||||
&dri2LoaderExtension.base,
|
||||
&systemTimeExtension.base,
|
||||
NULL
|
||||
&dri2LoaderExtension.base,
|
||||
&systemTimeExtension.base,
|
||||
NULL
|
||||
};
|
||||
|
||||
static __GLXDRIscreen *
|
||||
dri2CreateScreen(__GLXscreenConfigs * psc, int screen,
|
||||
__GLXdisplayPrivate * priv)
|
||||
static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
|
||||
__GLXdisplayPrivate *priv)
|
||||
{
|
||||
const __DRIconfig **driver_configs;
|
||||
const __DRIextension **extensions;
|
||||
__GLXDRIscreen *psp;
|
||||
unsigned int sareaHandle;
|
||||
char *driverName, *busID;
|
||||
drm_magic_t magic;
|
||||
int i;
|
||||
const __DRIconfig **driver_configs;
|
||||
const __DRIextension **extensions;
|
||||
__GLXDRIscreen *psp;
|
||||
unsigned int sareaHandle;
|
||||
char *driverName, *busID;
|
||||
drm_magic_t magic;
|
||||
int i;
|
||||
|
||||
psp = Xmalloc(sizeof *psp);
|
||||
if (psp == NULL)
|
||||
return NULL;
|
||||
psp = Xmalloc(sizeof *psp);
|
||||
if (psp == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Initialize per screen dynamic client GLX extensions */
|
||||
psc->ext_list_first_time = GL_TRUE;
|
||||
/* Initialize per screen dynamic client GLX extensions */
|
||||
psc->ext_list_first_time = GL_TRUE;
|
||||
|
||||
if (!DRI2Connect(psc->dpy, screen, &driverName, &busID, &sareaHandle))
|
||||
return NULL;
|
||||
if (!DRI2Connect(psc->dpy, screen, &driverName, &busID, &sareaHandle))
|
||||
return NULL;
|
||||
|
||||
psc->driver = driOpenDriver(driverName);
|
||||
if (psc->driver == NULL)
|
||||
goto handle_error;
|
||||
psc->driver = driOpenDriver(driverName);
|
||||
if (psc->driver == NULL)
|
||||
goto handle_error;
|
||||
|
||||
extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
|
||||
if (extensions == NULL) {
|
||||
ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
|
||||
goto handle_error;
|
||||
}
|
||||
extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
|
||||
if (extensions == NULL) {
|
||||
ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
|
||||
psc->core = (__DRIcoreExtension *) extensions[i];
|
||||
if (strcmp(extensions[i]->name, __DRI_DRI2) == 0)
|
||||
psc->dri2 = (__DRIdri2Extension *) extensions[i];
|
||||
}
|
||||
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
if (strcmp(extensions[i]->name, __DRI_CORE) == 0)
|
||||
psc->core = (__DRIcoreExtension *) extensions[i];
|
||||
if (strcmp(extensions[i]->name, __DRI_DRI2) == 0)
|
||||
psc->dri2 = (__DRIdri2Extension *) extensions[i];
|
||||
}
|
||||
if (psc->core == NULL || psc->dri2 == NULL) {
|
||||
ErrorMessageF("core dri or dri2 extension not found\n");
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
if (psc->core == NULL || psc->dri2 == NULL) {
|
||||
ErrorMessageF("core dri or dri2 extension not found\n");
|
||||
goto handle_error;
|
||||
}
|
||||
psc->fd = drmOpen(NULL, busID);
|
||||
if (psc->fd < 0) {
|
||||
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
psc->fd = drmOpen(NULL, busID);
|
||||
if (psc->fd < 0) {
|
||||
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
if (drmGetMagic(psc->fd, &magic))
|
||||
return NULL;
|
||||
|
||||
if (drmGetMagic(psc->fd, &magic))
|
||||
return NULL;
|
||||
if (!DRI2AuthConnection(psc->dpy, screen, magic)) {
|
||||
ErrorMessageF("failed to authenticate drm access\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!DRI2AuthConnection(psc->dpy, screen, magic)) {
|
||||
ErrorMessageF("failed to authenticate drm access\n");
|
||||
return NULL;
|
||||
}
|
||||
psc->__driScreen =
|
||||
psc->dri2->createNewScreen(screen, psc->fd,
|
||||
loader_extensions, &driver_configs, psc);
|
||||
if (psc->__driScreen == NULL) {
|
||||
ErrorMessageF("failed to create dri screen\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
psc->__driScreen =
|
||||
psc->dri2->createNewScreen(screen, psc->fd,
|
||||
loader_extensions, &driver_configs, psc);
|
||||
if (psc->__driScreen == NULL) {
|
||||
ErrorMessageF("failed to create dri screen\n");
|
||||
return NULL;
|
||||
}
|
||||
driBindExtensions(psc, 1);
|
||||
|
||||
driBindExtensions(psc, 1);
|
||||
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
|
||||
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
|
||||
|
||||
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
|
||||
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
|
||||
psp->destroyScreen = dri2DestroyScreen;
|
||||
psp->createContext = dri2CreateContext;
|
||||
psp->createDrawable = dri2CreateDrawable;
|
||||
psp->swapBuffers = dri2SwapBuffers;
|
||||
|
||||
psp->destroyScreen = dri2DestroyScreen;
|
||||
psp->createContext = dri2CreateContext;
|
||||
psp->createDrawable = dri2CreateDrawable;
|
||||
psp->swapBuffers = dri2SwapBuffers;
|
||||
Xfree(driverName);
|
||||
Xfree(busID);
|
||||
|
||||
Xfree(driverName);
|
||||
Xfree(busID);
|
||||
|
||||
return psp;
|
||||
return psp;
|
||||
|
||||
handle_error:
|
||||
Xfree(driverName);
|
||||
Xfree(busID);
|
||||
Xfree(driverName);
|
||||
Xfree(busID);
|
||||
|
||||
/* FIXME: clean up here */
|
||||
/* FIXME: clean up here */
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Called from __glXFreeDisplayPrivate.
|
||||
*/
|
||||
static void
|
||||
dri2DestroyDisplay(__GLXDRIdisplay * dpy)
|
||||
static void dri2DestroyDisplay(__GLXDRIdisplay *dpy)
|
||||
{
|
||||
Xfree(dpy);
|
||||
Xfree(dpy);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -354,30 +344,29 @@ dri2DestroyDisplay(__GLXDRIdisplay * dpy)
|
|||
* This is called from __glXInitialize() when we are given a new
|
||||
* display pointer.
|
||||
*/
|
||||
_X_HIDDEN __GLXDRIdisplay *
|
||||
dri2CreateDisplay(Display * dpy)
|
||||
_X_HIDDEN __GLXDRIdisplay *dri2CreateDisplay(Display *dpy)
|
||||
{
|
||||
__GLXDRIdisplayPrivate *pdp;
|
||||
int eventBase, errorBase;
|
||||
__GLXDRIdisplayPrivate *pdp;
|
||||
int eventBase, errorBase;
|
||||
|
||||
if (!DRI2QueryExtension(dpy, &eventBase, &errorBase))
|
||||
return NULL;
|
||||
if (!DRI2QueryExtension(dpy, &eventBase, &errorBase))
|
||||
return NULL;
|
||||
|
||||
pdp = Xmalloc(sizeof *pdp);
|
||||
if (pdp == NULL)
|
||||
return NULL;
|
||||
pdp = Xmalloc(sizeof *pdp);
|
||||
if (pdp == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!DRI2QueryVersion(dpy, &pdp->driMajor, &pdp->driMinor)) {
|
||||
Xfree(pdp);
|
||||
return NULL;
|
||||
}
|
||||
if (!DRI2QueryVersion(dpy, &pdp->driMajor, &pdp->driMinor)) {
|
||||
Xfree(pdp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pdp->driPatch = 0;
|
||||
pdp->driPatch = 0;
|
||||
|
||||
pdp->base.destroyDisplay = dri2DestroyDisplay;
|
||||
pdp->base.createScreen = dri2CreateScreen;
|
||||
pdp->base.destroyDisplay = dri2DestroyDisplay;
|
||||
pdp->base.createScreen = dri2CreateScreen;
|
||||
|
||||
return &pdp->base;
|
||||
return &pdp->base;
|
||||
}
|
||||
|
||||
#endif /* GLX_DIRECT_RENDERING */
|
||||
|
|
|
|||
|
|
@ -50,35 +50,33 @@
|
|||
#define RTLD_GLOBAL 0
|
||||
#endif
|
||||
|
||||
_X_HIDDEN void
|
||||
InfoMessageF(const char *f, ...)
|
||||
_X_HIDDEN void InfoMessageF(const char *f, ...)
|
||||
{
|
||||
va_list args;
|
||||
const char *env;
|
||||
va_list args;
|
||||
const char *env;
|
||||
|
||||
if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) {
|
||||
fprintf(stderr, "libGL: ");
|
||||
va_start(args, f);
|
||||
vfprintf(stderr, f, args);
|
||||
va_end(args);
|
||||
}
|
||||
if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) {
|
||||
fprintf(stderr, "libGL: ");
|
||||
va_start(args, f);
|
||||
vfprintf(stderr, f, args);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print error to stderr, unless LIBGL_DEBUG=="quiet".
|
||||
*/
|
||||
_X_HIDDEN void
|
||||
ErrorMessageF(const char *f, ...)
|
||||
_X_HIDDEN void ErrorMessageF(const char *f, ...)
|
||||
{
|
||||
va_list args;
|
||||
const char *env;
|
||||
va_list args;
|
||||
const char *env;
|
||||
|
||||
if ((env = getenv("LIBGL_DEBUG")) && !strstr(env, "quiet")) {
|
||||
fprintf(stderr, "libGL error: ");
|
||||
va_start(args, f);
|
||||
vfprintf(stderr, f, args);
|
||||
va_end(args);
|
||||
}
|
||||
if ((env = getenv("LIBGL_DEBUG")) && !strstr(env, "quiet")) {
|
||||
fprintf(stderr, "libGL error: ");
|
||||
va_start(args, f);
|
||||
vfprintf(stderr, f, args);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DEFAULT_DRIVER_DIR
|
||||
|
|
@ -98,8 +96,7 @@ ErrorMessageF(const char *f, ...)
|
|||
* \returns
|
||||
* A handle from \c dlopen, or \c NULL if driver file not found.
|
||||
*/
|
||||
_X_HIDDEN void *
|
||||
driOpenDriver(const char *driverName)
|
||||
_X_HIDDEN void *driOpenDriver(const char *driverName)
|
||||
{
|
||||
void *glhandle, *handle;
|
||||
const char *libPaths, *p, *next;
|
||||
|
|
@ -114,41 +111,40 @@ driOpenDriver(const char *driverName)
|
|||
/* don't allow setuid apps to use LIBGL_DRIVERS_PATH */
|
||||
libPaths = getenv("LIBGL_DRIVERS_PATH");
|
||||
if (!libPaths)
|
||||
libPaths = getenv("LIBGL_DRIVERS_DIR"); /* deprecated */
|
||||
libPaths = getenv("LIBGL_DRIVERS_DIR"); /* deprecated */
|
||||
}
|
||||
if (libPaths == NULL)
|
||||
libPaths = DEFAULT_DRIVER_DIR;
|
||||
libPaths = DEFAULT_DRIVER_DIR;
|
||||
|
||||
handle = NULL;
|
||||
for (p = libPaths; *p; p = next) {
|
||||
next = strchr(p, ':');
|
||||
if (next == NULL) {
|
||||
len = strlen(p);
|
||||
next = p + len;
|
||||
}
|
||||
else {
|
||||
len = next - p;
|
||||
next++;
|
||||
}
|
||||
next = strchr(p, ':');
|
||||
if (next == NULL) {
|
||||
len = strlen(p);
|
||||
next = p + len;
|
||||
} else {
|
||||
len = next - p;
|
||||
next++;
|
||||
}
|
||||
|
||||
#ifdef GLX_USE_TLS
|
||||
snprintf(realDriverName, sizeof realDriverName,
|
||||
"%.*s/tls/%s_dri.so", len, p, driverName);
|
||||
"%.*s/tls/%s_dri.so", len, p, driverName);
|
||||
InfoMessageF("OpenDriver: trying %s\n", realDriverName);
|
||||
handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
|
||||
#endif
|
||||
|
||||
if (handle == NULL) {
|
||||
snprintf(realDriverName, sizeof realDriverName,
|
||||
"%.*s/%s_dri.so", len, p, driverName);
|
||||
InfoMessageF("OpenDriver: trying %s\n", realDriverName);
|
||||
handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
|
||||
if ( handle == NULL ) {
|
||||
snprintf(realDriverName, sizeof realDriverName,
|
||||
"%.*s/%s_dri.so", len, p, driverName);
|
||||
InfoMessageF("OpenDriver: trying %s\n", realDriverName);
|
||||
handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL);
|
||||
}
|
||||
|
||||
if (handle != NULL)
|
||||
break;
|
||||
if ( handle != NULL )
|
||||
break;
|
||||
else
|
||||
ErrorMessageF("dlopen %s failed (%s)\n", realDriverName, dlerror());
|
||||
ErrorMessageF("dlopen %s failed (%s)\n", realDriverName, dlerror());
|
||||
}
|
||||
|
||||
if (!handle)
|
||||
|
|
@ -161,248 +157,244 @@ driOpenDriver(const char *driverName)
|
|||
}
|
||||
|
||||
_X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension = {
|
||||
{__DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION},
|
||||
__glXGetUST,
|
||||
__driGetMscRateOML
|
||||
{ __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION },
|
||||
__glXGetUST,
|
||||
__driGetMscRateOML
|
||||
};
|
||||
|
||||
#define __ATTRIB(attrib, field) \
|
||||
{ attrib, offsetof(__GLcontextModes, field) }
|
||||
|
||||
static const struct
|
||||
{
|
||||
unsigned int attrib, offset;
|
||||
} attribMap[] = {
|
||||
__ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
|
||||
__ATTRIB(__DRI_ATTRIB_LEVEL, level),
|
||||
__ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
|
||||
__ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
|
||||
__ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
|
||||
__ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
|
||||
__ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
|
||||
__ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
|
||||
__ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
|
||||
__ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
|
||||
__ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
|
||||
__ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
|
||||
static const struct { unsigned int attrib, offset; } attribMap[] = {
|
||||
__ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
|
||||
__ATTRIB(__DRI_ATTRIB_LEVEL, level),
|
||||
__ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
|
||||
__ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
|
||||
__ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
|
||||
__ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
|
||||
__ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
|
||||
__ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
|
||||
__ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
|
||||
__ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
|
||||
__ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
|
||||
__ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
|
||||
#if 0
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentIndex),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
|
||||
__ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
|
||||
__ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
|
||||
__ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
|
||||
__ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentIndex),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
|
||||
__ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
|
||||
__ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
|
||||
__ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
|
||||
__ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
|
||||
#endif
|
||||
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
|
||||
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
|
||||
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
|
||||
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
|
||||
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
|
||||
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
|
||||
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
|
||||
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
|
||||
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
|
||||
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
|
||||
#if 0
|
||||
__ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
|
||||
__ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
|
||||
#endif
|
||||
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
|
||||
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
|
||||
__ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE,
|
||||
bindToMipmapTexture),
|
||||
__ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),};
|
||||
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
|
||||
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
|
||||
__ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture),
|
||||
__ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),
|
||||
};
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
|
||||
|
||||
static int
|
||||
scalarEqual(__GLcontextModes * mode, unsigned int attrib, unsigned int value)
|
||||
scalarEqual(__GLcontextModes *mode, unsigned int attrib, unsigned int value)
|
||||
{
|
||||
unsigned int glxValue;
|
||||
int i;
|
||||
unsigned int glxValue;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(attribMap); i++)
|
||||
if (attribMap[i].attrib == attrib) {
|
||||
glxValue = *(unsigned int *) ((char *) mode + attribMap[i].offset);
|
||||
return glxValue == GLX_DONT_CARE || glxValue == value;
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(attribMap); i++)
|
||||
if (attribMap[i].attrib == attrib) {
|
||||
glxValue = *(unsigned int *) ((char *) mode + attribMap[i].offset);
|
||||
return glxValue == GLX_DONT_CARE || glxValue == value;
|
||||
}
|
||||
|
||||
return GL_TRUE; /* Is a non-existing attribute equal to value? */
|
||||
return GL_TRUE; /* Is a non-existing attribute equal to value? */
|
||||
}
|
||||
|
||||
static int
|
||||
driConfigEqual(const __DRIcoreExtension * core,
|
||||
__GLcontextModes * modes, const __DRIconfig * driConfig)
|
||||
driConfigEqual(const __DRIcoreExtension *core,
|
||||
__GLcontextModes *modes, const __DRIconfig *driConfig)
|
||||
{
|
||||
unsigned int attrib, value, glxValue;
|
||||
int i;
|
||||
unsigned int attrib, value, glxValue;
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
|
||||
switch (attrib) {
|
||||
case __DRI_ATTRIB_RENDER_TYPE:
|
||||
glxValue = 0;
|
||||
if (value & __DRI_ATTRIB_RGBA_BIT) {
|
||||
glxValue |= GLX_RGBA_BIT;
|
||||
}
|
||||
else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
|
||||
glxValue |= GLX_COLOR_INDEX_BIT;
|
||||
}
|
||||
if (glxValue != modes->renderType)
|
||||
return GL_FALSE;
|
||||
break;
|
||||
i = 0;
|
||||
while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
|
||||
switch (attrib) {
|
||||
case __DRI_ATTRIB_RENDER_TYPE:
|
||||
glxValue = 0;
|
||||
if (value & __DRI_ATTRIB_RGBA_BIT) {
|
||||
glxValue |= GLX_RGBA_BIT;
|
||||
} else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
|
||||
glxValue |= GLX_COLOR_INDEX_BIT;
|
||||
}
|
||||
if (glxValue != modes->renderType)
|
||||
return GL_FALSE;
|
||||
break;
|
||||
|
||||
case __DRI_ATTRIB_CONFIG_CAVEAT:
|
||||
if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
|
||||
glxValue = GLX_NON_CONFORMANT_CONFIG;
|
||||
else if (value & __DRI_ATTRIB_SLOW_BIT)
|
||||
glxValue = GLX_SLOW_CONFIG;
|
||||
else
|
||||
glxValue = GLX_NONE;
|
||||
if (glxValue != modes->visualRating)
|
||||
return GL_FALSE;
|
||||
break;
|
||||
case __DRI_ATTRIB_CONFIG_CAVEAT:
|
||||
if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
|
||||
glxValue = GLX_NON_CONFORMANT_CONFIG;
|
||||
else if (value & __DRI_ATTRIB_SLOW_BIT)
|
||||
glxValue = GLX_SLOW_CONFIG;
|
||||
else
|
||||
glxValue = GLX_NONE;
|
||||
if (glxValue != modes->visualRating)
|
||||
return GL_FALSE;
|
||||
break;
|
||||
|
||||
case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
|
||||
glxValue = 0;
|
||||
if (value & __DRI_ATTRIB_TEXTURE_1D_BIT)
|
||||
glxValue |= GLX_TEXTURE_1D_BIT_EXT;
|
||||
if (value & __DRI_ATTRIB_TEXTURE_2D_BIT)
|
||||
glxValue |= GLX_TEXTURE_2D_BIT_EXT;
|
||||
if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
|
||||
glxValue |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
|
||||
if (modes->bindToTextureTargets != GLX_DONT_CARE &&
|
||||
glxValue != modes->bindToTextureTargets)
|
||||
return GL_FALSE;
|
||||
break;
|
||||
case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
|
||||
glxValue = 0;
|
||||
if (value & __DRI_ATTRIB_TEXTURE_1D_BIT)
|
||||
glxValue |= GLX_TEXTURE_1D_BIT_EXT;
|
||||
if (value & __DRI_ATTRIB_TEXTURE_2D_BIT)
|
||||
glxValue |= GLX_TEXTURE_2D_BIT_EXT;
|
||||
if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
|
||||
glxValue |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
|
||||
if (modes->bindToTextureTargets != GLX_DONT_CARE &&
|
||||
glxValue != modes->bindToTextureTargets)
|
||||
return GL_FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!scalarEqual(modes, attrib, value))
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
default:
|
||||
if (!scalarEqual(modes, attrib, value))
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static __GLcontextModes *
|
||||
createDriMode(const __DRIcoreExtension * core,
|
||||
__GLcontextModes * modes, const __DRIconfig ** driConfigs)
|
||||
createDriMode(const __DRIcoreExtension *core,
|
||||
__GLcontextModes *modes, const __DRIconfig **driConfigs)
|
||||
{
|
||||
__GLXDRIconfigPrivate *config;
|
||||
int i;
|
||||
__GLXDRIconfigPrivate *config;
|
||||
int i;
|
||||
|
||||
for (i = 0; driConfigs[i]; i++) {
|
||||
if (driConfigEqual(core, modes, driConfigs[i]))
|
||||
break;
|
||||
}
|
||||
for (i = 0; driConfigs[i]; i++) {
|
||||
if (driConfigEqual(core, modes, driConfigs[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
if (driConfigs[i] == NULL)
|
||||
return NULL;
|
||||
if (driConfigs[i] == NULL)
|
||||
return NULL;
|
||||
|
||||
config = Xmalloc(sizeof *config);
|
||||
if (config == NULL)
|
||||
return NULL;
|
||||
config = Xmalloc(sizeof *config);
|
||||
if (config == NULL)
|
||||
return NULL;
|
||||
|
||||
config->modes = *modes;
|
||||
config->driConfig = driConfigs[i];
|
||||
config->modes = *modes;
|
||||
config->driConfig = driConfigs[i];
|
||||
|
||||
return &config->modes;
|
||||
return &config->modes;
|
||||
}
|
||||
|
||||
_X_HIDDEN __GLcontextModes *
|
||||
driConvertConfigs(const __DRIcoreExtension * core,
|
||||
__GLcontextModes * modes, const __DRIconfig ** configs)
|
||||
driConvertConfigs(const __DRIcoreExtension *core,
|
||||
__GLcontextModes *modes, const __DRIconfig **configs)
|
||||
{
|
||||
__GLcontextModes head, *tail, *m;
|
||||
__GLcontextModes head, *tail, *m;
|
||||
|
||||
tail = &head;
|
||||
head.next = NULL;
|
||||
for (m = modes; m; m = m->next) {
|
||||
tail->next = createDriMode(core, m, configs);
|
||||
if (tail->next == NULL) {
|
||||
/* no matching dri config for m */
|
||||
continue;
|
||||
}
|
||||
tail = &head;
|
||||
head.next = NULL;
|
||||
for (m = modes; m; m = m->next) {
|
||||
tail->next = createDriMode(core, m, configs);
|
||||
if (tail->next == NULL) {
|
||||
/* no matching dri config for m */
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
tail = tail->next;
|
||||
}
|
||||
tail = tail->next;
|
||||
}
|
||||
|
||||
_gl_context_modes_destroy(modes);
|
||||
_gl_context_modes_destroy(modes);
|
||||
|
||||
return head.next;
|
||||
return head.next;
|
||||
}
|
||||
|
||||
_X_HIDDEN void
|
||||
driBindExtensions(__GLXscreenConfigs * psc, int dri2)
|
||||
driBindExtensions(__GLXscreenConfigs *psc, int dri2)
|
||||
{
|
||||
const __DRIextension **extensions;
|
||||
int i;
|
||||
const __DRIextension **extensions;
|
||||
int i;
|
||||
|
||||
extensions = psc->core->getExtensions(psc->__driScreen);
|
||||
extensions = psc->core->getExtensions(psc->__driScreen);
|
||||
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
#ifdef __DRI_COPY_SUB_BUFFER
|
||||
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
|
||||
psc->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer_bit");
|
||||
}
|
||||
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
|
||||
psc->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer_bit");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_SWAP_CONTROL
|
||||
if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
|
||||
psc->swapControl = (__DRIswapControlExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_SGI_swap_control");
|
||||
__glXEnableDirectExtension(psc, "GLX_MESA_swap_control");
|
||||
}
|
||||
if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
|
||||
psc->swapControl = (__DRIswapControlExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_SGI_swap_control");
|
||||
__glXEnableDirectExtension(psc, "GLX_MESA_swap_control");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_ALLOCATE
|
||||
if (strcmp(extensions[i]->name, __DRI_ALLOCATE) == 0) {
|
||||
psc->allocate = (__DRIallocateExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_MESA_allocate_memory");
|
||||
}
|
||||
if (strcmp(extensions[i]->name, __DRI_ALLOCATE) == 0) {
|
||||
psc->allocate = (__DRIallocateExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_MESA_allocate_memory");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_FRAME_TRACKING
|
||||
if (strcmp(extensions[i]->name, __DRI_FRAME_TRACKING) == 0) {
|
||||
psc->frameTracking = (__DRIframeTrackingExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_MESA_swap_frame_usage");
|
||||
}
|
||||
if (strcmp(extensions[i]->name, __DRI_FRAME_TRACKING) == 0) {
|
||||
psc->frameTracking = (__DRIframeTrackingExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_MESA_swap_frame_usage");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_MEDIA_STREAM_COUNTER
|
||||
if (strcmp(extensions[i]->name, __DRI_MEDIA_STREAM_COUNTER) == 0) {
|
||||
psc->msc = (__DRImediaStreamCounterExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_SGI_video_sync");
|
||||
}
|
||||
if (strcmp(extensions[i]->name, __DRI_MEDIA_STREAM_COUNTER) == 0) {
|
||||
psc->msc = (__DRImediaStreamCounterExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_SGI_video_sync");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_SWAP_BUFFER_COUNTER
|
||||
/* No driver supports this at this time and the extension is
|
||||
* not defined in dri_interface.h. Will enable
|
||||
* GLX_OML_sync_control if implemented. */
|
||||
/* No driver supports this at this time and the extension is
|
||||
* not defined in dri_interface.h. Will enable
|
||||
* GLX_OML_sync_control if implemented. */
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_READ_DRAWABLE
|
||||
if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
|
||||
__glXEnableDirectExtension(psc, "GLX_SGI_make_current_read");
|
||||
}
|
||||
if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
|
||||
__glXEnableDirectExtension(psc, "GLX_SGI_make_current_read");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_TEX_BUFFER
|
||||
if ((strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) && dri2) {
|
||||
psc->texBuffer = (__DRItexBufferExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_EXT_texture_from_pixmap");
|
||||
}
|
||||
if ((strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) && dri2) {
|
||||
psc->texBuffer = (__DRItexBufferExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_EXT_texture_from_pixmap");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Ignore unknown extensions */
|
||||
}
|
||||
/* Ignore unknown extensions */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* GLX_DIRECT_RENDERING */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -81,7 +81,7 @@
|
|||
|
||||
|
||||
|
||||
#define GLX_MAJOR_VERSION 1 /* current version numbers */
|
||||
#define GLX_MAJOR_VERSION 1 /* current version numbers */
|
||||
#define GLX_MINOR_VERSION 4
|
||||
|
||||
#define __GLX_MAX_TEXTURE_UNITS 32
|
||||
|
|
@ -113,73 +113,70 @@ typedef struct __GLXDRIcontextRec __GLXDRIcontext;
|
|||
|
||||
#include "glxextensions.h"
|
||||
|
||||
struct __GLXDRIdisplayRec
|
||||
{
|
||||
struct __GLXDRIdisplayRec {
|
||||
/**
|
||||
* Method to destroy the private DRI display data.
|
||||
*/
|
||||
void (*destroyDisplay) (__GLXDRIdisplay * display);
|
||||
void (*destroyDisplay)(__GLXDRIdisplay *display);
|
||||
|
||||
__GLXDRIscreen *(*createScreen) (__GLXscreenConfigs * psc, int screen,
|
||||
__GLXdisplayPrivate * priv);
|
||||
__GLXDRIscreen *(*createScreen)(__GLXscreenConfigs *psc, int screen,
|
||||
__GLXdisplayPrivate *priv);
|
||||
};
|
||||
|
||||
struct __GLXDRIscreenRec
|
||||
{
|
||||
struct __GLXDRIscreenRec {
|
||||
|
||||
void (*destroyScreen) (__GLXscreenConfigs * psc);
|
||||
void (*destroyScreen)(__GLXscreenConfigs *psc);
|
||||
|
||||
__GLXDRIcontext *(*createContext) (__GLXscreenConfigs * psc,
|
||||
const __GLcontextModes * mode,
|
||||
GLXContext gc,
|
||||
GLXContext shareList, int renderType);
|
||||
__GLXDRIcontext *(*createContext)(__GLXscreenConfigs *psc,
|
||||
const __GLcontextModes *mode,
|
||||
GLXContext gc,
|
||||
GLXContext shareList, int renderType);
|
||||
|
||||
__GLXDRIdrawable *(*createDrawable)(__GLXscreenConfigs *psc,
|
||||
XID drawable,
|
||||
GLXDrawable glxDrawable,
|
||||
const __GLcontextModes *modes);
|
||||
|
||||
__GLXDRIdrawable *(*createDrawable) (__GLXscreenConfigs * psc,
|
||||
XID drawable,
|
||||
GLXDrawable glxDrawable,
|
||||
const __GLcontextModes * modes);
|
||||
|
||||
void (*swapBuffers) (__GLXDRIdrawable * pdraw);
|
||||
void (*swapBuffers)(__GLXDRIdrawable *pdraw);
|
||||
};
|
||||
|
||||
struct __GLXDRIcontextRec
|
||||
{
|
||||
void (*destroyContext) (__GLXDRIcontext * context,
|
||||
__GLXscreenConfigs * psc, Display * dpy);
|
||||
Bool(*bindContext) (__GLXDRIcontext * context, __GLXDRIdrawable * pdraw,
|
||||
__GLXDRIdrawable * pread);
|
||||
|
||||
void (*unbindContext) (__GLXDRIcontext * context);
|
||||
struct __GLXDRIcontextRec {
|
||||
void (*destroyContext)(__GLXDRIcontext *context, __GLXscreenConfigs *psc,
|
||||
Display *dpy);
|
||||
Bool (*bindContext)(__GLXDRIcontext *context,
|
||||
__GLXDRIdrawable *pdraw,
|
||||
__GLXDRIdrawable *pread);
|
||||
|
||||
void (*unbindContext)(__GLXDRIcontext *context);
|
||||
};
|
||||
|
||||
struct __GLXDRIdrawableRec
|
||||
{
|
||||
void (*destroyDrawable) (__GLXDRIdrawable * drawable);
|
||||
struct __GLXDRIdrawableRec {
|
||||
void (*destroyDrawable)(__GLXDRIdrawable *drawable);
|
||||
|
||||
XID xDrawable;
|
||||
XID drawable;
|
||||
__GLXscreenConfigs *psc;
|
||||
GLenum textureTarget;
|
||||
__DRIdrawable *driDrawable;
|
||||
XID xDrawable;
|
||||
XID drawable;
|
||||
__GLXscreenConfigs *psc;
|
||||
GLenum textureTarget;
|
||||
__DRIdrawable *driDrawable;
|
||||
};
|
||||
|
||||
/*
|
||||
** Function to create and DRI display data and initialize the display
|
||||
** dependent methods.
|
||||
*/
|
||||
extern __GLXDRIdisplay *driswCreateDisplay(Display * dpy);
|
||||
extern __GLXDRIdisplay *driCreateDisplay(Display * dpy);
|
||||
extern __GLXDRIdisplay *dri2CreateDisplay(Display * dpy);
|
||||
extern __GLXDRIdisplay *driswCreateDisplay(Display *dpy);
|
||||
extern __GLXDRIdisplay *driCreateDisplay(Display *dpy);
|
||||
extern __GLXDRIdisplay *dri2CreateDisplay(Display *dpy);
|
||||
|
||||
extern void DRI_glXUseXFont(Font font, int first, int count, int listbase);
|
||||
extern void DRI_glXUseXFont( Font font, int first, int count, int listbase );
|
||||
|
||||
/*
|
||||
** Functions to obtain driver configuration information from a direct
|
||||
** rendering client application
|
||||
*/
|
||||
extern const char *glXGetScreenDriver(Display * dpy, int scrNum);
|
||||
extern const char *glXGetScreenDriver (Display *dpy, int scrNum);
|
||||
|
||||
extern const char *glXGetDriverConfig(const char *driverName);
|
||||
extern const char *glXGetDriverConfig (const char *driverName);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -187,57 +184,53 @@ extern const char *glXGetDriverConfig(const char *driverName);
|
|||
|
||||
#define __GL_CLIENT_ATTRIB_STACK_DEPTH 16
|
||||
|
||||
typedef struct __GLXpixelStoreModeRec
|
||||
{
|
||||
GLboolean swapEndian;
|
||||
GLboolean lsbFirst;
|
||||
GLuint rowLength;
|
||||
GLuint imageHeight;
|
||||
GLuint imageDepth;
|
||||
GLuint skipRows;
|
||||
GLuint skipPixels;
|
||||
GLuint skipImages;
|
||||
GLuint alignment;
|
||||
typedef struct __GLXpixelStoreModeRec {
|
||||
GLboolean swapEndian;
|
||||
GLboolean lsbFirst;
|
||||
GLuint rowLength;
|
||||
GLuint imageHeight;
|
||||
GLuint imageDepth;
|
||||
GLuint skipRows;
|
||||
GLuint skipPixels;
|
||||
GLuint skipImages;
|
||||
GLuint alignment;
|
||||
} __GLXpixelStoreMode;
|
||||
|
||||
|
||||
typedef struct __GLXattributeRec
|
||||
{
|
||||
GLuint mask;
|
||||
typedef struct __GLXattributeRec {
|
||||
GLuint mask;
|
||||
|
||||
/**
|
||||
* Pixel storage state. Most of the pixel store mode state is kept
|
||||
* here and used by the client code to manage the packing and
|
||||
* unpacking of data sent to/received from the server.
|
||||
*/
|
||||
__GLXpixelStoreMode storePack, storeUnpack;
|
||||
__GLXpixelStoreMode storePack, storeUnpack;
|
||||
|
||||
/**
|
||||
* Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically
|
||||
* disabled?
|
||||
*/
|
||||
GLboolean NoDrawArraysProtocol;
|
||||
|
||||
GLboolean NoDrawArraysProtocol;
|
||||
|
||||
/**
|
||||
* Vertex Array storage state. The vertex array component
|
||||
* state is stored here and is used to manage the packing of
|
||||
* DrawArrays data sent to the server.
|
||||
*/
|
||||
struct array_state_vector *array_state;
|
||||
struct array_state_vector * array_state;
|
||||
} __GLXattribute;
|
||||
|
||||
typedef struct __GLXattributeMachineRec
|
||||
{
|
||||
__GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
|
||||
__GLXattribute **stackPointer;
|
||||
typedef struct __GLXattributeMachineRec {
|
||||
__GLXattribute *stack[__GL_CLIENT_ATTRIB_STACK_DEPTH];
|
||||
__GLXattribute **stackPointer;
|
||||
} __GLXattributeMachine;
|
||||
|
||||
/**
|
||||
* GLX state that needs to be kept on the client. One of these records
|
||||
* exist for each context that has been made current by this client.
|
||||
*/
|
||||
struct __GLXcontextRec
|
||||
{
|
||||
struct __GLXcontextRec {
|
||||
/**
|
||||
* \name Drawing command buffer.
|
||||
*
|
||||
|
|
@ -254,13 +247,13 @@ struct __GLXcontextRec
|
|||
* These must be the first 6 fields since they are static initialized
|
||||
* in the dummy context in glxext.c
|
||||
*/
|
||||
/*@{ */
|
||||
GLubyte *buf;
|
||||
GLubyte *pc;
|
||||
GLubyte *limit;
|
||||
GLubyte *bufEnd;
|
||||
GLint bufSize;
|
||||
/*@} */
|
||||
/*@{*/
|
||||
GLubyte *buf;
|
||||
GLubyte *pc;
|
||||
GLubyte *limit;
|
||||
GLubyte *bufEnd;
|
||||
GLint bufSize;
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* The XID of this rendering context. When the context is created a
|
||||
|
|
@ -268,24 +261,24 @@ struct __GLXcontextRec
|
|||
* destroyed but is still current to some thread. In this case the
|
||||
* context will be freed on next MakeCurrent.
|
||||
*/
|
||||
XID xid;
|
||||
XID xid;
|
||||
|
||||
/**
|
||||
* The XID of the \c shareList context.
|
||||
*/
|
||||
XID share_xid;
|
||||
XID share_xid;
|
||||
|
||||
/**
|
||||
* Screen number.
|
||||
*/
|
||||
GLint screen;
|
||||
__GLXscreenConfigs *psc;
|
||||
GLint screen;
|
||||
__GLXscreenConfigs *psc;
|
||||
|
||||
/**
|
||||
* \c GL_TRUE if the context was created with ImportContext, which
|
||||
* means the server-side context was created by another X client.
|
||||
*/
|
||||
GLboolean imported;
|
||||
GLboolean imported;
|
||||
|
||||
/**
|
||||
* The context tag returned by MakeCurrent when this context is made
|
||||
|
|
@ -295,7 +288,7 @@ struct __GLXcontextRec
|
|||
* \c WaitX, \c WaitGL, \c UseXFont, and \c MakeCurrent (for the old
|
||||
* context)).
|
||||
*/
|
||||
GLXContextTag currentContextTag;
|
||||
GLXContextTag currentContextTag;
|
||||
|
||||
/**
|
||||
* \name Rendering mode
|
||||
|
|
@ -304,11 +297,11 @@ struct __GLXcontextRec
|
|||
* When \c glRenderMode is called, the buffer associated with the
|
||||
* previous rendering mode (feedback or select) is filled.
|
||||
*/
|
||||
/*@{ */
|
||||
GLenum renderMode;
|
||||
GLfloat *feedbackBuf;
|
||||
GLuint *selectBuf;
|
||||
/*@} */
|
||||
/*@{*/
|
||||
GLenum renderMode;
|
||||
GLfloat *feedbackBuf;
|
||||
GLuint *selectBuf;
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* This is \c GL_TRUE if the pixel unpack modes are such that an image
|
||||
|
|
@ -316,43 +309,43 @@ struct __GLXcontextRec
|
|||
* still be true that the server will have to do some work. This
|
||||
* just promises that a straight copy will fetch the correct bytes.
|
||||
*/
|
||||
GLboolean fastImageUnpack;
|
||||
GLboolean fastImageUnpack;
|
||||
|
||||
/**
|
||||
* Fill newImage with the unpacked form of \c oldImage getting it
|
||||
* ready for transport to the server.
|
||||
*/
|
||||
void (*fillImage) (__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
|
||||
GLenum, const GLvoid *, GLubyte *, GLubyte *);
|
||||
void (*fillImage)(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
|
||||
GLenum, const GLvoid*, GLubyte*, GLubyte*);
|
||||
|
||||
/**
|
||||
* Client side attribs.
|
||||
*/
|
||||
__GLXattributeMachine attributes;
|
||||
__GLXattributeMachine attributes;
|
||||
|
||||
/**
|
||||
* Client side error code. This is set when client side gl API
|
||||
* routines need to set an error because of a bad enumerant or
|
||||
* running out of memory, etc.
|
||||
*/
|
||||
GLenum error;
|
||||
GLenum error;
|
||||
|
||||
/**
|
||||
* Whether this context does direct rendering.
|
||||
*/
|
||||
Bool isDirect;
|
||||
Bool isDirect;
|
||||
|
||||
/**
|
||||
* \c dpy of current display for this context. Will be \c NULL if not
|
||||
* current to any display, or if this is the "dummy context".
|
||||
*/
|
||||
Display *currentDpy;
|
||||
Display *currentDpy;
|
||||
|
||||
/**
|
||||
* The current drawable for this context. Will be None if this
|
||||
* context is not current to any drawable. currentReadable is below.
|
||||
*/
|
||||
GLXDrawable currentDrawable;
|
||||
GLXDrawable currentDrawable;
|
||||
|
||||
/**
|
||||
* \name GL Constant Strings
|
||||
|
|
@ -361,38 +354,38 @@ struct __GLXcontextRec
|
|||
* These pertain to GL attributes, not to be confused with
|
||||
* GLX versioning attributes.
|
||||
*/
|
||||
/*@{ */
|
||||
GLubyte *vendor;
|
||||
GLubyte *renderer;
|
||||
GLubyte *version;
|
||||
GLubyte *extensions;
|
||||
/*@} */
|
||||
/*@{*/
|
||||
GLubyte *vendor;
|
||||
GLubyte *renderer;
|
||||
GLubyte *version;
|
||||
GLubyte *extensions;
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Record the dpy this context was created on for later freeing
|
||||
*/
|
||||
Display *createDpy;
|
||||
Display *createDpy;
|
||||
|
||||
/**
|
||||
* Maximum small render command size. This is the smaller of 64k and
|
||||
* the size of the above buffer.
|
||||
*/
|
||||
GLint maxSmallRenderCommandSize;
|
||||
GLint maxSmallRenderCommandSize;
|
||||
|
||||
/**
|
||||
* Major opcode for the extension. Copied here so a lookup isn't
|
||||
* needed.
|
||||
*/
|
||||
GLint majorOpcode;
|
||||
GLint majorOpcode;
|
||||
|
||||
/**
|
||||
* Pointer to the mode used to create this context.
|
||||
*/
|
||||
const __GLcontextModes *mode;
|
||||
const __GLcontextModes * mode;
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
__GLXDRIcontext *driContext;
|
||||
__DRIcontext *__driContext;
|
||||
__GLXDRIcontext *driContext;
|
||||
__DRIcontext *__driContext;
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
@ -401,7 +394,7 @@ struct __GLXcontextRec
|
|||
*
|
||||
* \since Internal API version 20030606.
|
||||
*/
|
||||
GLXDrawable currentReadable;
|
||||
GLXDrawable currentReadable;
|
||||
|
||||
/**
|
||||
* Pointer to client-state data that is private to libGL. This is only
|
||||
|
|
@ -410,13 +403,13 @@ struct __GLXcontextRec
|
|||
* No internal API version change was made for this change. Client-side
|
||||
* drivers should NEVER use this data or even care that it exists.
|
||||
*/
|
||||
void *client_state_private;
|
||||
void * client_state_private;
|
||||
|
||||
/**
|
||||
* Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE.
|
||||
*/
|
||||
int renderType;
|
||||
|
||||
|
||||
/**
|
||||
* \name Raw server GL version
|
||||
*
|
||||
|
|
@ -424,12 +417,12 @@ struct __GLXcontextRec
|
|||
* returned by the server, and it may not reflect what is actually
|
||||
* supported (or reported) by the client-side library.
|
||||
*/
|
||||
/*@{ */
|
||||
/*@{*/
|
||||
int server_major; /**< Major version number. */
|
||||
int server_minor; /**< Minor version number. */
|
||||
/*@} */
|
||||
/*@}*/
|
||||
|
||||
char gl_extension_bits[__GL_EXT_BYTES];
|
||||
char gl_extension_bits[ __GL_EXT_BYTES ];
|
||||
};
|
||||
|
||||
#define __glXSetError(gc,code) \
|
||||
|
|
@ -471,57 +464,56 @@ 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).
|
||||
*/
|
||||
struct __GLXscreenConfigsRec
|
||||
{
|
||||
struct __GLXscreenConfigsRec {
|
||||
/**
|
||||
* GLX extension string reported by the X-server.
|
||||
*/
|
||||
const char *serverGLXexts;
|
||||
const char *serverGLXexts;
|
||||
|
||||
/**
|
||||
* GLX extension string to be reported to applications. This is the
|
||||
* set of extensions that the application can actually use.
|
||||
*/
|
||||
char *effectiveGLXexts;
|
||||
char *effectiveGLXexts;
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
/**
|
||||
* Per screen direct rendering interface functions and data.
|
||||
*/
|
||||
__DRIscreen *__driScreen;
|
||||
const __DRIcoreExtension *core;
|
||||
const __DRIlegacyExtension *legacy;
|
||||
const __DRIswrastExtension *swrast;
|
||||
const __DRIdri2Extension *dri2;
|
||||
__glxHashTable *drawHash;
|
||||
Display *dpy;
|
||||
int scr, fd;
|
||||
void *driver;
|
||||
__DRIscreen *__driScreen;
|
||||
const __DRIcoreExtension *core;
|
||||
const __DRIlegacyExtension *legacy;
|
||||
const __DRIswrastExtension *swrast;
|
||||
const __DRIdri2Extension *dri2;
|
||||
__glxHashTable *drawHash;
|
||||
Display *dpy;
|
||||
int scr, fd;
|
||||
void *driver;
|
||||
|
||||
__GLXDRIscreen *driScreen;
|
||||
__GLXDRIscreen *driScreen;
|
||||
|
||||
#ifdef __DRI_COPY_SUB_BUFFER
|
||||
const __DRIcopySubBufferExtension *copySubBuffer;
|
||||
const __DRIcopySubBufferExtension *copySubBuffer;
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_SWAP_CONTROL
|
||||
const __DRIswapControlExtension *swapControl;
|
||||
const __DRIswapControlExtension *swapControl;
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_ALLOCATE
|
||||
const __DRIallocateExtension *allocate;
|
||||
const __DRIallocateExtension *allocate;
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_FRAME_TRACKING
|
||||
const __DRIframeTrackingExtension *frameTracking;
|
||||
const __DRIframeTrackingExtension *frameTracking;
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_MEDIA_STREAM_COUNTER
|
||||
const __DRImediaStreamCounterExtension *msc;
|
||||
const __DRImediaStreamCounterExtension *msc;
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_TEX_BUFFER
|
||||
const __DRItexBufferExtension *texBuffer;
|
||||
const __DRItexBufferExtension *texBuffer;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -529,7 +521,7 @@ struct __GLXscreenConfigsRec
|
|||
/**
|
||||
* Linked list of glx visuals and fbconfigs for this screen.
|
||||
*/
|
||||
__GLcontextModes *visuals, *configs;
|
||||
__GLcontextModes *visuals, *configs;
|
||||
|
||||
/**
|
||||
* Per-screen dynamic GLX extension tracking. The \c direct_support
|
||||
|
|
@ -538,10 +530,10 @@ struct __GLXscreenConfigsRec
|
|||
* this field. The \c __GLXscreenConfigs structure is not used outside
|
||||
* libGL.
|
||||
*/
|
||||
/*@{ */
|
||||
unsigned char direct_support[8];
|
||||
GLboolean ext_list_first_time;
|
||||
/*@} */
|
||||
/*@{*/
|
||||
unsigned char direct_support[8];
|
||||
GLboolean ext_list_first_time;
|
||||
/*@}*/
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -549,27 +541,26 @@ struct __GLXscreenConfigsRec
|
|||
* Per display private data. One of these records exists for each display
|
||||
* that is using the OpenGL (GLX) extension.
|
||||
*/
|
||||
struct __GLXdisplayPrivateRec
|
||||
{
|
||||
struct __GLXdisplayPrivateRec {
|
||||
/**
|
||||
* Back pointer to the display
|
||||
*/
|
||||
Display *dpy;
|
||||
Display *dpy;
|
||||
|
||||
/**
|
||||
* The \c majorOpcode is common to all connections to the same server.
|
||||
* It is also copied into the context structure.
|
||||
*/
|
||||
int majorOpcode;
|
||||
int majorOpcode;
|
||||
|
||||
/**
|
||||
* \name Server Version
|
||||
*
|
||||
* Major and minor version returned by the server during initialization.
|
||||
*/
|
||||
/*@{ */
|
||||
int majorVersion, minorVersion;
|
||||
/*@} */
|
||||
/*@{*/
|
||||
int majorVersion, minorVersion;
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name Storage for the servers GLX vendor and versions strings.
|
||||
|
|
@ -577,40 +568,40 @@ struct __GLXdisplayPrivateRec
|
|||
* These are the same for all screens on this display. These fields will
|
||||
* be filled in on demand.
|
||||
*/
|
||||
/*@{ */
|
||||
const char *serverGLXvendor;
|
||||
const char *serverGLXversion;
|
||||
/*@} */
|
||||
/*@{*/
|
||||
const char *serverGLXvendor;
|
||||
const char *serverGLXversion;
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Configurations of visuals for all screens on this display.
|
||||
* Also, per screen data which now includes the server \c GLX_EXTENSION
|
||||
* string.
|
||||
*/
|
||||
__GLXscreenConfigs *screenConfigs;
|
||||
__GLXscreenConfigs *screenConfigs;
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
/**
|
||||
* Per display direct rendering interface functions and data.
|
||||
*/
|
||||
__GLXDRIdisplay *driswDisplay;
|
||||
__GLXDRIdisplay *driDisplay;
|
||||
__GLXDRIdisplay *dri2Display;
|
||||
__GLXDRIdisplay *driswDisplay;
|
||||
__GLXDRIdisplay *driDisplay;
|
||||
__GLXDRIdisplay *dri2Display;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
extern GLubyte *__glXFlushRenderBuffer(__GLXcontext *, GLubyte *);
|
||||
extern GLubyte *__glXFlushRenderBuffer(__GLXcontext*, GLubyte*);
|
||||
|
||||
extern void __glXSendLargeChunk(__GLXcontext * gc, GLint requestNumber,
|
||||
GLint totalRequests,
|
||||
const GLvoid * data, GLint dataLen);
|
||||
extern void __glXSendLargeChunk(__GLXcontext *gc, GLint requestNumber,
|
||||
GLint totalRequests,
|
||||
const GLvoid * data, GLint dataLen);
|
||||
|
||||
extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint,
|
||||
const GLvoid *, GLint);
|
||||
const GLvoid *, GLint);
|
||||
|
||||
/* Initialize the GLX extension for dpy */
|
||||
extern __GLXdisplayPrivate *__glXInitialize(Display *);
|
||||
extern __GLXdisplayPrivate *__glXInitialize(Display*);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
|
@ -619,12 +610,12 @@ extern int __glXDebug;
|
|||
/* This is per-thread storage in an MT environment */
|
||||
#if defined( USE_XTHREADS ) || defined( PTHREADS )
|
||||
|
||||
extern void __glXSetCurrentContext(__GLXcontext * c);
|
||||
extern void __glXSetCurrentContext(__GLXcontext *c);
|
||||
|
||||
# if defined( GLX_USE_TLS )
|
||||
|
||||
extern __thread void *__glX_tls_Context
|
||||
__attribute__ ((tls_model("initial-exec")));
|
||||
extern __thread void * __glX_tls_Context
|
||||
__attribute__((tls_model("initial-exec")));
|
||||
|
||||
# define __glXGetCurrentContext() __glX_tls_Context
|
||||
|
||||
|
|
@ -644,7 +635,7 @@ extern __GLXcontext *__glXcurrentContext;
|
|||
|
||||
extern void __glXSetCurrentContextNull(void);
|
||||
|
||||
extern void __glXFreeContext(__GLXcontext *);
|
||||
extern void __glXFreeContext(__GLXcontext*);
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -667,7 +658,7 @@ extern pthread_mutex_t __glXmutex;
|
|||
/*
|
||||
** Setup for a command. Initialize the extension for dpy if necessary.
|
||||
*/
|
||||
extern CARD8 __glXSetupForCommand(Display * dpy);
|
||||
extern CARD8 __glXSetupForCommand(Display *dpy);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
|
@ -678,11 +669,9 @@ extern CARD8 __glXSetupForCommand(Display * dpy);
|
|||
extern const GLuint __glXDefaultPixelStore[9];
|
||||
|
||||
/* Send an image to the server using RenderLarge. */
|
||||
extern void __glXSendLargeImage(__GLXcontext * gc, GLint compsize, GLint dim,
|
||||
GLint width, GLint height, GLint depth,
|
||||
GLenum format, GLenum type,
|
||||
const GLvoid * src, GLubyte * pc,
|
||||
GLubyte * modes);
|
||||
extern void __glXSendLargeImage(__GLXcontext *gc, GLint compsize, GLint dim,
|
||||
GLint width, GLint height, GLint depth, GLenum format, GLenum type,
|
||||
const GLvoid *src, GLubyte *pc, GLubyte *modes);
|
||||
|
||||
/* Return the size, in bytes, of some pixel data */
|
||||
extern GLint __glImageSize(GLint, GLint, GLint, GLenum, GLenum, GLenum);
|
||||
|
|
@ -702,23 +691,23 @@ extern GLint __glBytesPerElement(GLenum type);
|
|||
** updated to contain the modes needed by the server to decode the
|
||||
** sent data.
|
||||
*/
|
||||
extern void __glFillImage(__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
|
||||
GLenum, const GLvoid *, GLubyte *, GLubyte *);
|
||||
extern void __glFillImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
|
||||
GLenum, const GLvoid*, GLubyte*, GLubyte*);
|
||||
|
||||
/* Copy map data with a stride into a packed buffer */
|
||||
extern void __glFillMap1f(GLint, GLint, GLint, const GLfloat *, GLubyte *);
|
||||
extern void __glFillMap1d(GLint, GLint, GLint, const GLdouble *, GLubyte *);
|
||||
extern void __glFillMap2f(GLint, GLint, GLint, GLint, GLint,
|
||||
const GLfloat *, GLfloat *);
|
||||
const GLfloat *, GLfloat *);
|
||||
extern void __glFillMap2d(GLint, GLint, GLint, GLint, GLint,
|
||||
const GLdouble *, GLdouble *);
|
||||
const GLdouble *, GLdouble *);
|
||||
|
||||
/*
|
||||
** Empty an image out of the reply buffer into the clients memory applying
|
||||
** the pack modes to pack back into the clients requested format.
|
||||
*/
|
||||
extern void __glEmptyImage(__GLXcontext *, GLint, GLint, GLint, GLint, GLenum,
|
||||
GLenum, const GLubyte *, GLvoid *);
|
||||
extern void __glEmptyImage(__GLXcontext*, GLint, GLint, GLint, GLint, GLenum,
|
||||
GLenum, const GLubyte *, GLvoid *);
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -731,7 +720,7 @@ extern void __glXFreeVertexArrayState(__GLXcontext *);
|
|||
** Inform the Server of the major and minor numbers and of the client
|
||||
** libraries extension string.
|
||||
*/
|
||||
extern void __glXClientInfo(Display * dpy, int opcode);
|
||||
extern void __glXClientInfo ( Display *dpy, int opcode );
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
|
@ -739,21 +728,18 @@ extern void __glXClientInfo(Display * dpy, int opcode);
|
|||
** Declarations that should be in Xlib
|
||||
*/
|
||||
#ifdef __GL_USE_OUR_PROTOTYPES
|
||||
extern void _XFlush(Display *);
|
||||
extern Status _XReply(Display *, xReply *, int, Bool);
|
||||
extern void _XRead(Display *, void *, long);
|
||||
extern void _XSend(Display *, const void *, long);
|
||||
extern void _XFlush(Display*);
|
||||
extern Status _XReply(Display*, xReply*, int, Bool);
|
||||
extern void _XRead(Display*, void*, long);
|
||||
extern void _XSend(Display*, const void*, long);
|
||||
#endif
|
||||
|
||||
|
||||
extern void __glXInitializeVisualConfigFromTags(__GLcontextModes * config,
|
||||
int count, const INT32 * bp,
|
||||
Bool tagged_only,
|
||||
Bool fbconfig_style_tags);
|
||||
extern void __glXInitializeVisualConfigFromTags( __GLcontextModes *config,
|
||||
int count, const INT32 *bp, Bool tagged_only, Bool fbconfig_style_tags );
|
||||
|
||||
extern char *__glXGetStringFromServer(Display * dpy, int opcode,
|
||||
CARD32 glxCode, CARD32 for_whom,
|
||||
CARD32 name);
|
||||
extern char * __glXGetStringFromServer( Display * dpy, int opcode,
|
||||
CARD32 glxCode, CARD32 for_whom, CARD32 name );
|
||||
|
||||
extern char *__glXstrdup(const char *str);
|
||||
|
||||
|
|
@ -762,16 +748,15 @@ extern const char __glXGLClientVersion[];
|
|||
extern const char __glXGLClientExtensions[];
|
||||
|
||||
/* Get the unadjusted system time */
|
||||
extern int __glXGetUST(int64_t * ust);
|
||||
extern int __glXGetUST( int64_t * ust );
|
||||
|
||||
extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
|
||||
int32_t * numerator,
|
||||
int32_t * denominator);
|
||||
int32_t * numerator, int32_t * denominator);
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
GLboolean
|
||||
__driGetMscRateOML(__DRIdrawable * draw,
|
||||
int32_t * numerator, int32_t * denominator, void *private);
|
||||
__driGetMscRateOML(__DRIdrawable *draw,
|
||||
int32_t *numerator, int32_t *denominator, void *private);
|
||||
#endif
|
||||
|
||||
#endif /* !__GLX_client_h__ */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue