pass driver-type to DRI2Connect()
authorRob Clark <rob.clark@linaro.org>
Fri, 11 Nov 2011 23:24:27 +0000 (17:24 -0600)
committerRob Clark <rob.clark@linaro.org>
Fri, 2 Dec 2011 15:02:09 +0000 (09:02 -0600)
Allow libdri2 to be used with driver-types other than DRI2DriverDRI.

include/X11/extensions/dri2.h
src/dri2.c
test/dri2test.c
test/dri2util.c
test/dri2util.h

index 2913db150c29249175759ea5c80245bf29bd66df..e42cdb675d2f04219434857c89277e2cabc7bed6 100644 (file)
@@ -67,8 +67,8 @@ extern Bool
 DRI2QueryVersion(Display * display, int *major, int *minor);
 
 extern Bool
-DRI2Connect(Display * display, XID window,
-            char **driverName, char **deviceName);
+DRI2Connect(Display * dpy, XID window,
+               int driverType, char **driverName, char **deviceName);
 
 extern Bool
 DRI2Authenticate(Display * display, XID window, drm_magic_t magic);
index b93d455b906ad68c35695c2f85e6a59e17f1c7d9..91adec5e85f931f56f64e9a8406371c69137f6a9 100644 (file)
@@ -243,7 +243,8 @@ DRI2QueryVersion(Display * dpy, int *major, int *minor)
 }
 
 Bool
-DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName)
+DRI2Connect(Display * dpy, XID window,
+               int driverType, char **driverName, char **deviceName)
 {
    XExtDisplayInfo *info = DRI2FindDisplay(dpy);
    xDRI2ConnectReply rep;
@@ -256,7 +257,7 @@ DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName)
    req->reqType = info->codes->major_opcode;
    req->dri2ReqType = X_DRI2Connect;
    req->window = window;
-   req->driverType = DRI2DriverDRI;
+   req->driverType = driverType;
    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
       UnlockDisplay(dpy);
       SyncHandle();
index 1615add06001386c7d78021c66cb0e213553e0f3..1aa101d23d597ad4c50bc3c8adfba57b7fda38af 100644 (file)
@@ -77,7 +77,7 @@ int main(int argc, char **argv)
        XMapWindow(dpy, win);
        XFlush(dpy);
 
-       if ((fd = dri2_connect(dpy, &driver)) < 0) {
+       if ((fd = dri2_connect(dpy, DRI2DriverDRI, &driver)) < 0) {
                return -1;
        }
 
index 4c41f5bec8fdd23f033be86b9c61dc79d1e2a75d..20fda157b8c196a2f41aaea6c87d4e5f015663a1 100644 (file)
@@ -79,7 +79,7 @@ static const DRI2EventOps ops = {
                .EventToWire = EventToWire,
 };
 
-int dri2_connect(Display *dpy, char **driver)
+int dri2_connect(Display *dpy, int driverType, char **driver)
 {
        int eventBase, errorBase, major, minor;
        char *device;
@@ -108,7 +108,7 @@ int dri2_connect(Display *dpy, char **driver)
 
        root = RootWindow(dpy, DefaultScreen(dpy));
 
-       if (!DRI2Connect(dpy, root, driver, &device)) {
+       if (!DRI2Connect(dpy, root, driverType, driver, &device)) {
                ERROR_MSG("DRI2Connect failed");
                return -1;
        }
index d30460d34e2d9246b688d5d5fdfc73077b056390..39a007d447a2987f2194353071a91fdbf59af6e9 100644 (file)
@@ -74,7 +74,7 @@ typedef struct {
        void   (*fini)(void *hdl);
 } Backend;
 
-int dri2_connect(Display *dpy, char **driver);
+int dri2_connect(Display *dpy, int driverType, char **driver);
 Backend * get_backend(const char *driver);
 
 #endif /* _DRI2TEST_H_ */