summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkem <kem>2000-04-16 03:19:13 +0000
committerkem <kem>2000-04-16 03:19:13 +0000
commit8d836b52e8c38a5187c954c2e526cc81dbc8ec6d (patch)
treea74f5e145e26089357ca82907e9ef57b6a188d86
parent0c90cbe56c1ce75da1a09e5e41416ac8e5cee4ba (diff)
- Fixed swap buffers throttlingati-4-0-1-beta
- Removed old depth software fallback code - Fixed glBindTexture crash - Fixed kernel vertex buffer cleanup
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/Imakefile2
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_context.c6
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_context.h2
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_depth.c158
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_depth.h43
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_swap.c4
-rw-r--r--xc/lib/GL/mesa/src/drv/r128/r128_tex.c9
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_dma.c6
8 files changed, 12 insertions, 218 deletions
diff --git a/xc/lib/GL/mesa/src/drv/r128/Imakefile b/xc/lib/GL/mesa/src/drv/r128/Imakefile
index f6caefad4..0ed48c3c4 100644
--- a/xc/lib/GL/mesa/src/drv/r128/Imakefile
+++ b/xc/lib/GL/mesa/src/drv/r128/Imakefile
@@ -61,7 +61,6 @@ MESA_INCLUDES = -I. -I.. -I../../include
r128_clear.c \
r128_context.c \
r128_dd.c \
- r128_depth.c \
r128_fastpath.c \
r128_pipeline.c \
r128_screen.c \
@@ -77,7 +76,6 @@ MESA_INCLUDES = -I. -I.. -I../../include
r128_clear.o \
r128_context.o \
r128_dd.o \
- r128_depth.o \
r128_fastpath.o \
r128_pipeline.o \
r128_screen.o \
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_context.c b/xc/lib/GL/mesa/src/drv/r128/r128_context.c
index b27266462..5cf776d5f 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_context.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_context.c
@@ -39,7 +39,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r128_dd.h"
#include "r128_state.h"
#include "r128_span.h"
-#include "r128_depth.h"
#include "r128_tex.h"
#include "r128_vb.h"
#include "r128_pipeline.h"
@@ -97,7 +96,7 @@ r128ContextPtr r128CreateContext(GLvisual *glVisual,
r128ctx->lastTexAge[i] = -1;
}
- r128ctx->lastSwapAge = -1;
+ r128ctx->lastSwapAge = 0;
r128ctx->useFastPath = GL_FALSE;
@@ -125,9 +124,6 @@ r128ContextPtr r128CreateContext(GLvisual *glVisual,
r128DDInitDriverFuncs(glCtx);
r128DDInitStateFuncs(glCtx);
r128DDInitSpanFuncs(glCtx);
-#if 0
- r128DDInitDepthFuncs(glCtx);
-#endif
r128DDInitTextureFuncs(glCtx);
glCtx->Driver.TriangleCaps = (DD_TRI_CULL
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_context.h b/xc/lib/GL/mesa/src/drv/r128/r128_context.h
index 0cdc84c46..158f7b463 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_context.h
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_context.h
@@ -154,7 +154,7 @@ typedef struct {
/* Last known global tex heap ages */
int lastTexAge[R128_NR_TEX_HEAPS];
- int lastSwapAge; /* Last known swap age */
+ CARD32 lastSwapAge; /* Last known swap age */
GLenum FogMode; /* Current fog equation */
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_depth.c b/xc/lib/GL/mesa/src/drv/r128/r128_depth.c
deleted file mode 100644
index d0143b494..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_depth.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* $XFree86$ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-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
-on 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 above copyright notice and this permission notice (including the next
-paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- *
- */
-
-#include "r128_init.h"
-#include "r128_mesa.h"
-#include "r128_xmesa.h"
-#include "r128_context.h"
-#include "r128_lock.h"
-#include "r128_state.h"
-#include "r128_reg.h"
-#include "r128_cce.h"
-#include "r128_depth.h"
-
-/* FIXME: only handles 16bpp depth buffer for now */
-
-#define DEPTH_DECLS \
- r128ContextPtr r128ctx = R128_CONTEXT(ctx); \
- r128ScreenPtr r128scrn = r128ctx->r128Screen; \
- int xoff = (r128ctx->driDrawable->x + \
- r128scrn->depthX); \
- int yoff = (r128ctx->driDrawable->y + \
- r128scrn->depthY); \
- int height = r128ctx->driDrawable->h; \
- unsigned char *zbase = (r128scrn->fb + \
- xoff * (r128scrn->bpp/8) + \
- yoff * r128scrn->fbStride); \
- volatile GLdepth *zptr; \
- int i; \
- (void)i
-
-/* Return a pointer to the offset in the depth buffer at (x,y) */
-#define DEPTH_ADDR(base, _x, _y) \
- (GLdepth*)(zbase + _x * (r128scrn->bpp/8) + \
- (height - _y) * r128scrn->fbStride)
-
-/* Update the depth buffer for a given span. This is only used for
- software fallbacks. */
-static void r128DDWriteDepthSpan(GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLdepth z[],
- const GLubyte mask[])
-{
- DEPTH_DECLS;
-
- zptr = DEPTH_ADDR(zbase, x, y);
-
- LOCK_HARDWARE(r128ctx);
- R128CCE_WAIT_FOR_IDLE(r128ctx);
-
- for (i = 0; i < n; i++, zptr++)
- if (mask[i]) {
- *zptr = z[i];
- }
-
- UNLOCK_HARDWARE(r128ctx);
-}
-
-/* Update the depth buffer for a given array of pixels. This is only
- used for software fallbacks. */
-static void r128DDWriteDepthPixels(GLcontext *ctx,
- GLuint n,
- const GLint x[],
- const GLint y[],
- const GLdepth z[],
- const GLubyte mask[])
-{
- DEPTH_DECLS;
-
- LOCK_HARDWARE(r128ctx);
- R128CCE_WAIT_FOR_IDLE(r128ctx);
-
- for (i = 0; i < n; i++)
- if (mask[i]) {
- zptr = DEPTH_ADDR(zbase, x[i], y[i]);
- *zptr = z[i];
- }
-
- UNLOCK_HARDWARE(r128ctx);
-}
-
-/* Return a span in the depth buffer as ints. This is only used for
- software fallbacks. */
-static void r128DDReadDepthSpan(GLcontext *ctx,
- GLuint n,
- GLint x, GLint y, GLdepth depth[])
-{
- DEPTH_DECLS;
-
- zptr = DEPTH_ADDR(zbase, x, y);
-
- LOCK_HARDWARE(r128ctx);
- R128CCE_WAIT_FOR_IDLE(r128ctx);
-
- memcpy(depth, (void *)zptr, n*sizeof(*depth));
-
- UNLOCK_HARDWARE(r128ctx);
-}
-
-/* Return a span in the depth buffer as floats. This is only used for
- software fallbacks. */
-static void r128DDReadDepthPixels(GLcontext *ctx,
- GLuint n,
- const GLint x[], const GLint y[],
- GLdepth depth[])
-{
- DEPTH_DECLS;
-
- LOCK_HARDWARE(r128ctx);
- R128CCE_WAIT_FOR_IDLE(r128ctx);
-
- for (i = 0; i < n; i++) {
- zptr = DEPTH_ADDR(zbase, x[i], y[i]);
- depth[i] = zptr[i];
- }
-
- UNLOCK_HARDWARE(r128ctx);
-}
-
-
-/* Initialize the driver's depth functions */
-void r128DDInitDepthFuncs(GLcontext *ctx)
-{
- ctx->Driver.WriteDepthSpan = r128DDWriteDepthSpan;
- ctx->Driver.WriteDepthPixels = r128DDWriteDepthPixels;
- ctx->Driver.ReadDepthSpan = r128DDReadDepthSpan;
- ctx->Driver.ReadDepthPixels = r128DDReadDepthPixels;
-}
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_depth.h b/xc/lib/GL/mesa/src/drv/r128/r128_depth.h
deleted file mode 100644
index fa35afc16..000000000
--- a/xc/lib/GL/mesa/src/drv/r128/r128_depth.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $XFree86$ */
-/**************************************************************************
-
-Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
- Cedar Park, Texas.
-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
-on 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 above copyright notice and this permission notice (including the next
-paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
-ATI, PRECISION INSIGHT AND/OR THEIR 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.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- *
- */
-
-#ifndef _R128_DEPTH_H_
-#define _R128_DEPTH_H_
-
-#ifdef GLX_DIRECT_RENDERING
-
-extern void r128DDInitDepthFuncs(GLcontext *ctx);
-
-#endif
-#endif /* _R128_DEPTH_H_ */
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_swap.c b/xc/lib/GL/mesa/src/drv/r128/r128_swap.c
index 1ab7842af..6b347023d 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_swap.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_swap.c
@@ -51,7 +51,7 @@ void r128SwapBuffers(r128ContextPtr r128ctx)
int nc;
XF86DRIClipRectPtr c;
int dst_bpp;
- int swapAge;
+ CARD32 swapAge;
if (r128ctx->SWonly) {
/* FIXME: Provide software fallback for this case?? */
@@ -111,7 +111,7 @@ void r128SwapBuffers(r128ContextPtr r128ctx)
R128CCE((fw << 16) | fh);
}
- if (++swapAge < 0) swapAge = 0;
+ ++swapAge;
R128CCE0(R128_CCE_PACKET0, R128_SWAP_AGE_REG, 0);
R128CCE(swapAge);
r128ctx->lastSwapAge = swapAge;
diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_tex.c b/xc/lib/GL/mesa/src/drv/r128/r128_tex.c
index 99ae5cf70..b199658df 100644
--- a/xc/lib/GL/mesa/src/drv/r128/r128_tex.c
+++ b/xc/lib/GL/mesa/src/drv/r128/r128_tex.c
@@ -1563,6 +1563,12 @@ void r128UpdateTextureState(r128ContextPtr r128ctx)
/* Clear the GL_BLEND texturing fallback */
r128ctx->Fallback &= ~R128_FALLBACK_TEXTURE;
+ /* Unbind any currently bound textures */
+ if (r128ctx->CurrentTexObj[0]) r128ctx->CurrentTexObj[0]->bound = 0;
+ if (r128ctx->CurrentTexObj[1]) r128ctx->CurrentTexObj[1]->bound = 0;
+ r128ctx->CurrentTexObj[0] = NULL;
+ r128ctx->CurrentTexObj[1] = NULL;
+
/* Update the texture unit 0/1 state */
r128UpdateTex0State(r128ctx);
r128UpdateTex1State(r128ctx);
@@ -1725,9 +1731,6 @@ static void r128DDTexSubImage(GLcontext *ctx, GLenum target,
R128_CTX_TEX0STATE |
R128_CTX_TEX1STATE);
}
-
- /* Make the new texture current */
- r128ctx->CurrentTexObj[ctx->Texture.CurrentUnit] = t;
}
/* Set the texture parameter state */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_dma.c
index 7c2e41f44..9c645b492 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_dma.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_dma.c
@@ -38,7 +38,6 @@
#define R128_MAX_VBUF_AGE 0x10000000
-#define R128_VBUF_AGE_TAKEN R128_MAX_VBUF_AGE*2
#define R128_VB_AGE_REG R128_GUI_SCRATCH_REG0
extern int r128_do_engine_reset(drm_device_t *dev);
@@ -325,7 +324,6 @@ int r128_do_cce_wait_for_idle(drm_device_t *dev)
int pm4stat = R128_READ(R128_PM4_STAT);
if ((pm4stat & R128_PM4_FIFOCNT_MASK) >= dev_priv->cce_fifo_size &&
!(pm4stat & (R128_PM4_BUSY | R128_PM4_GUI_ACTIVE))) {
- r128_mark_vertbufs_done(dev);
return 0;
}
}
@@ -340,7 +338,6 @@ int r128_do_cce_wait_for_idle(drm_device_t *dev)
for (i = 0; i < dev_priv->usec_timeout; i++) {
int pm4stat = R128_READ(R128_PM4_STAT);
if (!(pm4stat & (R128_PM4_BUSY | R128_PM4_GUI_ACTIVE))) {
- r128_mark_vertbufs_done(dev);
return r128_do_engine_flush(dev);
}
udelay(1);
@@ -653,7 +650,8 @@ static int r128_send_vertbufs(drm_device_t *dev, drm_r128_vertex_t *v)
if (++dev_priv->submit_age == R128_MAX_VBUF_AGE) {
dev_priv->submit_age = 0;
- r128_do_cce_wait_for_idle(dev);
+ (void)r128_do_cce_wait_for_idle(dev);
+ r128_mark_vertbufs_done(dev);
}
for (i = 0; i < v->send_count; i++) {