Mesa (master): glx: Drop support for GLX_MESA_allocate_memory

Kristian Høgsberg krh at kemper.freedesktop.org
Tue Jul 20 02:48:17 UTC 2010


Module: Mesa
Branch: master
Commit: cb2a66fd0c095fe03be5aaf88c8d48f5867425d3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb2a66fd0c095fe03be5aaf88c8d48f5867425d3

Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Mon Jul 19 15:15:15 2010 -0400

glx: Drop support for GLX_MESA_allocate_memory

Only r200 implemented it.

---

 include/GL/glx.h                            |   16 ----
 include/GL/internal/dri_interface.h         |   18 -----
 src/glx/apple/gen_exports.tcl               |    3 +-
 src/glx/apple/glx_empty.c                   |   46 ------------
 src/glx/dri_common.c                        |    7 --
 src/glx/glxclient.h                         |    4 -
 src/glx/glxcmds.c                           |   71 ------------------
 src/glx/glxextensions.c                     |    2 -
 src/glx/glxextensions.h                     |    1 -
 src/mesa/drivers/dri/r200/r200_ioctl.c      |  107 ---------------------------
 src/mesa/drivers/dri/r200/r200_ioctl.h      |    5 -
 src/mesa/drivers/dri/radeon/radeon_screen.c |   12 ---
 src/mesa/drivers/x11/glxapi.c               |   30 --------
 13 files changed, 1 insertions(+), 321 deletions(-)

diff --git a/include/GL/glx.h b/include/GL/glx.h
index fd53964..a3a7d97 100644
--- a/include/GL/glx.h
+++ b/include/GL/glx.h
@@ -368,22 +368,6 @@ typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer);
 
 
 /*
- * ???. GLX_MESA_allocate_memory
- */ 
-#ifndef GLX_MESA_allocate_memory
-#define GLX_MESA_allocate_memory 1
-
-extern void *glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority);
-extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer);
-extern GLuint glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer);
-typedef void * ( * PFNGLXALLOCATEMEMORYMESAPROC) (Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority);
-typedef void ( * PFNGLXFREEMEMORYMESAPROC) (Display *dpy, int scrn, void *pointer);
-typedef GLuint (* PFNGLXGETMEMORYOFFSETMESAPROC) (Display *dpy, int scrn, const void *pointer);
-
-#endif /* GLX_MESA_allocate_memory */
-
-
-/*
  * ARB ?. GLX_ARB_render_texture
  * XXX This was never finalized!
  */
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index e4c2b3a..2c85464 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -74,7 +74,6 @@ typedef struct __DRIcoreExtensionRec		__DRIcoreExtension;
 typedef struct __DRIextensionRec		__DRIextension;
 typedef struct __DRIcopySubBufferExtensionRec	__DRIcopySubBufferExtension;
 typedef struct __DRIswapControlExtensionRec	__DRIswapControlExtension;
-typedef struct __DRIallocateExtensionRec	__DRIallocateExtension;
 typedef struct __DRIframeTrackingExtensionRec	__DRIframeTrackingExtension;
 typedef struct __DRImediaStreamCounterExtensionRec	__DRImediaStreamCounterExtension;
 typedef struct __DRItexOffsetExtensionRec	__DRItexOffsetExtension;
@@ -150,23 +149,6 @@ struct __DRIswapControlExtensionRec {
 };
 
 /**
- * Used by drivers that implement the GLX_MESA_allocate_memory.
- */
-#define __DRI_ALLOCATE "DRI_Allocate"
-#define __DRI_ALLOCATE_VERSION 1
-struct __DRIallocateExtensionRec {
-    __DRIextension base;
-
-    void *(*allocateMemory)(__DRIscreen *screen, GLsizei size,
-			    GLfloat readfreq, GLfloat writefreq,
-			    GLfloat priority);
-   
-    void (*freeMemory)(__DRIscreen *screen, GLvoid *pointer);
-   
-    GLuint (*memoryOffset)(__DRIscreen *screen, const GLvoid *pointer);
-};
-
-/**
  * Used by drivers that implement the GLX_MESA_swap_frame_usage extension.
  */
 #define __DRI_FRAME_TRACKING "DRI_FrameTracking"
