コード例 #1
0
ファイル: glxinit.c プロジェクト: venkatarajasekhar/Qt
_X_HIDDEN __GLXdisplayPrivate *
__glXInitialize(Display * dpy)
{
   XExtDisplayInfo *info = __glXFindDisplay(dpy);
   XExtData **privList, *private, *found;
   __GLXdisplayPrivate *dpyPriv;
   XEDataObject dataObj;
   int major, minor;

   if (!XextHasExtension(info))
      return NULL;

   /* See if a display private already exists.  If so, return it */
   dataObj.display = dpy;
   privList = XEHeadOfExtensionList(dataObj);
   found = XFindOnExtensionList(privList, info->codes->extension);
   if (found)
      return (__GLXdisplayPrivate *) found->private_data;

   /* See if the versions are compatible */
   if (!QueryVersion(dpy, info->codes->major_opcode, &major, &minor))
      return NULL;

   /*
    ** Allocate memory for all the pieces needed for this buffer.
    */
   private = (XExtData *) Xmalloc(sizeof(XExtData));
コード例 #2
0
ファイル: NVCtrl.c プロジェクト: RobertBeckebans/fhDOOM
Bool XNVCTRLQueryAttribute (
    Display *dpy,
    int screen,
    unsigned int display_mask,
    unsigned int attribute,
    int *value
){
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlQueryAttributeReply rep;
    xnvCtrlQueryAttributeReq   *req;
    Bool exists;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);
    GetReq (nvCtrlQueryAttribute, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlQueryAttribute;
    req->screen = screen;
    req->display_mask = display_mask;
    req->attribute = attribute;
    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }
    if (value) *value = rep.value;
    exists = rep.flags;
    UnlockDisplay (dpy);
    SyncHandle ();
    return exists;
}
コード例 #3
0
ファイル: CrXExtension.c プロジェクト: L3oV1nc3/VMGL
Status XVMGLExtWatchWindow(Display *dpy, unsigned int glWindow, XID XWindow )
{
    XExtDisplayInfo *ExtensionInfo = VMGLAutogenFindDisplay(dpy);
    XVMGLWatchWindowReply XInternalReply;
    register xVMGLWatchWindowReq *XProtoRequest;
    
    /* Goofy sanity check */
    if (!(glStubIP && glStubPort))
	return ((Status) 0);

    if (!XextHasExtension (ExtensionInfo))
        return ((Status) 0);

    LockDisplay (dpy);

    GetReq(VMGLWatchWindow, XProtoRequest);
    XProtoRequest->reqType = ExtensionInfo->codes->major_opcode;
    XProtoRequest->VMGLRequestType = X_VMGLWatchWindow;
    XProtoRequest->glWindow = glWindow;
    XProtoRequest->XWindow = XWindow;
    XProtoRequest->address = glStubIP;
    XProtoRequest->port = glStubPort;

    if (!_XReply (dpy, (xReply *) &XInternalReply, 0, xTrue)) {
	UnlockDisplay (dpy);
	SyncHandle ();
	return (Status)0;
    }
    
    UnlockDisplay (dpy);
    SyncHandle ();
    return ((Status) XInternalReply.retVal);
}
コード例 #4
0
ファイル: NVCtrl.c プロジェクト: RobertBeckebans/fhDOOM
Bool XNVCtrlSelectNotify (
    Display *dpy,
    int screen,
    int type,
    Bool onoff
){
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlSelectNotifyReq *req;

    if(!XextHasExtension (info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);
    GetReq (nvCtrlSelectNotify, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlSelectNotify;
    req->screen = screen;
    req->notifyType = type;
    req->onoff = onoff;
    UnlockDisplay (dpy);
    SyncHandle ();

    return True;
}
コード例 #5
0
ファイル: CrXExtension.c プロジェクト: L3oV1nc3/VMGL
/* Extension calls */
Status XVMGLExtInit (Display *dpy, in_addr_t address, in_port_t port)
{
    XExtDisplayInfo *ExtensionInfo = VMGLAutogenFindDisplay(dpy);
    XVMGLInitReply XInternalReply;
    register xVMGLInitReq *XProtoRequest;

    if (!XextHasExtension (ExtensionInfo))
        return ((Status) 0);

    LockDisplay (dpy);

    GetReq(VMGLInit, XProtoRequest);
    XProtoRequest->reqType = ExtensionInfo->codes->major_opcode;
    XProtoRequest->VMGLRequestType = X_VMGLInit;
    XProtoRequest->address = address;
    XProtoRequest->port = port;

    if (!_XReply (dpy, (xReply *) &XInternalReply, 0, xTrue)) {
	UnlockDisplay (dpy);
	SyncHandle ();
	return (Status)0;
    }

    UnlockDisplay (dpy);
    SyncHandle ();
    if (XInternalReply.retVal) {
	glStubIP = address;
	glStubPort = port;
	return ((Status) 1);
    } else
	return ((Status) 0);
}
コード例 #6
0
ファイル: NVCtrl.c プロジェクト: vampirefrog/wmbluegpu
Bool XNVCTRLQueryTargetCount (
    Display *dpy,
    int target_type,
    int *value
) {
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlQueryTargetCountReply  rep;
    xnvCtrlQueryTargetCountReq   *req;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);
    GetReq (nvCtrlQueryTargetCount, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlQueryTargetCount;
    req->target_type = target_type;
    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }
    if (value) *value = rep.count;
    UnlockDisplay (dpy);
    SyncHandle ();
    return True;
}
コード例 #7
0
ファイル: NVCtrl.c プロジェクト: venkatarajasekhar/Qt
static Bool QueryAttributePermissionsInternal (
    Display *dpy,
    unsigned int attribute,
    NVCTRLAttributePermissionsRec *permissions,
    unsigned int reqType
) {
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlQueryAttributePermissionsReply rep;
    xnvCtrlQueryAttributePermissionsReq *req;
    Bool exists;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay(dpy);
    GetReq(nvCtrlQueryAttributePermissions, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = reqType;
    req->attribute = attribute;
    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
        UnlockDisplay (dpy);
        SyncHandle();
        return False;
    }
    exists = rep.flags;
    if (exists && permissions) {
        permissions->type = rep.attr_type;
        permissions->permissions = rep.perms;
    }
    UnlockDisplay(dpy);
    SyncHandle();
    return exists;
}
コード例 #8
0
ファイル: NVCtrl.c プロジェクト: RobertBeckebans/fhDOOM
Bool XNVCTRLQueryVersion (
    Display *dpy,
    int *major,
    int *minor
){
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlQueryExtensionReply rep;
    xnvCtrlQueryExtensionReq   *req;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);
    GetReq (nvCtrlQueryExtension, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlQueryExtension;
    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }
    if (major) *major = rep.major;
    if (minor) *minor = rep.minor;
    UnlockDisplay (dpy);
    SyncHandle ();
    return True;
}
コード例 #9
0
ファイル: NVCtrl.c プロジェクト: RobertBeckebans/fhDOOM
Bool XNVCTRLIsNvScreen (
    Display *dpy,
    int screen
){
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlIsNvReply rep;
    xnvCtrlIsNvReq   *req;
    Bool isnv;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);
    GetReq (nvCtrlIsNv, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlIsNv;
    req->screen = screen;
    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }
    isnv = rep.isnv;
    UnlockDisplay (dpy);
    SyncHandle ();
    return isnv;
}
コード例 #10
0
int video_card_memory_size_ATI()
{
  XExtDisplayInfo* info;
  Display* dpy;
  int size;

  dpy = XOpenDisplay(NULL); //glXGetCurrentDisplay();
  info = find_display_fglx(dpy);
  if (XextHasExtension(info))
  {
    xFGLGetDriverDataReq* req;
    xFGLGetDriverDataReply rep;
    
    GetReq(FGLGetDriverData, req);

    // fill in the request structure
    req->reqType = info->codes->major_opcode;
    // calculate size of request structure in 4 byte units 
    req->length = (sizeof(*req)+3) / 4;
    req->fireglReqType = X_FGLGetDriverData;
    req->screen = DefaultScreen(dpy);
    // carry out the extension function and wait for reply
    // 3rd parameter, called "extra": number of extra 32 bit words
    // reply structures must be multiple of 4 with a minimum of 32 bytes
#ifdef __ia64__
    //SGI prism crashes in the _XReply() call, need to track this down
    //the firegl cards actually have 256MB of RAM, so return that.
    SyncHandle();
    return 256;
#endif
    if (!_XReply(dpy, (xReply *)&rep, (sizeof(rep) - 32) / 4, xFalse))
    {
      SyncHandle();
      return 0;
    }
    switch (rep.usVideoRam) {
      // DriverData.ulVideoRam is the contents of mmCONFIG_MEMSIZE shr 16
    case 0x1000:
      size = 256;
      break;
    case 0x800:
      size = 128;
      break;
    case 0x400:
      size = 64;
      break;
    case 0x200:
      size = 32;
      break;
    default:
      size = 0;
    }
    SyncHandle();
  }
  else
  {
    return 0;
  }
  return size;
}
コード例 #11
0
ファイル: Xdbe.c プロジェクト: aosm/X11
/* 
 * XdbeQueryExtension -
 *	Sets major_version_return and minor_verion_return to the major and
 *	minor DBE protocol version supported by the server.  If the DBE
 *	library is compatible with the version returned by the server, this
 *	function returns non-zero.  If dpy does not support the DBE
 *	extension, or if there was an error during communication with the
 *	server, or if the server and library protocol versions are
 *	incompatible, this functions returns zero.  No other Xdbe functions
 *	may be called before this function.   If a client violates this rule,
 *	the effects of all subsequent Xdbe calls are undefined.
 */
