summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorJerome Glisse <[email protected]>2006-09-12 18:34:43 +0000
committerJerome Glisse <[email protected]>2006-09-12 18:34:43 +0000
commit6a65e6db3d9a64cd2b233155a05074a3eb5c1975 (patch)
tree0d74c2b1c7fecf2a5993d192a02e9ab826713f3b /src/mesa/drivers/dri
parentb1cb39d8bdb6707be2e44d38c52f44515bcbf16e (diff)
Removing some of r200 dependency, cleaning up code a bit,
and fixing a couple of warning. More cleanup and shuffle to come. I have tested this change they might broke things especialy with r300_texstate.c change (format_x doesn't seems to be use at all by r300).
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/r300/r300_cmdbuf.c6
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h4
-rw-r--r--src/mesa/drivers/dri/r300/r300_reg.h69
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c103
-rw-r--r--src/mesa/drivers/dri/r300/r300_texmem.c20
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c105
-rw-r--r--src/mesa/drivers/dri/r300/radeon_context.h1
-rw-r--r--src/mesa/drivers/dri/r300/radeon_ioctl.c10
-rw-r--r--src/mesa/drivers/dri/r300/radeon_ioctl.h2
-rw-r--r--src/mesa/drivers/dri/r300/radeon_lock.h3
-rw-r--r--src/mesa/drivers/dri/r300/radeon_state.c10
11 files changed, 142 insertions, 191 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
index 1b1d2bfb039..ace9b667240 100644
--- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c
+++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
@@ -544,9 +544,9 @@ void r300InitCmdBuf(r300ContextPtr r300)
size = 64*256;
if (RADEON_DEBUG & (DEBUG_IOCTL|DEBUG_DMA)) {
- fprintf(stderr, "sizeof(drm_r300_cmd_header_t)=%ld\n",
+ fprintf(stderr, "sizeof(drm_r300_cmd_header_t)=%u\n",
sizeof(drm_r300_cmd_header_t));
- fprintf(stderr, "sizeof(drm_radeon_cmd_buffer_t)=%ld\n",
+ fprintf(stderr, "sizeof(drm_radeon_cmd_buffer_t)=%u\n",
sizeof(drm_radeon_cmd_buffer_t));
fprintf(stderr,
"Allocating %d bytes command buffer (max state is %d bytes)\n",
@@ -603,7 +603,7 @@ void r300EmitBlit(r300ContextPtr rmesa,
cmd[0].header.cmd_type = R300_CMD_PACKET3;
cmd[0].header.pad0 = R300_CMD_PACKET3_RAW;
- cmd[1].u = R200_CP_CMD_BITBLT_MULTI | (5 << 16);
+ cmd[1].u = R300_CP_CMD_BITBLT_MULTI | (5 << 16);
cmd[2].u = (RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
RADEON_GMC_BRUSH_NONE |
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index 17ce0d95bfe..df73cdedc11 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -207,6 +207,10 @@ struct r300_texture_env_state {
GLenum envMode;
};
+
+/* The blit width for texture uploads
+ */
+#define R300_BLIT_WIDTH_BYTES 1024
#define R300_MAX_TEXTURE_UNITS 8
struct r300_texture_state {
diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h
index f7cdfbe3c4e..f3d8fa60f5b 100644
--- a/src/mesa/drivers/dri/r300/r300_reg.h
+++ b/src/mesa/drivers/dri/r300/r300_reg.h
@@ -884,8 +884,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R300_TX_PITCH_0 0x4500 /* obvious missing in gap */
#define R300_TX_OFFSET_0 0x4540
-
-/* BEGIN: Guess from R200 */
+ /* BEGIN: Guess from R200 */
# define R300_TXO_ENDIAN_NO_SWAP (0 << 0)
# define R300_TXO_ENDIAN_BYTE_SWAP (1 << 0)
# define R300_TXO_ENDIAN_WORD_SWAP (2 << 0)
@@ -894,7 +893,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_TXO_MICRO_TILE (1 << 3)
# define R300_TXO_OFFSET_MASK 0xffffffe0
# define R300_TXO_OFFSET_SHIFT 5
-/* END: Guess from R200 */
+ /* END: Guess from R200 */
/* 32 bit chroma key */
#define R300_TX_CHROMA_KEY_0 0x4580
@@ -1244,35 +1243,34 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_BLEND_ENABLE (1 << 0)
# define R300_BLEND_UNKNOWN (3 << 1)
# define R300_BLEND_NO_SEPARATE (1 << 3)
- /* the following are shared between CBLEND and ABLEND */
+/* the following are shared between CBLEND and ABLEND */
# define R300_FCN_MASK (3 << 12)
# define R300_COMB_FCN_ADD_CLAMP (0 << 12)
# define R300_COMB_FCN_ADD_NOCLAMP (1 << 12)
# define R300_COMB_FCN_SUB_CLAMP (2 << 12)
# define R300_COMB_FCN_SUB_NOCLAMP (3 << 12)
-# define R300_SRC_BLEND_GL_ZERO (32 << 16)
-# define R300_SRC_BLEND_GL_ONE (33 << 16)
-# define R300_SRC_BLEND_GL_SRC_COLOR (34 << 16)
-# define R300_SRC_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 16)
-# define R300_SRC_BLEND_GL_DST_COLOR (36 << 16)
-# define R300_SRC_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 16)
-# define R300_SRC_BLEND_GL_SRC_ALPHA (38 << 16)
-# define R300_SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 16)
-# define R300_SRC_BLEND_GL_DST_ALPHA (40 << 16)
-# define R300_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 16)
-# define R300_SRC_BLEND_GL_SRC_ALPHA_SATURATE (42 << 16)
-# define R300_SRC_BLEND_MASK (63 << 16)
-# define R300_DST_BLEND_GL_ZERO (32 << 24)
-# define R300_DST_BLEND_GL_ONE (33 << 24)
-# define R300_DST_BLEND_GL_SRC_COLOR (34 << 24)
-# define R300_DST_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 24)
-# define R300_DST_BLEND_GL_DST_COLOR (36 << 24)
-# define R300_DST_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 24)
-# define R300_DST_BLEND_GL_SRC_ALPHA (38 << 24)
-# define R300_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 24)
-# define R300_DST_BLEND_GL_DST_ALPHA (40 << 24)
-# define R300_DST_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 24)
-# define R300_DST_BLEND_MASK (63 << 24)
+# define R300_COMB_FCN_MIN (4 << 12)
+# define R300_COMB_FCN_MAX (5 << 12)
+# define R300_COMB_FCN_RSUB_CLAMP (6 << 12)
+# define R300_COMB_FCN_RSUB_NOCLAMP (7 << 12)
+# define R300_BLEND_GL_ZERO (32)
+# define R300_BLEND_GL_ONE (33)
+# define R300_BLEND_GL_SRC_COLOR (34)
+# define R300_BLEND_GL_ONE_MINUS_SRC_COLOR (35)
+# define R300_BLEND_GL_DST_COLOR (36)
+# define R300_BLEND_GL_ONE_MINUS_DST_COLOR (37)
+# define R300_BLEND_GL_SRC_ALPHA (38)
+# define R300_BLEND_GL_ONE_MINUS_SRC_ALPHA (39)
+# define R300_BLEND_GL_DST_ALPHA (40)
+# define R300_BLEND_GL_ONE_MINUS_DST_ALPHA (41)
+# define R300_BLEND_GL_SRC_ALPHA_SATURATE (42)
+# define R300_BLEND_GL_CONST_COLOR (43)
+# define R300_BLEND_GL_ONE_MINUS_CONST_COLOR (44)
+# define R300_BLEND_GL_CONST_ALPHA (45)
+# define R300_BLEND_GL_ONE_MINUS_CONST_ALPHA (46)
+# define R300_BLEND_MASK (63)
+# define R300_SRC_BLEND_SHIFT (16)
+# define R300_DST_BLEND_SHIFT (24)
#define R300_RB3D_COLORMASK 0x4E0C
# define R300_COLORMASK0_B (1<<0)
# define R300_COLORMASK0_G (1<<1)
@@ -1560,4 +1558,21 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* END: Packet 3 commands */
+
+/* Color formats for 2d packets
+ */
+#define R300_CP_COLOR_FORMAT_CI8 2
+#define R300_CP_COLOR_FORMAT_ARGB1555 3
+#define R300_CP_COLOR_FORMAT_RGB565 4
+#define R300_CP_COLOR_FORMAT_ARGB8888 6
+#define R300_CP_COLOR_FORMAT_RGB332 7
+#define R300_CP_COLOR_FORMAT_RGB8 9
+#define R300_CP_COLOR_FORMAT_ARGB4444 15
+
+/*
+ * CP type-3 packets
+ */
+#define R300_CP_CMD_BITBLT_MULTI 0xC0009B00
+
+
#endif /* _R300_REG_H */
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 606729e683e..bac1bef9681 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -100,55 +100,54 @@ static int blend_factor(GLenum factor, GLboolean is_src)
switch (factor) {
case GL_ZERO:
- func = R200_BLEND_GL_ZERO;
+ func = R300_BLEND_GL_ZERO;
break;
case GL_ONE:
- func = R200_BLEND_GL_ONE;
+ func = R300_BLEND_GL_ONE;
break;
case GL_DST_COLOR:
- func = R200_BLEND_GL_DST_COLOR;
+ func = R300_BLEND_GL_DST_COLOR;
break;
case GL_ONE_MINUS_DST_COLOR:
- func = R200_BLEND_GL_ONE_MINUS_DST_COLOR;
+ func = R300_BLEND_GL_ONE_MINUS_DST_COLOR;
break;
case GL_SRC_COLOR:
- func = R200_BLEND_GL_SRC_COLOR;
+ func = R300_BLEND_GL_SRC_COLOR;
break;
case GL_ONE_MINUS_SRC_COLOR:
- func = R200_BLEND_GL_ONE_MINUS_SRC_COLOR;
+ func = R300_BLEND_GL_ONE_MINUS_SRC_COLOR;
break;
case GL_SRC_ALPHA:
- func = R200_BLEND_GL_SRC_ALPHA;
+ func = R300_BLEND_GL_SRC_ALPHA;
break;
case GL_ONE_MINUS_SRC_ALPHA:
- func = R200_BLEND_GL_ONE_MINUS_SRC_ALPHA;
+ func = R300_BLEND_GL_ONE_MINUS_SRC_ALPHA;
break;
case GL_DST_ALPHA:
- func = R200_BLEND_GL_DST_ALPHA;
+ func = R300_BLEND_GL_DST_ALPHA;
break;
case GL_ONE_MINUS_DST_ALPHA:
- func = R200_BLEND_GL_ONE_MINUS_DST_ALPHA;
+ func = R300_BLEND_GL_ONE_MINUS_DST_ALPHA;
break;
case GL_SRC_ALPHA_SATURATE:
- func =
- (is_src) ? R200_BLEND_GL_SRC_ALPHA_SATURATE :
- R200_BLEND_GL_ZERO;
+ func = (is_src) ? R300_BLEND_GL_SRC_ALPHA_SATURATE :
+ R300_BLEND_GL_ZERO;
break;
case GL_CONSTANT_COLOR:
- func = R200_BLEND_GL_CONST_COLOR;
+ func = R300_BLEND_GL_CONST_COLOR;
break;
case GL_ONE_MINUS_CONSTANT_COLOR:
- func = R200_BLEND_GL_ONE_MINUS_CONST_COLOR;
+ func = R300_BLEND_GL_ONE_MINUS_CONST_COLOR;
break;
case GL_CONSTANT_ALPHA:
- func = R200_BLEND_GL_CONST_ALPHA;
+ func = R300_BLEND_GL_CONST_ALPHA;
break;
case GL_ONE_MINUS_CONSTANT_ALPHA:
- func = R200_BLEND_GL_ONE_MINUS_CONST_ALPHA;
+ func = R300_BLEND_GL_ONE_MINUS_CONST_ALPHA;
break;
default:
fprintf(stderr, "unknown blend factor %x\n", factor);
- func = (is_src) ? R200_BLEND_GL_ONE : R200_BLEND_GL_ZERO;
+ func = (is_src) ? R300_BLEND_GL_ONE : R300_BLEND_GL_ZERO;
}
return func;
}
@@ -158,10 +157,10 @@ static int blend_factor(GLenum factor, GLboolean is_src)
* This is done in a single
* function because some blend equations (i.e., \c GL_MIN and \c GL_MAX)
* change the interpretation of the blend function.
- * Also, make sure that blend function and blend equation are set to their default
- * value if color blending is not enabled, since at least blend equations GL_MIN
- * and GL_FUNC_REVERSE_SUBTRACT will cause wrong results otherwise for
- * unknown reasons.
+ * Also, make sure that blend function and blend equation are set to their
+ * default value if color blending is not enabled, since at least blend
+ * equations GL_MIN and GL_FUNC_REVERSE_SUBTRACT will cause wrong results
+ * otherwise for unknown reasons.
*/
/* helper function */
@@ -200,12 +199,12 @@ static void r300_set_blend_cntl(r300ContextPtr r300, int func, int eqn, int cbit
static void r300_set_blend_state(GLcontext * ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
- int func = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ZERO << R200_DST_BLEND_SHIFT);
- int eqn = R200_COMB_FCN_ADD_CLAMP;
- int funcA = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ZERO << R200_DST_BLEND_SHIFT);
- int eqnA = R200_COMB_FCN_ADD_CLAMP;
+ int func = (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) |
+ (R300_BLEND_GL_ZERO << R300_DST_BLEND_SHIFT);
+ int eqn = R300_COMB_FCN_ADD_CLAMP;
+ int funcA = (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) |
+ (R300_BLEND_GL_ZERO << R300_DST_BLEND_SHIFT);
+ int eqnA = R300_COMB_FCN_ADD_CLAMP;
if (ctx->Color._LogicOpEnabled || !ctx->Color.BlendEnabled) {
r300_set_blend_cntl(r300,
@@ -214,8 +213,8 @@ static void r300_set_blend_state(GLcontext * ctx)
return;
}
- func = (blend_factor(ctx->Color.BlendSrcRGB, GL_TRUE) << R200_SRC_BLEND_SHIFT) |
- (blend_factor(ctx->Color.BlendDstRGB, GL_FALSE) << R200_DST_BLEND_SHIFT);
+ func = (blend_factor(ctx->Color.BlendSrcRGB, GL_TRUE) << R300_SRC_BLEND_SHIFT) |
+ (blend_factor(ctx->Color.BlendDstRGB, GL_FALSE) << R300_DST_BLEND_SHIFT);
switch (ctx->Color.BlendEquationRGB) {
case GL_FUNC_ADD:
@@ -227,19 +226,19 @@ static void r300_set_blend_state(GLcontext * ctx)
break;
case GL_FUNC_REVERSE_SUBTRACT:
- eqn = R200_COMB_FCN_RSUB_CLAMP;
+ eqn = R300_COMB_FCN_RSUB_CLAMP;
break;
case GL_MIN:
- eqn = R200_COMB_FCN_MIN;
- func = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ONE << R200_DST_BLEND_SHIFT);
+ eqn = R300_COMB_FCN_MIN;
+ func = (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) |
+ (R300_BLEND_GL_ONE << R300_DST_BLEND_SHIFT);
break;
case GL_MAX:
- eqn = R200_COMB_FCN_MAX;
- func = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ONE << R200_DST_BLEND_SHIFT);
+ eqn = R300_COMB_FCN_MAX;
+ func = (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) |
+ (R300_BLEND_GL_ONE << R300_DST_BLEND_SHIFT);
break;
default:
@@ -250,8 +249,8 @@ static void r300_set_blend_state(GLcontext * ctx)
}
- funcA = (blend_factor(ctx->Color.BlendSrcA, GL_TRUE) << R200_SRC_BLEND_SHIFT) |
- (blend_factor(ctx->Color.BlendDstA, GL_FALSE) << R200_DST_BLEND_SHIFT);
+ funcA = (blend_factor(ctx->Color.BlendSrcA, GL_TRUE) << R300_SRC_BLEND_SHIFT) |
+ (blend_factor(ctx->Color.BlendDstA, GL_FALSE) << R300_DST_BLEND_SHIFT);
switch (ctx->Color.BlendEquationA) {
case GL_FUNC_ADD:
@@ -263,19 +262,19 @@ static void r300_set_blend_state(GLcontext * ctx)
break;
case GL_FUNC_REVERSE_SUBTRACT:
- eqnA = R200_COMB_FCN_RSUB_CLAMP;
+ eqnA = R300_COMB_FCN_RSUB_CLAMP;
break;
case GL_MIN:
- eqnA = R200_COMB_FCN_MIN;
- funcA = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ONE << R200_DST_BLEND_SHIFT);
+ eqnA = R300_COMB_FCN_MIN;
+ funcA = (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) |
+ (R300_BLEND_GL_ONE << R300_DST_BLEND_SHIFT);
break;
case GL_MAX:
- eqnA = R200_COMB_FCN_MAX;
- funcA = (R200_BLEND_GL_ONE << R200_SRC_BLEND_SHIFT) |
- (R200_BLEND_GL_ONE << R200_DST_BLEND_SHIFT);
+ eqnA = R300_COMB_FCN_MAX;
+ funcA = (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) |
+ (R300_BLEND_GL_ONE << R300_DST_BLEND_SHIFT);
break;
default:
@@ -974,15 +973,15 @@ void r300UpdateViewportOffset( GLcontext *ctx )
GLfloat tx = v[MAT_TX] + xoffset + SUBPIXEL_X;
GLfloat ty = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
- if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != r300PackFloat32(tx) ||
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != r300PackFloat32(ty))
+ if ( rmesa->hw.vpt.cmd[R300_VPT_XOFFSET] != r300PackFloat32(tx) ||
+ rmesa->hw.vpt.cmd[R300_VPT_YOFFSET] != r300PackFloat32(ty))
{
/* Note: this should also modify whatever data the context reset
* code uses...
*/
R300_STATECHANGE( rmesa, vpt );
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] = r300PackFloat32(tx);
- rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] = r300PackFloat32(ty);
+ rmesa->hw.vpt.cmd[R300_VPT_XOFFSET] = r300PackFloat32(tx);
+ rmesa->hw.vpt.cmd[R300_VPT_YOFFSET] = r300PackFloat32(ty);
}
@@ -2186,12 +2185,12 @@ void r300InitState(r300ContextPtr r300)
switch (ctx->Visual.depthBits) {
case 16:
r300->state.depth.scale = 1.0 / (GLfloat) 0xffff;
- depth_fmt = R200_DEPTH_FORMAT_16BIT_INT_Z;
+ depth_fmt = R300_DEPTH_FORMAT_16BIT_INT_Z;
r300->state.stencil.clear = 0x00000000;
break;
case 24:
r300->state.depth.scale = 1.0 / (GLfloat) 0xffffff;
- depth_fmt = R200_DEPTH_FORMAT_24BIT_INT_Z;
+ depth_fmt = R300_DEPTH_FORMAT_24BIT_INT_Z;
r300->state.stencil.clear = 0x00ff0000;
break;
default:
diff --git a/src/mesa/drivers/dri/r300/r300_texmem.c b/src/mesa/drivers/dri/r300/r300_texmem.c
index c1d01020cdb..96973c00987 100644
--- a/src/mesa/drivers/dri/r300/r300_texmem.c
+++ b/src/mesa/drivers/dri/r300/r300_texmem.c
@@ -116,23 +116,23 @@ static void r300UploadGARTClientSubImage(r300ContextPtr rmesa,
*/
switch (texFormat->TexelBytes) {
case 1:
- blit_format = R200_CP_COLOR_FORMAT_CI8;
+ blit_format = R300_CP_COLOR_FORMAT_CI8;
srcPitch = t->image[0][0].width * texFormat->TexelBytes;
dstPitch = t->image[0][0].width * texFormat->TexelBytes;
break;
case 2:
- blit_format = R200_CP_COLOR_FORMAT_RGB565;
+ blit_format = R300_CP_COLOR_FORMAT_RGB565;
srcPitch = t->image[0][0].width * texFormat->TexelBytes;
dstPitch = t->image[0][0].width * texFormat->TexelBytes;
break;
case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
+ blit_format = R300_CP_COLOR_FORMAT_ARGB8888;
srcPitch = t->image[0][0].width * texFormat->TexelBytes;
dstPitch = t->image[0][0].width * texFormat->TexelBytes;
break;
case 8:
case 16:
- blit_format = R200_CP_COLOR_FORMAT_CI8;
+ blit_format = R300_CP_COLOR_FORMAT_CI8;
srcPitch = t->image[0][0].width * texFormat->TexelBytes;
dstPitch = t->image[0][0].width * texFormat->TexelBytes;
break;
@@ -179,17 +179,17 @@ static void r300UploadRectSubImage(r300ContextPtr rmesa,
switch (texFormat->TexelBytes) {
case 1:
- blit_format = R200_CP_COLOR_FORMAT_CI8;
+ blit_format = R300_CP_COLOR_FORMAT_CI8;
break;
case 2:
- blit_format = R200_CP_COLOR_FORMAT_RGB565;
+ blit_format = R300_CP_COLOR_FORMAT_RGB565;
break;
case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
+ blit_format = R300_CP_COLOR_FORMAT_ARGB8888;
break;
case 8:
case 16:
- blit_format = R200_CP_COLOR_FORMAT_CI8;
+ blit_format = R300_CP_COLOR_FORMAT_CI8;
break;
default:
return;
@@ -457,8 +457,8 @@ static void uploadSubImage( r300ContextPtr rmesa, r300TexObjPtr t,
needed (only with dxt1 since 2 dxt3/dxt5 blocks already use 32 Byte). */
/* set tex.height to 1/4 since 1 "macropixel" (dxt-block) has 4 real pixels. Needed
so the kernel module reads the right amount of data. */
- tex.format = R200_TXFORMAT_I8; /* any 1-byte texel format */
- tex.pitch = (BLIT_WIDTH_BYTES / 64);
+ tex.format = RADEON_TXFORMAT_I8; /* any 1-byte texel format */
+ tex.pitch = (R300_BLIT_WIDTH_BYTES / 64);
tex.height = (imageHeight + 3) / 4;
tex.width = (imageWidth + 3) / 4;
if ((t->format & R300_TX_FORMAT_DXT1) == R300_TX_FORMAT_DXT1)
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index b76e3490de7..c4a1bf01b4c 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -47,64 +47,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_tex.h"
#include "r300_reg.h"
-#define R200_TXFORMAT_A8 R200_TXFORMAT_I8
-#define R200_TXFORMAT_L8 R200_TXFORMAT_I8
-#define R200_TXFORMAT_AL88 R200_TXFORMAT_AI88
-#define R200_TXFORMAT_YCBCR R200_TXFORMAT_YVYU422
-#define R200_TXFORMAT_YCBCR_REV R200_TXFORMAT_VYUY422
-#define R200_TXFORMAT_RGB_DXT1 R200_TXFORMAT_DXT1
-#define R200_TXFORMAT_RGBA_DXT1 R200_TXFORMAT_DXT1
-#define R200_TXFORMAT_RGBA_DXT3 R200_TXFORMAT_DXT23
-#define R200_TXFORMAT_RGBA_DXT5 R200_TXFORMAT_DXT45
-
-#define _COLOR(f) \
- [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, 0 }
-#define _COLOR_REV(f) \
- [ MESA_FORMAT_ ## f ## _REV ] = { R200_TXFORMAT_ ## f, 0 }
-#define _ALPHA(f) \
- [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f | R200_TXFORMAT_ALPHA_IN_MAP, 0 }
-#define _ALPHA_REV(f) \
- [ MESA_FORMAT_ ## f ## _REV ] = { R200_TXFORMAT_ ## f | R200_TXFORMAT_ALPHA_IN_MAP, 0 }
-#define _YUV(f) \
- [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, R200_YUV_TO_RGB }
-#define _INVALID(f) \
- [ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 }
-#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_RGBA_DXT5 \
- || ((f) >= MESA_FORMAT_RGBA_FLOAT32 && (f) <= MESA_FORMAT_INTENSITY_FLOAT16)) \
- && tx_table[f].flag )
-
-#define _ASSIGN(entry, format) \
- [ MESA_FORMAT_ ## entry ] = { format, 0, 1}
-static const struct {
- GLuint format, filter;
-} tx_table0[] = {
- _ALPHA(RGBA8888),
- _ALPHA_REV(RGBA8888),
- _ALPHA(ARGB8888),
- _ALPHA_REV(ARGB8888),
- _INVALID(RGB888),
- _COLOR(RGB565),
- _COLOR_REV(RGB565),
- _ALPHA(ARGB4444),
- _ALPHA_REV(ARGB4444),
- _ALPHA(ARGB1555),
- _ALPHA_REV(ARGB1555),
- _ALPHA(AL88),
- _ALPHA_REV(AL88),
- _ALPHA(A8),
- _COLOR(L8),
- _ALPHA(I8),
- _INVALID(CI8),
- _YUV(YCBCR),
- _YUV(YCBCR_REV),
- _INVALID(RGB_FXT1),
- _INVALID(RGBA_FXT1),
- _COLOR(RGB_DXT1),
- _ALPHA(RGBA_DXT1),
- _ALPHA(RGBA_DXT3),
- _ALPHA(RGBA_DXT5),
- };
+#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_RGBA_DXT5 \
+ || ((f) >= MESA_FORMAT_RGBA_FLOAT32 && \
+ (f) <= MESA_FORMAT_INTENSITY_FLOAT16)) \
+ && tx_table[f].flag )
+
+#define _ASSIGN(entry, format) \
+ [ MESA_FORMAT_ ## entry ] = { format, 0, 1}
static const struct {
GLuint format, filter, flag;
@@ -156,9 +106,6 @@ static const struct {
_ASSIGN(INTENSITY_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, X, FL_I16)),
};
-#undef _COLOR
-#undef _ALPHA
-#undef _INVALID
#undef _ASSIGN
@@ -186,18 +133,12 @@ static void r300SetTexImages(r300ContextPtr rmesa,
/* Set the hardware texture format
*/
-
- t->format &= ~(R200_TXFORMAT_FORMAT_MASK |
- R200_TXFORMAT_ALPHA_IN_MAP);
-
if (VALID_FORMAT(baseImage->TexFormat->MesaFormat) &&
tx_table[baseImage->TexFormat->MesaFormat].flag) {
t->format =
tx_table[baseImage->TexFormat->MesaFormat].format;
-#if 1
t->filter |=
tx_table[baseImage->TexFormat->MesaFormat].filter;
-#endif
} else {
_mesa_problem(NULL, "unexpected texture format in %s",
__FUNCTION__);
@@ -208,7 +149,6 @@ static void r300SetTexImages(r300ContextPtr rmesa,
/* Compute which mipmap levels we really want to send to the hardware.
*/
-
driCalculateTextureFirstLastLevel((driTextureObject *) t);
log2Width = tObj->Image[0][t->base.firstLevel]->WidthLog2;
log2Height = tObj->Image[0][t->base.firstLevel]->HeightLog2;
@@ -223,7 +163,7 @@ static void r300SetTexImages(r300ContextPtr rmesa,
* memory organized as a rectangle of width BLIT_WIDTH_BYTES.
*/
curOffset = 0;
- blitWidth = BLIT_WIDTH_BYTES;
+ blitWidth = R300_BLIT_WIDTH_BYTES;
t->tile_bits = 0;
/* figure out if this texture is suitable for tiling. */
@@ -311,16 +251,16 @@ static void r300SetTexImages(r300ContextPtr rmesa,
t->image[0][i].width = MIN2(size / texelBytes, blitWidth);
t->image[0][i].height = (size / texelBytes) / t->image[0][i].width;
} else {
- t->image[0][i].x = curOffset % BLIT_WIDTH_BYTES;
- t->image[0][i].y = curOffset / BLIT_WIDTH_BYTES;
- t->image[0][i].width = MIN2(size, BLIT_WIDTH_BYTES);
+ t->image[0][i].x = curOffset % R300_BLIT_WIDTH_BYTES;
+ t->image[0][i].y = curOffset / R300_BLIT_WIDTH_BYTES;
+ t->image[0][i].width = MIN2(size, R300_BLIT_WIDTH_BYTES);
t->image[0][i].height = size / t->image[0][i].width;
}
#if 0
/* for debugging only and only applicable to non-rectangle targets */
assert(size % t->image[0][i].width == 0);
assert(t->image[0][i].x == 0
- || (size < BLIT_WIDTH_BYTES
+ || (size < R300_BLIT_WIDTH_BYTES
&& t->image[0][i].height == 1));
#endif
@@ -367,7 +307,7 @@ static void r300SetTexImages(r300ContextPtr rmesa,
t->format |= ((log2Width << R200_TXFORMAT_WIDTH_SHIFT) |
(log2Height << R200_TXFORMAT_HEIGHT_SHIFT));
#endif
-
+#if 0
t->format_x &= ~(R200_DEPTH_LOG2_MASK | R200_TEXCOORD_MASK);
if (tObj->Target == GL_TEXTURE_3D) {
t->format_x |= (log2Depth << R200_DEPTH_LOG2_SHIFT);
@@ -386,6 +326,11 @@ static void r300SetTexImages(r300ContextPtr rmesa,
(log2Width << R200_FACE_WIDTH_4_SHIFT) |
(log2Height << R200_FACE_HEIGHT_4_SHIFT));
}
+#endif
+ if (tObj->Target == GL_TEXTURE_CUBE_MAP) {
+ ASSERT(log2Width == log2Height);
+ t->format |= R300_TX_FORMAT_CUBIC_MAP;
+ }
t->size = (((tObj->Image[0][t->base.firstLevel]->Width - 1) << R300_TX_WIDTHMASK_SHIFT)
|((tObj->Image[0][t->base.firstLevel]->Height - 1) << R300_TX_HEIGHTMASK_SHIFT))
@@ -452,11 +397,12 @@ static GLboolean enable_tex_3d(GLcontext * ctx, int unit)
/* Need to load the 3d images associated with this unit.
*/
+#if 0
if (t->format & R200_TXFORMAT_NON_POWER2) {
t->format &= ~R200_TXFORMAT_NON_POWER2;
t->base.dirty_images[0] = ~0;
}
-
+#endif
ASSERT(tObj->Target == GL_TEXTURE_3D);
/* R100 & R200 do not support mipmaps for 3D textures.
@@ -487,12 +433,13 @@ static GLboolean enable_tex_cube(GLcontext * ctx, int unit)
/* Need to load the 2d images associated with this unit.
*/
+#if 0
if (t->format & R200_TXFORMAT_NON_POWER2) {
t->format &= ~R200_TXFORMAT_NON_POWER2;
for (face = 0; face < 6; face++)
t->base.dirty_images[face] = ~0;
}
-
+#endif
ASSERT(tObj->Target == GL_TEXTURE_CUBE_MAP);
if (t->base.dirty_images[0] || t->base.dirty_images[1] ||
@@ -571,10 +518,6 @@ static GLboolean update_tex_common(GLcontext * ctx, int unit)
driUpdateTextureLRU((driTextureObject *) t); /* XXX: should be locked! */
}
-#if R200_MERGED
- FALLBACK(&rmesa->radeon, RADEON_FALLBACK_BORDER_MODE, t->border_fallback);
-#endif
-
return !t->border_fallback;
}
@@ -618,8 +561,4 @@ void r300UpdateTextureState(GLcontext * ctx)
r300UpdateTextureUnit(ctx, 6) &&
r300UpdateTextureUnit(ctx, 7)
);
-
-#if R200_MERGED
- FALLBACK(&rmesa->radeon, RADEON_FALLBACK_TEXTURE, !ok);
-#endif
}
diff --git a/src/mesa/drivers/dri/r300/radeon_context.h b/src/mesa/drivers/dri/r300/radeon_context.h
index 4eeb4edcfd4..0ec6466e441 100644
--- a/src/mesa/drivers/dri/r300/radeon_context.h
+++ b/src/mesa/drivers/dri/r300/radeon_context.h
@@ -40,6 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_screen.h"
#include "drm.h"
#include "dri_util.h"
+#include "colormac.h"
struct radeon_context;
typedef struct radeon_context radeonContextRec;
diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.c b/src/mesa/drivers/dri/r300/radeon_ioctl.c
index 6a473e3bd64..d5b53194189 100644
--- a/src/mesa/drivers/dri/r300/radeon_ioctl.c
+++ b/src/mesa/drivers/dri/r300/radeon_ioctl.c
@@ -183,10 +183,7 @@ void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv,
(void *)radeon->glCtx);
}
- if (IS_R200_CLASS(radeon->radeonScreen))
- R200_FIREVERTICES((r200ContextPtr)radeon);
- else
- r300Flush(radeon->glCtx);
+ r300Flush(radeon->glCtx);
LOCK_HARDWARE(radeon);
@@ -283,10 +280,7 @@ void radeonPageFlip(const __DRIdrawablePrivate * dPriv)
radeon->sarea->pfCurrentPage);
}
- if (IS_R200_CLASS(radeon->radeonScreen))
- R200_FIREVERTICES((r200ContextPtr)radeon);
- else
- r300Flush(radeon->glCtx);
+ r300Flush(radeon->glCtx);
LOCK_HARDWARE(radeon);
if (!dPriv->numClipRects) {
diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.h b/src/mesa/drivers/dri/r300/radeon_ioctl.h
index b53767510e8..3a80d36c622 100644
--- a/src/mesa/drivers/dri/r300/radeon_ioctl.h
+++ b/src/mesa/drivers/dri/r300/radeon_ioctl.h
@@ -41,7 +41,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xf86drm.h"
#include "drm.h"
+#if 0
#include "r200_context.h"
+#endif
#include "radeon_drm.h"
extern void radeonCopyBuffer(const __DRIdrawablePrivate * drawable,
diff --git a/src/mesa/drivers/dri/r300/radeon_lock.h b/src/mesa/drivers/dri/r300/radeon_lock.h
index c7c75ae862a..632329fde1e 100644
--- a/src/mesa/drivers/dri/r300/radeon_lock.h
+++ b/src/mesa/drivers/dri/r300/radeon_lock.h
@@ -35,7 +35,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef __RADEON_LOCK_H__
#define __RADEON_LOCK_H__
+#if 0
#include "r200_ioctl.h"
+#endif
+#include "radeon_context.h"
extern void radeonGetLock(radeonContextPtr radeon, GLuint flags);
diff --git a/src/mesa/drivers/dri/r300/radeon_state.c b/src/mesa/drivers/dri/r300/radeon_state.c
index c95ae8df4f0..a6375ff878f 100644
--- a/src/mesa/drivers/dri/r300/radeon_state.c
+++ b/src/mesa/drivers/dri/r300/radeon_state.c
@@ -140,10 +140,7 @@ static void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h
if (ctx->Scissor.Enabled) {
/* We don't pipeline cliprect changes */
- if (IS_R200_CLASS(radeon->radeonScreen))
- R200_FIREVERTICES((r200ContextPtr)radeon);
- else
- r300Flush(ctx);
+ r300Flush(ctx);
radeonUpdateScissor(ctx);
}
@@ -196,10 +193,7 @@ void radeonEnable(GLcontext* ctx, GLenum cap, GLboolean state)
switch(cap) {
case GL_SCISSOR_TEST:
/* We don't pipeline cliprect & scissor changes */
- if (IS_R200_CLASS(radeon->radeonScreen))
- R200_FIREVERTICES((r200ContextPtr)radeon);
- else
- r300Flush(ctx);
+ r300Flush(ctx);
radeon->state.scissor.enabled = state;
radeonUpdateScissor(ctx);