dri: unify __DriverAPIRec
authorGeorge Sapountzis <gsapountzis@gmail.com>
Thu, 3 Nov 2011 10:46:08 +0000 (12:46 +0200)
committerGeorge Sapountzis <gsapountzis@gmail.com>
Fri, 4 Nov 2011 21:33:04 +0000 (23:33 +0200)
I dropped the comments because they don't add much.

src/gallium/state_trackers/dri/drm/dri2.c
src/gallium/state_trackers/dri/sw/drisw.c
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/dri_util.h
src/mesa/drivers/dri/common/drisw_util.h
src/mesa/drivers/dri/intel/intel_screen.c
src/mesa/drivers/dri/nouveau/nouveau_screen.c
src/mesa/drivers/dri/radeon/radeon_screen.c

index 357cc4994daa48a5fae6f565dae17b42f3304962..f45a95a67f9840c40d061484bffaa0e7cecc5c22 100644 (file)
@@ -701,7 +701,7 @@ dri2_create_buffer(__DRIscreen * sPriv,
  * DRI versions differ in their implementation of init_screen and swap_buffers.
  */
 const struct __DriverAPIRec driDriverAPI = {
-   .InitScreen2 = dri2_init_screen,
+   .InitScreen = dri2_init_screen,
    .DestroyScreen = dri_destroy_screen,
    .CreateContext = dri_create_context,
    .DestroyContext = dri_destroy_context,
index 39d7d30a13d1870f8e024358055ae82bdb0f6b1b..2c650cfd3aeaa95ec8e44ed0650b9ab317a630be 100644 (file)
@@ -356,10 +356,9 @@ const struct __DriverAPIRec driDriverAPI = {
    .DestroyContext = dri_destroy_context,
    .CreateBuffer = drisw_create_buffer,
    .DestroyBuffer = dri_destroy_buffer,
+   .SwapBuffers = drisw_swap_buffers,
    .MakeCurrent = dri_make_current,
    .UnbindContext = dri_unbind_context,
-
-   .SwapBuffers = drisw_swap_buffers,
 };
 
 /* This is the table of extensions that the loader will dlsym() for. */
index da4e39f9c0143f490107c56cae6bd9e812bdf62d..1775a43fc3ee5c795566a901f0946dc777a587bc 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "main/imports.h"
 
+#include <drm.h>
+#include <xf86drm.h>
 #include "dri_util.h"
 #include "utils.h"
 #include "xmlpool.h"
@@ -410,9 +412,6 @@ dri2CreateNewScreen(int scrn, int fd,
     __DRIscreen *psp;
     drmVersionPtr version;
 
-    if (driDriverAPI.InitScreen2 == NULL)
-        return NULL;
-
     psp = calloc(1, sizeof(*psp));
     if (!psp)
        return NULL;
@@ -433,7 +432,7 @@ dri2CreateNewScreen(int scrn, int fd,
 
     psp->DriverAPI = driDriverAPI;
     psp->api_mask = (1 << __DRI_API_OPENGL);
-    *driver_configs = driDriverAPI.InitScreen2(psp);
+    *driver_configs = driDriverAPI.InitScreen(psp);
     if (*driver_configs == NULL) {
        free(psp);
        return NULL;
index 7a3b0a9b2f5294e6d7b5aec0da19a164e2802495..b4f17d139df4674b4cc515b3eaf6adca92f5b9d7 100644 (file)
 #define _DRI_UTIL_H_
 
 #include <GL/gl.h>
-#include <drm.h>
-#include <drm_sarea.h>
-#include <xf86drm.h>
-#include "xmlconfig.h"
-#include "main/glheader.h"
+#include <GL/internal/dri_interface.h>
 #include "main/mtypes.h"
-#include "GL/internal/dri_interface.h"
+#include "xmlconfig.h"
 
-#define GLX_BAD_CONTEXT                    5
 
 /**
  * Extensions.
@@ -76,56 +71,37 @@ extern const __DRI2configQueryExtension dri2ConfigQueryExtension;
  * this structure.
  */
 struct __DriverAPIRec {
-    /**
-     * Screen destruction callback
-     */
+    const __DRIconfig **(*InitScreen) (__DRIscreen * priv);
+
     void (*DestroyScreen)(__DRIscreen *driScrnPriv);
 
-    /**
-     * Context creation callback
-     */                    
     GLboolean (*CreateContext)(gl_api api,
-                              const struct gl_config *glVis,
-                              __DRIcontext *driContextPriv,
+                               const struct gl_config *glVis,
+                               __DRIcontext *driContextPriv,
                                void *sharedContextPrivate);
 
-    /**
-     * Context destruction callback
-     */
     void (*DestroyContext)(__DRIcontext *driContextPriv);
 
-    /**
-     * Buffer (drawable) creation callback
-     */
     GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv,
                               __DRIdrawable *driDrawPriv,
                               const struct gl_config *glVis,
                               GLboolean pixmapBuffer);
-    
-    /**
-     * Buffer (drawable) destruction callback
-     */
+
     void (*DestroyBuffer)(__DRIdrawable *driDrawPriv);
 
-    /**
-     * Context activation callback
-     */
+    void (*SwapBuffers)(__DRIdrawable *driDrawPriv);
+
     GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv,
                              __DRIdrawable *driDrawPriv,
                              __DRIdrawable *driReadPriv);
 
-    /**
-     * Context unbinding callback
-     */
     GLboolean (*UnbindContext)(__DRIcontext *driContextPriv);
 
-    /* DRI2 Entry point */
-    const __DRIconfig **(*InitScreen2) (__DRIscreen * priv);
-
     __DRIbuffer *(*AllocateBuffer) (__DRIscreen *screenPrivate,
-                                   unsigned int attachment,
-                                   unsigned int format,
-                                   int width, int height);
+                                    unsigned int attachment,
+                                    unsigned int format,
+                                    int width, int height);
+
     void (*ReleaseBuffer) (__DRIscreen *screenPrivate, __DRIbuffer *buffer);
 };
 
index deb27093627090a6ea904a44d4afbd8a291391b9..1d3b14c6f5223535553e5d9aaa0c4e222d2a15d3 100644 (file)
@@ -56,7 +56,7 @@ struct __DriverAPIRec {
 
     void (*DestroyScreen)(__DRIscreen *driScrnPriv);
 
-    GLboolean (*CreateContext)(gl_api glapi,
+    GLboolean (*CreateContext)(gl_api api,
                                const struct gl_config *glVis,
                                __DRIcontext *driContextPriv,
                                void *sharedContextPrivate);
@@ -77,6 +77,13 @@ struct __DriverAPIRec {
                              __DRIdrawable *driReadPriv);
 
     GLboolean (*UnbindContext)(__DRIcontext *driContextPriv);
+
+    __DRIbuffer *(*AllocateBuffer) (__DRIscreen *screenPrivate,
+                                    unsigned int attachment,
+                                    unsigned int format,
+                                    int width, int height);
+
+    void (*ReleaseBuffer) (__DRIscreen *screenPrivate, __DRIbuffer *buffer);
 };
 
 extern const struct __DriverAPIRec driDriverAPI;
index 4ee70f9b3f778419754d4303fbd45c44558b8698..19dbc9fe140a7ef2a8ae4f62bad92c5c69003c54 100644 (file)
@@ -846,6 +846,7 @@ intelReleaseBuffer(__DRIscreen *screen, __DRIbuffer *buffer)
 
 
 const struct __DriverAPIRec driDriverAPI = {
+   .InitScreen          = intelInitScreen2,
    .DestroyScreen       = intelDestroyScreen,
    .CreateContext       = intelCreateContext,
    .DestroyContext      = intelDestroyContext,
@@ -853,7 +854,6 @@ const struct __DriverAPIRec driDriverAPI = {
    .DestroyBuffer       = intelDestroyBuffer,
    .MakeCurrent                 = intelMakeCurrent,
    .UnbindContext       = intelUnbindContext,
-   .InitScreen2                 = intelInitScreen2,
    .AllocateBuffer       = intelAllocateBuffer,
    .ReleaseBuffer        = intelReleaseBuffer
 };
index a6e2186cf4370b9bd92549dea99fc78a9b468aa1..2ce07647317eaf4dcfdf8a4e77c365c973df60d0 100644 (file)
@@ -241,7 +241,7 @@ static const __DRIextension *nouveau_screen_extensions[] = {
 };
 
 const struct __DriverAPIRec driDriverAPI = {
-       .InitScreen2     = nouveau_init_screen2,
+       .InitScreen      = nouveau_init_screen2,
        .DestroyScreen   = nouveau_destroy_screen,
        .CreateBuffer    = nouveau_create_buffer,
        .DestroyBuffer   = nouveau_destroy_buffer,
index f53a54727d32f254d4ae0749d7973d49d9a36a7c..84b0b5a20e3ddac950e382e973a4cc976226f075 100644 (file)
@@ -1354,6 +1354,7 @@ __DRIconfig **radeonInitScreen2(__DRIscreen *psp)
 }
 
 const struct __DriverAPIRec driDriverAPI = {
+   .InitScreen      = radeonInitScreen2,
    .DestroyScreen   = radeonDestroyScreen,
 #if defined(RADEON_R200)
    .CreateContext   = r200CreateContext,
@@ -1366,8 +1367,6 @@ const struct __DriverAPIRec driDriverAPI = {
    .DestroyBuffer   = radeonDestroyBuffer,
    .MakeCurrent     = radeonMakeCurrent,
    .UnbindContext   = radeonUnbindContext,
-    /* DRI2 */
-   .InitScreen2     = radeonInitScreen2,
 };
 
 /* This is the table of extensions that the loader will dlsym() for. */