summaryrefslogtreecommitdiff
path: root/src/glx/x11
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx/x11')
-rw-r--r--src/glx/x11/dri2_glx.c75
-rw-r--r--src/glx/x11/dri_common.c7
-rw-r--r--src/glx/x11/dri_glx.c2
-rw-r--r--src/glx/x11/glxclient.h6
-rw-r--r--src/glx/x11/glxcmds.c24
-rw-r--r--src/glx/x11/glxext.c86
-rw-r--r--src/glx/x11/indirect.c40
-rw-r--r--src/glx/x11/indirect.h2
-rw-r--r--src/glx/x11/indirect_init.c2
-rw-r--r--src/glx/x11/indirect_size.c1
10 files changed, 153 insertions, 92 deletions
diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c
index b878f05dda..0ef5d3ab56 100644
--- a/src/glx/x11/dri2_glx.c
+++ b/src/glx/x11/dri2_glx.c
@@ -77,6 +77,9 @@ struct __GLXDRIdrawablePrivateRec {
int bufferCount;
int width, height;
unsigned long configureSeqno;
+ int have_back;
+ int have_front;
+ int have_fake_front;
};
static void dri2DestroyContext(__GLXDRIcontext *context,
@@ -196,12 +199,22 @@ static void dri2CopySubBuffer(__GLXDRIdrawable *pdraw,
XRectangle xrect;
XserverRegion region;
+ /* Check we have the right attachments */
+ if (!(priv->have_front && priv->have_back))
+ return;
+
xrect.x = x;
xrect.y = priv->height - y - height;
xrect.width = width;
xrect.height = height;
+#ifdef __DRI2_FLUSH
+ if (pdraw->psc->f)
+ (*pdraw->psc->f->flush)(pdraw->driDrawable);
+#endif
+
region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
+ /* should get a fence ID back from here at some point */
DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
DRI2BufferFrontLeft, DRI2BufferBackLeft);
XFixesDestroyRegion(pdraw->psc->dpy, region);
@@ -214,6 +227,57 @@ static void dri2SwapBuffers(__GLXDRIdrawable *pdraw)
dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height);
}
+static void dri2WaitX(__GLXDRIdrawable *pdraw)
+{
+ __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
+ XRectangle xrect;
+ XserverRegion region;
+
+ /* Check we have the right attachments */
+ if (!(priv->have_fake_front && priv->have_front))
+ return;
+
+ xrect.x = 0;
+ xrect.y = 0;
+ xrect.width = priv->width;
+ xrect.height = priv->height;
+
+#ifdef __DRI2_FLUSH
+ if (pdraw->psc->f)
+ (*pdraw->psc->f->flush)(pdraw->driDrawable);
+#endif
+
+ region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
+ DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
+ DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
+ XFixesDestroyRegion(pdraw->psc->dpy, region);
+}
+
+static void dri2WaitGL(__GLXDRIdrawable *pdraw)
+{
+ __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
+ XRectangle xrect;
+ XserverRegion region;
+
+ if (!(priv->have_fake_front && priv->have_front))
+ return;
+
+ xrect.x = 0;
+ xrect.y = 0;
+ xrect.width = priv->width;
+ xrect.height = priv->height;
+
+#ifdef __DRI2_FLUSH
+ if (pdraw->psc->f)
+ (*pdraw->psc->f->flush)(pdraw->driDrawable);
+#endif
+
+ region = XFixesCreateRegion(pdraw->psc->dpy, &xrect, 1);
+ DRI2CopyRegion(pdraw->psc->dpy, pdraw->drawable, region,
+ DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
+ XFixesDestroyRegion(pdraw->psc->dpy, region);
+}
+
static void dri2DestroyScreen(__GLXscreenConfigs *psc)
{
/* Free the direct rendering per screen data */
@@ -261,6 +325,9 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
pdraw->width = *width;
pdraw->height = *height;
pdraw->bufferCount = *out_count;
+ pdraw->have_front = 0;
+ pdraw->have_fake_front = 0;
+ pdraw->have_back = 0;
/* This assumes the DRI2 buffer attachment tokens matches the
* __DRIbuffer tokens. */
@@ -270,6 +337,12 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
pdraw->buffers[i].pitch = buffers[i].pitch;
pdraw->buffers[i].cpp = buffers[i].cpp;
pdraw->buffers[i].flags = buffers[i].flags;
+ if (pdraw->buffers[i].attachment == __DRI_BUFFER_FRONT_LEFT)
+ pdraw->have_front = 1;
+ if (pdraw->buffers[i].attachment == __DRI_BUFFER_FAKE_FRONT_LEFT)
+ pdraw->have_fake_front = 1;
+ if (pdraw->buffers[i].attachment == __DRI_BUFFER_BACK_LEFT)
+ pdraw->have_back = 1;
}
Xfree(buffers);
@@ -366,6 +439,8 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
psp->createContext = dri2CreateContext;
psp->createDrawable = dri2CreateDrawable;
psp->swapBuffers = dri2SwapBuffers;
+ psp->waitGL = dri2WaitGL;
+ psp->waitX = dri2WaitX;
/* DRI2 suports SubBuffer through DRI2CopyRegion, so it's always
* available.*/
diff --git a/src/glx/x11/dri_common.c b/src/glx/x11/dri_common.c
index 4fda649e59..90c3d8c7d9 100644
--- a/src/glx/x11/dri_common.c
+++ b/src/glx/x11/dri_common.c
@@ -392,6 +392,13 @@ driBindExtensions(__GLXscreenConfigs *psc, int dri2)
}
#endif
+#ifdef __DRI2_FLUSH
+ if ((strcmp(extensions[i]->name, __DRI2_FLUSH) == 0) && dri2) {
+ psc->f = (__DRI2flushExtension *) extensions[i];
+ /* internal driver extension, no GL extension exposed */
+ }
+#endif
+
/* Ignore unknown extensions */
}
}
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index 44724d2c7d..3089aa1728 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -655,6 +655,8 @@ static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen,
psp->createContext = driCreateContext;
psp->createDrawable = driCreateDrawable;
psp->swapBuffers = driSwapBuffers;
+ psp->waitX = NULL;
+ psp->waitGL = NULL;
return psp;
}
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index 9332eb64d3..caf58bbd44 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -139,6 +139,8 @@ struct __GLXDRIscreenRec {
void (*swapBuffers)(__GLXDRIdrawable *pdraw);
void (*copySubBuffer)(__GLXDRIdrawable *pdraw,
int x, int y, int width, int height);
+ void (*waitX)(__GLXDRIdrawable *pdraw);
+ void (*waitGL)(__GLXDRIdrawable *pdraw);
};
struct __GLXDRIcontextRec {
@@ -517,6 +519,10 @@ struct __GLXscreenConfigsRec {
const __DRItexBufferExtension *texBuffer;
#endif
+#ifdef __DRI2_FLUSH
+ const __DRI2flushExtension *f;
+#endif
+
#endif
/**
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index c68b6ac4ef..fc0e593cb3 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -611,11 +611,15 @@ PUBLIC void glXWaitGL(void)
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
-/* This bit of ugliness unwraps the glFinish function */
-#ifdef glFinish
-#undef glFinish
-#endif
- glFinish();
+ int screen;
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, gc->currentDrawable, &screen);
+
+ if ( pdraw != NULL ) {
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
+ glFlush();
+ if (psc->driScreen->waitGL != NULL)
+ (*psc->driScreen->waitGL)(pdraw);
+ }
return;
}
#endif
@@ -647,7 +651,15 @@ PUBLIC void glXWaitX(void)
#ifdef GLX_DIRECT_RENDERING
if (gc->driContext) {
- XSync(dpy, False);
+ int screen;
+ __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, gc->currentDrawable, &screen);
+
+ if ( pdraw != NULL ) {
+ __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
+ if (psc->driScreen->waitX != NULL)
+ (*psc->driScreen->waitX)(pdraw);
+ } else
+ XSync(dpy, False);
return;
}
#endif
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index be6edf9b19..b296b7c651 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -56,19 +56,6 @@
void __glXDumpDrawBuffer(__GLXcontext * ctx);
#endif
-#ifdef USE_SPARC_ASM
-static void _glx_mesa_init_sparc_glapi_relocs(void);
-static int _mesa_sparc_needs_init = 1;
-#define INIT_MESA_SPARC do { \
- if (_mesa_sparc_needs_init) { \
- _glx_mesa_init_sparc_glapi_relocs(); \
- _mesa_sparc_needs_init = 0; \
- } \
- } while(0)
-#else
-#define INIT_MESA_SPARC do { } while(0)
-#endif
-
/*
** You can set this cell to 1 to force the gl drawing stuff to be
** one command per packet
@@ -670,7 +657,6 @@ __glXInitialize(Display * dpy)
}
#endif
- INIT_MESA_SPARC;
/* The one and only long long lock */
__glXLock();
@@ -785,7 +771,6 @@ __glXSetupForCommand(Display * dpy)
if (gc->currentDpy == dpy) {
/* Use opcode from gc because its right */
- INIT_MESA_SPARC;
return gc->majorOpcode;
}
else {
@@ -979,74 +964,3 @@ __glXDumpDrawBuffer(__GLXcontext * ctx)
}
}
#endif
-
-#ifdef USE_SPARC_ASM
-/*
- * This is where our dispatch table's bounds are.
- * And the static mesa_init is taken directly from
- * Mesa's 'sparc.c' initializer.
- *
- * We need something like this here, because this version
- * of openGL/glx never initializes a Mesa context, and so
- * the address of the dispatch table pointer never gets stuffed
- * into the dispatch jump table otherwise.
- *
- * It matters only on SPARC, and only if you are using assembler
- * code instead of C-code indirect dispatch.
- *
- * -- FEM, 04.xii.03
- */
-extern unsigned int _mesa_sparc_glapi_begin;
-extern unsigned int _mesa_sparc_glapi_end;
-extern void __glapi_sparc_icache_flush(unsigned int *);
-
-static void
-_glx_mesa_init_sparc_glapi_relocs(void)
-{
- unsigned int *insn_ptr, *end_ptr;
- unsigned long disp_addr;
-
- insn_ptr = &_mesa_sparc_glapi_begin;
- end_ptr = &_mesa_sparc_glapi_end;
- disp_addr = (unsigned long) &_glapi_Dispatch;
-
- /*
- * Verbatim from Mesa sparc.c. It's needed because there doesn't
- * seem to be a better way to do this:
- *
- * UNCONDITIONAL_JUMP ( (*_glapi_Dispatch) + entry_offset )
- *
- * This code is patching in the ADDRESS of the pointer to the
- * dispatch table. Hence, it must be called exactly once, because
- * that address is not going to change.
- *
- * What it points to can change, but Mesa (and hence, we) assume
- * that there is only one pointer.
- *
- */
- while (insn_ptr < end_ptr) {
-#if ( defined(__sparc_v9__) && ( !defined(__linux__) || defined(__linux_64__) ) )
-/*
- This code patches for 64-bit addresses. This had better
- not happen for Sparc/Linux, no matter what architecture we
- are building for. So, don't do this.
-
- The 'defined(__linux_64__)' is used here as a placeholder for
- when we do do 64-bit usermode on sparc linux.
- */
- insn_ptr[0] |= (disp_addr >> (32 + 10));
- insn_ptr[1] |= ((disp_addr & 0xffffffff) >> 10);
- __glapi_sparc_icache_flush(&insn_ptr[0]);
- insn_ptr[2] |= ((disp_addr >> 32) & ((1 << 10) - 1));
- insn_ptr[3] |= (disp_addr & ((1 << 10) - 1));
- __glapi_sparc_icache_flush(&insn_ptr[2]);
- insn_ptr += 11;
-#else
- insn_ptr[0] |= (disp_addr >> 10);
- insn_ptr[1] |= (disp_addr & ((1 << 10) - 1));
- __glapi_sparc_icache_flush(&insn_ptr[0]);
- insn_ptr += 5;
-#endif
- }
-}
-#endif /* sparc ASM in use */
diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c
index fb87abc0a5..08d52aeea3 100644
--- a/src/glx/x11/indirect.c
+++ b/src/glx/x11/indirect.c
@@ -7523,6 +7523,26 @@ __indirect_glGetProgramivARB(GLenum target, GLenum pname, GLint * params)
#define X_GLrop_ProgramEnvParameter4dvARB 4185
void
+__indirect_glProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x,
+ GLdouble y, GLdouble z, GLdouble w)
+{
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ const GLuint cmdlen = 44;
+ emit_header(gc->pc, X_GLrop_ProgramEnvParameter4dvARB, cmdlen);
+ (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+ (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+ (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 8);
+ (void) memcpy((void *) (gc->pc + 20), (void *) (&y), 8);
+ (void) memcpy((void *) (gc->pc + 28), (void *) (&z), 8);
+ (void) memcpy((void *) (gc->pc + 36), (void *) (&w), 8);
+ gc->pc += cmdlen;
+ if (__builtin_expect(gc->pc > gc->limit, 0)) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
+}
+
+#define X_GLrop_ProgramEnvParameter4dvARB 4185
+void
__indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index,
const GLdouble * params)
{
@@ -7540,6 +7560,26 @@ __indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index,
#define X_GLrop_ProgramEnvParameter4fvARB 4184
void
+__indirect_glProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x,
+ GLfloat y, GLfloat z, GLfloat w)
+{
+ __GLXcontext *const gc = __glXGetCurrentContext();
+ const GLuint cmdlen = 28;
+ emit_header(gc->pc, X_GLrop_ProgramEnvParameter4fvARB, cmdlen);
+ (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4);
+ (void) memcpy((void *) (gc->pc + 8), (void *) (&index), 4);
+ (void) memcpy((void *) (gc->pc + 12), (void *) (&x), 4);
+ (void) memcpy((void *) (gc->pc + 16), (void *) (&y), 4);
+ (void) memcpy((void *) (gc->pc + 20), (void *) (&z), 4);
+ (void) memcpy((void *) (gc->pc + 24), (void *) (&w), 4);
+ gc->pc += cmdlen;
+ if (__builtin_expect(gc->pc > gc->limit, 0)) {
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ }
+}
+
+#define X_GLrop_ProgramEnvParameter4fvARB 4184
+void
__indirect_glProgramEnvParameter4fvARB(GLenum target, GLuint index,
const GLfloat * params)
{
diff --git a/src/glx/x11/indirect.h b/src/glx/x11/indirect.h
index f8c88b36bb..0719a1b302 100644
--- a/src/glx/x11/indirect.h
+++ b/src/glx/x11/indirect.h
@@ -517,7 +517,9 @@ extern HIDDEN void __indirect_glGetProgramivARB(GLenum target, GLenum pname, GLi
extern HIDDEN void __indirect_glGetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble * params);
extern HIDDEN void __indirect_glGetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat * params);
extern HIDDEN void __indirect_glGetVertexAttribivARB(GLuint index, GLenum pname, GLint * params);
+extern HIDDEN void __indirect_glProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern HIDDEN void __indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble * params);
+extern HIDDEN void __indirect_glProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
extern HIDDEN void __indirect_glProgramEnvParameter4fvARB(GLenum target, GLuint index, const GLfloat * params);
extern HIDDEN void __indirect_glProgramLocalParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern HIDDEN void __indirect_glProgramLocalParameter4dvARB(GLenum target, GLuint index, const GLdouble * params);
diff --git a/src/glx/x11/indirect_init.c b/src/glx/x11/indirect_init.c
index 479184337c..852fe712c6 100644
--- a/src/glx/x11/indirect_init.c
+++ b/src/glx/x11/indirect_init.c
@@ -526,7 +526,9 @@ __GLapi * __glXNewIndirectAPI( void )
glAPI->GetVertexAttribdvARB = __indirect_glGetVertexAttribdvARB;
glAPI->GetVertexAttribfvARB = __indirect_glGetVertexAttribfvARB;
glAPI->GetVertexAttribivARB = __indirect_glGetVertexAttribivARB;
+ glAPI->ProgramEnvParameter4dARB = __indirect_glProgramEnvParameter4dARB;
glAPI->ProgramEnvParameter4dvARB = __indirect_glProgramEnvParameter4dvARB;
+ glAPI->ProgramEnvParameter4fARB = __indirect_glProgramEnvParameter4fARB;
glAPI->ProgramEnvParameter4fvARB = __indirect_glProgramEnvParameter4fvARB;
glAPI->ProgramLocalParameter4dARB = __indirect_glProgramLocalParameter4dARB;
glAPI->ProgramLocalParameter4dvARB = __indirect_glProgramLocalParameter4dvARB;
diff --git a/src/glx/x11/indirect_size.c b/src/glx/x11/indirect_size.c
index 12214d7fe4..54c039dd6c 100644
--- a/src/glx/x11/indirect_size.c
+++ b/src/glx/x11/indirect_size.c
@@ -240,6 +240,7 @@ __glTexEnvfv_size(GLenum e)
case GL_OPERAND1_ALPHA:
case GL_OPERAND2_ALPHA:
case GL_OPERAND3_ALPHA_NV:
+ case GL_BUMP_TARGET_ATI:
case GL_COORD_REPLACE_ARB:
/* case GL_COORD_REPLACE_NV:*/
return 1;