[Glamor] [PATCH] modify for glx

junyan.he at linux.intel.com junyan.he at linux.intel.com
Thu Jan 31 17:29:22 PST 2013


From: Junyan He <junyan.he at linux.intel.com>

---
 glx/glapi.c             |   38 ++++++++++++++++++++++++++++++++------
 glx/glxdri2.c           |    2 ++
 glx/glxserver.h         |    4 ++--
 glx/indirect_dispatch.h |    4 ++--
 4 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/glx/glapi.c b/glx/glapi.c
index 02e06ac..e2fb333 100644
--- a/glx/glapi.c
+++ b/glx/glapi.c
@@ -456,15 +456,41 @@ _glapi_add_dispatch(const char *const *function_names,
     return offset;
 }
 
-/*
- * glXGetProcAddress doesn't exist in the protocol, the drivers never call
- * this themselves, and neither does the server.  warn if it happens though.
- */
 PUBLIC _glapi_proc
 _glapi_get_proc_address(const char *funcName)
 {
-    ErrorF("_glapi_get_proc_address called!\n");
-    return NULL;
+    const char * func_name;
+    _glapi_proc proc;
+    GLint offset;
+    int i;
+
+    DebugF("glx's _glapi_get_proc_address called!\n");
+
+    if (funcName[0] != 'g' || funcName[1] != 'l')
+	return NULL;
+
+    offset = get_static_proc_offset(funcName);
+
+    if(offset < 0) {
+	for (i = 0; i < NumExtEntryPoints; i++) {
+	    if (strcmp(ExtEntryTable[i].name, funcName) == 0) {
+		offset = ExtEntryTable[i].dispatch_offset;
+		break;
+	    }
+	}
+
+	if(offset < 0) {
+	    DebugF("Can not find the entry for func: %s\n", funcName);
+	    return NULL;
+	}
+    }
+
+    proc = GET_by_offset(GET_DISPATCH(), offset);
+
+    DebugF("Find function %s address, offset is %d, address: %p",
+	   funcName, offset, proc);
+
+    return proc;
 }
 
 /**
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index bce1bfa..e34c851 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -544,6 +544,8 @@ create_driver_context(__GLXDRIcontext * context,
                 ctx_attribs[num_ctx_attribs++] = reset;
             }
 #endif
+        } else {
+            api = __DRI_API_OPENGL;
         }
 
         context->driContext =
-- 
1.7.10.4



More information about the Glamor mailing list