Status XdbeQueryExtension (
    Display *dpy,
    int *major_version_return,
    int *minor_version_return)
{
    XExtDisplayInfo *info = find_display (dpy);
    xDbeGetVersionReply rep;
    register xDbeGetVersionReq *req;

    if (!XextHasExtension (info))
        return (Status)0; /* failure */

    LockDisplay (dpy);
    DbeGetReq (DbeGetVersion, req, info);
    req->majorVersion = DBE_MAJOR_VERSION;
    req->minorVersion = DBE_MINOR_VERSION;

    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
	UnlockDisplay (dpy);
	SyncHandle ();
	return (Status)0; /* failure */
    }
    *major_version_return = rep.majorVersion;
    *minor_version_return = rep.minorVersion;
    UnlockDisplay (dpy);

    SyncHandle ();

    if (*major_version_return != DBE_MAJOR_VERSION)
        return (Status)0; /* failure */
    else
        return (Status)1; /* success */
}
コード例 #12
0
ファイル: NVCtrl.c プロジェクト: venkatarajasekhar/Qt
Bool XNVCTRLQueryTargetBinaryData (
    Display *dpy,
    int target_type,
    int target_id,
    unsigned int display_mask,
    unsigned int attribute,
    unsigned char **ptr,
    int *len
) {
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlQueryBinaryDataReply rep;
    xnvCtrlQueryBinaryDataReq   *req;
    Bool exists;
    int length, numbytes, slop;

    if (!ptr) return False;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);
    XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id);

    LockDisplay (dpy);
    GetReq (nvCtrlQueryBinaryData, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlQueryBinaryData;
    req->target_type = target_type;
    req->target_id = target_id;
    req->display_mask = display_mask;
    req->attribute = attribute;
    if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }
    length = rep.length;
    numbytes = rep.n;
    slop = numbytes & 3;
    exists = rep.flags;
    if (exists) {
        *ptr = (unsigned char *) Xmalloc(numbytes);
    }
    if (!exists || !*ptr) {
        _XEatData(dpy, length);
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    } else {
        _XRead(dpy, (char *) *ptr, numbytes);
        if (slop) _XEatData(dpy, 4-slop);
    }
    if (len) *len = numbytes;
    UnlockDisplay (dpy);
    SyncHandle ();
    return exists;
}
コード例 #13
0
ファイル: XEVI.c プロジェクト: SvenDowideit/clearlinux
Bool XeviQueryExtension (Display *dpy)
{
    XExtDisplayInfo *info = find_display (dpy);
    if (XextHasExtension(info)) {
	return True;
    } else {
	return False;
    }
}
コード例 #14
0
ファイル: XLbx.c プロジェクト: Magister/x11rdp_xorg71
int XLbxGetEventBase(Display *dpy)
{
    XExtDisplayInfo *info = find_display (dpy);

    if (XextHasExtension(info)) {
	return info->codes->first_event;
    } else {
	return -1;
    }
}
コード例 #15
0
ファイル: NVCtrl.c プロジェクト: vampirefrog/wmbluegpu
Bool XNVCTRLQueryDDCCIBlockLutOperation (
    Display *dpy,
    int screen,
    unsigned int display_mask,
    unsigned int color, // NV_CTRL_DDCCI_RED_LUT, NV_CTRL_DDCCI_GREEN_LUT, NV_CTRL_DDCCI_BLUE_LUT
    unsigned int offset,
    unsigned int size,
    unsigned int **value
) {
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlQueryDDCCIBlockLutOperationReply rep;
    xnvCtrlQueryDDCCIBlockLutOperationReq *req;
    Bool exists;
    int length, slop;
    char *ptr;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);
    GetReq (nvCtrlQueryDDCCIBlockLutOperation, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlQueryDDCCIBlockLutOperation;
    req->screen = screen;
    req->display_mask = display_mask;
    req->color=color;
    req->offset=offset;
    req->size=size;
    if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }
    length = rep.length;
    slop = rep.num_bytes & 3;
    ptr = (char *) Xmalloc(rep.num_bytes);
    if (! ptr) {
        _XEatData(dpy, length);
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    } else {
        _XRead(dpy, (char *) ptr, rep.num_bytes);
        if (slop) _XEatData(dpy, 4-slop);
    }
    exists = rep.flags;
    if(exists) {
        *value=(unsigned int *)ptr;
    }
    UnlockDisplay (dpy);
    SyncHandle ();
    return exists;
}
コード例 #16
0
ファイル: NVCtrl.c プロジェクト: revelator/Revelator-Doom3
Bool XNVCTRLQueryStringAttribute (
    Display *dpy,
    int screen,
    unsigned int display_mask,
    unsigned int attribute,
    char **ptr
)
{
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlQueryStringAttributeReply rep;
    xnvCtrlQueryStringAttributeReq   *req;
    Bool exists;
    int length, numbytes, slop;

    if (!ptr) return False;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);
    GetReq (nvCtrlQueryStringAttribute, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlQueryStringAttribute;
    req->screen = screen;
    req->display_mask = display_mask;
    req->attribute = attribute;
    if (!_XReply (dpy, (xReply *) &rep, 0, False))
    {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }
    length = rep.length;
    numbytes = rep.n;
    slop = numbytes & 3;
    *ptr = (char *) Xmalloc(numbytes);
    if (! *ptr)
    {
        _XEatData(dpy, length);
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }
    else
    {
        _XRead(dpy, (char *) *ptr, numbytes);
        if (slop) _XEatData(dpy, 4-slop);
    }
    exists = rep.flags;
    UnlockDisplay (dpy);
    SyncHandle ();
    return exists;
}
コード例 #17
0
ファイル: MITMisc.c プロジェクト: Magister/x11rdp_xorg71
Bool XMITMiscQueryExtension (Display *dpy, int *event_basep, int *error_basep)
{
    XExtDisplayInfo *info = find_display (dpy);

    if (XextHasExtension(info)) {
	*event_basep = info->codes->first_event;
	*error_basep = info->codes->first_error;
	return True;
    } else {
	return False;
    }
}
コード例 #18
0
ファイル: NVCtrl.c プロジェクト: vampirefrog/wmbluegpu
/* XXXAlternative: Instead of getting the manufacturer string from the server,
 * get the manufacturer Id instead, and have controller_manufacturer assigned
 * to a static string that would not need to be malloc'ed and freed.
 */