diff --git a/src/glx/apple/gen_exports.tcl b/src/glx/apple/gen_exports.tcl
index acfe6e6..ed76929 100644
--- a/src/glx/apple/gen_exports.tcl
+++ b/src/glx/apple/gen_exports.tcl
@@ -82,8 +82,7 @@ proc main {argc argv} {
 	glXBindSwapBarrierSGIX glXQueryMaxSwapBarriersSGIX \
 	glXGetSyncValuesOML glXSwapBuffersMscOML \
 	glXWaitForMscOML glXWaitForSbcOML \
-	glXAllocateMemoryMESA glXFreeMemoryMESA \
-	glXGetMemoryOffsetMESA glXReleaseBuffersMESA \
+	glXReleaseBuffersMESA \
 	glXCreateGLXPixmapMESA glXCopySubBufferMESA \
 	glXQueryGLXPbufferSGIX glXCreateGLXPbufferSGIX \
 	glXDestroyGLXPbufferSGIX glXSelectEventSGIX \
diff --git a/src/glx/apple/glx_empty.c b/src/glx/apple/glx_empty.c
index 44c5a25..e19bf05 100644
--- a/src/glx/apple/glx_empty.c
+++ b/src/glx/apple/glx_empty.c
@@ -191,52 +191,6 @@ glXWaitForSbcOML(Display * dpy, GLXDrawable drawable,
 }
 
 
-/**
- * GLX_MESA_allocate_memory
- */
-/*@{*/
-
-PUBLIC void *
-glXAllocateMemoryMESA(Display * dpy, int scrn,
-                      size_t size, float readFreq,
-                      float writeFreq, float priority)
-{
-   (void) dpy;
-   (void) scrn;
-   (void) size;
-   (void) readFreq;
-   (void) writeFreq;
-   (void) priority;
-   return NULL;
-}
-
-
-PUBLIC void
-glXFreeMemoryMESA(Display * dpy, int scrn, void *pointer)
-{
-#ifdef __DRI_ALLOCATE
-   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, scrn);
-
-   if (psc && psc->allocate)
-      (*psc->allocate->freeMemory) (psc->__driScreen, pointer);
-
-#else
-   (void) dpy;
-   (void) scrn;
-   (void) pointer;
-#endif /* __DRI_ALLOCATE */
-}
-
-
-PUBLIC GLuint
-glXGetMemoryOffsetMESA(Display * dpy, int scrn, const void *pointer)
-{
-   (void) dpy;
-   (void) scrn;
-   (void) pointer;
-   return ~0L;
-}
-
 Bool
 glXReleaseBuffersMESA(Display * dpy, GLXDrawable d)
 {
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 19936ff..70ff8f1 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -421,13 +421,6 @@ driBindCommonExtensions(__GLXscreenConfigs *psc,
       }
 #endif
 
-#ifdef __DRI_ALLOCATE
-      if (strcmp(extensions[i]->name, __DRI_ALLOCATE) == 0) {
-	 psc->allocate = (__DRIallocateExtension *) extensions[i];
-	 __glXEnableDirectExtension(psc, "GLX_MESA_allocate_memory");
-      }
-#endif
-
 #ifdef __DRI_FRAME_TRACKING
       if (strcmp(extensions[i]->name, __DRI_FRAME_TRACKING) == 0) {
 	 psc->frameTracking = (__DRIframeTrackingExtension *) extensions[i];
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index 10baede..090d7ee 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -545,10 +545,6 @@ struct __GLXscreenConfigsRec
    const __DRIswapControlExtension *swapControl;
 #endif
 
-#ifdef __DRI_ALLOCATE
-   const __DRIallocateExtension *allocate;
-#endif
-
 #ifdef __DRI_FRAME_TRACKING
    const __DRIframeTrackingExtension *frameTracking;
 #endif
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 0721c27..5d02255 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -2804,72 +2804,6 @@ __glXWaitForSbcOML(Display * dpy, GLXDrawable drawable,
    return False;
 }
 
-
-/**
- * GLX_MESA_allocate_memory
- */
-/*@{*/
-
-PUBLIC void *
-glXAllocateMemoryMESA(Display * dpy, int scrn,
-                      size_t size, float readFreq,
-                      float writeFreq, float priority)
-{
-#ifdef __DRI_ALLOCATE
-   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, scrn);
-
-   if (psc && psc->allocate)
-      return (*psc->allocate->allocateMemory) (psc->__driScreen, size,
-                                               readFreq, writeFreq, priority);
-
-#else
-   (void) dpy;
-   (void) scrn;
-   (void) size;
-   (void) readFreq;
-   (void) writeFreq;
-   (void) priority;
-#endif /* __DRI_ALLOCATE */
-
-   return NULL;
-}
-
-
-PUBLIC void
-glXFreeMemoryMESA(Display * dpy, int scrn, void *pointer)
-{
-#ifdef __DRI_ALLOCATE
-   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, scrn);
-
-   if (psc && psc->allocate)
-      (*psc->allocate->freeMemory) (psc->__driScreen, pointer);
-
-#else
-   (void) dpy;
-   (void) scrn;
-   (void) pointer;
-#endif /* __DRI_ALLOCATE */
-}
-
-
-PUBLIC GLuint
-glXGetMemoryOffsetMESA(Display * dpy, int scrn, const void *pointer)
-{
-#ifdef __DRI_ALLOCATE
-   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, scrn);
-
-   if (psc && psc->allocate)
-      return (*psc->allocate->memoryOffset) (psc->__driScreen, pointer);
-
-#else
-   (void) dpy;
-   (void) scrn;
-   (void) pointer;
-#endif /* GLX_DIRECT_RENDERING */
-
-   return ~0L;
-}
-
 /*@}*/
 
 
