[Mesa-dev] [PATCH 37/43] dri/radeon: use a const __DRIextension array

Emil Velikov emil.l.velikov at gmail.com
Tue Feb 18 17:20:16 PST 2014


Rather than keeping a separate and used copy of the screen extensions
within the raderon screen, move to use a constant array that can be
fed directly to the __DRIscreen.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/mesa/drivers/dri/radeon/radeon_screen.c | 29 ++++++++++++++---------------
 src/mesa/drivers/dri/radeon/radeon_screen.h |  2 --
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index dd94038..fe72b77 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -481,11 +481,23 @@ static int radeon_set_screen_flags(radeonScreenPtr screen, int device_id)
    return 0;
 }
 
+
+static const __DRIextension *radeon_screen_extensions[] = {
+    &dri2ConfigQueryExtension.base,
+#if defined(RADEON_R100)
+    &radeonTexBufferExtension.base,
+#elif defined(RADEON_R200)
+    &r200TexBufferExtension.base,
+#endif
+    &radeonFlushExtension.base,
+    &radeonImageExtension.base,
+    NULL
+};
+
 static radeonScreenPtr
 radeonCreateScreen2(__DRIscreen *sPriv)
 {
    radeonScreenPtr screen;
-   int i;
    int ret;
    uint32_t device_id = 0;
 
@@ -522,20 +534,7 @@ radeonCreateScreen2(__DRIscreen *sPriv)
    if (getenv("RADEON_NO_TCL"))
 	   screen->chip_flags &= ~RADEON_CHIPSET_TCL;
 
-   i = 0;
-   screen->extensions[i++] = &dri2ConfigQueryExtension.base;
-
-#if defined(RADEON_R100)
-   screen->extensions[i++] = &radeonTexBufferExtension.base;
-#elif defined(RADEON_R200)
-   screen->extensions[i++] = &r200TexBufferExtension.base;
-#endif
-
-   screen->extensions[i++] = &radeonFlushExtension.base;
-   screen->extensions[i++] = &radeonImageExtension.base;
-
-   screen->extensions[i++] = NULL;
-   sPriv->extensions = screen->extensions;
+   sPriv->extensions = radeon_screen_extensions;
 
    screen->driScreen = sPriv;
    screen->bom = radeon_bo_manager_gem_ctor(sPriv->fd);
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h
index 03abb2a..76fa1ec 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.h
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.h
@@ -97,8 +97,6 @@ typedef struct radeon_screen {
    /* Configuration cache with default values for all contexts */
    driOptionCache optionCache;
 
-   const __DRIextension *extensions[17];
-
    int num_gb_pipes;
    int num_z_pipes;
    drm_radeon_sarea_t *sarea;	/* Private SAREA data */
-- 
1.9.0



More information about the mesa-dev mailing list