Bool XNVCTRLQueryDDCCIDisplayControllerType (
    Display *dpy,
    int screen,
    unsigned int display_mask,
    unsigned char **controller_manufacturer,
    unsigned int *controller_type
)
{
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlQueryDDCCIDisplayControllerTypeReply rep;
    xnvCtrlQueryDDCCIDisplayControllerTypeReq *req;
    Bool exists;
    int length, numbytes, slop;
    char *ptr;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);
    GetReq (nvCtrlQueryDDCCIDisplayControllerType, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlQueryDDCCIDisplayControllerType;
    req->screen = screen;
    req->display_mask = display_mask;
    if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }
    length = rep.length;
    numbytes = rep.size;
    slop = numbytes & 3;
    ptr = (char *) Xmalloc(numbytes);
    if (! ptr) {
        _XEatData(dpy, length);
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    } else {
        _XRead(dpy, (char *) ptr, numbytes);
        if (slop) _XEatData(dpy, 4-slop);
    }
    exists = rep.flags;
    if(exists) {
        *controller_type=rep.controller_type;
        *controller_manufacturer=ptr;
    }
    UnlockDisplay (dpy);
    SyncHandle ();
    return exists;
}
コード例 #19
0
ファイル: NVCtrl.c プロジェクト: vampirefrog/wmbluegpu
Bool XNVCTRLQueryDDCCITimingReport (
    Display *dpy,
    int screen,
    unsigned int display_mask,
    unsigned int *sync_freq_out_range,
    unsigned int *unstable_count,
    unsigned int *positive_h_sync,
    unsigned int *positive_v_sync,
    unsigned int *h_freq,
    unsigned int *v_freq
) {
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlQueryDDCCITimingReportReply rep;
    xnvCtrlQueryDDCCITimingReportReq *req;
    unsigned int buf[6];
    Bool exists;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);

    GetReq (nvCtrlQueryDDCCITimingReport, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlQueryDDCCITimingReport;
    req->screen = screen;
    req->display_mask = display_mask;

    if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }

    _XRead(dpy, (char *)(&buf), 24);

    exists = rep.flags;

    *sync_freq_out_range = buf[0];
    *unstable_count = buf[1];
    *positive_h_sync = buf[2];
    *positive_v_sync = buf[3];
    *h_freq = buf[4];
    *v_freq = buf[5];

    UnlockDisplay (dpy);
    SyncHandle ();

    return exists;
}
コード例 #20
0
ファイル: mesa_dri2.c プロジェクト: emericg/libvdpau-vp8
Bool
_vdp_DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase)
{
   XExtDisplayInfo *info = DRI2FindDisplay(dpy);

   if (XextHasExtension(info)) {
      *eventBase = info->codes->first_event;
      *errorBase = info->codes->first_error;
      return True;
   }

   return False;
}
コード例 #21
0
ファイル: NVCtrl.c プロジェクト: vampirefrog/wmbluegpu
Bool XNVCTRLQueryDDCCILutSize (
    Display *dpy,
    int screen,
    unsigned int display_mask,
    unsigned int *red_entries,
    unsigned int *green_entries,
    unsigned int *blue_entries,
    unsigned int *red_bits_per_entries,
    unsigned int *green_bits_per_entries,
    unsigned int *blue_bits_per_entries
) {
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlQueryDDCCILutSizeReply rep;
    xnvCtrlQueryDDCCILutSizeReq *req;
    unsigned int buf[6];
    Bool exists;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);

    GetReq (nvCtrlQueryDDCCILutSize, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlQueryDDCCILutSize;
    req->screen = screen;
    req->display_mask = display_mask;

    if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }

    _XRead(dpy, (char *)(&buf), 24);

    *red_entries = buf[0];
    *green_entries = buf[1];
    *blue_entries = buf[2];
    *red_bits_per_entries = buf[3];
    *green_bits_per_entries = buf[4];
    *blue_bits_per_entries = buf[5];

    UnlockDisplay (dpy);
    SyncHandle ();
    exists = rep.flags;
    return exists;
}
コード例 #22
0
ファイル: NVCtrl.c プロジェクト: revelator/Revelator-Doom3
Bool XNVCTRLQueryValidAttributeValues (
    Display *dpy,
    int screen,
    unsigned int display_mask,
    unsigned int attribute,
    NVCTRLAttributeValidValuesRec *values
)
{
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlQueryValidAttributeValuesReply rep;
    xnvCtrlQueryValidAttributeValuesReq   *req;
    Bool exists;

    if (!values) return False;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);
    GetReq (nvCtrlQueryValidAttributeValues, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlQueryValidAttributeValues;
    req->screen = screen;
    req->display_mask = display_mask;
    req->attribute = attribute;
    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue))
    {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }
    exists = rep.flags;
    values->type = rep.attr_type;
    if (rep.attr_type == ATTRIBUTE_TYPE_RANGE)
    {
        values->u.range.min = rep.min;
        values->u.range.max = rep.max;
    }
    if (rep.attr_type == ATTRIBUTE_TYPE_INT_BITS)
    {
        values->u.bits.ints = rep.bits;
    }
    values->permissions = rep.perms;
    UnlockDisplay (dpy);
    SyncHandle ();
    return exists;
}
コード例 #23
0
ファイル: NVCtrl.c プロジェクト: vampirefrog/wmbluegpu
Bool XNVCTRLSetDDCCIRemoteProcedureCall (
    Display *dpy,
    int screen,
    unsigned int display_mask,
    unsigned int offset,
    unsigned int size,
    unsigned int *red_lut,
    unsigned int *green_lut,
    unsigned int *blue_lut,
    unsigned int *increment
) {
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlSetDDCCIRemoteProcedureCallReq *req;
    xnvCtrlSetDDCCIRemoteProcedureCallReply rep;
    unsigned int nbytes;
    Bool success;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);
    GetReq (nvCtrlSetDDCCIRemoteProcedureCall, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlSetDDCCIRemoteProcedureCall;
    req->screen = screen;
    req->display_mask = display_mask;
    req->size = size;
    nbytes= size << 2;
    req->num_bytes = nbytes * 4;
    req->length += (req->num_bytes + 3) >> 2;
    req->offset = offset;
    Data(dpy, (char *)red_lut, nbytes );
    Data(dpy, (char *)green_lut, nbytes );
    Data(dpy, (char *)blue_lut, nbytes );
    Data(dpy, (char *)increment, nbytes );

    if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }
    UnlockDisplay (dpy);
    SyncHandle ();

    success = rep.flags;
    return success;
}
コード例 #24
0
ファイル: XF86dri.c プロジェクト: aosm/X11server
Bool XF86DRIQueryExtension (Display *dpy, int *event_basep, int *error_basep)
{
    XExtDisplayInfo *info = find_display (dpy);

    TRACE("QueryExtension...");
    if (XextHasExtension(info)) {
	*event_basep = info->codes->first_event;
	*error_basep = info->codes->first_error;
        TRACE("QueryExtension... return True");
	return True;
    } else {
        TRACE("QueryExtension... return False");
	return False;
    }
}
コード例 #25
0
ファイル: Xinerama.c プロジェクト: sheldonrobinson/VcXsrv
Bool XPanoramiXQueryExtension (
    Display *dpy,
    int *event_base_return,
    int *error_base_return
)
{
    XExtDisplayInfo *info = find_display (dpy);

    if (XextHasExtension(info)) {
	*event_base_return = info->codes->first_event;
	*error_base_return = info->codes->first_error;
	return True;
    } else {
	return False;
    }
}
コード例 #26
0
ファイル: NVCtrl.c プロジェクト: vampirefrog/wmbluegpu
Bool XNVCTRLQueryDDCCISinglePointLutOperation (
    Display *dpy,
    int screen,
    unsigned int display_mask,
    unsigned int offset,
    unsigned int *red_value,
    unsigned int *green_value,
    unsigned int *blue_value
) {
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlQueryDDCCISinglePointLutOperationReply rep;
    xnvCtrlQueryDDCCISinglePointLutOperationReq *req;
    unsigned int buf[4];
    Bool exists;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);

    GetReq (nvCtrlQueryDDCCISinglePointLutOperation, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlQueryDDCCISinglePointLutOperation;
    req->screen = screen;
    req->display_mask = display_mask;
    req->offset = offset;

    if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }

    _XRead(dpy, (char *)(&buf), 12);

    *red_value = buf[0];
    *green_value = buf[1];
    *blue_value = buf[2];

    UnlockDisplay (dpy);
    SyncHandle ();

    exists=rep.flags;
    return exists;
}
コード例 #27
0
ファイル: XETrapInit.c プロジェクト: aosm/X11libs
/*
 * XETrapQueryExtension -
 *      Returns True if the DEC-XTRAP extension is available
 *      on the given display.  If the extension exists, the value of the
 *      first event code is stored into event_base and the value of the first
 *      error code is stored into error_base.
 */
