diff options
author | Keith Whitwell <[email protected]> | 2007-05-24 10:44:53 +0100 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2007-05-24 10:44:53 +0100 |
commit | b939adfa155f2b3ca5c5226e86da85629654d79b (patch) | |
tree | 43c11a5302d4981bb82d68b503af9ea40fc2b837 /src/mesa/drivers/x11 | |
parent | 8e4a95a93d15a6707a29454cd47e10b08314cda2 (diff) |
Use the x11 driver as a test harness for the softpipe/state_tracker code.
This has some limitations as we currently require a mapped framebuffer,
so it only really works with double-buffered ximage rgba8888 windows.
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r-- | src/mesa/drivers/x11/Makefile | 2 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_api.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_span.c | 13 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_tri.c | 40 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xmesaP.h | 7 |
6 files changed, 76 insertions, 0 deletions
diff --git a/src/mesa/drivers/x11/Makefile b/src/mesa/drivers/x11/Makefile new file mode 100644 index 00000000000..0ab1dc6e6bd --- /dev/null +++ b/src/mesa/drivers/x11/Makefile @@ -0,0 +1,2 @@ +default: + cd ../.. ; make
\ No newline at end of file diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index a07d0a90cf3..af1a169a766 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -80,6 +80,9 @@ #include "tnl/t_pipeline.h" #include "drivers/common/driverfuncs.h" +#include "softpipe/state_tracker/st_public.h" +#include "softpipe/generic/g_context.h" + /** * Global X driver lock */ @@ -1556,6 +1559,10 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) xmesa_register_swrast_functions( mesaCtx ); _swsetup_Wakeup(mesaCtx); + + st_create_context( mesaCtx, + generic_create() ); + return c; } @@ -1758,6 +1765,8 @@ PUBLIC GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, XMesaBuffer readBuffer ) { + _mesa_printf("%s %p %p %p\n", __FUNCTION__, drawBuffer, readBuffer ); + if (c) { if (!drawBuffer || !readBuffer) return GL_FALSE; /* must specify buffers! */ diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index c8546236fbf..63e7115e809 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -53,6 +53,8 @@ #include "tnl/tnl.h" #include "tnl/t_context.h" +#include "softpipe/generic/g_context.h" +#include "softpipe/state_tracker/st_public.h" /* @@ -828,6 +830,9 @@ xmesa_update_state( GLcontext *ctx, GLbitfield new_state ) _vbo_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); + st_invalidate_state( ctx, new_state ); + + if (ctx->DrawBuffer->Name != 0) return; diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index a24966b3aeb..3776891e2ec 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -1303,6 +1303,17 @@ static void put_row_rgb_TRUEDITHER_ximage( RGB_SPAN_ARGS ) } + +static void *get_pointer_4_ximage( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLint x, GLint y ) +{ + GET_XRB(xrb); + return PIXEL_ADDR4(xrb, x, y); +} + + + /* * Write a span of PF_8A8B8G8R-format pixels to an ximage. */ @@ -4593,6 +4604,7 @@ xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb, xrb->Base.PutMonoRow = put_mono_row_8A8B8G8R_ximage; xrb->Base.PutValues = put_values_8A8B8G8R_ximage; xrb->Base.PutMonoValues = put_mono_values_8A8B8G8R_ximage; + xrb->Base.GetPointer = get_pointer_4_ximage; } break; case PF_8A8R8G8B: @@ -4609,6 +4621,7 @@ xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb, xrb->Base.PutMonoRow = put_mono_row_8A8R8G8B_ximage; xrb->Base.PutValues = put_values_8A8R8G8B_ximage; xrb->Base.PutMonoValues = put_mono_values_8A8R8G8B_ximage; + xrb->Base.GetPointer = get_pointer_4_ximage; } break; case PF_8R8G8B: diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index 95c6d7c1d20..6158ef30f91 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -1443,6 +1443,46 @@ do { \ #endif + +GLboolean xmesa_get_cbuf_details( GLcontext *ctx, + void **ptr, + GLuint *cpp, + GLint *stride, + GLuint *format ) +{ + XMesaContext xmesa = XMESA_CONTEXT(ctx); + struct gl_framebuffer *fb = ctx->DrawBuffer; + struct gl_renderbuffer *crb = fb->_ColorDrawBuffers[0][0]; + struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(crb->Wrapped); + + *ptr = crb->GetPointer(ctx, crb, 0, 0); + *stride = ((GLubyte *)crb->GetPointer(ctx, crb, 0, 1) - + (GLubyte *)crb->GetPointer(ctx, crb, 0, 0)); + + if (!ptr) + goto bad; + + switch (xmesa->pixelformat) { + case PF_8A8B8G8R: + case PF_8A8R8G8B: + *format = 1; /* whatever */ + *cpp = 4; + break; + default: + goto bad; + } + + return GL_TRUE; + + bad: + *ptr = NULL; + *stride = 0; + *format = 0; + return GL_FALSE; +} + + + /** * Return pointer to line drawing function, or NULL if we should use a * swrast fallback. diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 01988867476..8f0bd34f474 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -578,4 +578,11 @@ extern void xmesa_register_swrast_functions( GLcontext *ctx ); #define ENABLE_EXT_timer_query 0 /* may not have 64-bit GLuint64EXT */ #endif + +GLboolean xmesa_get_cbuf_details( GLcontext *ctx, + void **ptr, + GLuint *cpp, + GLint *stride, + GLuint *format ); + #endif |