@@ -3233,11 +3167,6 @@ static const struct name_address_pair GLX_functions[] = {
    GLX_FUNCTION2(glXBindSwapBarrierSGIX, __glXBindSwapBarrierSGIX),
    GLX_FUNCTION2(glXQueryMaxSwapBarriersSGIX, __glXQueryMaxSwapBarriersSGIX),
 
-   /*** GLX_MESA_allocate_memory ***/
-   GLX_FUNCTION(glXAllocateMemoryMESA),
-   GLX_FUNCTION(glXFreeMemoryMESA),
-   GLX_FUNCTION(glXGetMemoryOffsetMESA),
-
    /*** GLX_MESA_copy_sub_buffer ***/
    GLX_FUNCTION2(glXCopySubBufferMESA, __glXCopySubBufferMESA),
 
diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c
index e58c296..762aec5 100644
--- a/src/glx/glxextensions.c
+++ b/src/glx/glxextensions.c
@@ -85,11 +85,9 @@ static const struct extension_info known_glx_extensions[] = {
    { GLX(EXT_visual_rating),           VER(0,0), Y, Y, N, N },
 #ifdef GLX_USE_APPLEGL
    { GLX(MESA_agp_offset),             VER(0,0), N, N, N, N }, /* Deprecated */
-   { GLX(MESA_allocate_memory),        VER(0,0), N, N, N, N },
    { GLX(MESA_copy_sub_buffer),        VER(0,0), N, N, N, N },
 #else
    { GLX(MESA_agp_offset),             VER(0,0), N, N, N, Y }, /* Deprecated */
-   { GLX(MESA_allocate_memory),        VER(0,0), Y, N, N, Y },
    { GLX(MESA_copy_sub_buffer),        VER(0,0), Y, N, N, N },
 #endif
    { GLX(MESA_pixmap_colormap),        VER(0,0), N, N, N, N }, /* Deprecated */
diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h
index f556b12..4f1b661 100644
--- a/src/glx/glxextensions.h
+++ b/src/glx/glxextensions.h
@@ -41,7 +41,6 @@ enum
    EXT_visual_rating_bit,
    EXT_import_context_bit,
    MESA_agp_offset_bit,
-   MESA_allocate_memory_bit,    /* Replaces MESA_agp_offset & NV_vertex_array_range */
    MESA_copy_sub_buffer_bit,
    MESA_depth_float_bit,
    MESA_pixmap_colormap_bit,
diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c
index b72f69b..df73de5 100644
--- a/src/mesa/drivers/dri/r200/r200_ioctl.c
+++ b/src/mesa/drivers/dri/r200/r200_ioctl.c
@@ -253,113 +253,6 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask )
    }
 }
 