Bool XETrapQueryExtension(Display *dpy,INT32 *event_base_return,
    INT32 *error_base_return, INT32 *opcode_return)
{
    Bool status = True;
    XExtDisplayInfo *info = find_display (dpy);

    if (XextHasExtension (info))
    {
        *event_base_return = (INT32)(info->codes->first_event);
        *error_base_return = (INT32)(info->codes->first_error);
	*opcode_return     = (INT32)(info->codes->major_opcode);
    }
    else
    {
        status = False;
    }
    return(status);
}
コード例 #28
0
ファイル: NVCtrl.c プロジェクト: venkatarajasekhar/Qt
Bool XNVCTRLSetTargetStringAttribute (
    Display *dpy,
    int target_type,
    int target_id,
    unsigned int display_mask,
    unsigned int attribute,
    char *ptr
) {
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlSetStringAttributeReq *req;
    xnvCtrlSetStringAttributeReply rep;
    int size;
    Bool success;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    size = strlen(ptr)+1;

    LockDisplay (dpy);
    GetReq (nvCtrlSetStringAttribute, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlSetStringAttribute;
    req->target_type = target_type;
    req->target_id = target_id;
    req->display_mask = display_mask;
    req->attribute = attribute;
    req->length += ((size + 3) & ~3) >> 2;
    req->num_bytes = size;
    Data(dpy, ptr, size);

    if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }
    UnlockDisplay (dpy);
    SyncHandle ();

    success = rep.flags;
    return success;
}
コード例 #29
0
ファイル: NVCtrl.c プロジェクト: vampirefrog/wmbluegpu
Bool XNVCTRLSetDDCCIBlockLutOperation (
    Display *dpy,
    int screen,
    unsigned int display_mask,
    unsigned int color, // NV_CTRL_DDCCI_RED_LUT, NV_CTRL_DDCCI_GREEN_LUT, NV_CTRL_DDCCI_BLUE_LUT
    unsigned int offset,
    unsigned int size,
    unsigned int *value
) {
    XExtDisplayInfo *info = find_display (dpy);
    xnvCtrlSetDDCCIBlockLutOperationReq *req;
    xnvCtrlSetDDCCIBlockLutOperationReply rep;
    Bool success;

    if(!XextHasExtension(info))
        return False;

    XNVCTRLCheckExtension (dpy, info, False);

    LockDisplay (dpy);
    GetReq (nvCtrlSetDDCCIBlockLutOperation, req);
    req->reqType = info->codes->major_opcode;
    req->nvReqType = X_nvCtrlSetDDCCIBlockLutOperation;
    req->screen = screen;
    req->display_mask = display_mask;
    req->color = color;
    req->offset = offset;
    req->size = size;
    req->num_bytes = size << 2;
    req->length += (req->num_bytes + 3) >> 2;
    Data(dpy, (char *)value, req->num_bytes );

    if (!_XReply (dpy, (xReply *) &rep, 0, False)) {
        UnlockDisplay (dpy);
        SyncHandle ();
        return False;
    }
    UnlockDisplay (dpy);
    SyncHandle ();

    success = rep.flags;
    return success;
}
コード例 #30
0
ファイル: glxext.c プロジェクト: XQuartz/AppleSGLX
/*
** Initialize the client side extension code.
*/
_X_HIDDEN __GLXdisplayPrivate *
__glXInitialize(Display * dpy)
{
   XExtDisplayInfo *info = __glXFindDisplay(dpy);
   XExtData **privList, *private, *found;
   __GLXdisplayPrivate *dpyPriv;
   XEDataObject dataObj;
   int major, minor;
#ifdef GLX_DIRECT_RENDERING
   Bool glx_direct, glx_accel;
#endif

   /* The one and only long long lock */
   __glXLock();

   if (!XextHasExtension(info)) {
      /* No GLX extension supported by this server. Oh well. */
      __glXUnlock();
      XMissingExtension(dpy, __glXExtensionName);
      return 0;
   }

   /* See if a display private already exists.  If so, return it */
   dataObj.display = dpy;
   privList = XEHeadOfExtensionList(dataObj);
   found = XFindOnExtensionList(privList, info->codes->extension);
   if (found) {
      __glXUnlock();
      return (__GLXdisplayPrivate *) found->private_data;
   }

   /* See if the versions are compatible */
   if (!QueryVersion(dpy, info->codes->major_opcode, &major, &minor)) {
      /* The client and server do not agree on versions.  Punt. */
      __glXUnlock();
      return 0;
   }

   /*
    ** Allocate memory for all the pieces needed for this buffer.
    */
   private = (XExtData *) Xmalloc(sizeof(XExtData));