dri: remove ttm common code since superioctl is device specific
[mesa.git] / src / mesa / drivers / dri / common / dri_util.h
index 001313c4c8a8303d7ebeb00822c843529f8d0c7b..539d28d1149a74d9d54d5aa3feb36ce1a0ec1977 100644 (file)
 #ifndef _DRI_UTIL_H_
 #define _DRI_UTIL_H_
 
-#define CAPI  /* XXX this should be globally defined somewhere */
-
-#ifdef DRI_NEW_INTERFACE_ONLY
-# include <GL/gl.h>
-#else
-# include "glxclient.h"
-#endif /* DRI_NEW_INTERFACE_ONLY */
+#include <GL/gl.h>
 #include "drm.h"
 #include "drm_sarea.h"
+#include "xf86drm.h"
 #include "GL/internal/glcore.h"
 #include "GL/internal/dri_interface.h"
 
 #define GLX_BAD_CONTEXT                    5
 
-/* This is a temporary relic.  Once all drivers are converted to support
- * the new interface, it can go away.
- */
-#ifdef DRI_NEW_INTERFACE_ONLY
-#define USE_NEW_INTERFACE
-#endif
-
 typedef struct __DRIdisplayPrivateRec  __DRIdisplayPrivate;
 typedef struct __DRIscreenPrivateRec   __DRIscreenPrivate;
 typedef struct __DRIcontextPrivateRec  __DRIcontextPrivate;
@@ -97,15 +85,15 @@ typedef struct __DRIutilversionRec2    __DRIutilversion2;
 #define DRI_VALIDATE_DRAWABLE_INFO(psp, pdp)                            \
 do {                                                                    \
     while (*(pdp->pStamp) != pdp->lastStamp) {                          \
-       DRM_UNLOCK(psp->fd, &psp->pSAREA->lock,                         \
-                  pdp->driContextPriv->hHWContext);                    \
+        register unsigned int hwContext = psp->pSAREA->lock.lock &      \
+                    ~(DRM_LOCK_HELD | DRM_LOCK_CONT);                  \
+       DRM_UNLOCK(psp->fd, &psp->pSAREA->lock, hwContext);             \
                                                                         \
        DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);     \
        DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp);                           \
        DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);   \
                                                                         \
-       DRM_LIGHT_LOCK(psp->fd, &psp->pSAREA->lock,                     \
-                      pdp->driContextPriv->hHWContext);                \
+       DRM_LIGHT_LOCK(psp->fd, &psp->pSAREA->lock, hwContext);         \
     }                                                                   \
 } while (0)
 
@@ -199,6 +187,14 @@ struct __DriverAPIRec {
     int64_t (*SwapBuffersMSC)( __DRIdrawablePrivate *priv, int64_t target_msc,
                               int64_t divisor, int64_t remainder );
     /*@}*/
+    void (*CopySubBuffer)(__DRIdrawablePrivate *driDrawPriv,
+                         int x, int y, int w, int h);
+
+    /**
+     * See corresponding field in \c __DRIscreenRec.
+     */
+    void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
+                        unsigned long long offset, GLint depth, GLuint pitch);
 };
 
 
@@ -325,7 +321,7 @@ struct __DRIdrawablePrivateRec {
      * \name Display and screen information.
      * 
      * Basically just need these for when the locking code needs to call
-     * __driUtilUpdateDrawableInfo() which calls XF86DRIGetDrawableInfo().
+     * \c __driUtilUpdateDrawableInfo.
      */
     /*@{*/
     __DRInativeDisplay *display;
@@ -336,12 +332,6 @@ struct __DRIdrawablePrivateRec {
      * Called via glXSwapBuffers().
      */
     void (*swapBuffers)( __DRIdrawablePrivate *dPriv );
-
-    /**
-     * Get information about the location, size, and clip rects of the
-     * drawable within the display.
-     */
-    PFNGLXGETDRAWABLEINFOPROC getInfo;
 };
 
 /**
@@ -369,10 +359,15 @@ struct __DRIcontextPrivateRec {
     __DRInativeDisplay *display;
 
     /**
-     * Pointer to drawable currently bound to this context.
+     * Pointer to drawable currently bound to this context for drawing.
      */
     __DRIdrawablePrivate *driDrawablePriv;
 
+    /**
+     * Pointer to drawable currently bound to this context for reading.
+     */
+    __DRIdrawablePrivate *driReadablePriv;
+
     /**
      * Pointer to screen on which this context was created.
      */
@@ -552,25 +547,20 @@ extern __DRIscreenPrivate * __driUtilCreateNewScreen( __DRInativeDisplay *dpy,
     drm_sarea_t *pSAREA, int fd, int internal_api_version,
     const struct __DriverAPIRec *driverAPI );
 
-#ifndef DRI_NEW_INTERFACE_ONLY
-extern __DRIscreenPrivate *
-__driUtilCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
-                      int numConfigs, __GLXvisualConfig *config,
-                      const struct __DriverAPIRec *driverAPI);
-#endif /* DRI_NEW_INTERFACE_ONLY */
-
 /* Test the version of the internal GLX API.  Returns a value like strcmp. */
 extern int
-driCompareGLXAPIVersion( GLuint required_version );
+driCompareGLXAPIVersion( GLint required_version );
 
 extern float
 driCalculateSwapUsage( __DRIdrawablePrivate *dPriv,
                       int64_t last_swap_ust, int64_t current_ust );
 
-/* Test for the GLX header glx.h */
-#ifndef GLX
-extern void 
-(*glXGetProcAddress(const GLubyte *procname))( void );
-#endif
+/**
+ * Pointer to the \c __DRIinterfaceMethods passed to the driver by the loader.
+ * 
+ * This pointer is set in the driver's \c __driCreateNewScreen function and
+ * is defined in dri_util.c.
+ */
+extern const __DRIinterfaceMethods * dri_interface;
 
 #endif /* _DRI_UTIL_H_ */