📄 xf86dri.c
字号:
} UnlockDisplay(dpy); SyncHandle(); TRACE("GetClientDriverName... return True"); return True;}PUBLIC Bool XF86DRICreateContextWithConfig(dpy, screen, configID, context, hHWContext) Display* dpy; int screen; int configID; XID* context; drm_context_t * hHWContext;{ XExtDisplayInfo *info = find_display (dpy); xXF86DRICreateContextReply rep; xXF86DRICreateContextReq *req; TRACE("CreateContext..."); XF86DRICheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DRICreateContext, req); req->reqType = info->codes->major_opcode; req->driReqType = X_XF86DRICreateContext; req->visual = configID; req->screen = screen; *context = XAllocID(dpy); req->context = *context; if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); TRACE("CreateContext... return False"); return False; } *hHWContext = rep.hHWContext; UnlockDisplay(dpy); SyncHandle(); TRACE("CreateContext... return True"); return True;}PUBLIC Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext) Display* dpy; int screen; Visual* visual; XID* context; drm_context_t * hHWContext;{ return XF86DRICreateContextWithConfig( dpy, screen, visual->visualid, context, hHWContext );}PUBLIC GLboolean XF86DRIDestroyContext(Display *dpy, int screen, XID context ){ XExtDisplayInfo *info = find_display (dpy); xXF86DRIDestroyContextReq *req; TRACE("DestroyContext..."); XF86DRICheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DRIDestroyContext, req); req->reqType = info->codes->major_opcode; req->driReqType = X_XF86DRIDestroyContext; req->screen = screen; req->context = context; UnlockDisplay(dpy); SyncHandle(); TRACE("DestroyContext... return True"); return True;}PUBLIC GLboolean XF86DRICreateDrawable(Display *dpy, int screen, XID drawable, drm_drawable_t * hHWDrawable ){ XExtDisplayInfo *info = find_display (dpy); xXF86DRICreateDrawableReply rep; xXF86DRICreateDrawableReq *req; TRACE("CreateDrawable..."); XF86DRICheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DRICreateDrawable, req); req->reqType = info->codes->major_opcode; req->driReqType = X_XF86DRICreateDrawable; req->screen = screen; req->drawable = drawable; if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); TRACE("CreateDrawable... return False"); return False; } *hHWDrawable = rep.hHWDrawable; UnlockDisplay(dpy); SyncHandle(); TRACE("CreateDrawable... return True"); return True;}static int noopErrorHandler(Display *dpy, XErrorEvent *xerr){ return 0;}PUBLIC GLboolean XF86DRIDestroyDrawable(Display *dpy, int screen, XID drawable ){ XExtDisplayInfo *info = find_display (dpy); xXF86DRIDestroyDrawableReq *req; int (*oldXErrorHandler)(Display *, XErrorEvent *); TRACE("DestroyDrawable..."); XF86DRICheckExtension (dpy, info, False); /* This is called from the DRI driver, which used call it like this * * if (windowExists(drawable)) * destroyDrawable(drawable); * * which is a textbook race condition - the window may disappear * from the server between checking for its existance and * destroying it. Instead we change the semantics of * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if * the windows is gone, by wrapping the destroy call in an error * handler. */ XSync(dpy, GL_FALSE); oldXErrorHandler = XSetErrorHandler(noopErrorHandler); LockDisplay(dpy); GetReq(XF86DRIDestroyDrawable, req); req->reqType = info->codes->major_opcode; req->driReqType = X_XF86DRIDestroyDrawable; req->screen = screen; req->drawable = drawable; UnlockDisplay(dpy); SyncHandle(); XSetErrorHandler(oldXErrorHandler); TRACE("DestroyDrawable... return True"); return True;}PUBLIC Bool XF86DRIGetDrawableInfo(Display* dpy, int screen, Drawable drawable, unsigned int* index, unsigned int* stamp, int* X, int* Y, int* W, int* H, int* numClipRects, drm_clip_rect_t ** pClipRects, int* backX, int* backY, int* numBackClipRects, drm_clip_rect_t ** pBackClipRects ){ XExtDisplayInfo *info = find_display (dpy); xXF86DRIGetDrawableInfoReply rep; xXF86DRIGetDrawableInfoReq *req; int total_rects; TRACE("GetDrawableInfo..."); XF86DRICheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DRIGetDrawableInfo, req); req->reqType = info->codes->major_opcode; req->driReqType = X_XF86DRIGetDrawableInfo; req->screen = screen; req->drawable = drawable; if (!_XReply(dpy, (xReply *)&rep, 1, xFalse)) { UnlockDisplay(dpy); SyncHandle(); TRACE("GetDrawableInfo... return False"); return False; } *index = rep.drawableTableIndex; *stamp = rep.drawableTableStamp; *X = (int)rep.drawableX; *Y = (int)rep.drawableY; *W = (int)rep.drawableWidth; *H = (int)rep.drawableHeight; *numClipRects = rep.numClipRects; total_rects = *numClipRects; *backX = rep.backX; *backY = rep.backY; *numBackClipRects = rep.numBackClipRects; total_rects += *numBackClipRects;#if 0 /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks * backwards compatibility (Because of the >> 2 shift) but the fix * enables multi-threaded apps to work. */ if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) - SIZEOF(xGenericReply) + total_rects * sizeof(drm_clip_rect_t)) + 3) & ~3) >> 2)) { _XEatData(dpy, rep.length); UnlockDisplay(dpy); SyncHandle(); TRACE("GetDrawableInfo... return False"); return False; }#endif if (*numClipRects) { int len = sizeof(drm_clip_rect_t) * (*numClipRects); *pClipRects = (drm_clip_rect_t *)Xcalloc(len, 1); if (*pClipRects) _XRead(dpy, (char*)*pClipRects, len); } else { *pClipRects = NULL; } if (*numBackClipRects) { int len = sizeof(drm_clip_rect_t) * (*numBackClipRects); *pBackClipRects = (drm_clip_rect_t *)Xcalloc(len, 1); if (*pBackClipRects) _XRead(dpy, (char*)*pBackClipRects, len); } else { *pBackClipRects = NULL; } UnlockDisplay(dpy); SyncHandle(); TRACE("GetDrawableInfo... return True"); return True;}PUBLIC Bool XF86DRIGetDeviceInfo(dpy, screen, hFrameBuffer, fbOrigin, fbSize, fbStride, devPrivateSize, pDevPrivate) Display* dpy; int screen; drm_handle_t * hFrameBuffer; int* fbOrigin; int* fbSize; int* fbStride; int* devPrivateSize; void** pDevPrivate;{ XExtDisplayInfo *info = find_display (dpy); xXF86DRIGetDeviceInfoReply rep; xXF86DRIGetDeviceInfoReq *req; TRACE("GetDeviceInfo..."); XF86DRICheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XF86DRIGetDeviceInfo, req); req->reqType = info->codes->major_opcode; req->driReqType = X_XF86DRIGetDeviceInfo; req->screen = screen; if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); TRACE("GetDeviceInfo... return False"); return False; } *hFrameBuffer = rep.hFrameBufferLow; if (sizeof(drm_handle_t) == 8) { int shift = 32; /* var to prevent warning on next line */ *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift; } *fbOrigin = rep.framebufferOrigin; *fbSize = rep.framebufferSize; *fbStride = rep.framebufferStride; *devPrivateSize = rep.devPrivateSize; if (rep.length) { if (!(*pDevPrivate = (void *)Xcalloc(rep.devPrivateSize, 1))) { _XEatData(dpy, ((rep.devPrivateSize+3) & ~3)); UnlockDisplay(dpy); SyncHandle(); TRACE("GetDeviceInfo... return False"); return False; } _XRead(dpy, (char*)*pDevPrivate, rep.devPrivateSize); } else { *pDevPrivate = NULL; } UnlockDisplay(dpy); SyncHandle(); TRACE("GetDeviceInfo... return True"); return True;}PUBLIC Bool XF86DRIOpenFullScreen(dpy, screen, drawable) Display* dpy; int screen; Drawable drawable;{ /* This function and the underlying X protocol are deprecated. */ (void) dpy; (void) screen; (void) drawable; return False;}PUBLIC Bool XF86DRICloseFullScreen(dpy, screen, drawable) Display* dpy; int screen; Drawable drawable;{ /* This function and the underlying X protocol are deprecated. */ (void) dpy; (void) screen; (void) drawable; return True;}#endif /* GLX_DIRECT_RENDERING */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -