aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-04-12 09:53:17 +0000
committermarha <marha@users.sourceforge.net>2010-04-12 09:53:17 +0000
commit29b86f9852b2b7ecc31cdfee56679537e40bc6e2 (patch)
tree1e6ec8ccf2dbf773260a1953b8e13c49f9b7c5f5 /mesalib/src/mesa/drivers
parent529236591df7366479a6fac30b387667678fd1ba (diff)
downloadvcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.tar.gz
vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.tar.bz2
vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.zip
svn merge -r524:HEAD "^/branches/released" .
Diffstat (limited to 'mesalib/src/mesa/drivers')
-rw-r--r--mesalib/src/mesa/drivers/common/driverfuncs.c31
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c159
-rw-r--r--mesalib/src/mesa/drivers/dri/Makefile.template24
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_metaops.c8
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c96
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.h28
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c17
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h8
-rw-r--r--mesalib/src/mesa/drivers/dri/common/spantmp.h23
-rw-r--r--mesalib/src/mesa/drivers/dri/common/spantmp2.h25
-rw-r--r--mesalib/src/mesa/drivers/dri/common/utils.c37
-rw-r--r--mesalib/src/mesa/drivers/dri/common/utils.h3
-rw-r--r--mesalib/src/mesa/drivers/dri/common/vblank.c20
-rw-r--r--mesalib/src/mesa/drivers/dri/common/vblank.h16
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlconfig.c7
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c86
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h13
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast_span.c52
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h33
-rw-r--r--mesalib/src/mesa/drivers/windows/gdi/mesa.def13
-rw-r--r--mesalib/src/mesa/drivers/windows/gdi/wmesa.c61
-rw-r--r--mesalib/src/mesa/drivers/windows/gdi/wmesadef.h2
-rw-r--r--mesalib/src/mesa/drivers/windows/gldirect/dglcontext.c2
-rw-r--r--mesalib/src/mesa/drivers/windows/icd/mesa.def6
24 files changed, 332 insertions, 438 deletions
diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c
index 4ca0e7bcc..ebfaa2f07 100644
--- a/mesalib/src/mesa/drivers/common/driverfuncs.c
+++ b/mesalib/src/mesa/drivers/common/driverfuncs.c
@@ -26,7 +26,6 @@
#include "main/glheader.h"
#include "main/imports.h"
#include "main/arrayobj.h"
-#include "main/buffers.h"
#include "main/context.h"
#include "main/framebuffer.h"
#include "main/mipmap.h"
@@ -50,7 +49,6 @@
#endif
#include "shader/program.h"
-#include "shader/prog_execute.h"
#include "shader/shader_api.h"
#include "tnl/tnl.h"
#include "swrast/swrast.h"
@@ -72,7 +70,7 @@
void
_mesa_init_driver_functions(struct dd_function_table *driver)
{
- _mesa_bzero(driver, sizeof(*driver));
+ memset(driver, 0, sizeof(*driver));
driver->GetString = NULL; /* REQUIRED! */
driver->UpdateState = NULL; /* REQUIRED! */
@@ -122,9 +120,8 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->FreeTexImageData = _mesa_free_texture_image_data;
driver->MapTexture = NULL;
driver->UnmapTexture = NULL;
- driver->TextureMemCpy = _mesa_memcpy;
+ driver->TextureMemCpy = memcpy;
driver->IsTextureResident = NULL;
- driver->ActiveTexture = NULL;
driver->UpdateTexturePalette = NULL;
/* imaging */
@@ -145,7 +142,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->BlendFuncSeparate = NULL;
driver->ClearColor = NULL;
driver->ClearDepth = NULL;
- driver->ClearIndex = NULL;
driver->ClearStencil = NULL;
driver->ClipPlane = NULL;
driver->ColorMask = NULL;
@@ -160,7 +156,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->Enable = NULL;
driver->Fogfv = NULL;
driver->Hint = NULL;
- driver->IndexMask = NULL;
driver->Lightfv = NULL;
driver->LightModelfv = NULL;
driver->LineStipple = NULL;
@@ -265,11 +260,23 @@ _mesa_init_driver_state(GLcontext *ctx)
ctx->Color.BlendDstRGB,
ctx->Color.BlendSrcA, ctx->Color.BlendDstA);
- ctx->Driver.ColorMask(ctx,
- ctx->Color.ColorMask[RCOMP],
- ctx->Color.ColorMask[GCOMP],
- ctx->Color.ColorMask[BCOMP],
- ctx->Color.ColorMask[ACOMP]);
+ if (ctx->Driver.ColorMaskIndexed) {
+ GLuint i;
+ for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+ ctx->Driver.ColorMaskIndexed(ctx, i,
+ ctx->Color.ColorMask[0][RCOMP],
+ ctx->Color.ColorMask[0][GCOMP],
+ ctx->Color.ColorMask[0][BCOMP],
+ ctx->Color.ColorMask[0][ACOMP]);
+ }
+ }
+ else {
+ ctx->Driver.ColorMask(ctx,
+ ctx->Color.ColorMask[0][RCOMP],
+ ctx->Color.ColorMask[0][GCOMP],
+ ctx->Color.ColorMask[0][BCOMP],
+ ctx->Color.ColorMask[0][ACOMP]);
+ }
ctx->Driver.CullFace(ctx, ctx->Polygon.CullFaceMode);
ctx->Driver.DepthFunc(ctx, ctx->Depth.Func);
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index cd9075b39..b97b760f1 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -56,7 +56,6 @@
#include "main/stencil.h"
#include "main/texobj.h"
#include "main/texenv.h"
-#include "main/texformat.h"
#include "main/teximage.h"
#include "main/texparam.h"
#include "main/texstate.h"
@@ -107,11 +106,11 @@ struct save_state
GLboolean AlphaEnabled;
/** META_BLEND */
- GLboolean BlendEnabled;
+ GLbitfield BlendEnabled;
GLboolean ColorLogicOpEnabled;
/** META_COLOR_MASK */
- GLubyte ColorMask[4];
+ GLubyte ColorMask[MAX_DRAW_BUFFERS][4];
/** META_DEPTH_TEST */
struct gl_depthbuffer_attrib Depth;
@@ -308,7 +307,7 @@ _mesa_meta_free(GLcontext *ctx)
* freed by the normal context destruction code. But this would be
* the place to free other meta data someday.
*/
- _mesa_free(ctx->Meta);
+ free(ctx->Meta);
ctx->Meta = NULL;
}
@@ -335,19 +334,29 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
if (state & META_BLEND) {
save->BlendEnabled = ctx->Color.BlendEnabled;
- if (ctx->Color.BlendEnabled)
- _mesa_set_enable(ctx, GL_BLEND, GL_FALSE);
+ if (ctx->Color.BlendEnabled) {
+ if (ctx->Extensions.EXT_draw_buffers2) {
+ GLuint i;
+ for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+ _mesa_set_enablei(ctx, GL_BLEND, i, GL_FALSE);
+ }
+ }
+ else {
+ _mesa_set_enable(ctx, GL_BLEND, GL_FALSE);
+ }
+ }
save->ColorLogicOpEnabled = ctx->Color.ColorLogicOpEnabled;
if (ctx->Color.ColorLogicOpEnabled)
_mesa_set_enable(ctx, GL_COLOR_LOGIC_OP, GL_FALSE);
}
if (state & META_COLOR_MASK) {
- COPY_4V(save->ColorMask, ctx->Color.ColorMask);
- if (!ctx->Color.ColorMask[0] ||
- !ctx->Color.ColorMask[1] ||
- !ctx->Color.ColorMask[2] ||
- !ctx->Color.ColorMask[3])
+ memcpy(save->ColorMask, ctx->Color.ColorMask,
+ sizeof(ctx->Color.ColorMask));
+ if (!ctx->Color.ColorMask[0][0] ||
+ !ctx->Color.ColorMask[0][1] ||
+ !ctx->Color.ColorMask[0][2] ||
+ !ctx->Color.ColorMask[0][3])
_mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
@@ -484,12 +493,12 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
if (state & META_TRANSFORM) {
GLuint activeTexture = ctx->Texture.CurrentUnit;
- _mesa_memcpy(save->ModelviewMatrix, ctx->ModelviewMatrixStack.Top->m,
- 16 * sizeof(GLfloat));
- _mesa_memcpy(save->ProjectionMatrix, ctx->ProjectionMatrixStack.Top->m,
- 16 * sizeof(GLfloat));
- _mesa_memcpy(save->TextureMatrix, ctx->TextureMatrixStack[0].Top->m,
- 16 * sizeof(GLfloat));
+ memcpy(save->ModelviewMatrix, ctx->ModelviewMatrixStack.Top->m,
+ 16 * sizeof(GLfloat));
+ memcpy(save->ProjectionMatrix, ctx->ProjectionMatrixStack.Top->m,
+ 16 * sizeof(GLfloat));
+ memcpy(save->TextureMatrix, ctx->TextureMatrixStack[0].Top->m,
+ 16 * sizeof(GLfloat));
save->MatrixMode = ctx->Transform.MatrixMode;
/* set 1:1 vertex:pixel coordinate transform */
_mesa_ActiveTextureARB(GL_TEXTURE0);
@@ -500,9 +509,9 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
_mesa_LoadIdentity();
_mesa_MatrixMode(GL_PROJECTION);
_mesa_LoadIdentity();
- _mesa_Ortho(0.0F, ctx->DrawBuffer->Width,
- 0.0F, ctx->DrawBuffer->Height,
- -1.0F, 1.0F);
+ _mesa_Ortho(0.0, ctx->DrawBuffer->Width,
+ 0.0, ctx->DrawBuffer->Height,
+ -1.0, 1.0);
save->ClipPlanesEnabled = ctx->Transform.ClipPlanesEnabled;
if (ctx->Transform.ClipPlanesEnabled) {
GLuint i;
@@ -566,16 +575,38 @@ _mesa_meta_end(GLcontext *ctx)
}
if (state & META_BLEND) {
- if (ctx->Color.BlendEnabled != save->BlendEnabled)
- _mesa_set_enable(ctx, GL_BLEND, save->BlendEnabled);
+ if (ctx->Color.BlendEnabled != save->BlendEnabled) {
+ if (ctx->Extensions.EXT_draw_buffers2) {
+ GLuint i;
+ for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+ _mesa_set_enablei(ctx, GL_BLEND, i, (save->BlendEnabled >> i) & 1);
+ }
+ }
+ else {
+ _mesa_set_enable(ctx, GL_BLEND, (save->BlendEnabled & 1));
+ }
+ }
if (ctx->Color.ColorLogicOpEnabled != save->ColorLogicOpEnabled)
_mesa_set_enable(ctx, GL_COLOR_LOGIC_OP, save->ColorLogicOpEnabled);
}
if (state & META_COLOR_MASK) {
- if (!TEST_EQ_4V(ctx->Color.ColorMask, save->ColorMask))
- _mesa_ColorMask(save->ColorMask[0], save->ColorMask[1],
- save->ColorMask[2], save->ColorMask[3]);
+ GLuint i;
+ for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+ if (!TEST_EQ_4V(ctx->Color.ColorMask[i], save->ColorMask[i])) {
+ if (i == 0) {
+ _mesa_ColorMask(save->ColorMask[i][0], save->ColorMask[i][1],
+ save->ColorMask[i][2], save->ColorMask[i][3]);
+ }
+ else {
+ _mesa_ColorMaskIndexed(i,
+ save->ColorMask[i][0],
+ save->ColorMask[i][1],
+ save->ColorMask[i][2],
+ save->ColorMask[i][3]);
+ }
+ }
+ }
}
if (state & META_DEPTH_TEST) {
@@ -1273,7 +1304,7 @@ _mesa_meta_BlitFramebuffer(GLcontext *ctx,
}
if (mask & GL_DEPTH_BUFFER_BIT) {
- GLuint *tmp = (GLuint *) _mesa_malloc(srcW * srcH * sizeof(GLuint));
+ GLuint *tmp = (GLuint *) malloc(srcW * srcH * sizeof(GLuint));
if (tmp) {
if (!blit->DepthFP)
init_blit_depth_pixels(ctx);
@@ -1297,7 +1328,7 @@ _mesa_meta_BlitFramebuffer(GLcontext *ctx,
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
mask &= ~GL_DEPTH_BUFFER_BIT;
- _mesa_free(tmp);
+ free(tmp);
}
}
@@ -1864,7 +1895,7 @@ _mesa_meta_DrawPixels(GLcontext *ctx,
_mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->StencilFP);
_mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_TRUE);
- for (bit = 0; bit < ctx->Visual.stencilBits; bit++) {
+ for (bit = 0; bit < ctx->DrawBuffer->Visual.stencilBits; bit++) {
const GLuint mask = 1 << bit;
if (mask & origStencilMask) {
_mesa_StencilFunc(GL_ALWAYS, mask, mask);
@@ -2034,7 +2065,7 @@ _mesa_meta_Bitmap(GLcontext *ctx,
if (!bitmap1)
return;
- bitmap8 = (GLubyte *) _mesa_calloc(width * height);
+ bitmap8 = (GLubyte *) calloc(1, width * height);
if (bitmap8) {
_mesa_expand_bitmap(width, height, &unpackSave, bitmap1,
bitmap8, width, 0xff);
@@ -2051,7 +2082,7 @@ _mesa_meta_Bitmap(GLcontext *ctx,
_mesa_set_enable(ctx, tex->Target, GL_FALSE);
- _mesa_free(bitmap8);
+ free(bitmap8);
}
_mesa_unmap_pbo_source(ctx, &unpackSave);
@@ -2100,12 +2131,15 @@ _mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target,
GL_COLOR_ATTACHMENT0_EXT,
target, texObj->Name, srcLevel);
}
+#if 0
+ /* other work is needed to enable 3D mipmap generation */
else if (target == GL_TEXTURE_3D) {
GLint zoffset = 0;
_mesa_FramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
target, texObj->Name, srcLevel, zoffset);
}
+#endif
else {
/* 2D / cube */
_mesa_FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
@@ -2289,6 +2323,26 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
_mesa_set_enable(ctx, target, GL_TRUE);
+ /* setup vertex positions */
+ {
+ verts[0].x = 0.0F;
+ verts[0].y = 0.0F;
+ verts[1].x = 1.0F;
+ verts[1].y = 0.0F;
+ verts[2].x = 1.0F;
+ verts[2].y = 1.0F;
+ verts[3].x = 0.0F;
+ verts[3].y = 1.0F;
+
+ /* upload new vertex data */
+ _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
+ }
+
+ /* setup projection matrix */
+ _mesa_MatrixMode(GL_PROJECTION);
+ _mesa_LoadIdentity();
+ _mesa_Ortho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
+
/* texture is already locked, unlock now */
_mesa_unlock_texture(ctx, texObj);
@@ -2355,21 +2409,6 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
}
}
- /* setup vertex positions */
- {
- verts[0].x = 0.0F;
- verts[0].y = 0.0F;
- verts[1].x = (GLfloat) dstWidth;
- verts[1].y = 0.0F;
- verts[2].x = (GLfloat) dstWidth;
- verts[2].y = (GLfloat) dstHeight;
- verts[3].x = 0.0F;
- verts[3].y = (GLfloat) dstHeight;
-
- /* upload new vertex data */
- _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
- }
-
/* limit sampling to src level */
_mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel);
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel);
@@ -2408,6 +2447,12 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
break;
}
+ assert(dstWidth == ctx->DrawBuffer->Width);
+ assert(dstHeight == ctx->DrawBuffer->Height);
+
+ /* setup viewport */
+ _mesa_set_viewport(ctx, 0, 0, dstWidth, dstHeight);
+
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
@@ -2489,7 +2534,7 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
/*
* Alloc image buffer (XXX could use a PBO)
*/
- buf = _mesa_malloc(width * height * bpp);
+ buf = malloc(width * height * bpp);
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
return;
@@ -2550,7 +2595,7 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
_mesa_lock_texture(ctx, texObj); /* re-lock */
- _mesa_free(buf);
+ free(buf);
}
@@ -2605,7 +2650,7 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
/*
* Alloc image buffer (XXX could use a PBO)
*/
- buf = _mesa_malloc(width * height * bpp);
+ buf = malloc(width * height * bpp);
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage%uD", dims);
return;
@@ -2646,7 +2691,7 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
_mesa_lock_texture(ctx, texObj); /* re-lock */
- _mesa_free(buf);
+ free(buf);
}
@@ -2689,7 +2734,7 @@ _mesa_meta_CopyColorTable(GLcontext *ctx,
{
GLfloat *buf;
- buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
+ buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyColorTable");
return;
@@ -2706,7 +2751,7 @@ _mesa_meta_CopyColorTable(GLcontext *ctx,
_mesa_meta_end(ctx);
- _mesa_free(buf);
+ free(buf);
}
@@ -2716,7 +2761,7 @@ _mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start,
{
GLfloat *buf;
- buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
+ buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyColorSubTable");
return;
@@ -2733,7 +2778,7 @@ _mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start,
_mesa_meta_end(ctx);
- _mesa_free(buf);
+ free(buf);
}
@@ -2744,7 +2789,7 @@ _mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
{
GLfloat *buf;
- buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
+ buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D");
return;
@@ -2763,7 +2808,7 @@ _mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
_mesa_meta_end(ctx);
- _mesa_free(buf);
+ free(buf);
}
@@ -2774,7 +2819,7 @@ _mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
{
GLfloat *buf;
- buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D");
return;
@@ -2794,5 +2839,5 @@ _mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
_mesa_meta_end(ctx);
- _mesa_free(buf);
+ free(buf);
}
diff --git a/mesalib/src/mesa/drivers/dri/Makefile.template b/mesalib/src/mesa/drivers/dri/Makefile.template
index 39d25ce3f..a0c25d26c 100644
--- a/mesalib/src/mesa/drivers/dri/Makefile.template
+++ b/mesalib/src/mesa/drivers/dri/Makefile.template
@@ -14,28 +14,11 @@ COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
../common/drirenderbuffer.c \
../common/dri_metaops.c
-ifeq ($(WINDOW_SYSTEM),dri)
-WINOBJ=
-WINLIB=
INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES)
OBJECTS = $(C_SOURCES:.c=.o) \
$(ASM_SOURCES:.S=.o)
-else
-# miniglx
-WINOBJ=
-WINLIB=-L$(MESA)/src/glx/mini
-MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
-INCLUDES = $(MINIGLX_INCLUDES) \
- $(SHARED_INCLUDES) \
- $(PCIACCESS_CFLAGS)
-
-OBJECTS = $(C_SOURCES:.c=.o) \
- $(MINIGLX_SOURCES:.c=.o) \
- $(ASM_SOURCES:.S=.o)
-endif
-
### Include directories
SHARED_INCLUDES = \
@@ -55,7 +38,7 @@ SHARED_INCLUDES = \
$(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
.S.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
##### TARGETS #####
@@ -67,11 +50,10 @@ default: subdirs lib
lib: symlinks subdirs depend
@$(MAKE) $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
-$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(WINOBJ) Makefile \
+$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) Makefile \
$(TOP)/src/mesa/drivers/dri/Makefile.template
$(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(WINOBJ) \
- $(DRI_LIB_DEPS)
+ $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(DRI_LIB_DEPS)
$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_metaops.c b/mesalib/src/mesa/drivers/dri/common/dri_metaops.c
index c7bea07dc..dfb7d6404 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_metaops.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_metaops.c
@@ -27,17 +27,9 @@
**************************************************************************/
#include "main/arrayobj.h"
-#include "main/attrib.h"
-#include "main/blend.h"
#include "main/bufferobj.h"
-#include "main/buffers.h"
-#include "main/depth.h"
#include "main/enable.h"
#include "main/matrix.h"
-#include "main/macros.h"
-#include "main/polygon.h"
-#include "main/shaders.h"
-#include "main/stencil.h"
#include "main/texstate.h"
#include "main/varray.h"
#include "main/viewport.h"
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index 547f18a00..75c98825b 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -97,7 +97,7 @@ driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 )
*
* \internal
* This function calls __DriverAPIRec::UnbindContext, and then decrements
- * __DRIdrawablePrivateRec::refcount which must be non-zero for a successful
+ * __DRIdrawableRec::refcount which must be non-zero for a successful
* return.
*
* While casting the opaque private pointers associated with the parameters
@@ -127,6 +127,7 @@ static int driUnbindContext(__DRIcontext *pcp)
/* Let driver unbind drawable from context */
(*psp->DriverAPI.UnbindContext)(pcp);
+ assert(pdp);
if (pdp->refcount == 0) {
/* ERROR!!! */
return GL_FALSE;
@@ -167,7 +168,7 @@ static int driBindContext(__DRIcontext *pcp,
__DRIdrawable *pdp,
__DRIdrawable *prp)
{
- __DRIscreenPrivate *psp = NULL;
+ __DRIscreen *psp = NULL;
/* Bind the drawable to the context */
@@ -189,6 +190,7 @@ static int driBindContext(__DRIcontext *pcp,
** initialize the drawable information if has not been done before.
*/
+ assert(psp);
if (!psp->dri2.enabled) {
if (pdp && !pdp->pStamp) {
DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
@@ -220,7 +222,7 @@ static int driBindContext(__DRIcontext *pcp,
*
* \param pdp pointer to the private drawable information to update.
*
- * This function basically updates the __DRIdrawablePrivate struct's
+ * This function basically updates the __DRIdrawable struct's
* cliprect information by calling \c __DRIinterfaceMethods::getDrawableInfo.
* This is usually called by the DRI_VALIDATE_DRAWABLE_INFO macro which
* compares the __DRIdrwablePrivate pStamp and lastStamp values. If
@@ -228,10 +230,10 @@ static int driBindContext(__DRIcontext *pcp,
* info.
*/
void
-__driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
+__driUtilUpdateDrawableInfo(__DRIdrawable *pdp)
{
- __DRIscreenPrivate *psp = pdp->driScreenPriv;
- __DRIcontextPrivate *pcp = pdp->driContextPriv;
+ __DRIscreen *psp = pdp->driScreenPriv;
+ __DRIcontext *pcp = pdp->driContextPriv;
if (!pcp
|| ((pdp != pcp->driDrawablePriv) && (pdp != pcp->driReadablePriv))) {
@@ -242,12 +244,12 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
}
if (pdp->pClipRects) {
- _mesa_free(pdp->pClipRects);
+ free(pdp->pClipRects);
pdp->pClipRects = NULL;
}
if (pdp->pBackClipRects) {
- _mesa_free(pdp->pBackClipRects);
+ free(pdp->pBackClipRects);
pdp->pBackClipRects = NULL;
}
@@ -309,7 +311,7 @@ static void driReportDamage(__DRIdrawable *pdp,
* \param drawablePrivate opaque pointer to the per-drawable private info.
*
* \internal
- * This function calls __DRIdrawablePrivate::swapBuffers.
+ * This function calls __DRIdrawable::swapBuffers.
*
* Is called directly from glXSwapBuffers().
*/
@@ -324,7 +326,7 @@ static void driSwapBuffers(__DRIdrawable *dPriv)
if (!dPriv->numClipRects)
return;
- rects = _mesa_malloc(sizeof(*rects) * dPriv->numClipRects);
+ rects = malloc(sizeof(*rects) * dPriv->numClipRects);
if (!rects)
return;
@@ -337,7 +339,7 @@ static void driSwapBuffers(__DRIdrawable *dPriv)
}
driReportDamage(dPriv, rects, dPriv->numClipRects);
- _mesa_free(rects);
+ free(rects);
}
static int driDrawableGetMSC( __DRIscreen *sPriv, __DRIdrawable *dPriv,
@@ -430,7 +432,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config,
*/
(void) attrs;
- pdp = _mesa_malloc(sizeof *pdp);
+ pdp = malloc(sizeof *pdp);
if (!pdp) {
return NULL;
}
@@ -457,7 +459,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config,
if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes,
renderType == GLX_PIXMAP_BIT)) {
- _mesa_free(pdp);
+ free(pdp);
return NULL;
}
@@ -484,8 +486,11 @@ dri2CreateNewDrawable(__DRIscreen *screen,
if (!pdraw)
return NULL;
- pdraw->pClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects);
- pdraw->pBackClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects);
+ pdraw->pClipRects = &pdraw->dri2.clipRect;
+ pdraw->pBackClipRects = &pdraw->dri2.clipRect;
+
+ pdraw->pStamp = &pdraw->dri2.stamp;
+ *pdraw->pStamp = pdraw->lastStamp + 1;
return pdraw;
}
@@ -497,7 +502,7 @@ static void dri_get_drawable(__DRIdrawable *pdp)
static void dri_put_drawable(__DRIdrawable *pdp)
{
- __DRIscreenPrivate *psp;
+ __DRIscreen *psp;
if (pdp) {
pdp->refcount--;
@@ -506,15 +511,15 @@ static void dri_put_drawable(__DRIdrawable *pdp)
psp = pdp->driScreenPriv;
(*psp->DriverAPI.DestroyBuffer)(pdp);
- if (pdp->pClipRects) {
- _mesa_free(pdp->pClipRects);
+ if (pdp->pClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
+ free(pdp->pClipRects);
pdp->pClipRects = NULL;
}
- if (pdp->pBackClipRects) {
- _mesa_free(pdp->pBackClipRects);
+ if (pdp->pBackClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
+ free(pdp->pBackClipRects);
pdp->pBackClipRects = NULL;
}
- _mesa_free(pdp);
+ free(pdp);
}
}
@@ -544,7 +549,7 @@ driDestroyContext(__DRIcontext *pcp)
{
if (pcp) {
(*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp);
- _mesa_free(pcp);
+ free(pcp);
}
}
@@ -560,7 +565,7 @@ driDestroyContext(__DRIcontext *pcp)
* success, or \c NULL on failure.
*
* \internal
- * This function allocates and fills a __DRIcontextPrivateRec structure. It
+ * This function allocates and fills a __DRIcontextRec structure. It
* performs some device independent initialization and passes all the
* relevent information to __DriverAPIRec::CreateContext to create the
* context.
@@ -574,13 +579,16 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
__DRIcontext *pcp;
void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
- pcp = _mesa_malloc(sizeof *pcp);
+ pcp = malloc(sizeof *pcp);
if (!pcp)
return NULL;
pcp->driScreenPriv = psp;
pcp->driDrawablePriv = NULL;
-
+ pcp->loaderPrivate = data;
+
+ pcp->dri2.draw_stamp = 0;
+ pcp->dri2.read_stamp = 0;
/* When the first context is created for a screen, initialize a "dummy"
* context.
*/
@@ -596,7 +604,7 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
pcp->hHWContext = hwContext;
if ( !(*psp->DriverAPI.CreateContext)(&config->modes, pcp, shareCtx) ) {
- _mesa_free(pcp);
+ free(pcp);
return NULL;
}
@@ -650,7 +658,7 @@ static void driDestroyScreen(__DRIscreen *psp)
(void)drmCloseOnce(psp->fd);
}
- _mesa_free(psp);
+ free(psp);
}
}
@@ -669,6 +677,8 @@ setupLoaderExtensions(__DRIscreen *psp,
psp->systemTime = (__DRIsystemTimeExtension *) extensions[i];
if (strcmp(extensions[i]->name, __DRI_DRI2_LOADER) == 0)
psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i];
+ if (strcmp(extensions[i]->name, __DRI_IMAGE_LOOKUP) == 0)
+ psp->dri2.image = (__DRIimageLookupExtension *) extensions[i];
}
}
@@ -688,7 +698,7 @@ setupLoaderExtensions(__DRIscreen *psp,
* \param drm_version Version of the kernel DRM.
* \param frame_buffer Data describing the location and layout of the
* framebuffer.
- * \param pSAREA Pointer the the SAREA.
+ * \param pSAREA Pointer to the SAREA.
* \param fd Device handle for the DRM.
* \param extensions ??
* \param driver_modes Returns modes suppoted by the driver
@@ -712,7 +722,7 @@ driCreateNewScreen(int scrn,
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
- psp = _mesa_calloc(sizeof *psp);
+ psp = calloc(1, sizeof *psp);
if (!psp)
return NULL;
@@ -757,7 +767,7 @@ driCreateNewScreen(int scrn,
*driver_modes = driDriverAPI.InitScreen(psp);
if (*driver_modes == NULL) {
- _mesa_free(psp);
+ free(psp);
return NULL;
}
@@ -779,7 +789,7 @@ dri2CreateNewScreen(int scrn, int fd,
if (driDriverAPI.InitScreen2 == NULL)
return NULL;
- psp = _mesa_calloc(sizeof(*psp));
+ psp = calloc(1, sizeof(*psp));
if (!psp)
return NULL;
@@ -801,7 +811,7 @@ dri2CreateNewScreen(int scrn, int fd,
psp->DriverAPI = driDriverAPI;
*driver_configs = driDriverAPI.InitScreen2(psp);
if (*driver_configs == NULL) {
- _mesa_free(psp);
+ free(psp);
return NULL;
}
@@ -841,7 +851,7 @@ const __DRIlegacyExtension driLegacyExtension = {
driCreateNewContext,
};
-/** Legacy DRI interface */
+/** DRI2 interface */
const __DRIdri2Extension driDRI2Extension = {
{ __DRI_DRI2, __DRI_DRI2_VERSION },
dri2CreateNewScreen,
@@ -849,14 +859,6 @@ const __DRIdri2Extension driDRI2Extension = {
dri2CreateNewContext,
};
-/* This is the table of extensions that the loader will dlsym() for. */
-PUBLIC const __DRIextension *__driDriverExtensions[] = {
- &driCoreExtension.base,
- &driLegacyExtension.base,
- &driDRI2Extension.base,
- NULL
-};
-
static int
driFrameTracking(__DRIdrawable *drawable, GLboolean enable)
{
@@ -871,7 +873,7 @@ driQueryFrameTracking(__DRIdrawable *dpriv,
__DRIswapInfo sInfo;
int status;
int64_t ust;
- __DRIscreenPrivate *psp = dpriv->driScreenPriv;
+ __DRIscreen *psp = dpriv->driScreenPriv;
status = dpriv->driScreenPriv->DriverAPI.GetSwapInfo( dpriv, & sInfo );
if ( status == 0 ) {
@@ -921,14 +923,14 @@ const __DRIframeTrackingExtension driFrameTrackingExtension = {
* be possible to cache the sync rate?
*/
float
-driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust,
+driCalculateSwapUsage( __DRIdrawable *dPriv, int64_t last_swap_ust,
int64_t current_ust )
{
int32_t n;
int32_t d;
int interval;
float usage = 1.0;
- __DRIscreenPrivate *psp = dPriv->driScreenPriv;
+ __DRIscreen *psp = dPriv->driScreenPriv;
if ( (*psp->systemTime->getMSCRate)(dPriv, &n, &d, dPriv->loaderPrivate) ) {
interval = (dPriv->swap_interval != 0) ? dPriv->swap_interval : 1;
@@ -955,4 +957,10 @@ driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust,
return usage;
}
+void
+dri2InvalidateDrawable(__DRIdrawable *drawable)
+{
+ drawable->dri2.stamp++;
+}
+
/*@}*/
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.h b/mesalib/src/mesa/drivers/dri/common/dri_util.h
index c95a5c829..99c0f1e44 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.h
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.h
@@ -59,16 +59,12 @@
typedef struct __DRIswapInfoRec __DRIswapInfo;
-/* Typedefs to avoid rewriting the world. */
-typedef struct __DRIscreenRec __DRIscreenPrivate;
-typedef struct __DRIdrawableRec __DRIdrawablePrivate;
-typedef struct __DRIcontextRec __DRIcontextPrivate;
-
/**
* Extensions.
*/
extern const __DRIlegacyExtension driLegacyExtension;
extern const __DRIcoreExtension driCoreExtension;
+extern const __DRIdri2Extension driDRI2Extension;
extern const __DRIextension driReadDrawableExtension;
extern const __DRIcopySubBufferExtension driCopySubBufferExtension;
extern const __DRIswapControlExtension driSwapControlExtension;
@@ -299,7 +295,8 @@ struct __DRIdrawableRec {
unsigned int index;
/**
- * Pointer to the "drawable has changed ID" stamp in the SAREA.
+ * Pointer to the "drawable has changed ID" stamp in the SAREA (or
+ * to dri2.stamp if DRI2 is being used).
*/
unsigned int *pStamp;
@@ -380,6 +377,11 @@ struct __DRIdrawableRec {
* GLX_MESA_swap_control.
*/
unsigned int swap_interval;
+
+ struct {
+ unsigned int stamp;
+ drm_clip_rect_t clipRect;
+ } dri2;
};
/**
@@ -415,6 +417,16 @@ struct __DRIcontextRec {
* Pointer to screen on which this context was created.
*/
__DRIscreen *driScreenPriv;
+
+ /**
+ * The loaders's private context data. This structure is opaque.
+ */
+ void *loaderPrivate;
+
+ struct {
+ int draw_stamp;
+ int read_stamp;
+ } dri2;
};
/**
@@ -532,6 +544,7 @@ struct __DRIscreenRec {
* fields will not be valid or initializaed in that case. */
int enabled;
__DRIdri2LoaderExtension *loader;
+ __DRIimageLookupExtension *image;
} dri2;
/* The lock actually in use, old sarea or DRI2 */
@@ -552,4 +565,7 @@ driCalculateSwapUsage( __DRIdrawable *dPriv,
extern GLint
driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 );
+extern void
+dri2InvalidateDrawable(__DRIdrawable *drawable);
+
#endif /* _DRI_UTIL_H_ */
diff --git a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
index 4e7e92c82..c9ce6e3cb 100644
--- a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
+++ b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
@@ -1,7 +1,6 @@
#include "main/mtypes.h"
#include "main/formats.h"
-#include "main/framebuffer.h"
#include "main/renderbuffer.h"
#include "main/imports.h"
#include "drirenderbuffer.h"
@@ -33,7 +32,7 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb)
/* don't free rb->Data Chances are it's a memory mapped region for
* the dri drivers.
*/
- _mesa_free(rb);
+ free(rb);
}
@@ -56,22 +55,14 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb)
driRenderbuffer *
driNewRenderbuffer(gl_format format, GLvoid *addr,
GLint cpp, GLint offset, GLint pitch,
- __DRIdrawablePrivate *dPriv)
+ __DRIdrawable *dPriv)
{
driRenderbuffer *drb;
- assert(format == GL_RGBA ||
- format == GL_RGB5 ||
- format == GL_RGBA8 ||
- format == GL_DEPTH_COMPONENT16 ||
- format == GL_DEPTH_COMPONENT24 ||
- format == GL_DEPTH_COMPONENT32 ||
- format == GL_STENCIL_INDEX8_EXT);
-
assert(cpp > 0);
assert(pitch > 0);
- drb = _mesa_calloc(sizeof(driRenderbuffer));
+ drb = calloc(1, sizeof(driRenderbuffer));
if (drb) {
const GLuint name = 0;
@@ -196,7 +187,7 @@ driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped)
* gl_framebuffer object.
*/
void
-driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv)
+driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawable *dPriv)
{
struct gl_framebuffer *fb = (struct gl_framebuffer *) dPriv->driverPrivate;
if (fb && (dPriv->w != fb->Width || dPriv->h != fb->Height)) {
diff --git a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h
index 3a5cbcdaa..677511334 100644
--- a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h
+++ b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h
@@ -43,10 +43,10 @@ typedef struct {
GLint flippedPitch;
GLvoid *flippedData; /* mmap'd address of buffer memory, if used */
- /* Pointer to corresponding __DRIdrawablePrivate. This is used to compute
+ /* Pointer to corresponding __DRIdrawable. This is used to compute
* the window's position within the framebuffer.
*/
- __DRIdrawablePrivate *dPriv;
+ __DRIdrawable *dPriv;
/* XXX this is for radeon/r200 only. We should really create a new
* r200Renderbuffer class, derived from this class... not a huge deal.
@@ -66,14 +66,14 @@ typedef struct {
extern driRenderbuffer *
driNewRenderbuffer(gl_format format, GLvoid *addr,
GLint cpp, GLint offset, GLint pitch,
- __DRIdrawablePrivate *dPriv);
+ __DRIdrawable *dPriv);
extern void
driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped);
extern void
-driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv);
+driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawable *dPriv);
#endif /* DRIRENDERBUFFER_H */
diff --git a/mesalib/src/mesa/drivers/dri/common/spantmp.h b/mesalib/src/mesa/drivers/dri/common/spantmp.h
index d5608b880..cdc4f422c 100644
--- a/mesalib/src/mesa/drivers/dri/common/spantmp.h
+++ b/mesalib/src/mesa/drivers/dri/common/spantmp.h
@@ -288,7 +288,6 @@ static void TAG(ReadRGBAPixels)( GLcontext *ctx,
HW_READ_LOCK()
{
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
- const GLubyte *mask = NULL; /* remove someday */
GLuint i;
LOCAL_VARS;
@@ -296,23 +295,11 @@ static void TAG(ReadRGBAPixels)( GLcontext *ctx,
HW_READ_CLIPLOOP()
{
- if (mask)
- {
- for (i=0;i<n;i++)
- if (mask[i]) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_RGBA( rgba[i], x[i], fy );
- }
- }
- else
- {
- for (i=0;i<n;i++) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_RGBA( rgba[i], x[i], fy );
- }
- }
+ for (i=0;i<n;i++) {
+ int fy = Y_FLIP( y[i] );
+ if (CLIPPIXEL( x[i], fy ))
+ READ_RGBA( rgba[i], x[i], fy );
+ }
}
HW_ENDCLIPLOOP();
}
diff --git a/mesalib/src/mesa/drivers/dri/common/spantmp2.h b/mesalib/src/mesa/drivers/dri/common/spantmp2.h
index 447f3d15b..98422a856 100644
--- a/mesalib/src/mesa/drivers/dri/common/spantmp2.h
+++ b/mesalib/src/mesa/drivers/dri/common/spantmp2.h
@@ -400,7 +400,7 @@
# define READ_RGBA( rgba, _x, _y ) \
do { \
GLuint p = GET_VALUE(_x, _y); \
- *((uint32_t *) rgba) = (t << 8) | 0xff; \
+ *((uint32_t *) rgba) = (p << 8) | 0xff; \
} while (0)
# else
# define READ_RGBA( rgba, _x, _y ) \
@@ -805,7 +805,6 @@ static void TAG(ReadRGBAPixels)( GLcontext *ctx,
HW_READ_LOCK()
{
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
- GLubyte *mask = NULL; /* remove someday */
GLint i;
LOCAL_VARS;
@@ -813,23 +812,11 @@ static void TAG(ReadRGBAPixels)( GLcontext *ctx,
HW_READ_CLIPLOOP()
{
- if (mask)
- {
- for (i=0;i<n;i++)
- if (mask[i]) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_RGBA( rgba[i], x[i], fy );
- }
- }
- else
- {
- for (i=0;i<n;i++) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_RGBA( rgba[i], x[i], fy );
- }
- }
+ for (i=0;i<n;i++) {
+ int fy = Y_FLIP( y[i] );
+ if (CLIPPIXEL( x[i], fy ))
+ READ_RGBA( rgba[i], x[i], fy );
+ }
}
HW_ENDCLIPLOOP();
}
diff --git a/mesalib/src/mesa/drivers/dri/common/utils.c b/mesalib/src/mesa/drivers/dri/common/utils.c
index b272eb74e..b85b364c5 100644
--- a/mesalib/src/mesa/drivers/dri/common/utils.c
+++ b/mesalib/src/mesa/drivers/dri/common/utils.c
@@ -34,7 +34,6 @@
#include "main/mtypes.h"
#include "main/cpuinfo.h"
#include "main/extensions.h"
-#include "glapi/dispatch.h"
#include "utils.h"
@@ -109,7 +108,7 @@ driGetRendererString( char * buffer, const char * hardware_name,
cpu = _mesa_get_cpu_string();
if (cpu) {
offset += sprintf(buffer + offset, " %s", cpu);
- _mesa_free(cpu);
+ free(cpu);
}
return offset;
@@ -276,10 +275,9 @@ driCheckDriDdxDrmVersions3(const char * driver_name,
}
/* Check that the DDX driver version is compatible */
- /* for miniglx we pass in -1 so we can ignore the DDX version */
- if ( (ddxActual->major != -1) && ((ddxActual->major < ddxExpected->major_min)
+ if ( (ddxActual->major < ddxExpected->major_min)
|| (ddxActual->major > ddxExpected->major_max)
- || (ddxActual->minor < ddxExpected->minor)) ) {
+ || (ddxActual->minor < ddxExpected->minor) ) {
fprintf(stderr, format2, driver_name, "DDX",
ddxExpected->major_min, ddxExpected->major_max, ddxExpected->minor,
ddxActual->major, ddxActual->minor, ddxActual->patch);
@@ -425,7 +423,8 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
const uint8_t * depth_bits, const uint8_t * stencil_bits,
unsigned num_depth_stencil_bits,
const GLenum * db_modes, unsigned num_db_modes,
- const uint8_t * msaa_samples, unsigned num_msaa_modes)
+ const uint8_t * msaa_samples, unsigned num_msaa_modes,
+ GLboolean enable_accum)
{
static const uint8_t bits_table[4][4] = {
/* R G B A */
@@ -487,7 +486,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
__GLcontextModes *modes;
unsigned i, j, k, h;
unsigned num_modes;
- unsigned num_accum_bits = 2;
+ unsigned num_accum_bits = (enable_accum) ? 2 : 1;
switch ( fb_type ) {
case GL_UNSIGNED_BYTE_3_3_2:
@@ -559,7 +558,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
}
num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * num_msaa_modes;
- configs = _mesa_calloc((num_modes + 1) * sizeof *configs);
+ configs = calloc(1, (num_modes + 1) * sizeof *configs);
if (configs == NULL)
return NULL;
@@ -568,7 +567,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
for ( i = 0 ; i < num_db_modes ; i++ ) {
for ( h = 0 ; h < num_msaa_modes; h++ ) {
for ( j = 0 ; j < num_accum_bits ; j++ ) {
- *c = _mesa_malloc (sizeof **c);
+ *c = malloc (sizeof **c);
modes = &(*c)->modes;
c++;
@@ -626,11 +625,10 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
modes->bindToTextureRgb = GL_TRUE;
modes->bindToTextureRgba = GL_TRUE;
modes->bindToMipmapTexture = GL_FALSE;
- modes->bindToTextureTargets = modes->rgbMode ?
- __DRI_ATTRIB_TEXTURE_1D_BIT |
- __DRI_ATTRIB_TEXTURE_2D_BIT |
- __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT :
- 0;
+ modes->bindToTextureTargets =
+ __DRI_ATTRIB_TEXTURE_1D_BIT |
+ __DRI_ATTRIB_TEXTURE_2D_BIT |
+ __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT;
}
}
}
@@ -653,7 +651,7 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a,
while (b[j] != NULL)
j++;
- all = _mesa_malloc((i + j + 1) * sizeof *all);
+ all = malloc((i + j + 1) * sizeof *all);
index = 0;
for (i = 0; a[i] != NULL; i++)
all[index++] = a[i];
@@ -661,8 +659,8 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a,
all[index++] = b[j];
all[index++] = NULL;
- _mesa_free(a);
- _mesa_free(b);
+ free(a);
+ free(b);
return all;
}
@@ -727,10 +725,7 @@ driGetConfigAttribIndex(const __DRIconfig *config,
{
switch (attribMap[index].attrib) {
case __DRI_ATTRIB_RENDER_TYPE:
- if (config->modes.rgbMode)
- *value = __DRI_ATTRIB_RGBA_BIT;
- else
- *value = __DRI_ATTRIB_COLOR_INDEX_BIT;
+ *value = __DRI_ATTRIB_RGBA_BIT;
break;
case __DRI_ATTRIB_CONFIG_CAVEAT:
if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG)
diff --git a/mesalib/src/mesa/drivers/dri/common/utils.h b/mesalib/src/mesa/drivers/dri/common/utils.h
index 2aa6de66c..02ca3feb7 100644
--- a/mesalib/src/mesa/drivers/dri/common/utils.h
+++ b/mesalib/src/mesa/drivers/dri/common/utils.h
@@ -104,7 +104,8 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
const uint8_t * depth_bits, const uint8_t * stencil_bits,
unsigned num_depth_stencil_bits,
const GLenum * db_modes, unsigned num_db_modes,
- const uint8_t * msaa_samples, unsigned num_msaa_modes);
+ const uint8_t * msaa_samples, unsigned num_msaa_modes,
+ GLboolean enable_accum);
__DRIconfig **driConcatConfigs(__DRIconfig **a,
__DRIconfig **b);
diff --git a/mesalib/src/mesa/drivers/dri/common/vblank.c b/mesalib/src/mesa/drivers/dri/common/vblank.c
index 12aeaa108..49b22a2dc 100644
--- a/mesalib/src/mesa/drivers/dri/common/vblank.c
+++ b/mesalib/src/mesa/drivers/dri/common/vblank.c
@@ -34,12 +34,12 @@
#include "vblank.h"
#include "xmlpool.h"
-static unsigned int msc_to_vblank(__DRIdrawablePrivate * dPriv, int64_t msc)
+static unsigned int msc_to_vblank(__DRIdrawable * dPriv, int64_t msc)
{
return (unsigned int)(msc - dPriv->msc_base + dPriv->vblank_base);
}
-static int64_t vblank_to_msc(__DRIdrawablePrivate * dPriv, unsigned int vblank)
+static int64_t vblank_to_msc(__DRIdrawable * dPriv, unsigned int vblank)
{
return (int64_t)(vblank - dPriv->vblank_base + dPriv->msc_base);
}
@@ -64,8 +64,8 @@ static int64_t vblank_to_msc(__DRIdrawablePrivate * dPriv, unsigned int vblank)
* \return Zero is returned on success. A negative errno value
* is returned on failure.
*/
-int driDrawableGetMSC32( __DRIscreenPrivate * priv,
- __DRIdrawablePrivate * dPriv,
+int driDrawableGetMSC32( __DRIscreen * priv,
+ __DRIdrawable * dPriv,
int64_t * count)
{
drmVBlank vbl;
@@ -122,7 +122,7 @@ int driDrawableGetMSC32( __DRIscreenPrivate * priv,
* \return Zero on success or \c GLX_BAD_CONTEXT on failure.
*/
-int driWaitForMSC32( __DRIdrawablePrivate *priv,
+int driWaitForMSC32( __DRIdrawable *priv,
int64_t target_msc, int64_t divisor, int64_t remainder,
int64_t * msc )
{
@@ -278,7 +278,7 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd )
*/
static unsigned
-driGetDefaultVBlankInterval( const __DRIdrawablePrivate *priv )
+driGetDefaultVBlankInterval( const __DRIdrawable *priv )
{
if ( (priv->vblFlags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) {
return 1;
@@ -295,7 +295,7 @@ driGetDefaultVBlankInterval( const __DRIdrawablePrivate *priv )
* direct rendering context.
*/
-void driDrawableInitVBlank( __DRIdrawablePrivate *priv )
+void driDrawableInitVBlank( __DRIdrawable *priv )
{
if ( priv->swap_interval == (unsigned)-1 &&
!( priv->vblFlags & VBLANK_FLAG_NO_IRQ ) ) {
@@ -320,7 +320,7 @@ void driDrawableInitVBlank( __DRIdrawablePrivate *priv )
*/
unsigned
-driGetVBlankInterval( const __DRIdrawablePrivate *priv )
+driGetVBlankInterval( const __DRIdrawable *priv )
{
if ( (priv->vblFlags & VBLANK_FLAG_INTERVAL) != 0 ) {
/* this must have been initialized when the drawable was first bound
@@ -340,7 +340,7 @@ driGetVBlankInterval( const __DRIdrawablePrivate *priv )
*/
void
-driGetCurrentVBlank( __DRIdrawablePrivate *priv )
+driGetCurrentVBlank( __DRIdrawable *priv )
{
drmVBlank vbl;
@@ -366,7 +366,7 @@ driGetCurrentVBlank( __DRIdrawablePrivate *priv )
*/
int
-driWaitForVBlank( __DRIdrawablePrivate *priv, GLboolean * missed_deadline )
+driWaitForVBlank( __DRIdrawable *priv, GLboolean * missed_deadline )
{
drmVBlank vbl;
unsigned original_seq;
diff --git a/mesalib/src/mesa/drivers/dri/common/vblank.h b/mesalib/src/mesa/drivers/dri/common/vblank.h
index 8b2c761a1..29d1ad800 100644
--- a/mesalib/src/mesa/drivers/dri/common/vblank.h
+++ b/mesalib/src/mesa/drivers/dri/common/vblank.h
@@ -44,17 +44,17 @@
#define VBLANK_FLAG_SECONDARY (1U << 8) /* Wait for secondary vblank.
*/
-extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count );
-extern int driDrawableGetMSC32( __DRIscreenPrivate * priv,
- __DRIdrawablePrivate * drawablePrivate,
+extern int driGetMSC32( __DRIscreen * priv, int64_t * count );
+extern int driDrawableGetMSC32( __DRIscreen * priv,
+ __DRIdrawable * drawablePrivate,
int64_t * count);
-extern int driWaitForMSC32( __DRIdrawablePrivate *priv,
+extern int driWaitForMSC32( __DRIdrawable *priv,
int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc );
extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache );
-extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv );
-extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv );
-extern void driGetCurrentVBlank( __DRIdrawablePrivate *priv );
-extern int driWaitForVBlank( __DRIdrawablePrivate *priv,
+extern void driDrawableInitVBlank ( __DRIdrawable *priv );
+extern unsigned driGetVBlankInterval( const __DRIdrawable *priv );
+extern void driGetCurrentVBlank( __DRIdrawable *priv );
+extern int driWaitForVBlank( __DRIdrawable *priv,
GLboolean * missed_deadline );
#undef usleep
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
index 46ba2ffbf..477259ea7 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
@@ -39,13 +39,6 @@
#include "dri_util.h"
#include "xmlconfig.h"
-/*
- * OS dependent ways of getting the name of the running program
- */
-#if (defined(__unix__) || defined(unix)) && !defined(USG)
-#include <sys/param.h>
-#endif
-
#undef GET_PROGRAM_NAME
#if (defined(__GNU_LIBRARY__) || defined(__GLIBC__)) && !defined(__UCLIBC__)
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index e9224ae70..e968ce4ba 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -137,7 +137,8 @@ swrastFillInModes(__DRIscreen *psp,
configs = driCreateConfigs(fb_format, fb_type,
depth_bits_array, stencil_bits_array,
depth_buffer_factor, back_buffer_modes,
- back_buffer_factor, msaa_samples_array, 1);
+ back_buffer_factor, msaa_samples_array, 1,
+ GL_TRUE);
if (configs == NULL) {
fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __FUNCTION__,
__LINE__);
@@ -159,7 +160,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
TRACE;
- psp = _mesa_calloc(sizeof(*psp));
+ psp = calloc(1, sizeof(*psp));
if (!psp)
return NULL;
@@ -188,7 +189,7 @@ static void driDestroyScreen(__DRIscreen *psp)
TRACE;
if (psp) {
- _mesa_free(psp);
+ free(psp);
}
}
@@ -207,34 +208,28 @@ static const __DRIextension **driGetExtensions(__DRIscreen *psp)
static GLuint
choose_pixel_format(const GLvisual *v)
{
- if (v->rgbMode) {
- int depth = v->rgbBits;
-
- if (depth == 32
- && v->redMask == 0xff0000
- && v->greenMask == 0x00ff00
- && v->blueMask == 0x0000ff)
- return PF_A8R8G8B8;
- else if (depth == 24
- && v->redMask == 0xff0000
- && v->greenMask == 0x00ff00
- && v->blueMask == 0x0000ff)
- return PF_X8R8G8B8;
- else if (depth == 16
- && v->redMask == 0xf800
- && v->greenMask == 0x07e0
- && v->blueMask == 0x001f)
- return PF_R5G6B5;
- else if (depth == 8
- && v->redMask == 0x07
- && v->greenMask == 0x38
- && v->blueMask == 0xc0)
- return PF_R3G3B2;
- }
- else {
- if (v->indexBits == 8)
- return PF_CI8;
- }
+ int depth = v->rgbBits;
+
+ if (depth == 32
+ && v->redMask == 0xff0000
+ && v->greenMask == 0x00ff00
+ && v->blueMask == 0x0000ff)
+ return PF_A8R8G8B8;
+ else if (depth == 24
+ && v->redMask == 0xff0000
+ && v->greenMask == 0x00ff00
+ && v->blueMask == 0x0000ff)
+ return PF_X8R8G8B8;
+ else if (depth == 16
+ && v->redMask == 0xf800
+ && v->greenMask == 0x07e0
+ && v->blueMask == 0x001f)
+ return PF_R5G6B5;
+ else if (depth == 8
+ && v->redMask == 0x07
+ && v->greenMask == 0x38
+ && v->blueMask == 0xc0)
+ return PF_R3G3B2;
_mesa_problem( NULL, "unexpected format in %s", __FUNCTION__ );
return 0;
@@ -245,8 +240,8 @@ swrast_delete_renderbuffer(struct gl_renderbuffer *rb)
{
TRACE;
- _mesa_free(rb->Data);
- _mesa_free(rb);
+ free(rb->Data);
+ free(rb);
}
static GLboolean
@@ -276,11 +271,11 @@ swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
TRACE;
- _mesa_free(rb->Data);
+ free(rb->Data);
swrast_alloc_front_storage(ctx, rb, internalFormat, width, height);
- rb->Data = _mesa_malloc(height * xrb->pitch);
+ rb->Data = malloc(height * xrb->pitch);
return GL_TRUE;
}
@@ -288,7 +283,7 @@ swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
static struct swrast_renderbuffer *
swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
{
- struct swrast_renderbuffer *xrb = _mesa_calloc(sizeof *xrb);
+ struct swrast_renderbuffer *xrb = calloc(1, sizeof *xrb);
GLuint pixel_format;
TRACE;
@@ -339,13 +334,6 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
xrb->Base.DataType = GL_UNSIGNED_BYTE;
xrb->bpp = 8;
break;
- case PF_CI8:
- xrb->Base.Format = MESA_FORMAT_CI8;
- xrb->Base.InternalFormat = GL_COLOR_INDEX8_EXT;
- xrb->Base._BaseFormat = GL_COLOR_INDEX;
- xrb->Base.DataType = GL_UNSIGNED_BYTE;
- xrb->bpp = 8;
- break;
default:
return NULL;
}
@@ -362,7 +350,7 @@ driCreateNewDrawable(__DRIscreen *screen,
TRACE;
- buf = _mesa_calloc(sizeof *buf);
+ buf = calloc(1, sizeof *buf);
if (!buf)
return NULL;
@@ -370,10 +358,10 @@ driCreateNewDrawable(__DRIscreen *screen,
buf->driScreenPriv = screen;
- buf->row = _mesa_malloc(MAX_WIDTH * 4);
+ buf->row = malloc(MAX_WIDTH * 4);
/* basic framebuffer setup */
- _mesa_initialize_framebuffer(&buf->Base, &config->modes);
+ _mesa_initialize_window_framebuffer(&buf->Base, &config->modes);
/* add front renderbuffer */
frontrb = swrast_new_renderbuffer(&config->modes, GL_TRUE);
@@ -405,7 +393,7 @@ driDestroyDrawable(__DRIdrawable *buf)
if (buf) {
struct gl_framebuffer *fb = &buf->Base;
- _mesa_free(buf->row);
+ free(buf->row);
fb->DeletePending = GL_TRUE;
_mesa_reference_framebuffer(&fb, NULL);
@@ -529,7 +517,7 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
TRACE;
- ctx = _mesa_calloc(sizeof *ctx);
+ ctx = calloc(1, sizeof *ctx);
if (!ctx)
return NULL;
@@ -544,7 +532,7 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
if (!_mesa_initialize_context(&ctx->Base, &config->modes,
shared ? &shared->Base : NULL,
&functions, (void *) ctx)) {
- _mesa_free(ctx);
+ free(ctx);
return NULL;
}
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h b/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h
index 54319b20c..17212be83 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h
@@ -50,13 +50,13 @@
#define DEBUG_SPAN 0
#if DEBUG_CORE
-#define TRACE _mesa_printf("--> %s\n", __FUNCTION__)
+#define TRACE printf("--> %s\n", __FUNCTION__)
#else
#define TRACE
#endif
#if DEBUG_SPAN
-#define TRACE_SPAN _mesa_printf("--> %s\n", __FUNCTION__)
+#define TRACE_SPAN printf("--> %s\n", __FUNCTION__)
#else
#define TRACE_SPAN
#endif
@@ -123,11 +123,10 @@ swrast_renderbuffer(struct gl_renderbuffer *rb)
/**
* Pixel formats we support
*/
-#define PF_CI8 1 /**< Color Index mode */
-#define PF_A8R8G8B8 2 /**< 32bpp TrueColor: 8-A, 8-R, 8-G, 8-B bits */
-#define PF_R5G6B5 3 /**< 16bpp TrueColor: 5-R, 6-G, 5-B bits */
-#define PF_R3G3B2 4 /**< 8bpp TrueColor: 3-R, 3-G, 2-B bits */
-#define PF_X8R8G8B8 5 /**< 32bpp TrueColor: 8-R, 8-G, 8-B bits */
+#define PF_A8R8G8B8 1 /**< 32bpp TrueColor: 8-A, 8-R, 8-G, 8-B bits */
+#define PF_R5G6B5 2 /**< 16bpp TrueColor: 5-R, 6-G, 5-B bits */
+#define PF_R3G3B2 3 /**< 8bpp TrueColor: 3-R, 3-G, 2-B bits */
+#define PF_X8R8G8B8 4 /**< 32bpp TrueColor: 8-R, 8-G, 8-B bits */
/**
* Renderbuffer pitch alignment (in bits).
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c b/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c
index f8e503463..d896e154f 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c
@@ -193,23 +193,6 @@ static const GLubyte kernel[16] = {
#include "swrast/s_spantemp.h"
-/* 8-bit color index */
-#define NAME(FUNC) FUNC##_CI8
-#define CI_MODE
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- *DST = VALUE[0]
-#define FETCH_PIXEL(DST, SRC) \
- DST = SRC[0]
-
-#include "swrast/s_spantemp.h"
-
-
/*
* Generate code for front-buffer span functions.
*/
@@ -257,7 +240,7 @@ static const GLubyte kernel[16] = {
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
#define INIT_PIXEL_PTR(P, X, Y) \
GLushort *P = (GLushort *)row;
-#define INC_PIXEL_PTR(P) P += 2
+#define INC_PIXEL_PTR(P) P++
#define STORE_PIXEL(DST, X, Y, VALUE) \
STORE_PIXEL_R5G6B5(DST, X, Y, VALUE)
#define FETCH_PIXEL(DST, SRC) \
@@ -282,23 +265,6 @@ static const GLubyte kernel[16] = {
#include "swrast_spantemp.h"
-/* 8-bit color index */
-#define NAME(FUNC) FUNC##_CI8_front
-#define CI_MODE
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)row;
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- *DST = VALUE[0]
-#define FETCH_PIXEL(DST, SRC) \
- DST = SRC[0]
-
-#include "swrast_spantemp.h"
-
-
/*
* Back-buffers are malloced memory and always private.
*
@@ -346,14 +312,6 @@ swrast_set_span_funcs_back(struct swrast_renderbuffer *xrb,
xrb->Base.PutValues = put_values_R3G3B2;
xrb->Base.PutMonoValues = put_mono_values_R3G3B2;
break;
- case PF_CI8:
- xrb->Base.GetRow = get_row_CI8;
- xrb->Base.GetValues = get_values_CI8;
- xrb->Base.PutRow = put_row_CI8;
- xrb->Base.PutMonoRow = put_mono_row_CI8;
- xrb->Base.PutValues = put_values_CI8;
- xrb->Base.PutMonoValues = put_mono_values_CI8;
- break;
default:
assert(0);
return;
@@ -410,14 +368,6 @@ swrast_set_span_funcs_front(struct swrast_renderbuffer *xrb,
xrb->Base.PutValues = put_values_R3G3B2_front;
xrb->Base.PutMonoValues = put_mono_values_R3G3B2_front;
break;
- case PF_CI8:
- xrb->Base.GetRow = get_row_CI8_front;
- xrb->Base.GetValues = get_values_CI8_front;
- xrb->Base.PutRow = put_row_CI8_front;
- xrb->Base.PutMonoRow = put_mono_row_CI8_front;
- xrb->Base.PutValues = put_values_CI8_front;
- xrb->Base.PutMonoValues = put_mono_values_CI8_front;
- break;
default:
assert(0);
return;
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h b/mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h
index e0cb24142..848736171 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h
@@ -37,7 +37,7 @@
#define _SWRAST_SPANTEMP_ONCE
static INLINE void
-PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p )
+PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLvoid *p )
{
__DRIcontext *ctx = swrast_context(glCtx);
__DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer);
@@ -98,7 +98,6 @@ GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row )
* Define the following macros before including this file:
* NAME(BASE) to generate the function name (i.e. add prefix or suffix)
* RB_TYPE the renderbuffer DataType
- * CI_MODE if set, color index mode, else RGBA
* SPAN_VARS to declare any local variables
* INIT_PIXEL_PTR(P, X, Y) to initialize a pointer to a pixel
* INC_PIXEL_PTR(P) to increment a pixel pointer by one pixel
@@ -113,9 +112,7 @@ GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row )
#include "main/macros.h"
-#ifdef CI_MODE
-#define RB_COMPONENTS 1
-#elif !defined(RB_COMPONENTS)
+#if !defined(RB_COMPONENTS)
#define RB_COMPONENTS 4
#endif
@@ -127,11 +124,7 @@ NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
#ifdef SPAN_VARS
SPAN_VARS
#endif
-#ifdef CI_MODE
- RB_TYPE *dest = (RB_TYPE *) values;
-#else
RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values;
-#endif
GLuint i;
char *row = swrast_drawable(ctx->ReadBuffer)->row;
INIT_PIXEL_PTR(pixel, x, y);
@@ -151,11 +144,7 @@ NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
#ifdef SPAN_VARS
SPAN_VARS
#endif
-#ifdef CI_MODE
- RB_TYPE *dest = (RB_TYPE *) values;
-#else
RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values;
-#endif
GLuint i;
for (i = 0; i < count; i++) {
RB_TYPE pixel[4];
@@ -179,7 +168,8 @@ NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
if (mask) {
for (i = 0; i < count; i++) {
if (mask[i]) {
- RB_TYPE pixel[4];
+ RB_TYPE row[4];
+ INIT_PIXEL_PTR(pixel, x, y);
STORE_PIXEL(pixel, x + i, y, src[i]);
PUT_PIXEL(ctx, x + i, YFLIP(xrb, y), pixel);
}
@@ -198,7 +188,6 @@ NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
}
-#if !defined(CI_MODE)
static void
NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
@@ -212,7 +201,8 @@ NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb,
if (mask) {
for (i = 0; i < count; i++) {
if (mask[i]) {
- RB_TYPE pixel[4];
+ RB_TYPE row[4];
+ INIT_PIXEL_PTR(pixel, x, y);
#ifdef STORE_PIXEL_RGB
STORE_PIXEL_RGB(pixel, x + i, y, src[i]);
#else
@@ -237,7 +227,6 @@ NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb,
}
(void) rb;
}
-#endif
static void
@@ -253,7 +242,8 @@ NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
if (mask) {
for (i = 0; i < count; i++) {
if (mask[i]) {
- RB_TYPE pixel[4];
+ RB_TYPE row[4];
+ INIT_PIXEL_PTR(pixel, x, y);
STORE_PIXEL(pixel, x + i, y, src);
PUT_PIXEL(ctx, x + i, YFLIP(xrb, y), pixel);
}
@@ -285,7 +275,8 @@ NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
ASSERT(mask);
for (i = 0; i < count; i++) {
if (mask[i]) {
- RB_TYPE pixel[4];
+ RB_TYPE row[4];
+ INIT_PIXEL_PTR(pixel, x, y);
STORE_PIXEL(pixel, x[i], y[i], src[i]);
PUT_PIXEL(ctx, x[i], YFLIP(xrb, y[i]), pixel);
}
@@ -307,7 +298,8 @@ NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
ASSERT(mask);
for (i = 0; i < count; i++) {
if (mask[i]) {
- RB_TYPE pixel[4];
+ RB_TYPE row[4];
+ INIT_PIXEL_PTR(pixel, x, y);
STORE_PIXEL(pixel, x[i], y[i], src);
PUT_PIXEL(ctx, x[i], YFLIP(xrb, y[i]), pixel);
}
@@ -319,7 +311,6 @@ NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
#undef NAME
#undef RB_TYPE
#undef RB_COMPONENTS
-#undef CI_MODE
#undef SPAN_VARS
#undef INIT_PIXEL_PTR
#undef INC_PIXEL_PTR
diff --git a/mesalib/src/mesa/drivers/windows/gdi/mesa.def b/mesalib/src/mesa/drivers/windows/gdi/mesa.def
index 62f75d954..b537b3460 100644
--- a/mesalib/src/mesa/drivers/windows/gdi/mesa.def
+++ b/mesalib/src/mesa/drivers/windows/gdi/mesa.def
@@ -867,10 +867,8 @@ EXPORTS
_glapi_get_proc_address
_mesa_add_soft_renderbuffers
_mesa_add_renderbuffer
- _mesa_bzero
- _mesa_calloc
+ _mesa_check_conditional_render
_mesa_choose_tex_format
- _mesa_compressed_texture_size
_mesa_create_framebuffer
_mesa_create_visual
_mesa_delete_array_object
@@ -887,7 +885,6 @@ EXPORTS
_mesa_error
_mesa_finish_render_texture
_mesa_framebuffer_renderbuffer
- _mesa_free
_mesa_free_context_data
_mesa_free_texture_image_data
_mesa_generate_mipmap
@@ -899,8 +896,6 @@ EXPORTS
_mesa_init_renderbuffer
_mesa_initialize_context
_mesa_make_current
- _mesa_memcpy
- _mesa_memset
_mesa_new_array_object
_mesa_new_framebuffer
_mesa_new_program
@@ -926,12 +921,13 @@ EXPORTS
_mesa_store_texsubimage1d
_mesa_store_texsubimage2d
_mesa_store_texsubimage3d
- _mesa_strcmp
_mesa_test_proxy_teximage
_mesa_reference_framebuffer
_mesa_update_framebuffer_visual
_mesa_use_program
_mesa_Viewport
+ _mesa_meta_init
+ _mesa_meta_free
_mesa_meta_CopyColorSubTable
_mesa_meta_CopyColorTable
_mesa_meta_CopyConvolutionFilter1D
@@ -941,7 +937,6 @@ EXPORTS
_mesa_meta_CopyTexSubImage1D
_mesa_meta_CopyTexSubImage2D
_mesa_meta_CopyTexSubImage3D
- _mesa_wait_query
_swrast_Accum
_swrast_Bitmap
_swrast_BlitFramebuffer
@@ -965,4 +960,4 @@ EXPORTS
_tnl_InvalidateState
_tnl_run_pipeline
_tnl_program_string
- _tnl_RasterPos \ No newline at end of file
+ _tnl_RasterPos
diff --git a/mesalib/src/mesa/drivers/windows/gdi/wmesa.c b/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
index 8929b22af..22b0c46b4 100644
--- a/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/mesalib/src/mesa/drivers/windows/gdi/wmesa.c
@@ -35,7 +35,7 @@ wmesa_new_framebuffer(HDC hdc, GLvisual *visual)
WMesaFramebuffer pwfb
= (WMesaFramebuffer) malloc(sizeof(struct wmesa_framebuffer));
if (pwfb) {
- _mesa_initialize_framebuffer(&pwfb->Base, visual);
+ _mesa_initialize_window_framebuffer(&pwfb->Base, visual);
pwfb->hDC = hdc;
/* insert at head of list */
pwfb->next = FirstFramebuffer;
@@ -248,16 +248,6 @@ static void wmesa_flush(GLcontext *ctx)
*/
/*
- * Set the color index used to clear the color buffer.
- */
-static void clear_index(GLcontext *ctx, GLuint index)
-{
- WMesaContext pwc = wmesa_context(ctx);
- /* Note that indexed mode is not supported yet */
- pwc->clearColorRef = RGB(0,0,0);
-}
-
-/*
* Set the color used to clear the color buffer.
*/
static void clear_color(GLcontext *ctx, const GLfloat color[4])
@@ -301,10 +291,10 @@ static void clear(GLcontext *ctx, GLbitfield mask)
/* Let swrast do all the work if the masks are not set to
* clear all channels. */
- if (ctx->Color.ColorMask[0] != 0xff ||
- ctx->Color.ColorMask[1] != 0xff ||
- ctx->Color.ColorMask[2] != 0xff ||
- ctx->Color.ColorMask[3] != 0xff) {
+ if (!ctx->Color.ColorMask[0][0] ||
+ !ctx->Color.ColorMask[0][1] ||
+ !ctx->Color.ColorMask[0][2] ||
+ !ctx->Color.ColorMask[0][3]) {
_swrast_Clear(ctx, mask);
return;
}
@@ -482,7 +472,7 @@ static void write_rgba_span_front(const GLcontext *ctx,
};
} BGRA;
BGRA *bgra, c;
- int i;
+ GLuint i;
if (n < 16) { // the value 16 is just guessed
y=FLIP(y);
@@ -827,9 +817,9 @@ static void read_rgba_span_32(const GLcontext *ctx,
lpdw = ((LPDWORD)(pwfb->pbPixels + pwfb->ScanWidth * y)) + x;
for (i=0; i<n; i++) {
pixel = lpdw[i];
- rgba[i][RCOMP] = (pixel & 0x00ff0000) >> 16;
- rgba[i][GCOMP] = (pixel & 0x0000ff00) >> 8;
- rgba[i][BCOMP] = (pixel & 0x000000ff);
+ rgba[i][RCOMP] = (GLubyte)((pixel & 0x00ff0000) >> 16);
+ rgba[i][GCOMP] = (GLubyte)((pixel & 0x0000ff00) >> 8);
+ rgba[i][BCOMP] = (GLubyte)(pixel & 0x000000ff);
rgba[i][ACOMP] = 255;
}
}
@@ -851,9 +841,9 @@ static void read_rgba_pixels_32(const GLcontext *ctx,
GLint y2 = FLIP(y[i]);
lpdw = ((LPDWORD)(pwfb->pbPixels + pwfb->ScanWidth * y2)) + x[i];
pixel = *lpdw;
- rgba[i][RCOMP] = (pixel & 0x00ff0000) >> 16;
- rgba[i][GCOMP] = (pixel & 0x0000ff00) >> 8;
- rgba[i][BCOMP] = (pixel & 0x000000ff);
+ rgba[i][RCOMP] = (GLubyte)((pixel & 0x00ff0000) >> 16);
+ rgba[i][GCOMP] = (GLubyte)((pixel & 0x0000ff00) >> 8);
+ rgba[i][BCOMP] = (GLubyte)(pixel & 0x000000ff);
rgba[i][ACOMP] = 255;
}
}
@@ -1245,7 +1235,7 @@ static void read_rgba_pixels_16(const GLcontext *ctx,
static void
wmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
- _mesa_free(rb);
+ free(rb);
}
@@ -1271,7 +1261,7 @@ wmesa_renderbuffer_storage(GLcontext *ctx,
* on if we're drawing to the front or back color buffer.
*/
void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
- BYTE cColorBits, int double_buffer)
+ int cColorBits, int double_buffer)
{
if (double_buffer) {
/* back buffer */
@@ -1286,9 +1276,6 @@ void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
rb->PutMonoValues = write_mono_rgba_pixels_16;
rb->GetRow = read_rgba_span_16;
rb->GetValues = read_rgba_pixels_16;
- rb->RedBits = 5;
- rb->GreenBits = 6;
- rb->BlueBits = 5;
break;
case PF_8R8G8B:
if (cColorBits == 24)
@@ -1300,9 +1287,6 @@ void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
rb->PutMonoValues = write_mono_rgba_pixels_24;
rb->GetRow = read_rgba_span_24;
rb->GetValues = read_rgba_pixels_24;
- rb->RedBits = 8;
- rb->GreenBits = 8;
- rb->BlueBits = 8;
}
else
{
@@ -1313,9 +1297,6 @@ void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
rb->PutMonoValues = write_mono_rgba_pixels_32;
rb->GetRow = read_rgba_span_32;
rb->GetValues = read_rgba_pixels_32;
- rb->RedBits = 8;
- rb->GreenBits = 8;
- rb->BlueBits = 8;
}
break;
default:
@@ -1331,9 +1312,6 @@ void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
rb->PutMonoValues = write_mono_rgba_pixels_front;
rb->GetRow = read_rgba_span_front;
rb->GetValues = read_rgba_pixels_front;
- rb->RedBits = 8; /* XXX fix these (565?) */
- rb->GreenBits = 8;
- rb->BlueBits = 8;
}
}
@@ -1473,12 +1451,10 @@ WMesaContext WMesaCreateContext(HDC hDC,
break;
}
/* Create visual based on flags */
- visual = _mesa_create_visual(rgb_flag,
- db_flag, /* db_flag */
+ visual = _mesa_create_visual(db_flag, /* db_flag */
GL_FALSE, /* stereo */
red_bits, green_bits, blue_bits, /* color RGB */
alpha_flag ? alpha_bits : 0, /* color A */
- 0, /* index bits */
DEFAULT_SOFTWARE_DEPTH_BITS, /* depth_bits */
8, /* stencil_bits */
16,16,16, /* accum RGB */
@@ -1486,7 +1462,7 @@ WMesaContext WMesaCreateContext(HDC hDC,
1); /* num samples */
if (!visual) {
- _mesa_free(c);
+ free(c);
return NULL;
}
@@ -1497,7 +1473,6 @@ WMesaContext WMesaCreateContext(HDC hDC,
functions.GetBufferSize = wmesa_get_buffer_size;
functions.Flush = wmesa_flush;
functions.Clear = clear;
- functions.ClearIndex = clear_index;
functions.ClearColor = clear_color;
functions.ResizeBuffers = wmesa_resize_buffers;
functions.Viewport = wmesa_viewport;
@@ -1524,7 +1499,7 @@ WMesaContext WMesaCreateContext(HDC hDC,
!_tnl_CreateContext(ctx) ||
!_swsetup_CreateContext(ctx)) {
_mesa_free_context_data(ctx);
- _mesa_free(c);
+ free(c);
return NULL;
}
_swsetup_Wakeup(ctx);
@@ -1569,7 +1544,7 @@ void WMesaDestroyContext( WMesaContext pwc )
_swrast_DestroyContext(ctx);
_mesa_free_context_data(ctx);
- _mesa_free(pwc);
+ free(pwc);
}
diff --git a/mesalib/src/mesa/drivers/windows/gdi/wmesadef.h b/mesalib/src/mesa/drivers/windows/gdi/wmesadef.h
index 83a42e608..1c0e24511 100644
--- a/mesalib/src/mesa/drivers/windows/gdi/wmesadef.h
+++ b/mesalib/src/mesa/drivers/windows/gdi/wmesadef.h
@@ -27,7 +27,7 @@ struct wmesa_framebuffer
HDC hDC;
int pixelformat;
GLuint ScanWidth;
- BYTE cColorBits;
+ int cColorBits;
/* back buffer DIB fields */
HDC dib_hDC;
BITMAPINFO bmi;
diff --git a/mesalib/src/mesa/drivers/windows/gldirect/dglcontext.c b/mesalib/src/mesa/drivers/windows/gldirect/dglcontext.c
index e9c23d1cc..a420b36ff 100644
--- a/mesalib/src/mesa/drivers/windows/gldirect/dglcontext.c
+++ b/mesalib/src/mesa/drivers/windows/gldirect/dglcontext.c
@@ -1377,14 +1377,12 @@ SkipPrimaryCreate:
#ifdef _USE_GLD3_WGL
lpCtx->glVis = _mesa_create_visual(
- GL_TRUE, // RGB mode
bDouble, /* double buffer */
GL_FALSE, // stereo
lpPFD->cRedBits,
lpPFD->cGreenBits,
lpPFD->cBlueBits,
dwAlphaBits,
- 0, // index bits
dwDepthBits,
dwStencilBits,
lpPFD->cAccumRedBits, // accum bits
diff --git a/mesalib/src/mesa/drivers/windows/icd/mesa.def b/mesalib/src/mesa/drivers/windows/icd/mesa.def
index 25ac08a2f..6f33d170f 100644
--- a/mesalib/src/mesa/drivers/windows/icd/mesa.def
+++ b/mesalib/src/mesa/drivers/windows/icd/mesa.def
@@ -32,8 +32,6 @@ EXPORTS
_mesa_buffer_data
_mesa_buffer_map
_mesa_buffer_subdata
- _mesa_bzero
- _mesa_calloc
_mesa_choose_tex_format
_mesa_compressed_texture_size
_mesa_create_framebuffer
@@ -47,15 +45,12 @@ EXPORTS
_mesa_enable_1_5_extensions
_mesa_enable_sw_extensions
_mesa_error
- _mesa_free
_mesa_free_context_data
_mesa_get_current_context
_mesa_init_default_imports
_mesa_init_driver_functions
_mesa_initialize_context
_mesa_make_current
- _mesa_memcpy
- _mesa_memset
_mesa_new_buffer_object
_mesa_new_texture_object
_mesa_problem
@@ -72,7 +67,6 @@ EXPORTS
_mesa_store_texsubimage1d
_mesa_store_texsubimage2d
_mesa_store_texsubimage3d
- _mesa_strcmp
_mesa_test_proxy_teximage
_mesa_Viewport
_mesa_meta_CopyColorSubTable