diff options
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r-- | src/mesa/drivers/x11/Makefile | 8 | ||||
-rw-r--r-- | src/mesa/drivers/x11/descrip.mms | 55 | ||||
-rw-r--r-- | src/mesa/drivers/x11/fakeglx.c | 21 | ||||
-rw-r--r-- | src/mesa/drivers/x11/glxapi.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/x11/glxheader.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/x11/sources | 8 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xfonts.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_api.c | 186 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_buffer.c | 119 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 316 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_glide.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_line.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_span.c | 352 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_surface.c | 251 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_tri.c | 248 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_winsys.c | 362 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xmesaP.h | 56 |
17 files changed, 668 insertions, 1346 deletions
diff --git a/src/mesa/drivers/x11/Makefile b/src/mesa/drivers/x11/Makefile index 51226eeae1..d2780e62c9 100644 --- a/src/mesa/drivers/x11/Makefile +++ b/src/mesa/drivers/x11/Makefile @@ -55,11 +55,11 @@ default: $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) $(CORE_MESA) - @ $(TOP)/bin/mklib -o $(GL_LIB) \ - -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + @ $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \ - -install $(TOP)/$(LIB_DIR) \ - $(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(OBJECTS) $(CORE_MESA) + -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ + -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).$(GL_MAJOR).dylib \ + $(GL_LIB_DEPS) $(OBJECTS) $(CORE_MESA) diff --git a/src/mesa/drivers/x11/descrip.mms b/src/mesa/drivers/x11/descrip.mms new file mode 100644 index 0000000000..648f683dfa --- /dev/null +++ b/src/mesa/drivers/x11/descrip.mms @@ -0,0 +1,55 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl +# Last revision : 3 October 2007 + +.first + define gl [----.include.gl] + define math [--.math] + define tnl [--.tnl] + define vbo [--.vbo] + define swrast [--.swrast] + define swrast_setup [--.swrast_setup] + define array_cache [--.array_cache] + define drivers [-] + define glapi [--.glapi] + define main [--.main] + define shader [--.shader] + +.include [----]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [----.include],[--.main],[--.glapi],[--.shader] +LIBDIR = [----.lib] +CFLAGS =/include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm + +SOURCES = fakeglx.c glxapi.c xfonts.c xm_api.c xm_dd.c xm_line.c xm_span.c\ + xm_tri.c xm_buffer.c + +OBJECTS =fakeglx.obj,glxapi.obj,xfonts.obj,xm_api.obj,xm_dd.obj,xm_line.obj,\ + xm_span.obj,xm_tri.obj,xm_buffer.obj + +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) + +clean : + purge + delete *.obj;* + +fakeglx.obj : fakeglx.c +glxapi.obj : glxapi.c +xfonts.obj : xfonts.c +xm_api.obj : xm_api.c +xm_buffer.obj : xm_buffer.c +xm_dd.obj : xm_dd.c +xm_line.obj : xm_line.c +xm_span.obj : xm_span.c +xm_tri.obj : xm_tri.c diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 7a170b4d3d..827d39f995 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -43,12 +43,12 @@ #include "glxheader.h" #include "glxapi.h" #include "GL/xmesa.h" -#include "context.h" -#include "config.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" -#include "version.h" +#include "main/context.h" +#include "main/config.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/version.h" #include "xfonts.h" #include "xmesaP.h" @@ -1183,11 +1183,12 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig ) * GLX_ARB_multisample */ case GLX_SAMPLE_BUFFERS_ARB: - /* ms not supported */ - return NULL; case GLX_SAMPLES_ARB: - /* ms not supported */ - return NULL; + parselist++; + if (*parselist++ != 0) + /* ms not supported */ + return NULL; + break; /* * FBConfig attribs. diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c index 309a0008d7..c2ccce6f52 100644 --- a/src/mesa/drivers/x11/glxapi.c +++ b/src/mesa/drivers/x11/glxapi.c @@ -34,8 +34,8 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include "glheader.h" -#include "glapi.h" +#include "main/glheader.h" +#include "glapi/glapi.h" #include "glxapi.h" diff --git a/src/mesa/drivers/x11/glxheader.h b/src/mesa/drivers/x11/glxheader.h index a402191f13..d88afba20e 100644 --- a/src/mesa/drivers/x11/glxheader.h +++ b/src/mesa/drivers/x11/glxheader.h @@ -30,10 +30,11 @@ #include <GL/vms_x_fix.h> #endif -#include "glheader.h" +#include "main/glheader.h" #ifdef XFree86Server +# include "xorg-server.h" # include "resource.h" # include "windowstr.h" diff --git a/src/mesa/drivers/x11/sources b/src/mesa/drivers/x11/sources deleted file mode 100644 index d76d65eaad..0000000000 --- a/src/mesa/drivers/x11/sources +++ /dev/null @@ -1,8 +0,0 @@ -# Note: only listing sources needed for X server renderer -MESA_DRIVER_X11_SOURCES = \ -xm_api.c \ -xm_buffer.c \ -xm_dd.c \ -xm_line.c \ -xm_span.c \ -xm_tri.c diff --git a/src/mesa/drivers/x11/xfonts.c b/src/mesa/drivers/x11/xfonts.c index d72c600bd1..f732c94586 100644 --- a/src/mesa/drivers/x11/xfonts.c +++ b/src/mesa/drivers/x11/xfonts.c @@ -33,8 +33,8 @@ #endif #include "glxheader.h" -#include "context.h" -#include "imports.h" +#include "main/context.h" +#include "main/imports.h" #include "xfonts.h" diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 18b033666f..c9009bad03 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -65,29 +65,22 @@ #include "glxheader.h" #include "GL/xmesa.h" #include "xmesaP.h" -#include "context.h" -#include "extensions.h" -#include "framebuffer.h" -#include "glthread.h" -#include "imports.h" -#include "macros.h" -#include "renderbuffer.h" -#include "teximage.h" +#include "main/context.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/renderbuffer.h" +#include "main/teximage.h" +#include "glapi/glthread.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "vbo/vbo.h" -#if 0 #include "tnl/tnl.h" #include "tnl/t_context.h" #include "tnl/t_pipeline.h" -#endif #include "drivers/common/driverfuncs.h" -#include "state_tracker/st_public.h" -#include "state_tracker/st_context.h" -#include "softpipe/sp_context.h" -#include "pipe/p_defines.h" - /** * Global X driver lock */ @@ -388,7 +381,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type, /* * Front renderbuffer */ - b->frontxrb = xmesa_create_renderbuffer(NULL, 0, &vis->mesa_visual, GL_FALSE); + b->frontxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, GL_FALSE); if (!b->frontxrb) { _mesa_free(b); return NULL; @@ -397,13 +390,13 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type, b->frontxrb->drawable = d; b->frontxrb->pixmap = (XMesaPixmap) d; _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_FRONT_LEFT, - &b->frontxrb->St.Base); + &b->frontxrb->Base); /* * Back renderbuffer */ if (vis->mesa_visual.doubleBufferMode) { - b->backxrb = xmesa_create_renderbuffer(NULL, 0, &vis->mesa_visual, GL_TRUE); + b->backxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, GL_TRUE); if (!b->backxrb) { /* XXX free front xrb too */ _mesa_free(b); @@ -414,7 +407,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type, b->db_mode = vis->ximage_flag ? BACK_XIMAGE : BACK_PIXMAP; _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_BACK_LEFT, - &b->backxrb->St.Base); + &b->backxrb->Base); } /* @@ -432,43 +425,14 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type, b->swAlpha = GL_FALSE; } - if (vis->mesa_visual.depthBits > 0 && - vis->mesa_visual.stencilBits > 0) { - /* combined depth/stencil */ - struct gl_renderbuffer *rb - = st_new_renderbuffer_fb(GL_DEPTH24_STENCIL8_EXT); - _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_DEPTH, rb); - _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_STENCIL, rb); - } - else { - if (vis->mesa_visual.depthBits > 0) { - struct gl_renderbuffer *rb - = st_new_renderbuffer_fb(GL_DEPTH_COMPONENT32); - _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_DEPTH, rb); - } - - if (vis->mesa_visual.stencilBits > 0) { - struct gl_renderbuffer *rb - = st_new_renderbuffer_fb(GL_STENCIL_INDEX8_EXT); - _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_STENCIL, rb); - } - } - - if (vis->mesa_visual.accumRedBits > 0) { - struct gl_renderbuffer *rb - = st_new_renderbuffer_fb(GL_RGBA16); - _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_ACCUM, rb); - } - - /* * Other renderbuffer (depth, stencil, etc) */ _mesa_add_soft_renderbuffers(&b->mesa_buffer, - GL_FALSE, /* color */ - GL_FALSE, /*vis->mesa_visual.haveDepthBuffer,*/ - GL_FALSE, /* stencil */ - GL_FALSE, /* accum */ + GL_FALSE, /* color */ + vis->mesa_visual.haveDepthBuffer, + vis->mesa_visual.haveStencilBuffer, + vis->mesa_visual.haveAccumBuffer, b->swAlpha, vis->mesa_visual.numAuxBuffers > 0 ); @@ -1339,6 +1303,67 @@ xmesa_convert_from_x_visual_type( int visualType ) /**********************************************************************/ +#ifdef IN_DRI_DRIVER +#define need_GL_VERSION_1_3 +#define need_GL_VERSION_1_4 +#define need_GL_VERSION_1_5 +#define need_GL_VERSION_2_0 + +/* sw extensions for imaging */ +#define need_GL_EXT_blend_color +#define need_GL_EXT_blend_minmax +#define need_GL_EXT_convolution +#define need_GL_EXT_histogram +#define need_GL_SGI_color_table + +/* sw extensions not associated with some GL version */ +#define need_GL_ARB_shader_objects +#define need_GL_ARB_vertex_program +#define need_GL_APPLE_vertex_array_object +#define need_GL_ATI_fragment_shader +#define need_GL_EXT_depth_bounds_test +#define need_GL_EXT_framebuffer_object +#define need_GL_EXT_framebuffer_blit +#define need_GL_EXT_gpu_program_parameters +#define need_GL_EXT_paletted_texture +#define need_GL_IBM_multimode_draw_arrays +#define need_GL_MESA_resize_buffers +#define need_GL_NV_vertex_program +#define need_GL_NV_fragment_program + +#include "extension_helper.h" +#include "utils.h" + +const struct dri_extension card_extensions[] = +{ + { "GL_VERSION_1_3", GL_VERSION_1_3_functions }, + { "GL_VERSION_1_4", GL_VERSION_1_4_functions }, + { "GL_VERSION_1_5", GL_VERSION_1_5_functions }, + { "GL_VERSION_2_0", GL_VERSION_2_0_functions }, + + { "GL_EXT_blend_color", GL_EXT_blend_color_functions }, + { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions }, + { "GL_EXT_convolution", GL_EXT_convolution_functions }, + { "GL_EXT_histogram", GL_EXT_histogram_functions }, + { "GL_SGI_color_table", GL_SGI_color_table_functions }, + + { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions }, + { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }, + { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions }, + { "GL_ATI_fragment_shader", GL_ATI_fragment_shader_functions }, + { "GL_EXT_depth_bounds_test", GL_EXT_depth_bounds_test_functions }, + { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, + { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, + { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, + { "GL_EXT_paletted_texture", GL_EXT_paletted_texture_functions }, + { "GL_IBM_multimode_draw_arrays", GL_IBM_multimode_draw_arrays_functions }, + { "GL_MESA_resize_buffers", GL_MESA_resize_buffers_functions }, + { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, + { "GL_NV_fragment_program", GL_NV_fragment_program_functions }, + { NULL, NULL } +}; +#endif + /* * Create a new X/Mesa visual. * Input: display - X11 display @@ -1384,6 +1409,14 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, XMesaVisual v; GLint red_bits, green_bits, blue_bits, alpha_bits; +#ifdef IN_DRI_DRIVER + /* driInitExtensions() should be called once per screen to setup extension + * indices. There is no need to call it when the context is created since + * XMesa enables mesa sw extensions on its own. + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); +#endif + #ifndef XFree86Server /* For debugging only */ if (_mesa_getenv("MESA_XSYNC")) { @@ -1530,9 +1563,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) XMesaContext c; GLcontext *mesaCtx; struct dd_function_table functions; -#if 0 TNLcontext *tnl; -#endif if (firstTime) { _glthread_INIT_MUTEX(_xmesa_lock); @@ -1549,15 +1580,6 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) /* initialize with default driver functions, then plug in XMesa funcs */ _mesa_init_driver_functions(&functions); xmesa_init_driver_functions(v, &functions); - st_init_driver_functions(&functions); - - /* override st's function */ - functions.UpdateState = xmesa_update_state; - - /* - functions.NewRenderbuffer = xmesa_new_renderbuffer; - */ - if (!_mesa_initialize_context(mesaCtx, &v->mesa_visual, share_list ? &(share_list->mesa) : (GLcontext *) NULL, &functions, (void *) c)) { @@ -1570,8 +1592,9 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) _mesa_enable_1_4_extensions(mesaCtx); _mesa_enable_1_5_extensions(mesaCtx); _mesa_enable_2_0_extensions(mesaCtx); + _mesa_enable_2_1_extensions(mesaCtx); #if ENABLE_EXT_texure_compression_s3tc - if (c->Mesa_DXTn) { + if (mesaCtx->Mesa_DXTn) { _mesa_enable_extension(mesaCtx, "GL_EXT_texture_compression_s3tc"); _mesa_enable_extension(mesaCtx, "GL_S3_s3tc"); } @@ -1597,49 +1620,22 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) /* Initialize the software rasterizer and helper modules. */ - if (!_swrast_CreateContext( mesaCtx ) -#if 0 - || !_vbo_CreateContext( mesaCtx ) || + if (!_swrast_CreateContext( mesaCtx ) || + !_vbo_CreateContext( mesaCtx ) || !_tnl_CreateContext( mesaCtx ) || - !_swsetup_CreateContext( mesaCtx ) -#endif - ) { + !_swsetup_CreateContext( mesaCtx )) { _mesa_free_context_data(&c->mesa); _mesa_free(c); return NULL; } -#if 0 /* tnl setup */ tnl = TNL_CONTEXT(mesaCtx); tnl->Driver.RunPipeline = _tnl_run_pipeline; -#endif - /* swrast setup */ xmesa_register_swrast_functions( mesaCtx ); - - - st_create_context( mesaCtx, - xmesa_create_softpipe( c ) ); - - _swsetup_CreateContext( mesaCtx ); _swsetup_Wakeup(mesaCtx); - /* override these functions, as if the xlib driver were derived from - * the softpipe driver. - */ -#if 0 - mesaCtx->st->pipe->surface_alloc = xmesa_surface_alloc; -#endif - mesaCtx->st->pipe->is_format_supported = xmesa_is_format_supported; - mesaCtx->st->pipe->get_tile_rgba = xmesa_get_tile_rgba; - mesaCtx->st->pipe->put_tile_rgba = xmesa_put_tile_rgba; - - mesaCtx->st->haveFramebufferRegions = GL_FALSE; - - /* special pipe->clear function */ - mesaCtx->st->pipe->clear = xmesa_clear; - return c; } @@ -1656,10 +1652,8 @@ void XMesaDestroyContext( XMesaContext c ) _swsetup_DestroyContext( mesaCtx ); _swrast_DestroyContext( mesaCtx ); -#if 0 _tnl_DestroyContext( mesaCtx ); _vbo_DestroyContext( mesaCtx ); -#endif _mesa_free_context_data( mesaCtx ); _mesa_free( c ); } diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index 09356c7329..f104d44d05 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -32,13 +32,9 @@ #include "glxheader.h" #include "GL/xmesa.h" #include "xmesaP.h" -#include "imports.h" -#include "framebuffer.h" -#include "renderbuffer.h" -#include "pipe/p_state.h" -#include "pipe/p_defines.h" -#include "pipe/p_winsys.h" -#include "state_tracker/st_context.h" +#include "main/imports.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" #if defined(USE_XSHM) && !defined(XFree86Server) @@ -249,18 +245,6 @@ xmesa_delete_renderbuffer(struct gl_renderbuffer *rb) } -static void -finish_surface_init(GLcontext *ctx, struct xmesa_renderbuffer *xrb) -{ - struct pipe_context *pipe = ctx->st->pipe; - if (!xrb->St.surface->region) { - int w = 1, h = 1; - xrb->St.surface->region = pipe->winsys->region_alloc(pipe->winsys, - 1, w, h, 0x0); - } -} - - /** * Reallocate renderbuffer storage for front color buffer. * Called via gl_renderbuffer::AllocStorage() @@ -284,12 +268,6 @@ xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->Height = height; rb->InternalFormat = internalFormat; - if (!xrb->St.surface || !xrb->St.surface->region) - finish_surface_init(ctx, xrb); - - xrb->St.surface->width = width; - xrb->St.surface->height = height; - return GL_TRUE; } @@ -339,103 +317,46 @@ xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, xrb->origin4 = NULL; } - if (!xrb->St.surface || !xrb->St.surface->region) - finish_surface_init(ctx, xrb); - - xrb->St.surface->width = width; - xrb->St.surface->height = height; - return GL_TRUE; } -/** - * Called to create the front/back color renderbuffers, not user-created - * renderbuffers. - */ struct xmesa_renderbuffer * -xmesa_create_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, - GLboolean backBuffer) +xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, + GLboolean backBuffer) { struct xmesa_renderbuffer *xrb = CALLOC_STRUCT(xmesa_renderbuffer); - struct pipe_context *pipe = NULL;/*ctx->st->pipe;*/ if (xrb) { GLuint name = 0; - GLuint pipeFormat = 0; - struct xmesa_surface *xms; - - _mesa_init_renderbuffer(&xrb->St.Base, name); + _mesa_init_renderbuffer(&xrb->Base, name); - xrb->St.Base.Delete = xmesa_delete_renderbuffer; + xrb->Base.Delete = xmesa_delete_renderbuffer; if (backBuffer) - xrb->St.Base.AllocStorage = xmesa_alloc_back_storage; + xrb->Base.AllocStorage = xmesa_alloc_back_storage; else - xrb->St.Base.AllocStorage = xmesa_alloc_front_storage; + xrb->Base.AllocStorage = xmesa_alloc_front_storage; if (visual->rgbMode) { - xrb->St.Base.InternalFormat = GL_RGBA; - xrb->St.Base._BaseFormat = GL_RGBA; - xrb->St.Base.DataType = GL_UNSIGNED_BYTE; - xrb->St.Base.RedBits = visual->redBits; - xrb->St.Base.GreenBits = visual->greenBits; - xrb->St.Base.BlueBits = visual->blueBits; - xrb->St.Base.AlphaBits = visual->alphaBits; - pipeFormat = PIPE_FORMAT_U_A8_R8_G8_B8; + xrb->Base.InternalFormat = GL_RGBA; + xrb->Base._BaseFormat = GL_RGBA; + xrb->Base.DataType = GL_UNSIGNED_BYTE; + xrb->Base.RedBits = visual->redBits; + xrb->Base.GreenBits = visual->greenBits; + xrb->Base.BlueBits = visual->blueBits; + xrb->Base.AlphaBits = visual->alphaBits; } else { - xrb->St.Base.InternalFormat = GL_COLOR_INDEX; - xrb->St.Base._BaseFormat = GL_COLOR_INDEX; - xrb->St.Base.DataType = GL_UNSIGNED_INT; - xrb->St.Base.IndexBits = visual->indexBits; + xrb->Base.InternalFormat = GL_COLOR_INDEX; + xrb->Base._BaseFormat = GL_COLOR_INDEX; + xrb->Base.DataType = GL_UNSIGNED_INT; + xrb->Base.IndexBits = visual->indexBits; } /* only need to set Red/Green/EtcBits fields for user-created RBs */ - - xrb->St.surface = xmesa_new_color_surface(pipe, pipeFormat); - xms = (struct xmesa_surface *) xrb->St.surface; - xms->xrb = xrb; } return xrb; } -#if 0 -struct gl_renderbuffer * -xmesa_new_renderbuffer(GLcontext *ctx, struct gl_renderbuffer *rb, - GLenum internalFormat, GLuint width, GLuint height) -{ - struct xmesa_renderbuffer *xrb = CALLOC_STRUCT(xmesa_renderbuffer); - if (xrb) { - GLuint name = 0; - _mesa_init_renderbuffer(&xrb->St.Base, name); - - xrb->St.Base.Delete = xmesa_delete_renderbuffer; - if (backBuffer) - xrb->St.Base.AllocStorage = xmesa_alloc_back_storage; - else - xrb->St.Base.AllocStorage = xmesa_alloc_front_storage; - - if (visual->rgbMode) { - xrb->St.Base.InternalFormat = GL_RGBA; - xrb->St.Base._BaseFormat = GL_RGBA; - xrb->St.Base.DataType = GL_UNSIGNED_BYTE; - xrb->St.Base.RedBits = visual->redBits; - xrb->St.Base.GreenBits = visual->greenBits; - xrb->St.Base.BlueBits = visual->blueBits; - xrb->St.Base.AlphaBits = visual->alphaBits; - } - else { - xrb->St.Base.InternalFormat = GL_COLOR_INDEX; - xrb->St.Base._BaseFormat = GL_COLOR_INDEX; - xrb->St.Base.DataType = GL_UNSIGNED_INT; - xrb->St.Base.IndexBits = visual->indexBits; - } - /* only need to set Red/Green/EtcBits fields for user-created RBs */ - } - return xrb; -} -#endif - - /** * Called via gl_framebuffer::Delete() method when this buffer * is _really_ being deleted. diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 34287effe1..305df548fa 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -29,34 +29,30 @@ */ #include "glxheader.h" -#include "bufferobj.h" -#include "buffers.h" -#include "context.h" -#include "colormac.h" -#include "depth.h" -#include "drawpix.h" -#include "extensions.h" -#include "framebuffer.h" -#include "macros.h" -#include "image.h" -#include "imports.h" -#include "mtypes.h" -#include "state.h" -#include "texobj.h" -#include "teximage.h" -#include "texstore.h" -#include "texformat.h" -#include "xmesaP.h" +#include "main/bufferobj.h" +#include "main/buffers.h" +#include "main/context.h" +#include "main/colormac.h" +#include "main/depth.h" +#include "main/drawpix.h" +#include "main/extensions.h" +#include "main/framebuffer.h" +#include "main/macros.h" +#include "main/image.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/state.h" +#include "main/texobj.h" +#include "main/teximage.h" +#include "main/texstore.h" +#include "main/texformat.h" #include "swrast/swrast.h" #include "swrast/s_context.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" #include "tnl/t_context.h" +#include "xmesaP.h" -#include "softpipe/sp_context.h" -#include "state_tracker/st_public.h" -#include "state_tracker/st_context.h" -#include "state_tracker/st_draw.h" /* @@ -222,7 +218,7 @@ clear_pixmap(GLcontext *ctx, struct xmesa_renderbuffer *xrb, assert(xmbuf->cleargc); XMesaFillRectangle( xmesa->display, xrb->pixmap, xmbuf->cleargc, - x, xrb->St.Base.Height - y - height, + x, xrb->Base.Height - y - height, width, height ); } @@ -333,9 +329,9 @@ clear_32bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, | ((pixel << 24) & 0xff000000); } - if (width == xrb->St.Base.Width && height == xrb->St.Base.Height) { + if (width == xrb->Base.Width && height == xrb->Base.Height) { /* clearing whole buffer */ - const GLuint n = xrb->St.Base.Width * xrb->St.Base.Height; + const GLuint n = xrb->Base.Width * xrb->Base.Height; GLuint *ptr4 = (GLuint *) xrb->ximage->data; if (pixel == 0) { /* common case */ @@ -379,8 +375,8 @@ clear_nbit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, -void -xmesa_clear_buffers(GLcontext *ctx, GLbitfield buffers) +static void +clear_buffers(GLcontext *ctx, GLbitfield buffers) { if (ctx->DrawBuffer->Name == 0) { /* this is a window system framebuffer */ @@ -424,7 +420,42 @@ xmesa_clear_buffers(GLcontext *ctx, GLbitfield buffers) #ifndef XFree86Server -/* XXX this was never tested in the Xserver environment */ +/* XXX these functions haven't been tested in the Xserver environment */ + + +/** + * Check if we can do an optimized glDrawPixels into an 8R8G8B visual. + */ +static GLboolean +can_do_DrawPixels_8R8G8B(GLcontext *ctx, GLenum format, GLenum type) +{ + if (format == GL_BGRA && + type == GL_UNSIGNED_BYTE && + ctx->DrawBuffer && + ctx->DrawBuffer->Name == 0 && + ctx->Pixel.ZoomX == 1.0 && /* no zooming */ + ctx->Pixel.ZoomY == 1.0 && + ctx->_ImageTransferState == 0 /* no color tables, scale/bias, etc */) { + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + if ((swrast->_RasterMask & ~CLIP_BIT) == 0) /* no blend, z-test, etc */ { + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; + if (rb) { + struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped); + if (xrb && + xrb->pixmap && /* drawing to pixmap or window */ + xrb->Base.AlphaBits == 0) { + return GL_TRUE; + } + } + } + } + return GL_FALSE; +} + /** * This function implements glDrawPixels() with an XPutImage call when @@ -438,37 +469,16 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { - const SWcontext *swrast = SWRAST_CONTEXT( ctx ); - struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0]; - struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped); - - if (swrast->NewState) - _swrast_validate_derived( ctx ); - - if (ctx->DrawBuffer->Name == 0 && - format == GL_BGRA && - type == GL_UNSIGNED_BYTE && - (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */ - ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ - ctx->Pixel.ZoomX == 1.0 && /* no zooming */ - ctx->Pixel.ZoomY == 1.0 && - xrb->pixmap && /* drawing to pixmap or window */ - xrb->St.Base.AlphaBits == 0) - { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - XMesaDisplay *dpy = xmesa->xm_visual->display; - const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ + if (can_do_DrawPixels_8R8G8B(ctx, format, type)) { + const SWcontext *swrast = SWRAST_CONTEXT( ctx ); + struct gl_pixelstore_attrib clippedUnpack = *unpack; int dstX = x; int dstY = y; int w = width; int h = height; - struct gl_pixelstore_attrib clippedUnpack = *unpack; - ASSERT(xmesa->xm_visual->dithered_pf == PF_8R8G8B); - ASSERT(xmesa->xm_visual->undithered_pf == PF_8R8G8B); - ASSERT(dpy); - ASSERT(gc); + if (swrast->NewState) + _swrast_validate_derived( ctx ); if (unpack->BufferObj->Name) { /* unpack from PBO */ @@ -493,14 +503,26 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, } if (_mesa_clip_drawpixels(ctx, &dstX, &dstY, &w, &h, &clippedUnpack)) { + const XMesaContext xmesa = XMESA_CONTEXT(ctx); + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); + const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ + struct xmesa_renderbuffer *xrb + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); + const int srcX = clippedUnpack.SkipPixels; + const int srcY = clippedUnpack.SkipRows; + const int rowLength = clippedUnpack.RowLength; + XMesaImage ximage; + + ASSERT(xmesa->xm_visual->dithered_pf == PF_8R8G8B); + ASSERT(xmesa->xm_visual->undithered_pf == PF_8R8G8B); + ASSERT(dpy); + ASSERT(gc); + /* This is a little tricky since all coordinates up to now have * been in the OpenGL bottom-to-top orientation. X is top-to-bottom * so we have to carefully compute the Y coordinates/addresses here. */ - int srcX = clippedUnpack.SkipPixels; - int srcY = clippedUnpack.SkipRows; - int rowLength = clippedUnpack.RowLength; - XMesaImage ximage; MEMSET(&ximage, 0, sizeof(XMesaImage)); ximage.width = width; ximage.height = height; @@ -511,9 +533,9 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, ximage.bitmap_unit = 32; ximage.bitmap_bit_order = LSBFirst; ximage.bitmap_pad = 32; - ximage.depth = 24; - ximage.bytes_per_line = -rowLength * 4; /* negative to flip image */ + ximage.depth = 32; ximage.bits_per_pixel = 32; + ximage.bytes_per_line = -rowLength * 4; /* negative to flip image */ /* it seems we don't need to set the ximage.red/green/blue_mask fields */ /* flip Y axis for dest position */ dstY = YFLIP(xrb, dstY) - h + 1; @@ -535,6 +557,41 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, /** + * Check if we can do an optimized glDrawPixels into an 5R6G5B visual. + */ +static GLboolean +can_do_DrawPixels_5R6G5B(GLcontext *ctx, GLenum format, GLenum type) +{ + if (format == GL_RGB && + type == GL_UNSIGNED_SHORT_5_6_5 && + !ctx->Color.DitherFlag && /* no dithering */ + ctx->DrawBuffer && + ctx->DrawBuffer->Name == 0 && + ctx->Pixel.ZoomX == 1.0 && /* no zooming */ + ctx->Pixel.ZoomY == 1.0 && + ctx->_ImageTransferState == 0 /* no color tables, scale/bias, etc */) { + const SWcontext *swrast = SWRAST_CONTEXT(ctx); + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + if ((swrast->_RasterMask & ~CLIP_BIT) == 0) /* no blend, z-test, etc */ { + struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; + if (rb) { + struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped); + if (xrb && + xrb->pixmap && /* drawing to pixmap or window */ + xrb->Base.AlphaBits == 0) { + return GL_TRUE; + } + } + } + } + return GL_FALSE; +} + + +/** * This function implements glDrawPixels() with an XPutImage call when * drawing to the front buffer (X Window drawable). The image format * must be GL_RGB and image type must be GL_UNSIGNED_SHORT_5_6_5 to @@ -547,35 +604,17 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels ) { - struct xmesa_renderbuffer *xrb - = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - const SWcontext *swrast = SWRAST_CONTEXT( ctx ); - XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ - - ASSERT(dpy); - ASSERT(gc); - ASSERT(xmesa->xm_visual->undithered_pf == PF_5R6G5B); - - if (swrast->NewState) - _swrast_validate_derived( ctx ); - - if (xrb->pixmap && /* drawing to pixmap or window */ - format == GL_RGB && - type == GL_UNSIGNED_SHORT_5_6_5 && - !ctx->Color.DitherFlag && /* no dithering */ - (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */ - ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ - ctx->Pixel.ZoomX == 1.0 && /* no zooming */ - ctx->Pixel.ZoomY == 1.0) { + if (can_do_DrawPixels_5R6G5B(ctx, format, type)) { + const SWcontext *swrast = SWRAST_CONTEXT( ctx ); + struct gl_pixelstore_attrib clippedUnpack = *unpack; int dstX = x; int dstY = y; int w = width; int h = height; - struct gl_pixelstore_attrib clippedUnpack = *unpack; + if (swrast->NewState) + _swrast_validate_derived( ctx ); + if (unpack->BufferObj->Name) { /* unpack from PBO */ GLubyte *buf; @@ -599,14 +638,25 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, } if (_mesa_clip_drawpixels(ctx, &dstX, &dstY, &w, &h, &clippedUnpack)) { + const XMesaContext xmesa = XMESA_CONTEXT(ctx); + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); + const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ + struct xmesa_renderbuffer *xrb + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); + const int srcX = clippedUnpack.SkipPixels; + const int srcY = clippedUnpack.SkipRows; + const int rowLength = clippedUnpack.RowLength; + XMesaImage ximage; + + ASSERT(xmesa->xm_visual->undithered_pf == PF_5R6G5B); + ASSERT(dpy); + ASSERT(gc); + /* This is a little tricky since all coordinates up to now have * been in the OpenGL bottom-to-top orientation. X is top-to-bottom * so we have to carefully compute the Y coordinates/addresses here. */ - int srcX = clippedUnpack.SkipPixels; - int srcY = clippedUnpack.SkipRows; - int rowLength = clippedUnpack.RowLength; - XMesaImage ximage; MEMSET(&ximage, 0, sizeof(XMesaImage)); ximage.width = width; ximage.height = height; @@ -618,8 +668,8 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, ximage.bitmap_bit_order = LSBFirst; ximage.bitmap_pad = 16; ximage.depth = 16; - ximage.bytes_per_line = -rowLength * 2; /* negative to flip image */ ximage.bits_per_pixel = 16; + ximage.bytes_per_line = -rowLength * 2; /* negative to flip image */ /* it seems we don't need to set the ximage.red/green/blue_mask fields */ /* flip Y axis for dest position */ dstY = YFLIP(xrb, dstY) - h + 1; @@ -639,6 +689,42 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, } +/** + * Determine if we can do an optimized glCopyPixels. + */ +static GLboolean +can_do_CopyPixels(GLcontext *ctx, GLenum type) +{ + if (type == GL_COLOR && + ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ + ctx->Pixel.ZoomX == 1.0 && /* no zooming */ + ctx->Pixel.ZoomY == 1.0 && + ctx->Color.DrawBuffer[0] == GL_FRONT && /* copy to front buf */ + ctx->Pixel.ReadBuffer == GL_FRONT && /* copy from front buf */ + ctx->ReadBuffer->_ColorReadBuffer && + ctx->DrawBuffer->_ColorDrawBuffers[0]) { + const SWcontext *swrast = SWRAST_CONTEXT( ctx ); + + if (swrast->NewState) + _swrast_validate_derived( ctx ); + + if ((swrast->_RasterMask & ~CLIP_BIT) == 0x0 && + ctx->ReadBuffer && + ctx->ReadBuffer->_ColorReadBuffer && + ctx->DrawBuffer && + ctx->DrawBuffer->_ColorDrawBuffers[0]) { + struct xmesa_renderbuffer *srcXrb + = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped); + struct xmesa_renderbuffer *dstXrb + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); + if (srcXrb->pixmap && dstXrb->pixmap) { + return GL_TRUE; + } + } + } + return GL_FALSE; +} + /** * Implement glCopyPixels for the front color buffer (or back buffer Pixmap) @@ -650,31 +736,19 @@ xmesa_CopyPixels( GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint destx, GLint desty, GLenum type ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - const SWcontext *swrast = SWRAST_CONTEXT( ctx ); - XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ - struct xmesa_renderbuffer *srcXrb - = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped); - struct xmesa_renderbuffer *dstXrb - = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); - - ASSERT(dpy); - ASSERT(gc); - - if (swrast->NewState) - _swrast_validate_derived( ctx ); - - if (ctx->Color.DrawBuffer[0] == GL_FRONT && - ctx->Pixel.ReadBuffer == GL_FRONT && - srcXrb->pixmap && - dstXrb->pixmap && - type == GL_COLOR && - (swrast->_RasterMask & ~CLIP_BIT) == 0 && /* no blend, z-test, etc */ - ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ - ctx->Pixel.ZoomX == 1.0 && /* no zooming */ - ctx->Pixel.ZoomY == 1.0) { + if (can_do_CopyPixels(ctx, type)) { + const XMesaContext xmesa = XMESA_CONTEXT(ctx); + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); + const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ + struct xmesa_renderbuffer *srcXrb + = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped); + struct xmesa_renderbuffer *dstXrb + = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); + + ASSERT(dpy); + ASSERT(gc); + /* Note: we don't do any special clipping work here. We could, * but X will do it for us. */ @@ -687,6 +761,7 @@ xmesa_CopyPixels( GLcontext *ctx, _swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type ); } } + #endif /* XFree86Server */ @@ -704,7 +779,7 @@ get_string( GLcontext *ctx, GLenum name ) #ifdef XFree86Server return (const GLubyte *) "Mesa GLX Indirect"; #else - return (const GLubyte *) "Mesa X11 (softpipe)"; + return (const GLubyte *) "Mesa X11"; #endif case GL_VENDOR: #ifdef XFree86Server @@ -831,9 +906,6 @@ 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; @@ -841,7 +913,7 @@ xmesa_update_state( GLcontext *ctx, GLbitfield new_state ) * GL_DITHER, GL_READ/DRAW_BUFFER, buffer binding state, etc. effect * renderbuffer span/clear funcs. */ - if (new_state & (_NEW_COLOR | _NEW_BUFFERS)) { + if (new_state & (_NEW_COLOR | _NEW_PIXEL | _NEW_BUFFERS)) { XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); struct xmesa_renderbuffer *front_xrb, *back_xrb; @@ -1074,12 +1146,13 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, driver->IndexMask = index_mask; driver->ColorMask = color_mask; driver->Enable = enable; - driver->Clear = xmesa_clear_buffers; + driver->Clear = clear_buffers; driver->Viewport = xmesa_viewport; #ifndef XFree86Server driver->CopyPixels = xmesa_CopyPixels; if (xmvisual->undithered_pf == PF_8R8G8B && - xmvisual->dithered_pf == PF_8R8G8B) { + xmvisual->dithered_pf == PF_8R8G8B && + xmvisual->BitsPerPixel == 32) { driver->DrawPixels = xmesa_DrawPixels_8R8G8B; } else if (xmvisual->undithered_pf == PF_5R6G5B) { @@ -1098,7 +1171,6 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, driver->BeginQuery = xmesa_begin_query; driver->EndQuery = xmesa_end_query; #endif - } diff --git a/src/mesa/drivers/x11/xm_glide.c b/src/mesa/drivers/x11/xm_glide.c index ae4f4282db..cbd69b011a 100644 --- a/src/mesa/drivers/x11/xm_glide.c +++ b/src/mesa/drivers/x11/xm_glide.c @@ -64,7 +64,8 @@ FXcreateContext(XMesaVisual v, XMesaWindow w, XMesaContext c, XMesaBuffer b) attribs[numAttribs++] = FXMESA_NONE; /* [dBorca] we should take an envvar for `fxMesaSelectCurrentBoard'!!! */ - hw = fxMesaSelectCurrentBoard(0); +/* hw = fxMesaSelectCurrentBoard(0); */ + hw = GR_SSTTYPE_Voodoo2; /* if these fail, there's a new bug somewhere */ ASSERT(b->mesa_buffer.Width > 0); diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index deeae5019c..f643b6d3a7 100644 --- a/src/mesa/drivers/x11/xm_line.c +++ b/src/mesa/drivers/x11/xm_line.c @@ -31,9 +31,9 @@ #include "glxheader.h" -#include "depth.h" -#include "macros.h" -#include "mtypes.h" +#include "main/depth.h" +#include "main/macros.h" +#include "main/mtypes.h" #include "xmesaP.h" /* Internal swrast includes: @@ -121,7 +121,7 @@ void xmesa_choose_point( GLcontext *ctx ) #define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \ - xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped) + xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped) /* @@ -587,8 +587,8 @@ get_line_func(GLcontext *ctx) const int depth = GET_VISUAL_DEPTH(xmesa->xm_visual); const struct xmesa_renderbuffer *xrb; - if ((ctx->DrawBuffer->_ColorDrawBufferMask[0] - & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 0) + if ((ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_FRONT_LEFT) && + (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_BACK_LEFT)) return (swrast_line_func) NULL; if (ctx->RenderMode != GL_RENDER) return (swrast_line_func) NULL; if (ctx->Line.SmoothFlag) return (swrast_line_func) NULL; @@ -598,7 +598,7 @@ get_line_func(GLcontext *ctx) if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL; if (xmbuf->swAlpha) return (swrast_line_func) NULL; - xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); + xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); if (xrb->ximage && swrast->_RasterMask==DEPTH_BIT @@ -661,8 +661,8 @@ get_line_func(GLcontext *ctx) } #ifndef XFree86Server - if (ctx->DrawBuffer->_NumColorDrawBuffers[0] == 1 - && ctx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT + if (ctx->DrawBuffer->_NumColorDrawBuffers == 1 + && ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT && swrast->_RasterMask == LOGIC_OP_BIT && ctx->Color.LogicOp == GL_XOR && !ctx->Line.StippleFlag diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index ce54a18a27..57b5749448 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -23,15 +23,15 @@ */ #include "glxheader.h" -#include "colormac.h" -#include "context.h" -#include "depth.h" -#include "drawpix.h" -#include "extensions.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" -#include "state.h" +#include "main/colormac.h" +#include "main/context.h" +#include "main/depth.h" +#include "main/drawpix.h" +#include "main/extensions.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" +#include "main/state.h" #include "xmesaP.h" #include "swrast/swrast.h" @@ -1303,17 +1303,6 @@ 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. */ @@ -4539,260 +4528,257 @@ xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb, enum pixel_format pixelformat, GLint depth) { const GLboolean pixmap = xrb->pixmap ? GL_TRUE : GL_FALSE; - struct gl_renderbuffer *rb = &xrb->St.Base; switch (pixelformat) { case PF_Index: - ASSERT(rb->DataType == GL_UNSIGNED_INT); + ASSERT(xrb->Base.DataType == GL_UNSIGNED_INT); if (pixmap) { - rb->PutRow = put_row_ci_pixmap; - rb->PutRowRGB = NULL; - rb->PutMonoRow = put_mono_row_ci_pixmap; - rb->PutValues = put_values_ci_pixmap; - rb->PutMonoValues = put_mono_values_ci_pixmap; + xrb->Base.PutRow = put_row_ci_pixmap; + xrb->Base.PutRowRGB = NULL; + xrb->Base.PutMonoRow = put_mono_row_ci_pixmap; + xrb->Base.PutValues = put_values_ci_pixmap; + xrb->Base.PutMonoValues = put_mono_values_ci_pixmap; } else { - rb->PutRow = put_row_ci_ximage; - rb->PutRowRGB = NULL; - rb->PutMonoRow = put_mono_row_ci_ximage; - rb->PutValues = put_values_ci_ximage; - rb->PutMonoValues = put_mono_values_ci_ximage; + xrb->Base.PutRow = put_row_ci_ximage; + xrb->Base.PutRowRGB = NULL; + xrb->Base.PutMonoRow = put_mono_row_ci_ximage; + xrb->Base.PutValues = put_values_ci_ximage; + xrb->Base.PutMonoValues = put_mono_values_ci_ximage; } break; case PF_Truecolor: if (pixmap) { - rb->PutRow = put_row_TRUECOLOR_pixmap; - rb->PutRowRGB = put_row_rgb_TRUECOLOR_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_TRUECOLOR_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_TRUECOLOR_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_TRUECOLOR_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_TRUECOLOR_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_TRUECOLOR_ximage; - rb->PutRowRGB = put_row_rgb_TRUECOLOR_ximage; - rb->PutMonoRow = put_mono_row_ximage; - rb->PutValues = put_values_TRUECOLOR_ximage; - rb->PutMonoValues = put_mono_values_ximage; + xrb->Base.PutRow = put_row_TRUECOLOR_ximage; + xrb->Base.PutRowRGB = put_row_rgb_TRUECOLOR_ximage; + xrb->Base.PutMonoRow = put_mono_row_ximage; + xrb->Base.PutValues = put_values_TRUECOLOR_ximage; + xrb->Base.PutMonoValues = put_mono_values_ximage; } break; case PF_Dither_True: if (pixmap) { - rb->PutRow = put_row_TRUEDITHER_pixmap; - rb->PutRowRGB = put_row_rgb_TRUEDITHER_pixmap; - rb->PutMonoRow = put_mono_row_TRUEDITHER_pixmap; - rb->PutValues = put_values_TRUEDITHER_pixmap; - rb->PutMonoValues = put_mono_values_TRUEDITHER_pixmap; + xrb->Base.PutRow = put_row_TRUEDITHER_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_TRUEDITHER_pixmap; + xrb->Base.PutMonoRow = put_mono_row_TRUEDITHER_pixmap; + xrb->Base.PutValues = put_values_TRUEDITHER_pixmap; + xrb->Base.PutMonoValues = put_mono_values_TRUEDITHER_pixmap; } else { - rb->PutRow = put_row_TRUEDITHER_ximage; - rb->PutRowRGB = put_row_rgb_TRUEDITHER_ximage; - rb->PutMonoRow = put_mono_row_TRUEDITHER_ximage; - rb->PutValues = put_values_TRUEDITHER_ximage; - rb->PutMonoValues = put_mono_values_TRUEDITHER_ximage; + xrb->Base.PutRow = put_row_TRUEDITHER_ximage; + xrb->Base.PutRowRGB = put_row_rgb_TRUEDITHER_ximage; + xrb->Base.PutMonoRow = put_mono_row_TRUEDITHER_ximage; + xrb->Base.PutValues = put_values_TRUEDITHER_ximage; + xrb->Base.PutMonoValues = put_mono_values_TRUEDITHER_ximage; } break; case PF_8A8B8G8R: if (pixmap) { - rb->PutRow = put_row_8A8B8G8R_pixmap; - rb->PutRowRGB = put_row_rgb_8A8B8G8R_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_8A8B8G8R_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_8A8B8G8R_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_8A8B8G8R_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_8A8B8G8R_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_8A8B8G8R_ximage; - rb->PutRowRGB = put_row_rgb_8A8B8G8R_ximage; - rb->PutMonoRow = put_mono_row_8A8B8G8R_ximage; - rb->PutValues = put_values_8A8B8G8R_ximage; - rb->PutMonoValues = put_mono_values_8A8B8G8R_ximage; - rb->GetPointer = get_pointer_4_ximage; + xrb->Base.PutRow = put_row_8A8B8G8R_ximage; + xrb->Base.PutRowRGB = put_row_rgb_8A8B8G8R_ximage; + xrb->Base.PutMonoRow = put_mono_row_8A8B8G8R_ximage; + xrb->Base.PutValues = put_values_8A8B8G8R_ximage; + xrb->Base.PutMonoValues = put_mono_values_8A8B8G8R_ximage; } break; case PF_8A8R8G8B: if (pixmap) { - rb->PutRow = put_row_8A8R8G8B_pixmap; - rb->PutRowRGB = put_row_rgb_8A8R8G8B_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_8A8R8G8B_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_8A8R8G8B_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_8A8R8G8B_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_8A8R8G8B_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_8A8R8G8B_ximage; - rb->PutRowRGB = put_row_rgb_8A8R8G8B_ximage; - rb->PutMonoRow = put_mono_row_8A8R8G8B_ximage; - rb->PutValues = put_values_8A8R8G8B_ximage; - rb->PutMonoValues = put_mono_values_8A8R8G8B_ximage; - rb->GetPointer = get_pointer_4_ximage; + xrb->Base.PutRow = put_row_8A8R8G8B_ximage; + xrb->Base.PutRowRGB = put_row_rgb_8A8R8G8B_ximage; + xrb->Base.PutMonoRow = put_mono_row_8A8R8G8B_ximage; + xrb->Base.PutValues = put_values_8A8R8G8B_ximage; + xrb->Base.PutMonoValues = put_mono_values_8A8R8G8B_ximage; } break; case PF_8R8G8B: if (pixmap) { - rb->PutRow = put_row_8R8G8B_pixmap; - rb->PutRowRGB = put_row_rgb_8R8G8B_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_8R8G8B_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_8R8G8B_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_8R8G8B_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_8R8G8B_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_8R8G8B_ximage; - rb->PutRowRGB = put_row_rgb_8R8G8B_ximage; - rb->PutMonoRow = put_mono_row_8R8G8B_ximage; - rb->PutValues = put_values_8R8G8B_ximage; - rb->PutMonoValues = put_mono_values_8R8G8B_ximage; + xrb->Base.PutRow = put_row_8R8G8B_ximage; + xrb->Base.PutRowRGB = put_row_rgb_8R8G8B_ximage; + xrb->Base.PutMonoRow = put_mono_row_8R8G8B_ximage; + xrb->Base.PutValues = put_values_8R8G8B_ximage; + xrb->Base.PutMonoValues = put_mono_values_8R8G8B_ximage; } break; case PF_8R8G8B24: if (pixmap) { - rb->PutRow = put_row_8R8G8B24_pixmap; - rb->PutRowRGB = put_row_rgb_8R8G8B24_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_8R8G8B24_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_8R8G8B24_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_8R8G8B24_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_8R8G8B24_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_8R8G8B24_ximage; - rb->PutRowRGB = put_row_rgb_8R8G8B24_ximage; - rb->PutMonoRow = put_mono_row_8R8G8B24_ximage; - rb->PutValues = put_values_8R8G8B24_ximage; - rb->PutMonoValues = put_mono_values_8R8G8B24_ximage; + xrb->Base.PutRow = put_row_8R8G8B24_ximage; + xrb->Base.PutRowRGB = put_row_rgb_8R8G8B24_ximage; + xrb->Base.PutMonoRow = put_mono_row_8R8G8B24_ximage; + xrb->Base.PutValues = put_values_8R8G8B24_ximage; + xrb->Base.PutMonoValues = put_mono_values_8R8G8B24_ximage; } break; case PF_5R6G5B: if (pixmap) { - rb->PutRow = put_row_5R6G5B_pixmap; - rb->PutRowRGB = put_row_rgb_5R6G5B_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_5R6G5B_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_5R6G5B_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_5R6G5B_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_5R6G5B_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_5R6G5B_ximage; - rb->PutRowRGB = put_row_rgb_5R6G5B_ximage; - rb->PutMonoRow = put_mono_row_ximage; - rb->PutValues = put_values_5R6G5B_ximage; - rb->PutMonoValues = put_mono_values_ximage; + xrb->Base.PutRow = put_row_5R6G5B_ximage; + xrb->Base.PutRowRGB = put_row_rgb_5R6G5B_ximage; + xrb->Base.PutMonoRow = put_mono_row_ximage; + xrb->Base.PutValues = put_values_5R6G5B_ximage; + xrb->Base.PutMonoValues = put_mono_values_ximage; } break; case PF_Dither_5R6G5B: if (pixmap) { - rb->PutRow = put_row_DITHER_5R6G5B_pixmap; - rb->PutRowRGB = put_row_rgb_DITHER_5R6G5B_pixmap; - rb->PutMonoRow = put_mono_row_TRUEDITHER_pixmap; - rb->PutValues = put_values_DITHER_5R6G5B_pixmap; - rb->PutMonoValues = put_mono_values_TRUEDITHER_pixmap; + xrb->Base.PutRow = put_row_DITHER_5R6G5B_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_DITHER_5R6G5B_pixmap; + xrb->Base.PutMonoRow = put_mono_row_TRUEDITHER_pixmap; + xrb->Base.PutValues = put_values_DITHER_5R6G5B_pixmap; + xrb->Base.PutMonoValues = put_mono_values_TRUEDITHER_pixmap; } else { - rb->PutRow = put_row_DITHER_5R6G5B_ximage; - rb->PutRowRGB = put_row_rgb_DITHER_5R6G5B_ximage; - rb->PutMonoRow = put_mono_row_DITHER_5R6G5B_ximage; - rb->PutValues = put_values_DITHER_5R6G5B_ximage; - rb->PutMonoValues = put_mono_values_DITHER_5R6G5B_ximage; + xrb->Base.PutRow = put_row_DITHER_5R6G5B_ximage; + xrb->Base.PutRowRGB = put_row_rgb_DITHER_5R6G5B_ximage; + xrb->Base.PutMonoRow = put_mono_row_DITHER_5R6G5B_ximage; + xrb->Base.PutValues = put_values_DITHER_5R6G5B_ximage; + xrb->Base.PutMonoValues = put_mono_values_DITHER_5R6G5B_ximage; } break; case PF_Dither: if (pixmap) { - rb->PutRow = put_row_DITHER_pixmap; - rb->PutRowRGB = put_row_rgb_DITHER_pixmap; - rb->PutMonoRow = put_mono_row_DITHER_pixmap; - rb->PutValues = put_values_DITHER_pixmap; - rb->PutMonoValues = put_mono_values_DITHER_pixmap; + xrb->Base.PutRow = put_row_DITHER_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_DITHER_pixmap; + xrb->Base.PutMonoRow = put_mono_row_DITHER_pixmap; + xrb->Base.PutValues = put_values_DITHER_pixmap; + xrb->Base.PutMonoValues = put_mono_values_DITHER_pixmap; } else { if (depth == 8) { - rb->PutRow = put_row_DITHER8_ximage; - rb->PutRowRGB = put_row_rgb_DITHER8_ximage; - rb->PutMonoRow = put_mono_row_DITHER8_ximage; - rb->PutValues = put_values_DITHER8_ximage; - rb->PutMonoValues = put_mono_values_DITHER8_ximage; + xrb->Base.PutRow = put_row_DITHER8_ximage; + xrb->Base.PutRowRGB = put_row_rgb_DITHER8_ximage; + xrb->Base.PutMonoRow = put_mono_row_DITHER8_ximage; + xrb->Base.PutValues = put_values_DITHER8_ximage; + xrb->Base.PutMonoValues = put_mono_values_DITHER8_ximage; } else { - rb->PutRow = put_row_DITHER_ximage; - rb->PutRowRGB = put_row_rgb_DITHER_ximage; - rb->PutMonoRow = put_mono_row_DITHER_ximage; - rb->PutValues = put_values_DITHER_ximage; - rb->PutMonoValues = put_mono_values_DITHER_ximage; + xrb->Base.PutRow = put_row_DITHER_ximage; + xrb->Base.PutRowRGB = put_row_rgb_DITHER_ximage; + xrb->Base.PutMonoRow = put_mono_row_DITHER_ximage; + xrb->Base.PutValues = put_values_DITHER_ximage; + xrb->Base.PutMonoValues = put_mono_values_DITHER_ximage; } } break; case PF_1Bit: if (pixmap) { - rb->PutRow = put_row_1BIT_pixmap; - rb->PutRowRGB = put_row_rgb_1BIT_pixmap; - rb->PutMonoRow = put_mono_row_1BIT_pixmap; - rb->PutValues = put_values_1BIT_pixmap; - rb->PutMonoValues = put_mono_values_1BIT_pixmap; + xrb->Base.PutRow = put_row_1BIT_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_1BIT_pixmap; + xrb->Base.PutMonoRow = put_mono_row_1BIT_pixmap; + xrb->Base.PutValues = put_values_1BIT_pixmap; + xrb->Base.PutMonoValues = put_mono_values_1BIT_pixmap; } else { - rb->PutRow = put_row_1BIT_ximage; - rb->PutRowRGB = put_row_rgb_1BIT_ximage; - rb->PutMonoRow = put_mono_row_1BIT_ximage; - rb->PutValues = put_values_1BIT_ximage; - rb->PutMonoValues = put_mono_values_1BIT_ximage; + xrb->Base.PutRow = put_row_1BIT_ximage; + xrb->Base.PutRowRGB = put_row_rgb_1BIT_ximage; + xrb->Base.PutMonoRow = put_mono_row_1BIT_ximage; + xrb->Base.PutValues = put_values_1BIT_ximage; + xrb->Base.PutMonoValues = put_mono_values_1BIT_ximage; } break; case PF_HPCR: if (pixmap) { - rb->PutRow = put_row_HPCR_pixmap; - rb->PutRowRGB = put_row_rgb_HPCR_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_HPCR_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_HPCR_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_HPCR_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_HPCR_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - rb->PutRow = put_row_HPCR_ximage; - rb->PutRowRGB = put_row_rgb_HPCR_ximage; - rb->PutMonoRow = put_mono_row_HPCR_ximage; - rb->PutValues = put_values_HPCR_ximage; - rb->PutMonoValues = put_mono_values_HPCR_ximage; + xrb->Base.PutRow = put_row_HPCR_ximage; + xrb->Base.PutRowRGB = put_row_rgb_HPCR_ximage; + xrb->Base.PutMonoRow = put_mono_row_HPCR_ximage; + xrb->Base.PutValues = put_values_HPCR_ximage; + xrb->Base.PutMonoValues = put_mono_values_HPCR_ximage; } break; case PF_Lookup: if (pixmap) { - rb->PutRow = put_row_LOOKUP_pixmap; - rb->PutRowRGB = put_row_rgb_LOOKUP_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_LOOKUP_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_LOOKUP_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_LOOKUP_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_LOOKUP_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { if (depth==8) { - rb->PutRow = put_row_LOOKUP8_ximage; - rb->PutRowRGB = put_row_rgb_LOOKUP8_ximage; - rb->PutMonoRow = put_mono_row_LOOKUP8_ximage; - rb->PutValues = put_values_LOOKUP8_ximage; - rb->PutMonoValues = put_mono_values_LOOKUP8_ximage; + xrb->Base.PutRow = put_row_LOOKUP8_ximage; + xrb->Base.PutRowRGB = put_row_rgb_LOOKUP8_ximage; + xrb->Base.PutMonoRow = put_mono_row_LOOKUP8_ximage; + xrb->Base.PutValues = put_values_LOOKUP8_ximage; + xrb->Base.PutMonoValues = put_mono_values_LOOKUP8_ximage; } else { - rb->PutRow = put_row_LOOKUP_ximage; - rb->PutRowRGB = put_row_rgb_LOOKUP_ximage; - rb->PutMonoRow = put_mono_row_ximage; - rb->PutValues = put_values_LOOKUP_ximage; - rb->PutMonoValues = put_mono_values_ximage; + xrb->Base.PutRow = put_row_LOOKUP_ximage; + xrb->Base.PutRowRGB = put_row_rgb_LOOKUP_ximage; + xrb->Base.PutMonoRow = put_mono_row_ximage; + xrb->Base.PutValues = put_values_LOOKUP_ximage; + xrb->Base.PutMonoValues = put_mono_values_ximage; } } break; case PF_Grayscale: if (pixmap) { - rb->PutRow = put_row_GRAYSCALE_pixmap; - rb->PutRowRGB = put_row_rgb_GRAYSCALE_pixmap; - rb->PutMonoRow = put_mono_row_pixmap; - rb->PutValues = put_values_GRAYSCALE_pixmap; - rb->PutMonoValues = put_mono_values_pixmap; + xrb->Base.PutRow = put_row_GRAYSCALE_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_GRAYSCALE_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { if (depth == 8) { - rb->PutRow = put_row_GRAYSCALE8_ximage; - rb->PutRowRGB = put_row_rgb_GRAYSCALE8_ximage; - rb->PutMonoRow = put_mono_row_GRAYSCALE8_ximage; - rb->PutValues = put_values_GRAYSCALE8_ximage; - rb->PutMonoValues = put_mono_values_GRAYSCALE8_ximage; + xrb->Base.PutRow = put_row_GRAYSCALE8_ximage; + xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE8_ximage; + xrb->Base.PutMonoRow = put_mono_row_GRAYSCALE8_ximage; + xrb->Base.PutValues = put_values_GRAYSCALE8_ximage; + xrb->Base.PutMonoValues = put_mono_values_GRAYSCALE8_ximage; } else { - rb->PutRow = put_row_GRAYSCALE_ximage; - rb->PutRowRGB = put_row_rgb_GRAYSCALE_ximage; - rb->PutMonoRow = put_mono_row_ximage; - rb->PutValues = put_values_GRAYSCALE_ximage; - rb->PutMonoValues = put_mono_values_ximage; + xrb->Base.PutRow = put_row_GRAYSCALE_ximage; + xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE_ximage; + xrb->Base.PutMonoRow = put_mono_row_ximage; + xrb->Base.PutValues = put_values_GRAYSCALE_ximage; + xrb->Base.PutMonoValues = put_mono_values_ximage; } } break; @@ -4804,12 +4790,12 @@ xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb, /* Get functions */ if (pixelformat == PF_Index) { - rb->GetRow = get_row_ci; - rb->GetValues = get_values_ci; + xrb->Base.GetRow = get_row_ci; + xrb->Base.GetValues = get_values_ci; } else { - rb->GetRow = get_row_rgba; - rb->GetValues = get_values_rgba; + xrb->Base.GetRow = get_row_rgba; + xrb->Base.GetValues = get_values_rgba; } } diff --git a/src/mesa/drivers/x11/xm_surface.c b/src/mesa/drivers/x11/xm_surface.c deleted file mode 100644 index a3f2fe7d68..0000000000 --- a/src/mesa/drivers/x11/xm_surface.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/** - * \file xm_surface.c - * Code to allow the softpipe code to write to X windows/buffers. - * This is a bit of a hack for now. We've basically got two different - * abstractions for color buffers: gl_renderbuffer and pipe_surface. - * They'll need to get merged someday... - * For now, they're separate things that point to each other. - */ - - -#include "glxheader.h" -#include "GL/xmesa.h" -#include "xmesaP.h" -#include "context.h" -#include "imports.h" -#include "macros.h" -#include "framebuffer.h" -#include "renderbuffer.h" - -#include "pipe/p_context.h" -#include "pipe/p_defines.h" -#include "pipe/p_winsys.h" -#include "softpipe/sp_context.h" -#include "softpipe/sp_clear.h" -#include "softpipe/sp_tile_cache.h" -#include "softpipe/sp_surface.h" -#include "state_tracker/st_context.h" - - -#define CLIP_TILE \ - do { \ - if (x + w > ps->width) \ - w = ps->width - x; \ - if (y + h > ps->height) \ - h = ps->height -y; \ - } while(0) - - -static INLINE struct xmesa_surface * -xmesa_surface(struct pipe_surface *ps) -{ - return (struct xmesa_surface *) ps; -} - - -static INLINE struct xmesa_renderbuffer * -xmesa_rb(struct pipe_surface *ps) -{ - struct xmesa_surface *xms = xmesa_surface(ps); - return xms->xrb; -} - - -#define FLIP(Y) Y = xrb->St.Base.Height - (Y) - 1; - - -void -xmesa_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps, - uint x, uint y, uint w, uint h, float *p) -{ - struct xmesa_surface *xms = xmesa_surface(ps); - struct xmesa_renderbuffer *xrb = xms->xrb; - - if (xrb) { - /* this is a front/back color buffer */ - GLubyte tmp[MAX_WIDTH * 4]; - GLuint i, j; - uint w0 = w; - GET_CURRENT_CONTEXT(ctx); - - CLIP_TILE; - - FLIP(y); - for (i = 0; i < h; i++) { - xrb->St.Base.GetRow(ctx, &xrb->St.Base, w, x, y - i, tmp); - for (j = 0; j < w * 4; j++) { - p[j] = UBYTE_TO_FLOAT(tmp[j]); - } - p += w0 * 4; - } - } - else { - /* other softpipe surface */ - softpipe_get_tile_rgba(ps, x, y, w, h, p); - } -} - - -void -xmesa_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps, - uint x, uint y, uint w, uint h, const float *p) -{ - struct xmesa_surface *xms = xmesa_surface(ps); - struct xmesa_renderbuffer *xrb = xms->xrb; - - if (xrb) { - /* this is a front/back color buffer */ - GLubyte tmp[MAX_WIDTH * 4]; - GLuint i, j; - uint w0 = w; - GET_CURRENT_CONTEXT(ctx); - CLIP_TILE; - FLIP(y); - for (i = 0; i < h; i++) { - for (j = 0; j < w * 4; j++) { - UNCLAMPED_FLOAT_TO_UBYTE(tmp[j], p[j]); - } - xrb->St.Base.PutRow(ctx, &xrb->St.Base, w, x, y - i, tmp, NULL); - p += w0 * 4; - } -#if 0 /* debug: flush */ - { - XMesaContext xm = XMESA_CONTEXT(ctx); - XSync(xm->display, 0); - } -#endif - } - else { - /* other softpipe surface */ - softpipe_put_tile_rgba(ps, x, y, w, h, p); - } -} - - - -/** - * Called to create a pipe_surface for each X renderbuffer. - * Note: this is being used instead of pipe->surface_alloc() since we - * have special/unique quad read/write functions for X. - */ -struct pipe_surface * -xmesa_new_color_surface(struct pipe_context *pipe, GLuint pipeFormat) -{ - struct xmesa_surface *xms = CALLOC_STRUCT(xmesa_surface); - - assert(pipeFormat); - - xms->surface.format = pipeFormat; - xms->surface.refcount = 1; - - /* Note, the region we allocate doesn't actually have any storage - * since we're drawing into an XImage or Pixmap. - * The region's size will get set in the xmesa_alloc_front/back_storage() - * functions. - */ - if (pipe) - xms->surface.region = pipe->winsys->region_alloc(pipe->winsys, - 1, 0, 0, 0x0); - - return &xms->surface; -} - - -/** - * Called via pipe->surface_alloc() to create new surfaces (textures, - * renderbuffers, etc. - */ -struct pipe_surface * -xmesa_surface_alloc(struct pipe_context *pipe, GLuint pipeFormat) -{ - struct xmesa_surface *xms = CALLOC_STRUCT(xmesa_surface); - - assert(pipe); - assert(pipeFormat); - - xms->surface.format = pipeFormat; - xms->surface.refcount = 1; - - return &xms->surface; -} - - -boolean -xmesa_is_format_supported(struct pipe_context *pipe, uint format) -{ - switch( format ) { - case PIPE_FORMAT_U_A8_R8_G8_B8: - case PIPE_FORMAT_S_R16_G16_B16_A16: - case PIPE_FORMAT_S8_Z24: - return TRUE; - }; - return FALSE; -} - - -/** - * Called via pipe->clear() - */ -void -xmesa_clear(struct pipe_context *pipe, struct pipe_surface *ps, GLuint value) -{ - struct xmesa_renderbuffer *xrb = xmesa_rb(ps); - - /* XXX actually, we should just discard any cached tiles from this - * surface since we don't want to accidentally re-use them after clearing. - */ - pipe->flush(pipe, 0); - - { - struct softpipe_context *sp = softpipe_context(pipe); - if (ps == sp_tile_cache_get_surface(sp->cbuf_cache[0])) { - float clear[4]; - clear[0] = 0.2; /* XXX hack */ - clear[1] = 0.2; - clear[2] = 0.2; - clear[3] = 0.2; - sp_tile_cache_clear(sp->cbuf_cache[0], clear); - } - } - - if (xrb && xrb->ximage) { - /* clearing back color buffer */ - GET_CURRENT_CONTEXT(ctx); - xmesa_clear_buffers(ctx, BUFFER_BIT_BACK_LEFT); - } - else if (xrb && xrb->pixmap) { - /* clearing front color buffer */ - GET_CURRENT_CONTEXT(ctx); - xmesa_clear_buffers(ctx, BUFFER_BIT_FRONT_LEFT); - } - else { - /* clearing other buffer */ - softpipe_clear(pipe, ps, value); - } -} - diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index 9f17083f90..3a0cf80139 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -30,11 +30,11 @@ */ +#include "main/depth.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" #include "glxheader.h" -#include "depth.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" #include "xmesaP.h" /* Internal swrast includes: @@ -45,7 +45,7 @@ #define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \ - xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped) + xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped) /**********************************************************************/ @@ -66,7 +66,7 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLint x = span.x, y = YFLIP(xrb, span.y); \ GLuint i; \ for (i = 0; i < span.end; i++, x++) { \ @@ -82,7 +82,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -102,7 +102,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -117,7 +117,7 @@ span.blue += span.blueStep; \ span.alpha += span.alphaStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -137,7 +137,7 @@ #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -152,7 +152,7 @@ span.blue += span.blueStep; \ span.alpha += span.alphaStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -171,7 +171,7 @@ #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -184,7 +184,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -202,7 +202,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -217,7 +217,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -232,7 +232,7 @@ #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -248,7 +248,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -265,7 +265,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -278,7 +278,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -296,7 +296,7 @@ #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -310,7 +310,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -327,7 +327,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ XDITHER_SETUP(y); \ @@ -342,7 +342,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -357,7 +357,7 @@ #define SETUP_CODE \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ XDITHER_SETUP(y); \ @@ -373,7 +373,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -390,7 +390,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ LOOKUP_SETUP; \ for (i = 0; i < span.end; i++) { \ @@ -404,7 +404,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -422,7 +422,7 @@ #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -436,7 +436,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -453,7 +453,7 @@ XMesaImage *img = xrb->ximage; \ unsigned long pixel; \ PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], v2->color[2]); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -463,7 +463,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -481,7 +481,7 @@ GET_XRB(xrb); \ GLuint p = PACK_8A8B8G8R( v2->color[0], v2->color[1],\ v2->color[2], v2->color[3]); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -490,7 +490,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -508,7 +508,7 @@ GET_XRB(xrb); \ GLuint p = PACK_8A8R8G8B(v2->color[0], v2->color[1], \ v2->color[2], v2->color[3]); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -517,7 +517,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -534,7 +534,7 @@ #define SETUP_CODE \ GET_XRB(xrb); \ GLuint p = PACK_8R8G8B( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -543,7 +543,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -561,7 +561,7 @@ #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = v2->color; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -573,7 +573,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -588,7 +588,7 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -601,7 +601,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -618,7 +618,7 @@ #define SETUP_CODE \ GET_XRB(xrb); \ GLushort p = PACK_5R6G5B( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -627,7 +627,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -645,7 +645,7 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ const GLubyte *color = v2->color; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -656,7 +656,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -673,7 +673,7 @@ #define SETUP_CODE \ GET_XRB(xrb); \ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ FLAT_DITHER_ROW_SETUP(YFLIP(xrb, y)); \ @@ -684,7 +684,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -699,7 +699,7 @@ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; \ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ FLAT_DITHER_ROW_SETUP(y); \ @@ -711,7 +711,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -731,7 +731,7 @@ GLubyte r = v2->color[0]; \ GLubyte g = v2->color[1]; \ GLubyte b = v2->color[2]; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -741,7 +741,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -762,7 +762,7 @@ GLubyte g = v2->color[1]; \ GLubyte b = v2->color[2]; \ GLubyte p = LOOKUP(r,g,b); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ const DEPTH_TYPE z = FixedToDepth(span.z); \ @@ -771,7 +771,7 @@ zRow[i] = z; \ } \ span.z += span.zStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -785,7 +785,7 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -796,7 +796,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -812,7 +812,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = PACK_8A8B8G8R(FixedToInt(span.red), \ @@ -822,7 +822,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.alpha += span.alphaStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -838,7 +838,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = PACK_8A8R8G8B(FixedToInt(span.red), \ @@ -848,7 +848,7 @@ span.green += span.greenStep; \ span.blue += span.blueStep; \ span.alpha += span.alphaStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -863,7 +863,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \ @@ -871,7 +871,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -886,7 +886,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ PIXEL_TYPE *pixel = pRow; \ for (i = 0; i < span.end; i++, pixel++) { \ @@ -896,7 +896,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -910,7 +910,7 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -921,7 +921,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -936,7 +936,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) PACK_5R6G5B(FixedToInt(span.red), \ @@ -944,7 +944,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -960,7 +960,7 @@ #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -969,7 +969,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -984,7 +984,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ XDITHER_SETUP(y); \ @@ -994,7 +994,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -1007,7 +1007,7 @@ #define SETUP_CODE \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ XDITHER_SETUP(y); \ @@ -1018,7 +1018,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -1033,7 +1033,7 @@ #define BYTES_PER_ROW (xrb->ximage->bytes_per_line) #define SETUP_CODE \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ LOOKUP_SETUP; \ for (i = 0; i < span.end; i++) { \ @@ -1042,7 +1042,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -1058,7 +1058,7 @@ #define SETUP_CODE \ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -1067,7 +1067,7 @@ span.red += span.redStep; \ span.green += span.greenStep; \ span.blue += span.blueStep; \ - } + } } #include "swrast/s_tritemp.h" @@ -1082,12 +1082,12 @@ XMesaImage *img = xrb->ximage; \ unsigned long pixel; \ PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], v2->color[2]); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ XMesaPutPixel(img, x, y, pixel); \ - } + } } #include "swrast/s_tritemp.h" @@ -1103,11 +1103,11 @@ GET_XRB(xrb); \ unsigned long p = PACK_8B8G8R( v2->color[0], \ v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ - } + } } #include "swrast/s_tritemp.h" @@ -1123,11 +1123,11 @@ GET_XRB(xrb); \ unsigned long p = PACK_8R8G8B( v2->color[0], \ v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ - } + } } #include "swrast/s_tritemp.h" @@ -1143,11 +1143,11 @@ GET_XRB(xrb); \ unsigned long p = PACK_8R8G8B( v2->color[0], \ v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ - } + } } #include "swrast/s_tritemp.h" @@ -1162,14 +1162,14 @@ #define SETUP_CODE \ GET_XRB(xrb); \ const GLubyte *color = v2->color; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ PIXEL_TYPE *pixel = pRow; \ for (i = 0; i < span.end; i++, pixel++) { \ pixel->r = color[RCOMP]; \ pixel->g = color[GCOMP]; \ pixel->b = color[BCOMP]; \ - } + } } #include "swrast/s_tritemp.h" @@ -1182,7 +1182,7 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ @@ -1190,7 +1190,7 @@ PACK_TRUEDITHER(p, x, y, v2->color[0], \ v2->color[1], v2->color[2] ); \ XMesaPutPixel(img, x, y, p); \ - } + } } #include "swrast/s_tritemp.h" @@ -1206,11 +1206,11 @@ GET_XRB(xrb); \ unsigned long p = PACK_5R6G5B( v2->color[0], \ v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ - } + } } #include "swrast/s_tritemp.h" @@ -1226,13 +1226,13 @@ XMesaContext xmesa = XMESA_CONTEXT(ctx); \ GET_XRB(xrb); \ const GLubyte *color = v2->color; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP], \ color[GCOMP], color[BCOMP]); \ - } + } } #include "swrast/s_tritemp.h" @@ -1247,13 +1247,13 @@ #define SETUP_CODE \ GET_XRB(xrb); \ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ FLAT_DITHER_ROW_SETUP(YFLIP(xrb, y)); \ for (i = 0; i < span.end; i++, x++) { \ pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x); \ - } + } } #include "swrast/s_tritemp.h" @@ -1266,14 +1266,14 @@ GET_XRB(xrb); \ XMesaImage *img = xrb->ximage; \ FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ FLAT_DITHER_ROW_SETUP(y); \ for (i = 0; i < span.end; i++, x++) { \ unsigned long p = FLAT_DITHER(x); \ XMesaPutPixel(img, x, y, p ); \ - } + } } #include "swrast/s_tritemp.h" @@ -1291,12 +1291,12 @@ GLubyte r = v2->color[0]; \ GLubyte g = v2->color[1]; \ GLubyte b = v2->color[2]; -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ GLint x = span.x, y = YFLIP(xrb, span.y); \ for (i = 0; i < span.end; i++, x++) { \ pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b); \ - } + } } #include "swrast/s_tritemp.h" @@ -1315,11 +1315,11 @@ GLubyte g = v2->color[1]; \ GLubyte b = v2->color[2]; \ GLubyte p = LOOKUP(r,g,b); -#define RENDER_SPAN( span ) \ +#define RENDER_SPAN( span ) { \ GLuint i; \ for (i = 0; i < span.end; i++) { \ pRow[i] = (PIXEL_TYPE) p; \ - } + } } #include "swrast/s_tritemp.h" @@ -1443,46 +1443,6 @@ do { \ #endif -#if 0 -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; -} -#endif - - /** * Return pointer to line drawing function, or NULL if we should use a * swrast fallback. @@ -1502,8 +1462,8 @@ get_triangle_func(GLcontext *ctx) #endif /* trivial fallback tests */ - if ((ctx->DrawBuffer->_ColorDrawBufferMask[0] - & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 0) + if ((ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_FRONT_LEFT) && + (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_BACK_LEFT)) return (swrast_tri_func) NULL; if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL; @@ -1519,7 +1479,7 @@ get_triangle_func(GLcontext *ctx) if (xmbuf->swAlpha) return (swrast_tri_func) NULL; - xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped); + xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped); if (xrb->ximage) { if ( ctx->Light.ShadeModel==GL_SMOOTH diff --git a/src/mesa/drivers/x11/xm_winsys.c b/src/mesa/drivers/x11/xm_winsys.c deleted file mode 100644 index eab9fd3852..0000000000 --- a/src/mesa/drivers/x11/xm_winsys.c +++ /dev/null @@ -1,362 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * - **************************************************************************/ - -/* - * Authors: - * Keith Whitwell - * Brian Paul - */ - - -#include "glxheader.h" -#include "xmesaP.h" -#include "main/macros.h" - -#include "pipe/p_winsys.h" -#include "softpipe/sp_winsys.h" - - -/** - * XMesa winsys, derived from softpipe winsys. - * NOTE: there's nothing really X-specific in this winsys layer so - * we could probably lift it up somewhere. - */ -struct xm_winsys -{ - struct softpipe_winsys sws; - int foo; /* placeholder */ -}; - - -/** - * Low-level OS/window system memory buffer - */ -struct xm_buffer -{ - boolean userBuffer; /** Is this a user-space buffer? */ - int refcount; - unsigned size; - void *data; - void *mapped; -}; - - - -/* Turn the softpipe opaque buffer pointer into a dri_bufmgr opaque - * buffer pointer... - */ -static inline struct xm_buffer * -xm_bo( struct pipe_buffer *bo ) -{ - return (struct xm_buffer *) bo; -} - -static inline struct pipe_buffer * -pipe_bo( struct xm_buffer *bo ) -{ - return (struct pipe_buffer *) bo; -} - -/* Turn a softpipe winsys into an xm/softpipe winsys: - */ -static inline struct xm_winsys * -xm_winsys(struct softpipe_winsys *sws) -{ - return (struct xm_winsys *) sws; -} - - -/* Most callbacks map direcly onto dri_bufmgr operations: - */ -static void * -xm_buffer_map(struct pipe_winsys *pws, struct pipe_buffer *buf, - unsigned flags) -{ - struct xm_buffer *xm_buf = xm_bo(buf); - xm_buf->mapped = xm_buf->data; - return xm_buf->mapped; -} - -static void -xm_buffer_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf) -{ - struct xm_buffer *xm_buf = xm_bo(buf); - xm_buf->mapped = NULL; -} - -static void -xm_buffer_reference(struct pipe_winsys *pws, - struct pipe_buffer **ptr, - struct pipe_buffer *buf) -{ - if (*ptr) { - struct xm_buffer *oldBuf = xm_bo(*ptr); - oldBuf->refcount--; - assert(oldBuf->refcount >= 0); - if (oldBuf->refcount == 0) { - if (oldBuf->data) { - if (!oldBuf->userBuffer) - free(oldBuf->data); - oldBuf->data = NULL; - } - free(oldBuf); - } - *ptr = NULL; - } - - assert(!(*ptr)); - - if (buf) { - struct xm_buffer *newBuf = xm_bo(buf); - newBuf->refcount++; - *ptr = buf; - } -} - -static void -xm_buffer_data(struct pipe_winsys *pws, struct pipe_buffer *buf, - unsigned size, const void *data, unsigned usage) -{ - struct xm_buffer *xm_buf = xm_bo(buf); - assert(!xm_buf->userBuffer); - if (xm_buf->size != size) { - if (xm_buf->data) - free(xm_buf->data); - xm_buf->data = malloc(size); - xm_buf->size = size; - } - if (data) - memcpy(xm_buf->data, data, size); -} - -static void -xm_buffer_subdata(struct pipe_winsys *pws, struct pipe_buffer *buf, - unsigned long offset, unsigned long size, const void *data) -{ - struct xm_buffer *xm_buf = xm_bo(buf); - GLubyte *b = (GLubyte *) xm_buf->data; - assert(!xm_buf->userBuffer); - assert(b); - memcpy(b + offset, data, size); -} - -static void -xm_buffer_get_subdata(struct pipe_winsys *pws, struct pipe_buffer *buf, - unsigned long offset, unsigned long size, void *data) -{ - const struct xm_buffer *xm_buf = xm_bo(buf); - const GLubyte *b = (GLubyte *) xm_buf->data; - assert(!xm_buf->userBuffer); - assert(b); - memcpy(data, b + offset, size); -} - -static void -xm_flush_frontbuffer(struct pipe_winsys *pws) -{ - /* - struct intel_context *intel = intel_pipe_winsys(sws)->intel; - __DRIdrawablePrivate *dPriv = intel->driDrawable; - - intelCopyBuffer(dPriv, NULL); - */ -} - -static void -xm_wait_idle(struct pipe_winsys *pws) -{ - /* no-op */ -} - -static const char * -xm_get_name(struct pipe_winsys *pws) -{ - return "Xlib"; -} - - -static struct pipe_buffer * -xm_buffer_create(struct pipe_winsys *pws, - unsigned alignment, - unsigned flags, - unsigned hint) -{ - struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer); - buffer->refcount = 1; - return pipe_bo(buffer); -} - - -/** - * Create buffer which wraps user-space data. - */ -static struct pipe_buffer * -xm_user_buffer_create(struct pipe_winsys *pws, void *ptr, unsigned bytes) -{ - struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer); - buffer->userBuffer = TRUE; - buffer->refcount = 1; - buffer->data = ptr; - buffer->size = bytes; - return pipe_bo(buffer); -} - - - -/** - * Round n up to next multiple. - */ -static INLINE unsigned -round_up(unsigned n, unsigned multiple) -{ - return (n + multiple - 1) & ~(multiple - 1); -} - - -static struct pipe_region * -xm_region_alloc(struct pipe_winsys *winsys, - unsigned cpp, unsigned width, unsigned height, unsigned flags) -{ - struct pipe_region *region = CALLOC_STRUCT(pipe_region); - const unsigned alignment = 64; - - region->cpp = cpp; - region->pitch = round_up(width, alignment / cpp); - region->height = height; - region->refcount = 1; - - assert(region->pitch > 0); - - region->buffer = winsys->buffer_create( winsys, alignment, 0, 0 ) -; - - /* NULL data --> just allocate the space */ - winsys->buffer_data( winsys, - region->buffer, - region->pitch * cpp * height, - NULL, - PIPE_BUFFER_USAGE_PIXEL ); - return region; -} - - -static void -xm_region_release(struct pipe_winsys *winsys, struct pipe_region **region) -{ - if (!*region) - return; - - assert((*region)->refcount > 0); - (*region)->refcount--; - - if ((*region)->refcount == 0) { - assert((*region)->map_refcount == 0); - - winsys->buffer_reference( winsys, &((*region)->buffer), NULL ); - free(*region); - } - *region = NULL; -} - - -/** - * Called via pipe->surface_alloc() to create new surfaces (textures, - * renderbuffers, etc. - */ -static struct pipe_surface * -xm_surface_alloc(struct pipe_winsys *ws, GLuint pipeFormat) -{ - struct xmesa_surface *xms = CALLOC_STRUCT(xmesa_surface); - - assert(ws); - assert(pipeFormat); - - xms->surface.format = pipeFormat; - xms->surface.refcount = 1; -#if 0 - /* - * This is really just a softpipe surface, not an XImage/Pixmap surface. - */ - softpipe_init_surface_funcs(&xms->surface); -#endif - return &xms->surface; -} - - - - -struct xmesa_pipe_winsys -{ - struct pipe_winsys winsys; - XMesaContext xmesa; -}; - -static struct pipe_winsys * -xmesa_create_pipe_winsys( XMesaContext xmesa ) -{ - struct xmesa_pipe_winsys *xws = CALLOC_STRUCT(xmesa_pipe_winsys); - - /* Fill in this struct with callbacks that pipe will need to - * communicate with the window system, buffer manager, etc. - * - * Pipe would be happy with a malloc based memory manager, but - * the SwapBuffers implementation in this winsys driver requires - * that rendering be done to an appropriate _DriBufferObject. - */ - xws->winsys.buffer_create = xm_buffer_create; - xws->winsys.user_buffer_create = xm_user_buffer_create; - xws->winsys.buffer_map = xm_buffer_map; - xws->winsys.buffer_unmap = xm_buffer_unmap; - xws->winsys.buffer_reference = xm_buffer_reference; - xws->winsys.buffer_data = xm_buffer_data; - xws->winsys.buffer_subdata = xm_buffer_subdata; - xws->winsys.buffer_get_subdata = xm_buffer_get_subdata; - - xws->winsys.region_alloc = xm_region_alloc; - xws->winsys.region_release = xm_region_release; - - xws->winsys.surface_alloc = xm_surface_alloc; - - xws->winsys.flush_frontbuffer = xm_flush_frontbuffer; - xws->winsys.wait_idle = xm_wait_idle; - xws->winsys.get_name = xm_get_name; - xws->xmesa = xmesa; - - return &xws->winsys; -} - - -struct pipe_context * -xmesa_create_softpipe(XMesaContext xmesa) -{ - struct xm_winsys *xm_ws = CALLOC_STRUCT( xm_winsys ); - - /* Create the softpipe context: - */ - return softpipe_create( xmesa_create_pipe_winsys(xmesa), &xm_ws->sws ); -} diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index fd2dfcd79a..98867ac710 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -28,7 +28,7 @@ #include "GL/xmesa.h" -#include "mtypes.h" +#include "main/mtypes.h" #if defined(FX) #include "GL/fxmesa.h" #include "xm_glide.h" @@ -36,9 +36,6 @@ #ifdef XFree86Server #include "xm_image.h" #endif -#include "state_tracker/st_cb_fbo.h" -#include "softpipe/sp_context.h" -#include "softpipe/sp_surface.h" extern _glthread_Mutex _xmesa_lock; @@ -130,7 +127,7 @@ struct xmesa_visual { /** - * Context info, dDerived from GLcontext. + * Context info, derived from GLcontext. * Basically corresponds to a GLXContext. */ struct xmesa_context { @@ -180,11 +177,7 @@ typedef enum { */ struct xmesa_renderbuffer { -#if 0 struct gl_renderbuffer Base; /* Base class */ -#else - struct st_renderbuffer St; /**< Base class */ -#endif XMesaBuffer Parent; /**< The XMesaBuffer this renderbuffer belongs to */ XMesaDrawable drawable; /* Usually the X window ID */ @@ -203,8 +196,6 @@ struct xmesa_renderbuffer GLint bottom; /* used for FLIP macro, equals height - 1 */ ClearFunc clearFunc; - - void *pSurface; /** pipe surface */ }; @@ -500,8 +491,8 @@ extern const int xmesa_kernel1[16]; */ extern struct xmesa_renderbuffer * -xmesa_create_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, - GLboolean backBuffer); +xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, + GLboolean backBuffer); extern void xmesa_delete_framebuffer(struct gl_framebuffer *fb); @@ -549,7 +540,6 @@ xmesa_renderbuffer(struct gl_renderbuffer *rb) /** * Return pointer to XMesaContext corresponding to a Mesa GLcontext. * Since we're using structure containment, it's just a cast!. - * XXX should use inlined function for better type safety. */ static INLINE XMesaContext XMESA_CONTEXT(GLcontext *ctx) @@ -561,7 +551,6 @@ XMESA_CONTEXT(GLcontext *ctx) /** * Return pointer to XMesaBuffer corresponding to a Mesa GLframebuffer. * Since we're using structure containment, it's just a cast!. - * XXX should use inlined function for better type safety. */ static INLINE XMesaBuffer XMESA_BUFFER(GLframebuffer *b) @@ -592,41 +581,4 @@ extern void xmesa_register_swrast_functions( GLcontext *ctx ); #define ENABLE_EXT_timer_query 0 /* may not have 64-bit GLuint64EXT */ #endif - -struct pipe_surface; -struct pipe_context; - -struct xmesa_surface -{ - struct pipe_surface surface; - struct xmesa_renderbuffer *xrb; -}; - - -extern void -xmesa_clear(struct pipe_context *pipe, struct pipe_surface *ps, GLuint value); - -extern void -xmesa_clear_buffers(GLcontext *ctx, GLbitfield buffers); - -extern struct pipe_context * -xmesa_create_softpipe(XMesaContext xm); - -extern struct pipe_surface * -xmesa_surface_alloc(struct pipe_context *pipe, GLuint format); - -extern struct pipe_surface * -xmesa_new_color_surface(struct pipe_context *pipe, GLuint format); - -extern boolean -xmesa_is_format_supported(struct pipe_context *pipe, uint format); - -extern void -xmesa_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps, - uint x, uint y, uint w, uint h, float *p); - -extern void -xmesa_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps, - uint x, uint y, uint w, uint h, const float *p); - #endif |