summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaryll <daryll>1999-12-08 18:57:32 +0000
committerdaryll <daryll>1999-12-08 18:57:32 +0000
commit6db1b3d541ddc8ec3100f022f17f6c1f6eeb550f (patch)
treeda20fd3ed2d5a8dc21bb67a8b8022fd8a0ac1ac6
parentdbca8ea0711cfefcdeab56a4a51730fa64d4543a (diff)
Add xdri files to SourceForge CVS repository.
-rw-r--r--xc/lib/GL/mesa/src/X/xdri.c111
-rw-r--r--xc/lib/GL/mesa/src/X/xdriP.h37
2 files changed, 148 insertions, 0 deletions
diff --git a/xc/lib/GL/mesa/src/X/xdri.c b/xc/lib/GL/mesa/src/X/xdri.c
new file mode 100644
index 000000000..9adf0bf2c
--- /dev/null
+++ b/xc/lib/GL/mesa/src/X/xdri.c
@@ -0,0 +1,111 @@
+
+#if defined(GLX_DIRECT_RENDERING)
+
+/* Mesa includes
+ */
+#ifdef HAVE_CONFIG_H
+#include "conf.h"
+#endif
+
+#include "GL/xmesa.h"
+#include "xmesaP.h"
+#include "context.h"
+#include "macros.h"
+#include "matrix.h"
+#include "types.h"
+
+/* Direct rendering includes
+ */
+#include "dri_mesaint.h"
+
+
+void XMesaDriSwapBuffers( XMesaBuffer b )
+{
+ __DRIdrawablePrivate *pdp = b->driDrawPriv;
+ __DRIscreenPrivate *psp = pdp->driScreenPriv;
+ drmContext hHWContext = pdp->driContextPriv->hHWContext;
+
+ /*
+ ** Grab the lock and make sure drawable info is still
+ ** up to date.
+ */
+ DRM_LIGHT_LOCK(psp->fd, &psp->pSAREA->lock, hHWContext);
+ XMESA_VALIDATE_DRAWABLE_INFO(b->display, psp, pdp);
+
+ /* Copy back image to front buffer */
+ if (pdp->numClipRects) {
+ int numClipRects = pdp->numClipRects;
+ XF86DRIClipRectPtr pRect = pdp->pClipRects;
+ int y;
+ GLbyte *s8, *d8;
+ GLuint *s32, *d32;
+
+ while (numClipRects--) {
+ int w = pRect->x2-pRect->x1;
+
+ switch (psp->fbBPP) {
+ case 8:
+ for (y = pRect->y1; y < pRect->y2; y++) {
+ s8 = (GLbyte *)b->backimage->data +
+ y*b->backimage->bytes_per_line +
+ pRect->x1;
+ d8 = (GLbyte *)psp->pFB + psp->fbOrigin +
+ (pdp->y + y)*psp->fbStride +
+ pdp->x + pRect->x1;
+ memcpy(d8, s8, w);
+ }
+ break;
+ case 15:
+ case 16:
+ break;
+ case 24:
+ break;
+ case 32:
+ for (y = pRect->y1; y < pRect->y2; y++) {
+ /* These are calculated in GLbytes */
+ s8 = (GLbyte *)b->backimage->data +
+ (y - pdp->y)*b->backimage->bytes_per_line;
+ d8 = (GLbyte *)psp->pFB + psp->fbOrigin +
+ y*psp->fbStride;
+ s32 = (GLuint *)s8;
+ d32 = (GLuint *)d8;
+ /* These are calculated in GLuints */
+ s32 += (pRect->x1 - pdp->x);
+ d32 += pRect->x1;
+ memcpy(d32, s32, w<<2);
+ }
+ break;
+ }
+
+ pRect++;
+ }
+ }
+ /* Unlock the screen */
+ DRM_UNLOCK(psp->fd, &psp->pSAREA->lock, hHWContext);
+}
+
+
+
+/*
+ * Initialize the XMesa driver.
+ */
+GLboolean XMesaInitDriver( __DRIscreenPrivate *driScrnPriv )
+{
+ return GL_TRUE;
+}
+
+/*
+ * Reset the XMesa driver when the X server resets.
+ */
+void XMesaResetDriver( __DRIscreenPrivate *driScrnPriv )
+{
+}
+
+#else
+
+extern void i_hate_these_stupid_dummy_functions();
+void i_hate_these_stupid_dummy_functions()
+{
+}
+
+#endif
diff --git a/xc/lib/GL/mesa/src/X/xdriP.h b/xc/lib/GL/mesa/src/X/xdriP.h
new file mode 100644
index 000000000..484ee7f23
--- /dev/null
+++ b/xc/lib/GL/mesa/src/X/xdriP.h
@@ -0,0 +1,37 @@
+#ifndef _XDRI_P_H
+#define _XDRI_P_H
+
+/* Direct rendering includes
+ */
+#include "dri_mesaint.h"
+
+
+/*
+ * Direct rendering macros:
+ */
+#define XMESA_VALIDATE_DRAWABLE_INFO(dpy, psp, pdp) \
+do { \
+ while (*(pdp->pStamp) != pdp->lastStamp) { \
+ DRM_UNLOCK(psp->fd, &psp->pSAREA->lock, \
+ pdp->driContextPriv->hHWContext); \
+ \
+ DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \
+ DRI_MESA_VALIDATE_DRAWABLE_INFO(dpy, psp->myNum, pdp); \
+ DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \
+ \
+ DRM_LIGHT_LOCK(psp->fd, &psp->pSAREA->lock, \
+ pdp->driContextPriv->hHWContext); \
+ } \
+} while (0)
+
+
+
+#define DRI_DRAWABLE_ARG , __DRIdrawablePrivate *driDrawPriv
+#define DRI_DRAWABLE_PARM , driDrawPriv
+
+#define DRI_CTX_ARG , __DRIcontextPrivate *driContextPriv
+
+
+extern void XMesaDriSwapBuffers( XMesaBuffer b );
+
+#endif