-/* This version of AllocateMemoryMESA allocates only GART memory, and
- * only does so after the point at which the driver has been
- * initialized.
- *
- * Theoretically a valid context isn't required.  However, in this
- * implementation, it is, as I'm using the hardware lock to protect
- * the kernel data structures, and the current context to get the
- * device fd.
- */
-void *r200AllocateMemoryMESA(__DRIscreen *screen, GLsizei size,
-			     GLfloat readfreq, GLfloat writefreq,
-			     GLfloat priority)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   r200ContextPtr rmesa;
-   int region_offset;
-   drm_radeon_mem_alloc_t alloc;
-   int ret;
-
-   if (R200_DEBUG & RADEON_IOCTL)
-      fprintf(stderr, "%s sz %d %f/%f/%f\n", __FUNCTION__, size, readfreq,
-	      writefreq, priority);
-
-   if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || !rmesa->radeon.radeonScreen->gartTextures.map)
-      return NULL;
-
-   if (getenv("R200_NO_ALLOC"))
-      return NULL;
-
-   alloc.region = RADEON_MEM_REGION_GART;
-   alloc.alignment = 0;
-   alloc.size = size;
-   alloc.region_offset = &region_offset;
-
-   ret = drmCommandWriteRead( rmesa->radeon.radeonScreen->driScreen->fd,
-			      DRM_RADEON_ALLOC,
-			      &alloc, sizeof(alloc));
-
-   if (ret) {
-      fprintf(stderr, "%s: DRM_RADEON_ALLOC ret %d\n", __FUNCTION__, ret);
-      return NULL;
-   }
-
-   {
-      char *region_start = (char *)rmesa->radeon.radeonScreen->gartTextures.map;
-      return (void *)(region_start + region_offset);
-   }
-}
-
-
-/* Called via glXFreeMemoryMESA() */
-void r200FreeMemoryMESA(__DRIscreen *screen, GLvoid *pointer)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   r200ContextPtr rmesa;
-   ptrdiff_t region_offset;
-   drm_radeon_mem_free_t memfree;
-   int ret;
-
-   if (R200_DEBUG & RADEON_IOCTL)
-      fprintf(stderr, "%s %p\n", __FUNCTION__, pointer);
-
-   if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || !rmesa->radeon.radeonScreen->gartTextures.map) {
-      fprintf(stderr, "%s: no context\n", __FUNCTION__);
-      return;
-   }
-
-   region_offset = (char *)pointer - (char *)rmesa->radeon.radeonScreen->gartTextures.map;
-
-   if (region_offset < 0 ||
-       region_offset > rmesa->radeon.radeonScreen->gartTextures.size) {
-      fprintf(stderr, "offset %d outside range 0..%d\n", region_offset,
-	      rmesa->radeon.radeonScreen->gartTextures.size);
-      return;
-   }
-
-   memfree.region = RADEON_MEM_REGION_GART;
-   memfree.region_offset = region_offset;
-
-   ret = drmCommandWrite( rmesa->radeon.radeonScreen->driScreen->fd,
-			  DRM_RADEON_FREE,
-			  &memfree, sizeof(memfree));
-
-   if (ret)
-      fprintf(stderr, "%s: DRM_RADEON_FREE ret %d\n", __FUNCTION__, ret);
-}
-
-/* Called via glXGetMemoryOffsetMESA() */
-GLuint r200GetMemoryOffsetMESA(__DRIscreen *screen, const GLvoid *pointer)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   r200ContextPtr rmesa;
-   GLuint card_offset;
-
-   if (!ctx || !(rmesa = R200_CONTEXT(ctx)) ) {
-      fprintf(stderr, "%s: no context\n", __FUNCTION__);
-      return ~0;
-   }
-
-   if (!r200IsGartMemory( rmesa, pointer, 0 ))
-      return ~0;
-
-   card_offset = r200GartOffsetFromVirtual( rmesa, pointer );
-
-   return card_offset - rmesa->radeon.radeonScreen->gart_base;
-}
-
 GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer,
 			   GLint size )
 {
diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.h b/src/mesa/drivers/dri/r200/r200_ioctl.h
index 8d51aef..c5dca89 100644
--- a/src/mesa/drivers/dri/r200/r200_ioctl.h
+++ b/src/mesa/drivers/dri/r200/r200_ioctl.h
@@ -64,11 +64,6 @@ extern void r200EmitAOS(r200ContextPtr rmesa, GLuint nr, GLuint offset);
 
 extern void r200InitIoctlFuncs( struct dd_function_table *functions );
 
-extern void *r200AllocateMemoryMESA( __DRIscreen *screen, GLsizei size, GLfloat readfreq,
-				   GLfloat writefreq, GLfloat priority );
-extern void r200FreeMemoryMESA( __DRIscreen *screen, GLvoid *pointer );
-extern GLuint r200GetMemoryOffsetMESA( __DRIscreen *screen, const GLvoid *pointer );
-
 extern GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer,
 				   GLint size );
 
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 956ffeb..efe6b2e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -338,12 +338,6 @@ static const __DRItexBufferExtension radeonTexBufferExtension = {
 #endif
 
 #if defined(RADEON_R200)
-static const __DRIallocateExtension r200AllocateExtension = {
-    { __DRI_ALLOCATE, __DRI_ALLOCATE_VERSION },
-    r200AllocateMemoryMESA,
-    r200FreeMemoryMESA,
-    r200GetMemoryOffsetMESA
-};
 
 static const __DRItexOffsetExtension r200texOffsetExtension = {
     { __DRI_TEX_OFFSET, __DRI_TEX_OFFSET_VERSION },
@@ -1222,9 +1216,6 @@ radeonCreateScreen( __DRIscreen *sPriv )
 #endif
 
 #if defined(RADEON_R200)
-   if (IS_R200_CLASS(screen))
-      screen->extensions[i++] = &r200AllocateExtension.base;
-
    screen->extensions[i++] = &r200texOffsetExtension.base;
 #endif
 
@@ -1380,9 +1371,6 @@ radeonCreateScreen2(__DRIscreen *sPriv)
 #endif
 
 #if defined(RADEON_R200)
-   if (IS_R200_CLASS(screen))
-       screen->extensions[i++] = &r200AllocateExtension.base;
-
    screen->extensions[i++] = &r200TexBufferExtension.base;
 #endif
 
diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c
index 955eba4..8c3f273 100644
--- a/src/mesa/drivers/x11/glxapi.c
+++ b/src/mesa/drivers/x11/glxapi.c
@@ -1111,31 +1111,6 @@ glXGetAGPOffsetMESA( const GLvoid *pointer )
 }
 
 
-/*** GLX_MESA_allocate_memory */
-
-void PUBLIC *
-glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size,
-                      float readfreq, float writefreq, float priority)
-{
-   /* dummy */
-   return NULL;
-}
-
-void PUBLIC
-glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
-{
-   /* dummy */
-}
-
-
-GLuint PUBLIC
-glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer)
-{
-   /* dummy */
-   return 0;
-}
-
-
 /*** GLX_EXT_texture_from_pixmap */
 
 void PUBLIC
@@ -1387,11 +1362,6 @@ static struct name_address_pair GLX_functions[] = {
    /*** GLX_MESA_agp_offset ***/
    { "glXGetAGPOffsetMESA", (__GLXextFuncPtr) glXGetAGPOffsetMESA },
 
-   /*** GLX_MESA_allocate_memory ***/
-   { "glXAllocateMemoryMESA", (__GLXextFuncPtr) glXAllocateMemoryMESA },
-   { "glXFreeMemoryMESA", (__GLXextFuncPtr) glXFreeMemoryMESA },
-   { "glXGetMemoryOffsetMESA", (__GLXextFuncPtr) glXGetMemoryOffsetMESA },
-
    /*** GLX_EXT_texture_from_pixmap ***/
    { "glXBindTexImageEXT", (__GLXextFuncPtr) glXBindTexImageEXT },
    { "glXReleaseTexImageEXT", (__GLXextFuncPtr) glXReleaseTexImageEXT },




More information about the mesa-commit mailing list