mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
glx: indent -br -i3 -npcs --no-tabs
Some manual intervention applied since XEXT_* and other macro magic fooled indent. Auto generated files were also skipped.
This commit is contained in:
parent
741869d73a
commit
0896268b97
14 changed files with 3476 additions and 3345 deletions
|
|
@ -52,320 +52,328 @@
|
|||
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 */
|
||||
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, XID window,
|
||||
char **driverName, char **deviceName)
|
||||
Bool
|
||||
DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName)
|
||||
{
|
||||
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->window = window;
|
||||
req->driverType = DRI2DriverDRI;
|
||||
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->window = window;
|
||||
req->driverType = DRI2DriverDRI;
|
||||
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
|
||||
if (rep.driverNameLength == 0 && rep.deviceNameLength == 0) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
if (rep.driverNameLength == 0 && rep.deviceNameLength == 0) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
|
||||
*driverName = Xmalloc(rep.driverNameLength + 1);
|
||||
if (*driverName == NULL) {
|
||||
_XEatData(dpy,
|
||||
((rep.driverNameLength + 3) & ~3) +
|
||||
((rep.deviceNameLength + 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.deviceNameLength + 3) & ~3));
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
_XReadPad(dpy, *driverName, rep.driverNameLength);
|
||||
(*driverName)[rep.driverNameLength] = '\0';
|
||||
|
||||
*deviceName = Xmalloc(rep.deviceNameLength + 1);
|
||||
if (*deviceName == NULL) {
|
||||
Xfree(*driverName);
|
||||
_XEatData(dpy, ((rep.deviceNameLength + 3) & ~3));
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
_XReadPad(dpy, *deviceName, rep.deviceNameLength);
|
||||
(*deviceName)[rep.deviceNameLength] = '\0';
|
||||
*deviceName = Xmalloc(rep.deviceNameLength + 1);
|
||||
if (*deviceName == NULL) {
|
||||
Xfree(*driverName);
|
||||
_XEatData(dpy, ((rep.deviceNameLength + 3) & ~3));
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
_XReadPad(dpy, *deviceName, rep.deviceNameLength);
|
||||
(*deviceName)[rep.deviceNameLength] = '\0';
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return True;
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool DRI2Authenticate(Display *dpy, XID window, drm_magic_t magic)
|
||||
Bool
|
||||
DRI2Authenticate(Display * dpy, XID window, drm_magic_t magic)
|
||||
{
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2AuthenticateReq *req;
|
||||
xDRI2AuthenticateReply rep;
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2AuthenticateReq *req;
|
||||
xDRI2AuthenticateReply rep;
|
||||
|
||||
XextCheckExtension (dpy, info, dri2ExtensionName, False);
|
||||
XextCheckExtension(dpy, info, dri2ExtensionName, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2Authenticate, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2Authenticate;
|
||||
req->window = window;
|
||||
req->magic = magic;
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2Authenticate, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2Authenticate;
|
||||
req->window = window;
|
||||
req->magic = magic;
|
||||
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return False;
|
||||
}
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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(rep.count * sizeof buffers[0]);
|
||||
if (buffers == NULL) {
|
||||
_XEatData(dpy, rep.count * sizeof repBuffer);
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return NULL;
|
||||
}
|
||||
buffers = Xmalloc(rep.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;
|
||||
}
|
||||
|
||||
|
||||
DRI2Buffer *DRI2GetBuffersWithFormat(Display *dpy, XID drawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments, int count,
|
||||
int *outCount)
|
||||
DRI2Buffer *
|
||||
DRI2GetBuffersWithFormat(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 * 2), req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2GetBuffersWithFormat;
|
||||
req->drawable = drawable;
|
||||
req->count = count;
|
||||
p = (CARD32 *) &req[1];
|
||||
for (i = 0; i < (count * 2); i++)
|
||||
p[i] = attachments[i];
|
||||
LockDisplay(dpy);
|
||||
GetReqExtra(DRI2GetBuffers, count * (4 * 2), req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2GetBuffersWithFormat;
|
||||
req->drawable = drawable;
|
||||
req->count = count;
|
||||
p = (CARD32 *) & req[1];
|
||||
for (i = 0; i < (count * 2); 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(rep.count * sizeof buffers[0]);
|
||||
if (buffers == NULL) {
|
||||
_XEatData(dpy, rep.count * sizeof repBuffer);
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
return NULL;
|
||||
}
|
||||
buffers = Xmalloc(rep.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 DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
|
||||
CARD32 dest, CARD32 src)
|
||||
void
|
||||
DRI2CopyRegion(Display * dpy, XID drawable, XserverRegion region,
|
||||
CARD32 dest, CARD32 src)
|
||||
{
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2CopyRegionReq *req;
|
||||
xDRI2CopyRegionReply rep;
|
||||
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
|
||||
xDRI2CopyRegionReq *req;
|
||||
xDRI2CopyRegionReply rep;
|
||||
|
||||
XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
|
||||
XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2CopyRegion, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2CopyRegion;
|
||||
req->drawable = drawable;
|
||||
req->region = region;
|
||||
req->dest = dest;
|
||||
req->src = src;
|
||||
LockDisplay(dpy);
|
||||
GetReq(DRI2CopyRegion, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->dri2ReqType = X_DRI2CopyRegion;
|
||||
req->drawable = drawable;
|
||||
req->region = region;
|
||||
req->dest = dest;
|
||||
req->src = src;
|
||||
|
||||
_XReply(dpy, (xReply *)&rep, 0, xFalse);
|
||||
_XReply(dpy, (xReply *) & rep, 0, xFalse);
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,45 +36,53 @@
|
|||
#include <X11/extensions/Xfixes.h>
|
||||
#include <X11/extensions/dri2tokens.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);
|
||||
DRI2QueryExtension(Display * display, int *eventBase, int *errorBase);
|
||||
|
||||
extern Bool
|
||||
DRI2QueryVersion(Display *display, int *major, int *minor);
|
||||
DRI2QueryVersion(Display * display, int *major, int *minor);
|
||||
|
||||
extern Bool
|
||||
DRI2Connect(Display *display, XID window,
|
||||
char **driverName, char **deviceName);
|
||||
DRI2Connect(Display * display, XID window,
|
||||
char **driverName, char **deviceName);
|
||||
|
||||
extern Bool
|
||||
DRI2Authenticate(Display *display, XID window, drm_magic_t magic);
|
||||
DRI2Authenticate(Display * display, XID window, drm_magic_t magic);
|
||||
|
||||
extern void
|
||||
DRI2CreateDrawable(Display *display, XID drawable);
|
||||
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);
|
||||
DRI2DestroyDrawable(Display * display, XID handle);
|
||||
|
||||
extern DRI2Buffer*
|
||||
DRI2GetBuffers(Display * dpy, XID drawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments, int count,
|
||||
int *outCount);
|
||||
|
||||
/**
|
||||
* \note
|
||||
* This function is only supported with DRI2 version 1.1 or later.
|
||||
*/
|
||||
extern DRI2Buffer *
|
||||
DRI2GetBuffersWithFormat(Display *dpy, XID drawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments, int count,
|
||||
int *outCount);
|
||||
extern DRI2Buffer*
|
||||
DRI2GetBuffersWithFormat(Display * dpy, XID drawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments,
|
||||
int count, int *outCount);
|
||||
|
||||
extern void
|
||||
DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
|
||||
CARD32 dest, CARD32 src);
|
||||
DRI2CopyRegion(Display * dpy, XID drawable,
|
||||
XserverRegion region,
|
||||
CARD32 dest, CARD32 src);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -54,249 +54,260 @@ 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;
|
||||
int have_back;
|
||||
int have_fake_front;
|
||||
struct __GLXDRIdrawablePrivateRec
|
||||
{
|
||||
__GLXDRIdrawable base;
|
||||
__DRIbuffer buffers[5];
|
||||
int bufferCount;
|
||||
int width, height;
|
||||
int have_back;
|
||||
int have_fake_front;
|
||||
};
|
||||
|
||||
static void dri2WaitX(__GLXDRIdrawable *pdraw);
|
||||
static void dri2WaitX(__GLXDRIdrawable * pdraw);
|
||||
|
||||
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->bufferCount = 0;
|
||||
pdraw->base.destroyDrawable = dri2DestroyDrawable;
|
||||
pdraw->base.xDrawable = xDrawable;
|
||||
pdraw->base.drawable = drawable;
|
||||
pdraw->base.psc = psc;
|
||||
pdraw->bufferCount = 0;
|
||||
|
||||
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 dri2CopySubBuffer(__GLXDRIdrawable *pdraw,
|
||||
int x, int y, int width, int height)
|
||||
static void
|
||||
dri2CopySubBuffer(__GLXDRIdrawable * pdraw,
|
||||
int x, int y, int width, int height)
|
||||
{
|
||||
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
||||
XRectangle xrect;
|
||||
XserverRegion region;
|
||||
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
||||
XRectangle xrect;
|
||||
XserverRegion region;
|
||||
|
||||
/* Check we have the right attachments */
|
||||
if (!priv->have_back)
|
||||
return;
|
||||
/* Check we have the right attachments */
|
||||
if (!priv->have_back)
|
||||
return;
|
||||
|
||||
xrect.x = x;
|
||||
xrect.y = priv->height - y - height;
|
||||
xrect.width = width;
|
||||
xrect.height = height;
|
||||
xrect.x = x;
|
||||
xrect.y = priv->height - y - height;
|
||||
xrect.width = width;
|
||||
xrect.height = height;
|
||||
|
||||
#ifdef __DRI2_FLUSH
|
||||
if (pdraw->psc->f)
|
||||
(*pdraw->psc->f->flush)(pdraw->driDrawable);
|
||||
if (pdraw->psc->f)
|
||||
(*pdraw->psc->f->flush) (pdraw->driDrawable);
|
||||
#endif
|
||||
|
||||
region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
|
||||
/* should get a fence ID back from here at some point */
|
||||
DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
|
||||
DRI2BufferFrontLeft, DRI2BufferBackLeft);
|
||||
XFixesDestroyRegion(pdraw->psc->dpy, region);
|
||||
region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
|
||||
/* should get a fence ID back from here at some point */
|
||||
DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
|
||||
DRI2BufferFrontLeft, DRI2BufferBackLeft);
|
||||
XFixesDestroyRegion(pdraw->psc->dpy, region);
|
||||
|
||||
/* Refresh the fake front (if present) after we just damaged the real
|
||||
* front.
|
||||
*/
|
||||
dri2WaitX(pdraw);
|
||||
/* Refresh the fake front (if present) after we just damaged the real
|
||||
* front.
|
||||
*/
|
||||
dri2WaitX(pdraw);
|
||||
}
|
||||
|
||||
static void dri2SwapBuffers(__GLXDRIdrawable *pdraw)
|
||||
static void
|
||||
dri2SwapBuffers(__GLXDRIdrawable * pdraw)
|
||||
{
|
||||
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
||||
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
||||
|
||||
dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height);
|
||||
dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height);
|
||||
}
|
||||
|
||||
static void dri2WaitX(__GLXDRIdrawable *pdraw)
|
||||
static void
|
||||
dri2WaitX(__GLXDRIdrawable * pdraw)
|
||||
{
|
||||
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
||||
XRectangle xrect;
|
||||
XserverRegion region;
|
||||
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
||||
XRectangle xrect;
|
||||
XserverRegion region;
|
||||
|
||||
/* Check we have the right attachments */
|
||||
if (!priv->have_fake_front)
|
||||
return;
|
||||
/* Check we have the right attachments */
|
||||
if (!priv->have_fake_front)
|
||||
return;
|
||||
|
||||
xrect.x = 0;
|
||||
xrect.y = 0;
|
||||
xrect.width = priv->width;
|
||||
xrect.height = priv->height;
|
||||
xrect.x = 0;
|
||||
xrect.y = 0;
|
||||
xrect.width = priv->width;
|
||||
xrect.height = priv->height;
|
||||
|
||||
#ifdef __DRI2_FLUSH
|
||||
if (pdraw->psc->f)
|
||||
(*pdraw->psc->f->flush)(pdraw->driDrawable);
|
||||
if (pdraw->psc->f)
|
||||
(*pdraw->psc->f->flush) (pdraw->driDrawable);
|
||||
#endif
|
||||
|
||||
region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
|
||||
DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
|
||||
DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
|
||||
XFixesDestroyRegion(pdraw->psc->dpy, region);
|
||||
region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
|
||||
DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
|
||||
DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
|
||||
XFixesDestroyRegion(pdraw->psc->dpy, region);
|
||||
}
|
||||
|
||||
static void dri2WaitGL(__GLXDRIdrawable *pdraw)
|
||||
static void
|
||||
dri2WaitGL(__GLXDRIdrawable * pdraw)
|
||||
{
|
||||
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
||||
XRectangle xrect;
|
||||
XserverRegion region;
|
||||
__GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
|
||||
XRectangle xrect;
|
||||
XserverRegion region;
|
||||
|
||||
if (!priv->have_fake_front)
|
||||
return;
|
||||
if (!priv->have_fake_front)
|
||||
return;
|
||||
|
||||
xrect.x = 0;
|
||||
xrect.y = 0;
|
||||
xrect.width = priv->width;
|
||||
xrect.height = priv->height;
|
||||
xrect.x = 0;
|
||||
xrect.y = 0;
|
||||
xrect.width = priv->width;
|
||||
xrect.height = priv->height;
|
||||
|
||||
#ifdef __DRI2_FLUSH
|
||||
if (pdraw->psc->f)
|
||||
(*pdraw->psc->f->flush)(pdraw->driDrawable);
|
||||
if (pdraw->psc->f)
|
||||
(*pdraw->psc->f->flush) (pdraw->driDrawable);
|
||||
#endif
|
||||
|
||||
region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
|
||||
DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
|
||||
DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
|
||||
XFixesDestroyRegion(pdraw->psc->dpy, region);
|
||||
region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
|
||||
DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
|
||||
DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
|
||||
XFixesDestroyRegion(pdraw->psc->dpy, region);
|
||||
}
|
||||
|
||||
|
||||
static void dri2FlushFrontBuffer(__DRIdrawable *driDrawable,
|
||||
void *loaderPrivate)
|
||||
static void
|
||||
dri2FlushFrontBuffer(__DRIdrawable * driDrawable, void *loaderPrivate)
|
||||
{
|
||||
(void) driDrawable;
|
||||
dri2WaitGL((__GLXDRIdrawable *) loaderPrivate);
|
||||
(void) driDrawable;
|
||||
dri2WaitGL((__GLXDRIdrawable *) loaderPrivate);
|
||||
}
|
||||
|
||||
|
||||
static void dri2DestroyScreen(__GLXscreenConfigs *psc)
|
||||
static void
|
||||
dri2DestroyScreen(__GLXscreenConfigs * psc)
|
||||
{
|
||||
/* Free the direct rendering per screen data */
|
||||
(*psc->core->destroyScreen)(psc->__driScreen);
|
||||
close(psc->fd);
|
||||
psc->__driScreen = NULL;
|
||||
/* Free the direct rendering per screen data */
|
||||
(*psc->core->destroyScreen) (psc->__driScreen);
|
||||
close(psc->fd);
|
||||
psc->__driScreen = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -306,221 +317,222 @@ static void dri2DestroyScreen(__GLXscreenConfigs *psc)
|
|||
* \c DRI2GetBuffers or \c DRI2GetBuffersWithFormat.
|
||||
*/
|
||||
static void
|
||||
process_buffers(__GLXDRIdrawablePrivate *pdraw, DRI2Buffer *buffers,
|
||||
unsigned count)
|
||||
process_buffers(__GLXDRIdrawablePrivate * pdraw, DRI2Buffer * buffers,
|
||||
unsigned count)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
pdraw->bufferCount = count;
|
||||
pdraw->have_fake_front = 0;
|
||||
pdraw->have_back = 0;
|
||||
pdraw->bufferCount = count;
|
||||
pdraw->have_fake_front = 0;
|
||||
pdraw->have_back = 0;
|
||||
|
||||
/* This assumes the DRI2 buffer attachment tokens matches the
|
||||
* __DRIbuffer tokens. */
|
||||
for (i = 0; i < 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;
|
||||
if (pdraw->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT)
|
||||
pdraw->have_fake_front = 1;
|
||||
if (pdraw->buffers[i].attachment == __DRI_BUFFER_BACK_LEFT)
|
||||
pdraw->have_back = 1;
|
||||
}
|
||||
/* This assumes the DRI2 buffer attachment tokens matches the
|
||||
* __DRIbuffer tokens. */
|
||||
for (i = 0; i < 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;
|
||||
if (pdraw->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT)
|
||||
pdraw->have_fake_front = 1;
|
||||
if (pdraw->buffers[i].attachment == __DRI_BUFFER_BACK_LEFT)
|
||||
pdraw->have_back = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
__GLXDRIdrawablePrivate *pdraw = loaderPrivate;
|
||||
DRI2Buffer *buffers;
|
||||
|
||||
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;
|
||||
process_buffers(pdraw, buffers, *out_count);
|
||||
pdraw->width = *width;
|
||||
pdraw->height = *height;
|
||||
process_buffers(pdraw, buffers, *out_count);
|
||||
|
||||
Xfree(buffers);
|
||||
Xfree(buffers);
|
||||
|
||||
return pdraw->buffers;
|
||||
return pdraw->buffers;
|
||||
}
|
||||
|
||||
static __DRIbuffer *
|
||||
dri2GetBuffersWithFormat(__DRIdrawable *driDrawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments, int count,
|
||||
int *out_count, void *loaderPrivate)
|
||||
dri2GetBuffersWithFormat(__DRIdrawable * driDrawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments, int count,
|
||||
int *out_count, void *loaderPrivate)
|
||||
{
|
||||
__GLXDRIdrawablePrivate *pdraw = loaderPrivate;
|
||||
DRI2Buffer *buffers;
|
||||
__GLXDRIdrawablePrivate *pdraw = loaderPrivate;
|
||||
DRI2Buffer *buffers;
|
||||
|
||||
buffers = DRI2GetBuffersWithFormat(pdraw->base.psc->dpy,
|
||||
pdraw->base.xDrawable,
|
||||
width, height, attachments,
|
||||
count, out_count);
|
||||
if (buffers == NULL)
|
||||
return NULL;
|
||||
buffers = DRI2GetBuffersWithFormat(pdraw->base.psc->dpy,
|
||||
pdraw->base.xDrawable,
|
||||
width, height, attachments,
|
||||
count, out_count);
|
||||
if (buffers == NULL)
|
||||
return NULL;
|
||||
|
||||
pdraw->width = *width;
|
||||
pdraw->height = *height;
|
||||
process_buffers(pdraw, buffers, *out_count);
|
||||
pdraw->width = *width;
|
||||
pdraw->height = *height;
|
||||
process_buffers(pdraw, buffers, *out_count);
|
||||
|
||||
Xfree(buffers);
|
||||
Xfree(buffers);
|
||||
|
||||
return pdraw->buffers;
|
||||
return pdraw->buffers;
|
||||
}
|
||||
|
||||
static const __DRIdri2LoaderExtension dri2LoaderExtension = {
|
||||
{ __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION },
|
||||
dri2GetBuffers,
|
||||
dri2FlushFrontBuffer,
|
||||
dri2GetBuffersWithFormat,
|
||||
{__DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION},
|
||||
dri2GetBuffers,
|
||||
dri2FlushFrontBuffer,
|
||||
dri2GetBuffersWithFormat,
|
||||
};
|
||||
|
||||
static const __DRIdri2LoaderExtension dri2LoaderExtension_old = {
|
||||
{ __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION },
|
||||
dri2GetBuffers,
|
||||
dri2FlushFrontBuffer,
|
||||
NULL,
|
||||
{__DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION},
|
||||
dri2GetBuffers,
|
||||
dri2FlushFrontBuffer,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const __DRIextension *loader_extensions[] = {
|
||||
&dri2LoaderExtension.base,
|
||||
&systemTimeExtension.base,
|
||||
NULL
|
||||
&dri2LoaderExtension.base,
|
||||
&systemTimeExtension.base,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const __DRIextension *loader_extensions_old[] = {
|
||||
&dri2LoaderExtension_old.base,
|
||||
&systemTimeExtension.base,
|
||||
NULL
|
||||
&dri2LoaderExtension_old.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;
|
||||
const __GLXDRIdisplayPrivate *const pdp = (__GLXDRIdisplayPrivate *)
|
||||
const __DRIconfig **driver_configs;
|
||||
const __DRIextension **extensions;
|
||||
const __GLXDRIdisplayPrivate *const pdp = (__GLXDRIdisplayPrivate *)
|
||||
priv->dri2Display;
|
||||
__GLXDRIscreen *psp;
|
||||
char *driverName, *deviceName;
|
||||
drm_magic_t magic;
|
||||
int i;
|
||||
__GLXDRIscreen *psp;
|
||||
char *driverName, *deviceName;
|
||||
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, RootWindow(psc->dpy, screen),
|
||||
&driverName, &deviceName))
|
||||
return NULL;
|
||||
if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen),
|
||||
&driverName, &deviceName))
|
||||
return NULL;
|
||||
|
||||
psc->driver = driOpenDriver(driverName);
|
||||
if (psc->driver == NULL) {
|
||||
ErrorMessageF("driver pointer missing\n");
|
||||
goto handle_error;
|
||||
}
|
||||
psc->driver = driOpenDriver(driverName);
|
||||
if (psc->driver == NULL) {
|
||||
ErrorMessageF("driver pointer missing\n");
|
||||
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];
|
||||
}
|
||||
extensions = dlsym(psc->driver, __DRI_DRIVER_EXTENSIONS);
|
||||
if (extensions == NULL) {
|
||||
ErrorMessageF("driver exports no extensions (%s)\n", dlerror());
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
if (psc->core == NULL || psc->dri2 == NULL) {
|
||||
ErrorMessageF("core dri or dri2 extension not found\n");
|
||||
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];
|
||||
}
|
||||
|
||||
psc->fd = open(deviceName, O_RDWR);
|
||||
if (psc->fd < 0) {
|
||||
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
if (psc->core == NULL || psc->dri2 == NULL) {
|
||||
ErrorMessageF("core dri or dri2 extension not found\n");
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
if (drmGetMagic(psc->fd, &magic)) {
|
||||
ErrorMessageF("failed to get magic\n");
|
||||
return NULL;
|
||||
}
|
||||
psc->fd = open(deviceName, O_RDWR);
|
||||
if (psc->fd < 0) {
|
||||
ErrorMessageF("failed to open drm device: %s\n", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!DRI2Authenticate(psc->dpy, RootWindow(psc->dpy, screen), magic)) {
|
||||
ErrorMessageF("failed to authenticate magic %d\n", magic);
|
||||
return NULL;
|
||||
}
|
||||
if (drmGetMagic(psc->fd, &magic)) {
|
||||
ErrorMessageF("failed to get magic\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* If the server does not support the protocol for
|
||||
* DRI2GetBuffersWithFormat, don't supply that interface to the driver.
|
||||
*/
|
||||
psc->__driScreen =
|
||||
psc->dri2->createNewScreen(screen, psc->fd,
|
||||
((pdp->driMinor < 1)
|
||||
? loader_extensions_old
|
||||
: loader_extensions),
|
||||
&driver_configs, psc);
|
||||
if (!DRI2Authenticate(psc->dpy, RootWindow(psc->dpy, screen), magic)) {
|
||||
ErrorMessageF("failed to authenticate magic %d\n", magic);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (psc->__driScreen == NULL) {
|
||||
ErrorMessageF("failed to create dri screen\n");
|
||||
return NULL;
|
||||
}
|
||||
/* If the server does not support the protocol for
|
||||
* DRI2GetBuffersWithFormat, don't supply that interface to the driver.
|
||||
*/
|
||||
psc->__driScreen =
|
||||
psc->dri2->createNewScreen(screen, psc->fd, ((pdp->driMinor < 1)
|
||||
? loader_extensions_old
|
||||
: loader_extensions),
|
||||
&driver_configs, psc);
|
||||
|
||||
driBindExtensions(psc, 1);
|
||||
if (psc->__driScreen == NULL) {
|
||||
ErrorMessageF("failed to create dri screen\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
|
||||
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
|
||||
driBindExtensions(psc, 1);
|
||||
|
||||
psc->driver_configs = 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->waitGL = dri2WaitGL;
|
||||
psp->waitX = dri2WaitX;
|
||||
psc->driver_configs = driver_configs;
|
||||
|
||||
/* DRI2 suports SubBuffer through DRI2CopyRegion, so it's always
|
||||
* available.*/
|
||||
psp->copySubBuffer = dri2CopySubBuffer;
|
||||
__glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer");
|
||||
psp->destroyScreen = dri2DestroyScreen;
|
||||
psp->createContext = dri2CreateContext;
|
||||
psp->createDrawable = dri2CreateDrawable;
|
||||
psp->swapBuffers = dri2SwapBuffers;
|
||||
psp->waitGL = dri2WaitGL;
|
||||
psp->waitX = dri2WaitX;
|
||||
|
||||
Xfree(driverName);
|
||||
Xfree(deviceName);
|
||||
/* DRI2 suports SubBuffer through DRI2CopyRegion, so it's always
|
||||
* available.*/
|
||||
psp->copySubBuffer = dri2CopySubBuffer;
|
||||
__glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer");
|
||||
|
||||
return psp;
|
||||
Xfree(driverName);
|
||||
Xfree(deviceName);
|
||||
|
||||
return psp;
|
||||
|
||||
handle_error:
|
||||
Xfree(driverName);
|
||||
Xfree(deviceName);
|
||||
Xfree(driverName);
|
||||
Xfree(deviceName);
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -528,29 +540,30 @@ static void 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 */
|
||||
|
|
|
|||
|
|
@ -49,33 +49,35 @@
|
|||
#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
|
||||
|
|
@ -95,7 +97,8 @@ _X_HIDDEN void 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;
|
||||
|
|
@ -110,40 +113,41 @@ _X_HIDDEN void *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)
|
||||
|
|
@ -156,253 +160,258 @@ _X_HIDDEN void *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->driCopySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer");
|
||||
}
|
||||
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
|
||||
psc->driCopySubBuffer =
|
||||
(__DRIcopySubBufferExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_MESA_copy_sub_buffer");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __DRI_SWAP_CONTROL
|
||||
/* No DRI2 support for swap_control at the moment, since SwapBuffers
|
||||
* is done by the X server */
|
||||
if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0 && !dri2) {
|
||||
psc->swapControl = (__DRIswapControlExtension *) extensions[i];
|
||||
__glXEnableDirectExtension(psc, "GLX_SGI_swap_control");
|
||||
__glXEnableDirectExtension(psc, "GLX_MESA_swap_control");
|
||||
}
|
||||
/* No DRI2 support for swap_control at the moment, since SwapBuffers
|
||||
* is done by the X server */
|
||||
if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0 && !dri2) {
|
||||
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
|
||||
|
||||
#ifdef __DRI2_FLUSH
|
||||
if ((strcmp(extensions[i]->name, __DRI2_FLUSH) == 0) && dri2) {
|
||||
psc->f = (__DRI2flushExtension *) extensions[i];
|
||||
/* internal driver extension, no GL extension exposed */
|
||||
}
|
||||
if ((strcmp(extensions[i]->name, __DRI2_FLUSH) == 0) && dri2) {
|
||||
psc->f = (__DRI2flushExtension *) extensions[i];
|
||||
/* internal driver extension, no GL extension exposed */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Ignore unknown extensions */
|
||||
}
|
||||
/* Ignore unknown extensions */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* GLX_DIRECT_RENDERING */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -25,7 +25,7 @@
|
|||
/**
|
||||
* \file glx_pbuffer.c
|
||||
* Implementation of pbuffer related functions.
|
||||
*
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
|||
* \note
|
||||
* This function dynamically determines whether to use the SGIX_pbuffer
|
||||
* version of the protocol or the GLX 1.3 version of the protocol.
|
||||
*
|
||||
*
|
||||
* \todo
|
||||
* This function needs to be modified to work with direct-rendering drivers.
|
||||
*/
|
||||
|
|
@ -198,7 +198,7 @@ determineTextureFormat(const int *attribs, int numAttribs)
|
|||
|
||||
for (i = 0; i < numAttribs; i++) {
|
||||
if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
|
||||
return attribs[2 * i + 1];
|
||||
return attribs[2 * i + 1];
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -681,8 +681,7 @@ GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX,
|
|||
PUBLIC
|
||||
GLX_ALIAS_VOID(glXSelectEventSGIX,
|
||||
(Display * dpy, GLXDrawable drawable,
|
||||
unsigned long mask), (dpy, drawable, mask),
|
||||
glXSelectEvent)
|
||||
unsigned long mask), (dpy, drawable, mask), glXSelectEvent)
|
||||
|
||||
PUBLIC
|
||||
GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
/**
|
||||
* \file glx_query.c
|
||||
* Generic utility functions to query internal data from the server.
|
||||
*
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
|
|
@ -43,13 +43,10 @@
|
|||
* Exchange a protocol request for glXQueryServerString.
|
||||
*/
|
||||
char *
|
||||
__glXQueryServerString(Display* dpy,
|
||||
int opcode,
|
||||
CARD32 screen,
|
||||
CARD32 name)
|
||||
__glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name)
|
||||
{
|
||||
xcb_connection_t *c = XGetXCBConnection(dpy);
|
||||
xcb_glx_query_server_string_reply_t* reply =
|
||||
xcb_glx_query_server_string_reply_t *reply =
|
||||
xcb_glx_query_server_string_reply(c,
|
||||
xcb_glx_query_server_string(c,
|
||||
screen,
|
||||
|
|
@ -59,7 +56,7 @@ __glXQueryServerString(Display* dpy,
|
|||
/* The spec doesn't mention this, but the Xorg server replies with
|
||||
* a string already terminated with '\0'. */
|
||||
uint32_t len = xcb_glx_query_server_string_string_length(reply);
|
||||
char* buf = Xmalloc(len);
|
||||
char *buf = Xmalloc(len);
|
||||
memcpy(buf, xcb_glx_query_server_string_string(reply), len);
|
||||
free(reply);
|
||||
|
||||
|
|
@ -70,23 +67,20 @@ __glXQueryServerString(Display* dpy,
|
|||
* Exchange a protocol request for glGetString.
|
||||
*/
|
||||
char *
|
||||
__glXGetString(Display* dpy,
|
||||
int opcode,
|
||||
CARD32 contextTag,
|
||||
CARD32 name)
|
||||
__glXGetString(Display * dpy, int opcode, CARD32 contextTag, CARD32 name)
|
||||
{
|
||||
xcb_connection_t *c = XGetXCBConnection(dpy);
|
||||
xcb_glx_get_string_reply_t* reply =
|
||||
xcb_glx_get_string_reply(c,
|
||||
xcb_glx_get_string(c,
|
||||
contextTag,
|
||||
name),
|
||||
NULL);
|
||||
xcb_glx_get_string_reply_t *reply = xcb_glx_get_string_reply(c,
|
||||
xcb_glx_get_string
|
||||
(c,
|
||||
contextTag,
|
||||
name),
|
||||
NULL);
|
||||
|
||||
/* The spec doesn't mention this, but the Xorg server replies with
|
||||
* a string already terminated with '\0'. */
|
||||
uint32_t len = xcb_glx_get_string_string_length(reply);
|
||||
char* buf = Xmalloc(len);
|
||||
char *buf = Xmalloc(len);
|
||||
memcpy(buf, xcb_glx_get_string_string(reply), len);
|
||||
free(reply);
|
||||
|
||||
|
|
@ -97,7 +91,7 @@ __glXGetString(Display* dpy,
|
|||
|
||||
/**
|
||||
* GLX protocol structure for the ficticious "GXLGenericGetString" request.
|
||||
*
|
||||
*
|
||||
* This is a non-existant protocol packet. It just so happens that all of
|
||||
* the real protocol packets used to request a string from the server have
|
||||
* an identical binary layout. The only difference between them is the
|
||||
|
|
@ -167,25 +161,17 @@ __glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode,
|
|||
}
|
||||
|
||||
char *
|
||||
__glXQueryServerString(Display* dpy,
|
||||
int opcode,
|
||||
CARD32 screen,
|
||||
CARD32 name)
|
||||
__glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name)
|
||||
{
|
||||
return __glXGetStringFromServer(dpy, opcode,
|
||||
X_GLXQueryServerString,
|
||||
screen, name);
|
||||
X_GLXQueryServerString, screen, name);
|
||||
}
|
||||
|
||||
char *
|
||||
__glXGetString(Display* dpy,
|
||||
int opcode,
|
||||
CARD32 contextTag,
|
||||
CARD32 name)
|
||||
__glXGetString(Display * dpy, int opcode, CARD32 contextTag, CARD32 name)
|
||||
{
|
||||
return __glXGetStringFromServer(dpy, opcode, X_GLsop_GetString,
|
||||
contextTag, name);
|
||||
}
|
||||
|
||||
#endif /* USE_XCB */
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
/* If we build the library with gcc's -fvisibility=hidden flag, we'll
|
||||
* use the PUBLIC macro to mark functions that are to be exported.
|
||||
*
|
||||
* We also need to define a USED attribute, so the optimizer doesn't
|
||||
* We also need to define a USED attribute, so the optimizer doesn't
|
||||
* inline a static function that we later use in an alias. - ajax
|
||||
*/
|
||||
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
|
||||
|
|
@ -78,8 +78,8 @@
|
|||
|
||||
|
||||
|
||||
#define GLX_MAJOR_VERSION 1 /* current version numbers */
|
||||
#define GLX_MINOR_VERSION 4
|
||||
#define GLX_MAJOR_VERSION 1 /* current version numbers */
|
||||
#define GLX_MINOR_VERSION 4
|
||||
|
||||
#define __GLX_MAX_TEXTURE_UNITS 32
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ typedef struct _glapi_table __GLapi;
|
|||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
|
||||
#define containerOf(ptr, type, member) \
|
||||
#define containerOf(ptr, type, member) \
|
||||
(type *)( (char *)ptr - offsetof(type,member) )
|
||||
|
||||
#include <GL/internal/dri_interface.h>
|
||||
|
|
@ -110,75 +110,78 @@ 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);
|
||||
|
||||
__GLXDRIdrawable *(*createDrawable)(__GLXscreenConfigs *psc,
|
||||
XID drawable,
|
||||
GLXDrawable glxDrawable,
|
||||
const __GLcontextModes *modes);
|
||||
__GLXDRIcontext *(*createContext) (__GLXscreenConfigs * psc,
|
||||
const __GLcontextModes * mode,
|
||||
GLXContext gc,
|
||||
GLXContext shareList, int renderType);
|
||||
|
||||
void (*swapBuffers)(__GLXDRIdrawable *pdraw);
|
||||
void (*copySubBuffer)(__GLXDRIdrawable *pdraw,
|
||||
int x, int y, int width, int height);
|
||||
void (*waitX)(__GLXDRIdrawable *pdraw);
|
||||
void (*waitGL)(__GLXDRIdrawable *pdraw);
|
||||
__GLXDRIdrawable *(*createDrawable) (__GLXscreenConfigs * psc,
|
||||
XID drawable,
|
||||
GLXDrawable glxDrawable,
|
||||
const __GLcontextModes * modes);
|
||||
|
||||
void (*swapBuffers) (__GLXDRIdrawable * pdraw);
|
||||
void (*copySubBuffer) (__GLXDRIdrawable * pdraw,
|
||||
int x, int y, int width, int height);
|
||||
void (*waitX) (__GLXDRIdrawable * pdraw);
|
||||
void (*waitGL) (__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;
|
||||
GLenum textureFormat; /* EXT_texture_from_pixmap support */
|
||||
XID xDrawable;
|
||||
XID drawable;
|
||||
__GLXscreenConfigs *psc;
|
||||
GLenum textureTarget;
|
||||
__DRIdrawable *driDrawable;
|
||||
GLenum textureFormat; /* EXT_texture_from_pixmap support */
|
||||
};
|
||||
|
||||
/*
|
||||
** 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
|
||||
|
||||
|
|
@ -186,53 +189,57 @@ 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.
|
||||
*
|
||||
|
|
@ -249,13 +256,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
|
||||
|
|
@ -263,24 +270,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
|
||||
|
|
@ -290,7 +297,7 @@ struct __GLXcontextRec {
|
|||
* \c WaitX, \c WaitGL, \c UseXFont, and \c MakeCurrent (for the old
|
||||
* context)).
|
||||
*/
|
||||
GLXContextTag currentContextTag;
|
||||
GLXContextTag currentContextTag;
|
||||
|
||||
/**
|
||||
* \name Rendering mode
|
||||
|
|
@ -299,11 +306,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
|
||||
|
|
@ -311,43 +318,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
|
||||
|
|
@ -356,38 +363,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
|
||||
|
||||
/**
|
||||
|
|
@ -396,22 +403,22 @@ struct __GLXcontextRec {
|
|||
*
|
||||
* \since Internal API version 20030606.
|
||||
*/
|
||||
GLXDrawable currentReadable;
|
||||
GLXDrawable currentReadable;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Pointer to client-state data that is private to libGL. This is only
|
||||
* used for indirect rendering contexts.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
|
|
@ -419,23 +426,23 @@ 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. */
|
||||
/*@}*/
|
||||
/*@} */
|
||||
|
||||
/**
|
||||
* Thread ID we're currently current in. Zero if none.
|
||||
*/
|
||||
unsigned long thread_id;
|
||||
|
||||
char gl_extension_bits[ __GL_EXT_BYTES ];
|
||||
char gl_extension_bits[__GL_EXT_BYTES];
|
||||
};
|
||||
|
||||
#define __glXSetError(gc,code) \
|
||||
if (!(gc)->error) { \
|
||||
(gc)->error = code; \
|
||||
}
|
||||
#define __glXSetError(gc,code) \
|
||||
if (!(gc)->error) { \
|
||||
(gc)->error = code; \
|
||||
}
|
||||
|
||||
extern void __glFreeAttributeState(__GLXcontext *);
|
||||
|
||||
|
|
@ -446,7 +453,7 @@ extern void __glFreeAttributeState(__GLXcontext *);
|
|||
* that will use the GLXRender GLX command. In this case it is
|
||||
* \c glPolygonStipple.
|
||||
*/
|
||||
#define __GLX_MAX_SMALL_RENDER_CMD_SIZE 156
|
||||
#define __GLX_MAX_SMALL_RENDER_CMD_SIZE 156
|
||||
|
||||
/**
|
||||
* To keep the implementation fast, the code uses a "limit" pointer
|
||||
|
|
@ -458,75 +465,76 @@ extern void __glFreeAttributeState(__GLXcontext *);
|
|||
* efficacy of the buffer. The "+32" is just to keep the code working
|
||||
* in case somebody counts wrong.
|
||||
*/
|
||||
#define __GLX_BUFFER_LIMIT_SIZE (__GLX_MAX_SMALL_RENDER_CMD_SIZE + 32)
|
||||
#define __GLX_BUFFER_LIMIT_SIZE (__GLX_MAX_SMALL_RENDER_CMD_SIZE + 32)
|
||||
|
||||
/**
|
||||
* This implementation uses a smaller threshold for switching
|
||||
* to the RenderLarge protocol than the protcol requires so that
|
||||
* large copies don't occur.
|
||||
*/
|
||||
#define __GLX_RENDER_CMD_SIZE_LIMIT 4096
|
||||
#define __GLX_RENDER_CMD_SIZE_LIMIT 4096
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
const __DRIconfig** driver_configs;
|
||||
const __DRIconfig **driver_configs;
|
||||
|
||||
#ifdef __DRI_COPY_SUB_BUFFER
|
||||
const __DRIcopySubBufferExtension *driCopySubBuffer;
|
||||
const __DRIcopySubBufferExtension *driCopySubBuffer;
|
||||
#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
|
||||
|
||||
#ifdef __DRI2_FLUSH
|
||||
const __DRI2flushExtension *f;
|
||||
const __DRI2flushExtension *f;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -534,7 +542,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
|
||||
|
|
@ -543,10 +551,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;
|
||||
/*@} */
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -554,67 +562,68 @@ 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.
|
||||
*
|
||||
*
|
||||
* 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 *);
|
||||
|
||||
extern void __glXPreferEGL(int state);
|
||||
|
||||
|
|
@ -625,14 +634,14 @@ extern int __glXDebug;
|
|||
/* This is per-thread storage in an MT environment */
|
||||
#if 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
|
||||
# define __glXGetCurrentContext() __glX_tls_Context
|
||||
|
||||
# else
|
||||
|
||||
|
|
@ -643,14 +652,14 @@ extern __GLXcontext *__glXGetCurrentContext(void);
|
|||
#else
|
||||
|
||||
extern __GLXcontext *__glXcurrentContext;
|
||||
#define __glXGetCurrentContext() __glXcurrentContext
|
||||
#define __glXSetCurrentContext(gc) __glXcurrentContext = gc
|
||||
#define __glXGetCurrentContext() __glXcurrentContext
|
||||
#define __glXSetCurrentContext(gc) __glXcurrentContext = gc
|
||||
|
||||
#endif /* defined( PTHREADS ) */
|
||||
|
||||
extern void __glXSetCurrentContextNull(void);
|
||||
|
||||
extern void __glXFreeContext(__GLXcontext*);
|
||||
extern void __glXFreeContext(__GLXcontext *);
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -669,7 +678,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);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
|
@ -680,9 +689,11 @@ 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 +713,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 +742,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,20 +750,22 @@ 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 * __glXQueryServerString(Display* dpy, int opcode,
|
||||
CARD32 screen, CARD32 name);
|
||||
extern char * __glXGetString(Display* dpy, int opcode,
|
||||
CARD32 screen, CARD32 name);
|
||||
extern char *__glXQueryServerString(Display * dpy, int opcode,
|
||||
CARD32 screen, CARD32 name);
|
||||
extern char *__glXGetString(Display * dpy, int opcode,
|
||||
CARD32 screen, CARD32 name);
|
||||
|
||||
extern char *__glXstrdup(const char *str);
|
||||
|
||||
|
|
@ -761,15 +774,16 @@ 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
|
|
@ -81,7 +81,7 @@ _X_HIDDEN pthread_mutex_t __glXmutex = PTHREAD_MUTEX_INITIALIZER;
|
|||
|
||||
/**
|
||||
* Per-thread GLX context pointer.
|
||||
*
|
||||
*
|
||||
* \c __glXSetCurrentContext is written is such a way that this pointer can
|
||||
* \b never be \c NULL. This is important! Because of this
|
||||
* \c __glXGetCurrentContext can be implemented as trivial macro.
|
||||
|
|
@ -101,7 +101,7 @@ static pthread_once_t once_control = PTHREAD_ONCE_INIT;
|
|||
|
||||
/**
|
||||
* Per-thread data key.
|
||||
*
|
||||
*
|
||||
* Once \c init_thread_data has been called, the per-thread data key will
|
||||
* take a value of \c NULL. As each new thread is created the default
|
||||
* value, in that thread, will be \c NULL.
|
||||
|
|
@ -110,7 +110,7 @@ static pthread_key_t ContextTSD;
|
|||
|
||||
/**
|
||||
* Initialize the per-thread data key.
|
||||
*
|
||||
*
|
||||
* This function is called \b exactly once per-process (not per-thread!) to
|
||||
* initialize the per-thread data key. This is ideally done using the
|
||||
* \c pthread_once mechanism.
|
||||
|
|
@ -302,8 +302,8 @@ FetchDRIDrawable(Display * dpy, GLXDrawable glxDrawable, GLXContext gc)
|
|||
#endif /* GLX_DIRECT_RENDERING */
|
||||
|
||||
static void
|
||||
__glXGenerateError(Display *dpy, GLXContext gc, XID resource,
|
||||
BYTE errorCode, CARD16 minorCode)
|
||||
__glXGenerateError(Display * dpy, GLXContext gc, XID resource,
|
||||
BYTE errorCode, CARD16 minorCode)
|
||||
{
|
||||
xError error;
|
||||
|
||||
|
|
@ -318,7 +318,7 @@ __glXGenerateError(Display *dpy, GLXContext gc, XID resource,
|
|||
|
||||
/**
|
||||
* Make a particular context current.
|
||||
*
|
||||
*
|
||||
* \note This is in this file so that it can access dummyContext.
|
||||
*/
|
||||
static Bool
|
||||
|
|
@ -347,21 +347,19 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
|
||||
if (gc == NULL && (draw != None || read != None)) {
|
||||
__glXGenerateError(dpy, gc, (draw != None) ? draw : read,
|
||||
BadMatch, X_GLXMakeContextCurrent);
|
||||
BadMatch, X_GLXMakeContextCurrent);
|
||||
return False;
|
||||
}
|
||||
if (gc != NULL && (draw == None || read == None)) {
|
||||
__glXGenerateError(dpy, gc, None,
|
||||
BadMatch, X_GLXMakeContextCurrent);
|
||||
__glXGenerateError(dpy, gc, None, BadMatch, X_GLXMakeContextCurrent);
|
||||
return False;
|
||||
}
|
||||
|
||||
_glapi_check_multithread();
|
||||
|
||||
if (gc != NULL && gc->thread_id != 0 &&
|
||||
gc->thread_id != _glthread_GetID()) {
|
||||
if (gc != NULL && gc->thread_id != 0 && gc->thread_id != _glthread_GetID()) {
|
||||
__glXGenerateError(dpy, gc, gc->xid,
|
||||
BadAccess, X_GLXMakeContextCurrent);
|
||||
BadAccess, X_GLXMakeContextCurrent);
|
||||
return False;
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +371,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
|||
|
||||
if ((pdraw == NULL) || (pread == NULL)) {
|
||||
__glXGenerateError(dpy, gc, (pdraw == NULL) ? draw : read,
|
||||
GLXBadDrawable, X_GLXMakeContextCurrent);
|
||||
GLXBadDrawable, X_GLXMakeContextCurrent);
|
||||
return False;
|
||||
}
|
||||
|
||||
|
|
@ -521,6 +519,5 @@ GLX_ALIAS(Bool, glXMakeCurrentReadSGI,
|
|||
|
||||
PUBLIC
|
||||
GLX_ALIAS(Bool, glXMakeContextCurrent,
|
||||
(Display * dpy, GLXDrawable d, GLXDrawable r,
|
||||
GLXContext ctx), (dpy, d, r, ctx),
|
||||
MakeContextCurrent)
|
||||
(Display * dpy, GLXDrawable d, GLXDrawable r,
|
||||
GLXContext ctx), (dpy, d, r, ctx), MakeContextCurrent)
|
||||
|
|
|
|||
|
|
@ -102,19 +102,19 @@ static
|
|||
XEXT_GENERATE_ERROR_STRING(__glXErrorString, __glXExtensionName,
|
||||
__GLX_NUMBER_ERRORS, error_list)
|
||||
|
||||
static /* const */ XExtensionHooks __glXExtensionHooks = {
|
||||
NULL, /* create_gc */
|
||||
NULL, /* copy_gc */
|
||||
NULL, /* flush_gc */
|
||||
NULL, /* free_gc */
|
||||
NULL, /* create_font */
|
||||
NULL, /* free_font */
|
||||
__glXCloseDisplay, /* close_display */
|
||||
NULL, /* wire_to_event */
|
||||
NULL, /* event_to_wire */
|
||||
NULL, /* error */
|
||||
__glXErrorString, /* error_string */
|
||||
};
|
||||
static /* const */ XExtensionHooks __glXExtensionHooks = {
|
||||
NULL, /* create_gc */
|
||||
NULL, /* copy_gc */
|
||||
NULL, /* flush_gc */
|
||||
NULL, /* free_gc */
|
||||
NULL, /* create_font */
|
||||
NULL, /* free_font */
|
||||
__glXCloseDisplay, /* close_display */
|
||||
NULL, /* wire_to_event */
|
||||
NULL, /* event_to_wire */
|
||||
NULL, /* error */
|
||||
__glXErrorString, /* error_string */
|
||||
};
|
||||
|
||||
static
|
||||
XEXT_GENERATE_FIND_DISPLAY(__glXFindDisplay, __glXExtensionInfo,
|
||||
|
|
@ -150,8 +150,8 @@ FreeScreenConfigs(__GLXdisplayPrivate * priv)
|
|||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
if (psc->driver_configs) {
|
||||
for(unsigned int i = 0; psc->driver_configs[i]; i++)
|
||||
free((__DRIconfig*)psc->driver_configs[i]);
|
||||
for (unsigned int i = 0; psc->driver_configs[i]; i++)
|
||||
free((__DRIconfig *) psc->driver_configs[i]);
|
||||
free(psc->driver_configs);
|
||||
psc->driver_configs = NULL;
|
||||
}
|
||||
|
|
@ -217,15 +217,14 @@ QueryVersion(Display * dpy, int opcode, int *major, int *minor)
|
|||
{
|
||||
#ifdef USE_XCB
|
||||
xcb_connection_t *c = XGetXCBConnection(dpy);
|
||||
xcb_glx_query_version_reply_t* reply =
|
||||
xcb_glx_query_version_reply(c,
|
||||
xcb_glx_query_version(c,
|
||||
GLX_MAJOR_VERSION,
|
||||
GLX_MINOR_VERSION),
|
||||
NULL);
|
||||
xcb_glx_query_version_reply_t *reply = xcb_glx_query_version_reply(c,
|
||||
xcb_glx_query_version
|
||||
(c,
|
||||
GLX_MAJOR_VERSION,
|
||||
GLX_MINOR_VERSION),
|
||||
NULL);
|
||||
|
||||
if(reply->major_version != GLX_MAJOR_VERSION)
|
||||
{
|
||||
if (reply->major_version != GLX_MAJOR_VERSION) {
|
||||
free(reply);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
|
@ -543,7 +542,8 @@ getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
|
|||
__GLXscreenConfigs *psc;
|
||||
|
||||
psc = priv->screenConfigs + screen;
|
||||
psc->serverGLXexts = __glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS);
|
||||
psc->serverGLXexts =
|
||||
__glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS);
|
||||
|
||||
LockDisplay(dpy);
|
||||
|
||||
|
|
@ -601,7 +601,8 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
|
|||
memset(psc, 0, screens * sizeof(__GLXscreenConfigs));
|
||||
priv->screenConfigs = psc;
|
||||
|
||||
priv->serverGLXversion = __glXQueryServerString(dpy, priv->majorOpcode, 0, GLX_VERSION);
|
||||
priv->serverGLXversion =
|
||||
__glXQueryServerString(dpy, priv->majorOpcode, 0, GLX_VERSION);
|
||||
if (priv->serverGLXversion == NULL) {
|
||||
FreeScreenConfigs(priv);
|
||||
return GL_FALSE;
|
||||
|
|
@ -786,10 +787,10 @@ __glXSetupForCommand(Display * dpy)
|
|||
|
||||
/**
|
||||
* Flush the drawing command transport buffer.
|
||||
*
|
||||
*
|
||||
* \param ctx Context whose transport buffer is to be flushed.
|
||||
* \param pc Pointer to first unused buffer location.
|
||||
*
|
||||
*
|
||||
* \todo
|
||||
* Modify this function to use \c ctx->pc instead of the explicit
|
||||
* \c pc parameter.
|
||||
|
|
@ -881,11 +882,11 @@ __glXSendLargeChunk(__GLXcontext * gc, GLint requestNumber,
|
|||
|
||||
/**
|
||||
* Send a command that is too large for the GLXRender protocol request.
|
||||
*
|
||||
*
|
||||
* Send a large command, one that is too large for some reason to
|
||||
* send using the GLXRender protocol request. One reason to send
|
||||
* a large command is to avoid copying the data.
|
||||
*
|
||||
*
|
||||
* \param ctx GLX context
|
||||
* \param header Header data.
|
||||
* \param headerLen Size, in bytes, of the header data. It is assumed that
|
||||
|
|
|
|||
|
|
@ -315,10 +315,10 @@ set_glx_extension(const struct extension_info *ext,
|
|||
|
||||
/**
|
||||
* Convert the server's extension string to a bit-field.
|
||||
*
|
||||
*
|
||||
* \param server_string GLX extension string from the server.
|
||||
* \param server_support Bit-field of supported extensions.
|
||||
*
|
||||
*
|
||||
* \note
|
||||
* This function is used to process both GLX and GL extension strings. The
|
||||
* bit-fields used to track each of these have different sizes. Therefore,
|
||||
|
|
@ -336,8 +336,7 @@ __glXProcessServerString(const struct extension_info *ext,
|
|||
/* Determine the length of the next extension name.
|
||||
*/
|
||||
for (len = 0; (server_string[base + len] != SEPARATOR)
|
||||
&& (server_string[base + len] != NUL);
|
||||
len++) {
|
||||
&& (server_string[base + len] != NUL); len++) {
|
||||
/* empty */
|
||||
}
|
||||
|
||||
|
|
@ -351,8 +350,7 @@ __glXProcessServerString(const struct extension_info *ext,
|
|||
* over the previous string and any trialing white-space.
|
||||
*/
|
||||
for (base += len; (server_string[base] == SEPARATOR)
|
||||
&& (server_string[base] != NUL);
|
||||
base++) {
|
||||
&& (server_string[base] != NUL); base++) {
|
||||
/* empty */
|
||||
}
|
||||
}
|
||||
|
|
@ -549,7 +547,7 @@ __glXGetClientExtensions(void)
|
|||
/**
|
||||
* Calculate the list of application usable extensions. The resulting
|
||||
* string is stored in \c psc->effectiveGLXexts.
|
||||
*
|
||||
*
|
||||
* \param psc Pointer to GLX per-screen record.
|
||||
* \param display_is_direct_capable True if the display is capable of
|
||||
* direct rendering.
|
||||
|
|
@ -600,7 +598,7 @@ __glXCalculateUsableExtensions(__GLXscreenConfigs * psc,
|
|||
* it and the "server" supports it. In this case that means that either
|
||||
* the true server supports it or it is only for direct-rendering and
|
||||
* the direct rendering driver supports it.
|
||||
*
|
||||
*
|
||||
* If the display is not capable of direct rendering, then the extension
|
||||
* is enabled if and only if the client-side library and the server
|
||||
* support it.
|
||||
|
|
@ -609,10 +607,10 @@ __glXCalculateUsableExtensions(__GLXscreenConfigs * psc,
|
|||
if (display_is_direct_capable) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
usable[i] = (client_glx_support[i] & client_glx_only[i])
|
||||
| (client_glx_support[i] & psc->
|
||||
direct_support[i] & server_support[i])
|
||||
| (client_glx_support[i] & psc->
|
||||
direct_support[i] & direct_glx_only[i]);
|
||||
| (client_glx_support[i] & psc->direct_support[i] &
|
||||
server_support[i])
|
||||
| (client_glx_support[i] & psc->direct_support[i] &
|
||||
direct_glx_only[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -630,7 +628,7 @@ __glXCalculateUsableExtensions(__GLXscreenConfigs * psc,
|
|||
/**
|
||||
* Calculate the list of application usable extensions. The resulting
|
||||
* string is stored in \c gc->extensions.
|
||||
*
|
||||
*
|
||||
* \param gc Pointer to GLX context.
|
||||
* \param server_string Extension string from the server.
|
||||
* \param major_version GL major version from the server.
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* (C) Copyright IBM Corporation 2004, 2005
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
/**
|
||||
* \file indirect_vertex_array.c
|
||||
* Implement GLX protocol for vertex arrays and vertex buffer objects.
|
||||
*
|
||||
*
|
||||
* The most important function in this fill is \c fill_array_info_cache.
|
||||
* The \c array_state_vector contains a cache of the ARRAY_INFO data sent
|
||||
* in the DrawArrays protocol. Certain operations, such as enabling or
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
* fills-in this data. Additionally, it examines the enabled state and
|
||||
* other factors to determine what "version" of DrawArrays protocoal can be
|
||||
* used.
|
||||
*
|
||||
*
|
||||
* Current, only two versions of DrawArrays protocol are implemented. The
|
||||
* first version is the "none" protocol. This is the fallback when the
|
||||
* server does not support GL 1.1 / EXT_vertex_arrays. It is implemented
|
||||
|
|
@ -90,11 +90,11 @@ static GLboolean validate_type(__GLXcontext * gc, GLenum type);
|
|||
|
||||
|
||||
/**
|
||||
* Table of sizes, in bytes, of a GL types. All of the type enums are be in
|
||||
* Table of sizes, in bytes, of a GL types. All of the type enums are be in
|
||||
* the range 0x1400 - 0x140F. That includes types added by extensions (i.e.,
|
||||
* \c GL_HALF_FLOAT_NV). This elements of this table correspond to the
|
||||
* type enums masked with 0x0f.
|
||||
*
|
||||
*
|
||||
* \notes
|
||||
* \c GL_HALF_FLOAT_NV is not included. Neither are \c GL_2_BYTES,
|
||||
* \c GL_3_BYTES, or \c GL_4_BYTES.
|
||||
|
|
@ -131,15 +131,15 @@ __glXFreeVertexArrayState(__GLXcontext * gc)
|
|||
|
||||
/**
|
||||
* Initialize vertex array state of a GLX context.
|
||||
*
|
||||
*
|
||||
* \param gc GLX context whose vertex array state is to be initialized.
|
||||
*
|
||||
*
|
||||
* \warning
|
||||
* This function may only be called after __GLXcontext::gl_extension_bits,
|
||||
* __GLXcontext::server_minor, and __GLXcontext::server_major have been
|
||||
* initialized. These values are used to determine what vertex arrays are
|
||||
* supported.
|
||||
*
|
||||
*
|
||||
* \bug
|
||||
* Return values from malloc are not properly tested.
|
||||
*/
|
||||
|
|
@ -171,7 +171,7 @@ __glXInitVertexArrayState(__GLXcontext * gc)
|
|||
* are supported by the server are create. For example, if the server
|
||||
* supports only 2 texture units, then only 2 texture coordinate arrays
|
||||
* are created.
|
||||
*
|
||||
*
|
||||
* At the very least, GL_VERTEX_ARRAY, GL_NORMAL_ARRAY,
|
||||
* GL_COLOR_ARRAY, GL_INDEX_ARRAY, GL_TEXTURE_COORD_ARRAY, and
|
||||
* GL_EDGE_FLAG_ARRAY are supported.
|
||||
|
|
@ -532,7 +532,7 @@ emit_DrawArrays_none(GLenum mode, GLint first, GLsizei count)
|
|||
/**
|
||||
* Emit the header data for the GL 1.1 / EXT_vertex_arrays DrawArrays
|
||||
* protocol.
|
||||
*
|
||||
*
|
||||
* \param gc GLX context.
|
||||
* \param arrays Array state.
|
||||
* \param elements_per_request Location to store the number of elements that
|
||||
|
|
@ -543,7 +543,7 @@ emit_DrawArrays_none(GLenum mode, GLint first, GLsizei count)
|
|||
* will be zero.
|
||||
* \param mode Drawing mode.
|
||||
* \param count Number of vertices.
|
||||
*
|
||||
*
|
||||
* \returns
|
||||
* A pointer to the buffer for array data.
|
||||
*/
|
||||
|
|
@ -594,7 +594,7 @@ emit_DrawArrays_header_old(__GLXcontext * gc,
|
|||
/* Calculate the number of data packets that will be required to send
|
||||
* the whole command. To do this, the number of verticies that
|
||||
* will fit in a single buffer must be calculated.
|
||||
*
|
||||
*
|
||||
* The important value here is elements_per_request. This is the
|
||||
* number of complete array elements that will fit in a single
|
||||
* buffer. There may be some wasted space at the end of the buffer,
|
||||
|
|
@ -869,7 +869,7 @@ emit_DrawElements_old(GLenum mode, GLsizei count, GLenum type,
|
|||
/**
|
||||
* Validate that the \c mode parameter to \c glDrawArrays, et. al. is valid.
|
||||
* If it is not valid, then an error code is set in the GLX context.
|
||||
*
|
||||
*
|
||||
* \returns
|
||||
* \c GL_TRUE if the argument is valid, \c GL_FALSE if is not.
|
||||
*/
|
||||
|
|
@ -902,7 +902,7 @@ validate_mode(__GLXcontext * gc, GLenum mode)
|
|||
* A value less than zero is invalid and will result in \c GL_INVALID_VALUE
|
||||
* being set. A value of zero will not result in an error being set, but
|
||||
* will result in \c GL_FALSE being returned.
|
||||
*
|
||||
*
|
||||
* \returns
|
||||
* \c GL_TRUE if the argument is valid, \c GL_FALSE if it is not.
|
||||
*/
|
||||
|
|
@ -1084,21 +1084,21 @@ __indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count,
|
|||
|
||||
|
||||
#define COMMON_ARRAY_DATA_INIT(a, PTR, TYPE, STRIDE, COUNT, NORMALIZED, HDR_SIZE, OPCODE) \
|
||||
do { \
|
||||
(a)->data = PTR; \
|
||||
(a)->data_type = TYPE; \
|
||||
(a)->user_stride = STRIDE; \
|
||||
(a)->count = COUNT; \
|
||||
(a)->normalized = NORMALIZED; \
|
||||
\
|
||||
(a)->element_size = __glXTypeSize( TYPE ) * COUNT; \
|
||||
(a)->true_stride = (STRIDE == 0) \
|
||||
? (a)->element_size : STRIDE; \
|
||||
\
|
||||
(a)->header_size = HDR_SIZE; \
|
||||
((uint16_t *) (a)->header)[0] = __GLX_PAD((a)->header_size + (a)->element_size); \
|
||||
((uint16_t *) (a)->header)[1] = OPCODE; \
|
||||
} while(0)
|
||||
do { \
|
||||
(a)->data = PTR; \
|
||||
(a)->data_type = TYPE; \
|
||||
(a)->user_stride = STRIDE; \
|
||||
(a)->count = COUNT; \
|
||||
(a)->normalized = NORMALIZED; \
|
||||
\
|
||||
(a)->element_size = __glXTypeSize( TYPE ) * COUNT; \
|
||||
(a)->true_stride = (STRIDE == 0) \
|
||||
? (a)->element_size : STRIDE; \
|
||||
\
|
||||
(a)->header_size = HDR_SIZE; \
|
||||
((uint16_t *) (a)->header)[0] = __GLX_PAD((a)->header_size + (a)->element_size); \
|
||||
((uint16_t *) (a)->header)[1] = OPCODE; \
|
||||
} while(0)
|
||||
|
||||
|
||||
void
|
||||
|
|
@ -1363,36 +1363,36 @@ __indirect_glTexCoordPointer(GLint size, GLenum type, GLsizei stride,
|
|||
{
|
||||
static const uint16_t short_ops[5] = {
|
||||
0, X_GLrop_TexCoord1sv, X_GLrop_TexCoord2sv, X_GLrop_TexCoord3sv,
|
||||
X_GLrop_TexCoord4sv
|
||||
X_GLrop_TexCoord4sv
|
||||
};
|
||||
static const uint16_t int_ops[5] = {
|
||||
0, X_GLrop_TexCoord1iv, X_GLrop_TexCoord2iv, X_GLrop_TexCoord3iv,
|
||||
X_GLrop_TexCoord4iv
|
||||
X_GLrop_TexCoord4iv
|
||||
};
|
||||
static const uint16_t float_ops[5] = {
|
||||
0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2fv, X_GLrop_TexCoord3fv,
|
||||
X_GLrop_TexCoord4fv
|
||||
X_GLrop_TexCoord4fv
|
||||
};
|
||||
static const uint16_t double_ops[5] = {
|
||||
0, X_GLrop_TexCoord1dv, X_GLrop_TexCoord2dv, X_GLrop_TexCoord3dv,
|
||||
X_GLrop_TexCoord4dv
|
||||
X_GLrop_TexCoord4dv
|
||||
};
|
||||
|
||||
static const uint16_t mshort_ops[5] = {
|
||||
0, X_GLrop_MultiTexCoord1svARB, X_GLrop_MultiTexCoord2svARB,
|
||||
X_GLrop_MultiTexCoord3svARB, X_GLrop_MultiTexCoord4svARB
|
||||
X_GLrop_MultiTexCoord3svARB, X_GLrop_MultiTexCoord4svARB
|
||||
};
|
||||
static const uint16_t mint_ops[5] = {
|
||||
0, X_GLrop_MultiTexCoord1ivARB, X_GLrop_MultiTexCoord2ivARB,
|
||||
X_GLrop_MultiTexCoord3ivARB, X_GLrop_MultiTexCoord4ivARB
|
||||
X_GLrop_MultiTexCoord3ivARB, X_GLrop_MultiTexCoord4ivARB
|
||||
};
|
||||
static const uint16_t mfloat_ops[5] = {
|
||||
0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2fvARB,
|
||||
X_GLrop_MultiTexCoord3fvARB, X_GLrop_MultiTexCoord4fvARB
|
||||
X_GLrop_MultiTexCoord3fvARB, X_GLrop_MultiTexCoord4fvARB
|
||||
};
|
||||
static const uint16_t mdouble_ops[5] = {
|
||||
0, X_GLrop_MultiTexCoord1dvARB, X_GLrop_MultiTexCoord2dvARB,
|
||||
X_GLrop_MultiTexCoord3dvARB, X_GLrop_MultiTexCoord4dvARB
|
||||
X_GLrop_MultiTexCoord3dvARB, X_GLrop_MultiTexCoord4dvARB
|
||||
};
|
||||
|
||||
uint16_t opcode;
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ __indirect_glGetError(void)
|
|||
|
||||
/**
|
||||
* Get the selected attribute from the client state.
|
||||
*
|
||||
*
|
||||
* \returns
|
||||
* On success \c GL_TRUE is returned. Otherwise, \c GL_FALSE is returned.
|
||||
*/
|
||||
|
|
@ -679,7 +679,8 @@ __indirect_glGetString(GLenum name)
|
|||
*/
|
||||
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
s = (GLubyte *) __glXGetString(dpy, gc->majorOpcode, gc->currentContextTag, name);
|
||||
s = (GLubyte *) __glXGetString(dpy, gc->majorOpcode, gc->currentContextTag,
|
||||
name);
|
||||
if (!s) {
|
||||
/* Throw data on the floor */
|
||||
__glXSetError(gc, GL_OUT_OF_MEMORY);
|
||||
|
|
@ -753,7 +754,7 @@ __indirect_glGetString(GLenum name)
|
|||
* hardware accelerated. For example, a TNT will show core
|
||||
* version 1.5, but most of the post-1.2 functionality is a
|
||||
* software fallback.
|
||||
*
|
||||
*
|
||||
* I don't want to break applications that rely on this odd
|
||||
* behavior. At the same time, the code is written and tested,
|
||||
* so I didn't want to throw it away. Therefore, the code is here
|
||||
|
|
@ -766,7 +767,7 @@ __indirect_glGetString(GLenum name)
|
|||
* gc->server_minor are set. This version may be higher than we
|
||||
* can completely support, but it may imply support for some
|
||||
* extensions that we can support.
|
||||
*
|
||||
*
|
||||
* For example, at the time of this writing, the client-side
|
||||
* library only supports upto core GL version 1.2. However, cubic
|
||||
* textures, multitexture, multisampling, and some other 1.3
|
||||
|
|
@ -880,50 +881,50 @@ GLboolean
|
|||
__indirect_glAreTexturesResident(GLsizei n, const GLuint * textures,
|
||||
GLboolean * residences)
|
||||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
Display *const dpy = gc->currentDpy;
|
||||
GLboolean retval = (GLboolean) 0;
|
||||
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
|
||||
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
Display *const dpy = gc->currentDpy;
|
||||
GLboolean retval = (GLboolean) 0;
|
||||
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
|
||||
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
|
||||
#ifdef USE_XCB
|
||||
xcb_connection_t *c = XGetXCBConnection(dpy);
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
xcb_glx_are_textures_resident_reply_t *reply =
|
||||
xcb_glx_are_textures_resident_reply(c,
|
||||
xcb_glx_are_textures_resident
|
||||
(c, gc->currentContextTag, n,
|
||||
textures), NULL);
|
||||
(void) memcpy(residences, xcb_glx_are_textures_resident_data(reply),
|
||||
xcb_glx_are_textures_resident_data_length(reply) *
|
||||
sizeof(GLboolean));
|
||||
retval = reply->ret_val;
|
||||
free(reply);
|
||||
xcb_connection_t *c = XGetXCBConnection(dpy);
|
||||
(void) __glXFlushRenderBuffer(gc, gc->pc);
|
||||
xcb_glx_are_textures_resident_reply_t *reply =
|
||||
xcb_glx_are_textures_resident_reply(c,
|
||||
xcb_glx_are_textures_resident
|
||||
(c, gc->currentContextTag, n,
|
||||
textures), NULL);
|
||||
(void) memcpy(residences, xcb_glx_are_textures_resident_data(reply),
|
||||
xcb_glx_are_textures_resident_data_length(reply) *
|
||||
sizeof(GLboolean));
|
||||
retval = reply->ret_val;
|
||||
free(reply);
|
||||
#else
|
||||
GLubyte const *pc =
|
||||
__glXSetupSingleRequest(gc, X_GLsop_AreTexturesResident, cmdlen);
|
||||
(void) memcpy((void *) (pc + 0), (void *) (&n), 4);
|
||||
(void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
|
||||
if (n & 3) {
|
||||
/* n is not a multiple of four.
|
||||
* When reply_is_always_array is TRUE, __glXReadReply() will
|
||||
* put a multiple of four bytes into the dest buffer. If the
|
||||
* caller's buffer is not a multiple of four in size, we'll write
|
||||
* out of bounds. So use a temporary buffer that's a few bytes
|
||||
* larger.
|
||||
*/
|
||||
GLboolean *res4 = malloc((n + 3) & ~3);
|
||||
retval = (GLboolean) __glXReadReply(dpy, 1, res4, GL_TRUE);
|
||||
memcpy(residences, res4, n);
|
||||
free(res4);
|
||||
}
|
||||
else {
|
||||
retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
GLubyte const *pc =
|
||||
__glXSetupSingleRequest(gc, X_GLsop_AreTexturesResident, cmdlen);
|
||||
(void) memcpy((void *) (pc + 0), (void *) (&n), 4);
|
||||
(void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
|
||||
if (n & 3) {
|
||||
/* n is not a multiple of four.
|
||||
* When reply_is_always_array is TRUE, __glXReadReply() will
|
||||
* put a multiple of four bytes into the dest buffer. If the
|
||||
* caller's buffer is not a multiple of four in size, we'll write
|
||||
* out of bounds. So use a temporary buffer that's a few bytes
|
||||
* larger.
|
||||
*/
|
||||
GLboolean *res4 = malloc((n + 3) & ~3);
|
||||
retval = (GLboolean) __glXReadReply(dpy, 1, res4, GL_TRUE);
|
||||
memcpy(residences, res4, n);
|
||||
free(res4);
|
||||
}
|
||||
else {
|
||||
retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
#endif /* USE_XCB */
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -936,36 +937,37 @@ GLboolean
|
|||
glAreTexturesResidentEXT(GLsizei n, const GLuint * textures,
|
||||
GLboolean * residences)
|
||||
{
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
|
||||
if (gc->isDirect) {
|
||||
return CALL_AreTexturesResident(GET_DISPATCH(),
|
||||
(n, textures, residences));
|
||||
} else {
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
Display *const dpy = gc->currentDpy;
|
||||
GLboolean retval = (GLboolean) 0;
|
||||
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
|
||||
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
|
||||
GLubyte const *pc =
|
||||
__glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
|
||||
X_GLvop_AreTexturesResidentEXT,
|
||||
cmdlen);
|
||||
(void) memcpy((void *) (pc + 0), (void *) (&n), 4);
|
||||
(void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
|
||||
if (n & 3) {
|
||||
/* see comments in __indirect_glAreTexturesResident() */
|
||||
GLboolean *res4 = malloc((n + 3) & ~3);
|
||||
retval = (GLboolean) __glXReadReply(dpy, 1, res4, GL_TRUE);
|
||||
memcpy(residences, res4, n);
|
||||
free(res4);
|
||||
}
|
||||
else {
|
||||
retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
if (gc->isDirect) {
|
||||
return CALL_AreTexturesResident(GET_DISPATCH(),
|
||||
(n, textures, residences));
|
||||
}
|
||||
else {
|
||||
__GLXcontext *const gc = __glXGetCurrentContext();
|
||||
Display *const dpy = gc->currentDpy;
|
||||
GLboolean retval = (GLboolean) 0;
|
||||
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
|
||||
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
|
||||
GLubyte const *pc =
|
||||
__glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
|
||||
X_GLvop_AreTexturesResidentEXT,
|
||||
cmdlen);
|
||||
(void) memcpy((void *) (pc + 0), (void *) (&n), 4);
|
||||
(void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
|
||||
if (n & 3) {
|
||||
/* see comments in __indirect_glAreTexturesResident() */
|
||||
GLboolean *res4 = malloc((n + 3) & ~3);
|
||||
retval = (GLboolean) __glXReadReply(dpy, 1, res4, GL_TRUE);
|
||||
memcpy(residences, res4, n);
|
||||
free(res4);
|
||||
}
|
||||
else {
|
||||
retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
|
||||
}
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue