gallium/draw: initial code to properly support llvm in the draw module
[mesa.git] / src / mesa / drivers / dri / gamma / gamma_xmesa.c
index 30c2ba023afeb0ea26aed1f90c17c7d732f33cbd..622121eed468db75bd14a61d5f035d3264239ad5 100644 (file)
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c,v 1.14 2002/10/30 12:51:30 alanh Exp $ */
 /*
  * Copyright 2001 by Alan Hourihane.
  *
  */
 
 #include "gamma_context.h"
+#include "gamma_macros.h"
 #include "gamma_vb.h"
-#include "context.h"
-#include "matrix.h"
+#include "main/context.h"
+#include "main/matrix.h"
 #include "glint_dri.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
 #include "tnl/tnl.h"
-#include "array_cache/acache.h"
+#include "vbo/vbo.h"
 
 static GLboolean 
-gammaInitDriver(__DRIscreenPrivate *sPriv)
+gammaInitDriver(__DRIscreen *sPriv)
 {
     sPriv->private = (void *) gammaCreateScreen( sPriv );
 
@@ -50,14 +50,14 @@ gammaInitDriver(__DRIscreenPrivate *sPriv)
 }
 
 static void 
-gammaDestroyContext(__DRIcontextPrivate *driContextPriv)
+gammaDestroyContext(__DRIcontext *driContextPriv)
 {
     gammaContextPtr gmesa = (gammaContextPtr)driContextPriv->driverPrivate;
 
     if (gmesa) {
       _swsetup_DestroyContext( gmesa->glCtx );
       _tnl_DestroyContext( gmesa->glCtx );
-      _ac_DestroyContext( gmesa->glCtx );
+      _vbo_DestroyContext( gmesa->glCtx );
       _swrast_DestroyContext( gmesa->glCtx );
 
       gammaFreeVB( gmesa->glCtx );
@@ -73,8 +73,8 @@ gammaDestroyContext(__DRIcontextPrivate *driContextPriv)
 
 
 static GLboolean
-gammaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
-                   __DRIdrawablePrivate *driDrawPriv,
+gammaCreateBuffer( __DRIscreen *driScrnPriv,
+                   __DRIdrawable *driDrawPriv,
                    const __GLcontextModes *mesaVis,
                    GLboolean isPixmap )
 {
@@ -95,17 +95,17 @@ gammaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
 
 
 static void
-gammaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
+gammaDestroyBuffer(__DRIdrawable *driDrawPriv)
 {
-   _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate));
+   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 static void
-gammaSwapBuffers( __DRIdrawablePrivate *dPriv )
+gammaSwapBuffers( __DRIdrawable *dPriv )
 {
    if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
     gammaContextPtr gmesa;
-    __DRIscreenPrivate *driScrnPriv;
+    __DRIscreen *driScrnPriv;
     GLcontext *ctx;
 
     gmesa = (gammaContextPtr) dPriv->driContextPriv->driverPrivate;
@@ -128,7 +128,7 @@ gammaSwapBuffers( __DRIdrawablePrivate *dPriv )
        int i;
        int nRect = dPriv->numClipRects;
        drm_clip_rect_t *pRect = dPriv->pClipRects;
-       __DRIscreenPrivate *driScrnPriv = gmesa->driScreen;
+       __DRIscreen *driScrnPriv = gmesa->driScreen;
        GLINTDRIPtr gDRIPriv = (GLINTDRIPtr)driScrnPriv->pDevPriv;
 
        CHECK_DMA_BUFFER(gmesa, 2);
@@ -194,9 +194,9 @@ gammaSwapBuffers( __DRIdrawablePrivate *dPriv )
 }
 
 static GLboolean 
-gammaMakeCurrent(__DRIcontextPrivate *driContextPriv,
-                __DRIdrawablePrivate *driDrawPriv,
-                __DRIdrawablePrivate *driReadPriv)
+gammaMakeCurrent(__DRIcontext *driContextPriv,
+                __DRIdrawable *driDrawPriv,
+                __DRIdrawable *driReadPriv)
 {
     if (driContextPriv) {
        GET_CURRENT_CONTEXT(ctx);
@@ -225,11 +225,6 @@ newGammaCtx->new_state |= GAMMA_NEW_WINDOW; /* FIXME */
        _mesa_make_current2( newGammaCtx->glCtx, 
                          (GLframebuffer *) driDrawPriv->driverPrivate,
                          (GLframebuffer *) driReadPriv->driverPrivate );
-
-       if (!newGammaCtx->glCtx->Viewport.Width) {
-           _mesa_set_viewport(newGammaCtx->glCtx, 0, 0, 
-                                       driDrawPriv->w, driDrawPriv->h);
-       }
     } else {
        _mesa_make_current( 0, 0 );
     }
@@ -238,12 +233,12 @@ newGammaCtx->new_state |= GAMMA_NEW_WINDOW; /* FIXME */
 
 
 static GLboolean 
-gammaUnbindContext( __DRIcontextPrivate *driContextPriv )
+gammaUnbindContext( __DRIcontext *driContextPriv )
 {
    return GL_TRUE;
 }
 
-static struct __DriverAPIRec gammaAPI = {
+const struct __DriverAPIRec driDriverAPI = {
    gammaInitDriver,
    gammaDestroyScreen,
    gammaCreateContext,
@@ -260,22 +255,19 @@ static struct __DriverAPIRec gammaAPI = {
 /*
  * This is the bootstrap function for the driver.
  * The __driCreateScreen name is the symbol that libGL.so fetches.
- * Return:  pointer to a __DRIscreenPrivate.
+ * Return:  pointer to a __DRIscreen.
  */
-#ifndef _SOLO
 void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
                         int numConfigs, __GLXvisualConfig *config)
 {
-   __DRIscreenPrivate *psp;
+   __DRIscreen *psp;
    psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &gammaAPI);
    return (void *) psp;
 }
-#else
-void *__driCreateScreen(struct DRIDriverRec *driver,
-                        struct DRIDriverContextRec *driverContext)
-{
-   __DRIscreenPrivate *psp;
-   psp = __driUtilCreateScreen(driver, driverContext, &gammaAPI);
-   return (void *) psp;
-}
-#endif
+
+/* This is the table of extensions that the loader will dlsym() for. */
+PUBLIC const __DRIextension *__driDriverExtensions[] = {
+    &driCoreExtension.base,
+    &driLegacyExtension.base,
+    NULL
+};