From 3996ed555e0a024051e4d161c8d31b2530d8cdc5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 20 Oct 2011 15:15:34 -0700 Subject: [PATCH] radeon: Unifdef RADEON_R300 and RADEON_R600. --- src/mesa/drivers/dri/radeon/radeon_screen.c | 118 ----- src/mesa/drivers/dri/radeon/radeon_span.c | 510 +------------------ src/mesa/drivers/dri/radeon/radeon_texture.c | 14 - 3 files changed, 6 insertions(+), 636 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 3805fc62fae..6cfb1637f85 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -55,13 +55,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #elif defined(RADEON_R200) #include "r200_context.h" #include "r200_tex.h" -#elif defined(RADEON_R300) -#include "r300_context.h" -#include "r300_tex.h" -#elif defined(RADEON_R600) -#include "r600_context.h" -#include "r700_driconf.h" /* +r6/r7 */ -#include "r600_tex.h" /* +r6/r7 */ #endif #include "utils.h" @@ -140,77 +133,6 @@ DRI_CONF_BEGIN DRI_CONF_END; static const GLuint __driNConfigOptions = 17; -#elif defined(RADEON_R300) || defined(RADEON_R600) - -#define DRI_CONF_FP_OPTIMIZATION_SPEED 0 -#define DRI_CONF_FP_OPTIMIZATION_QUALITY 1 - -/* TODO: integrate these into xmlpool.h! */ -#define DRI_CONF_MAX_TEXTURE_IMAGE_UNITS(def,min,max) \ -DRI_CONF_OPT_BEGIN_V(texture_image_units,int,def, # min ":" # max ) \ - DRI_CONF_DESC(en,"Number of texture image units") \ - DRI_CONF_DESC(de,"Anzahl der Textureinheiten") \ -DRI_CONF_OPT_END - -#define DRI_CONF_MAX_TEXTURE_COORD_UNITS(def,min,max) \ -DRI_CONF_OPT_BEGIN_V(texture_coord_units,int,def, # min ":" # max ) \ - DRI_CONF_DESC(en,"Number of texture coordinate units") \ - DRI_CONF_DESC(de,"Anzahl der Texturkoordinateneinheiten") \ -DRI_CONF_OPT_END - - - -#define DRI_CONF_DISABLE_S3TC(def) \ -DRI_CONF_OPT_BEGIN(disable_s3tc,bool,def) \ - DRI_CONF_DESC(en,"Disable S3TC compression") \ -DRI_CONF_OPT_END - -#define DRI_CONF_DISABLE_FALLBACK(def) \ -DRI_CONF_OPT_BEGIN(disable_lowimpact_fallback,bool,def) \ - DRI_CONF_DESC(en,"Disable Low-impact fallback") \ -DRI_CONF_OPT_END - -#define DRI_CONF_DISABLE_DOUBLE_SIDE_STENCIL(def) \ -DRI_CONF_OPT_BEGIN(disable_stencil_two_side,bool,def) \ - DRI_CONF_DESC(en,"Disable GL_EXT_stencil_two_side") \ -DRI_CONF_OPT_END - -#define DRI_CONF_FP_OPTIMIZATION(def) \ -DRI_CONF_OPT_BEGIN_V(fp_optimization,enum,def,"0:1") \ - DRI_CONF_DESC_BEGIN(en,"Fragment Program optimization") \ - DRI_CONF_ENUM(0,"Optimize for Speed") \ - DRI_CONF_ENUM(1,"Optimize for Quality") \ - DRI_CONF_DESC_END \ -DRI_CONF_OPT_END - -PUBLIC const char __driConfigOptions[] = -DRI_CONF_BEGIN - DRI_CONF_SECTION_PERFORMANCE - DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN) - DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS) - DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) - DRI_CONF_MAX_TEXTURE_IMAGE_UNITS(8, 2, 8) - DRI_CONF_MAX_TEXTURE_COORD_UNITS(8, 2, 8) - DRI_CONF_COMMAND_BUFFER_SIZE(8, 8, 32) - DRI_CONF_DISABLE_FALLBACK(true) - DRI_CONF_DISABLE_DOUBLE_SIDE_STENCIL(false) - DRI_CONF_SECTION_END - DRI_CONF_SECTION_QUALITY - DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB) - DRI_CONF_DEF_MAX_ANISOTROPY(1.0, "1.0,2.0,4.0,8.0,16.0") - DRI_CONF_FORCE_S3TC_ENABLE(false) - DRI_CONF_DISABLE_S3TC(false) - DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER) - DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC) - DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF) - DRI_CONF_FP_OPTIMIZATION(DRI_CONF_FP_OPTIMIZATION_SPEED) - DRI_CONF_SECTION_END - DRI_CONF_SECTION_DEBUG - DRI_CONF_NO_RAST(false) - DRI_CONF_SECTION_END -DRI_CONF_END; -static const GLuint __driNConfigOptions = 17; - #endif static int getSwapInfo( __DRIdrawable *dPriv, __DRIswapInfo * sInfo ); @@ -281,32 +203,6 @@ static const __DRItexBufferExtension r200TexBufferExtension = { }; #endif -#if defined(RADEON_R300) -static const __DRItexOffsetExtension r300texOffsetExtension = { - { __DRI_TEX_OFFSET, __DRI_TEX_OFFSET_VERSION }, - r300SetTexOffset, -}; - -static const __DRItexBufferExtension r300TexBufferExtension = { - { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION }, - r300SetTexBuffer, - r300SetTexBuffer2, -}; -#endif - -#if defined(RADEON_R600) -static const __DRItexOffsetExtension r600texOffsetExtension = { - { __DRI_TEX_OFFSET, __DRI_TEX_OFFSET_VERSION }, - r600SetTexOffset, /* +r6/r7 */ -}; - -static const __DRItexBufferExtension r600TexBufferExtension = { - { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION }, - r600SetTexBuffer, /* +r6/r7 */ - r600SetTexBuffer2, /* +r6/r7 */ -}; -#endif - static void radeonDRI2Flush(__DRIdrawable *drawable) { @@ -1403,14 +1299,6 @@ radeonCreateScreen2(__DRIscreen *sPriv) screen->extensions[i++] = &r200TexBufferExtension.base; #endif -#if defined(RADEON_R300) - screen->extensions[i++] = &r300TexBufferExtension.base; -#endif - -#if defined(RADEON_R600) - screen->extensions[i++] = &r600TexBufferExtension.base; -#endif - screen->extensions[i++] = &radeonFlushExtension.base; screen->extensions[i++] = &radeonImageExtension.base; @@ -1691,12 +1579,6 @@ const struct __DriverAPIRec driDriverAPI = { #if defined(RADEON_R200) .CreateContext = r200CreateContext, .DestroyContext = r200DestroyContext, -#elif defined(RADEON_R600) - .CreateContext = r600CreateContext, - .DestroyContext = radeonDestroyContext, -#elif defined(RADEON_R300) - .CreateContext = r300CreateContext, - .DestroyContext = radeonDestroyContext, #else .CreateContext = r100CreateContext, .DestroyContext = radeonDestroyContext, diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 8c6f2e49a5c..9d88ce98f09 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -118,324 +118,6 @@ static GLubyte *r200_depth_4byte(const struct radeon_renderbuffer * rrb, } #endif -/* r600 tiling - * two main types: - * - 1D (akin to macro-linear/micro-tiled on older asics) - * - 2D (akin to macro-tiled/micro-tiled on older asics) - */ -#if defined(RADEON_R600) -static inline GLint r600_1d_tile_helper(const struct radeon_renderbuffer * rrb, - GLint x, GLint y, GLint is_depth, GLint is_stencil) -{ - GLint element_bytes = rrb->cpp; - GLint num_samples = 1; - GLint tile_width = 8; - GLint tile_height = 8; - GLint tile_thickness = 1; - GLint pitch_elements = rrb->pitch / element_bytes; - GLint height = rrb->base.Height; - GLint z = 0; - GLint sample_number = 0; - /* */ - GLint tile_bytes; - GLint tiles_per_row; - GLint tiles_per_slice; - GLint slice_offset; - GLint tile_row_index; - GLint tile_column_index; - GLint tile_offset; - GLint pixel_number = 0; - GLint element_offset; - GLint offset = 0; - - tile_bytes = tile_width * tile_height * tile_thickness * element_bytes * num_samples; - tiles_per_row = pitch_elements / tile_width; - tiles_per_slice = tiles_per_row * (height / tile_height); - slice_offset = (z / tile_thickness) * tiles_per_slice * tile_bytes; - tile_row_index = y / tile_height; - tile_column_index = x / tile_width; - tile_offset = ((tile_row_index * tiles_per_row) + tile_column_index) * tile_bytes; - - if (is_depth) { - GLint pixel_offset = 0; - - pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0] - pixel_number |= ((y >> 0) & 1) << 1; // pn[1] = y[0] - pixel_number |= ((x >> 1) & 1) << 2; // pn[2] = x[1] - pixel_number |= ((y >> 1) & 1) << 3; // pn[3] = y[1] - pixel_number |= ((x >> 2) & 1) << 4; // pn[4] = x[2] - pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2] - switch (element_bytes) { - case 2: - pixel_offset = pixel_number * element_bytes * num_samples; - break; - case 4: - /* stencil and depth data are stored separately within a tile. - * stencil is stored in a contiguous tile before the depth tile. - * stencil element is 1 byte, depth element is 3 bytes. - * stencil tile is 64 bytes. - */ - if (is_stencil) - pixel_offset = pixel_number * 1 * num_samples; - else - pixel_offset = (pixel_number * 3 * num_samples) + 64; - break; - } - element_offset = pixel_offset + (sample_number * element_bytes); - } else { - GLint sample_offset; - - switch (element_bytes) { - case 1: - pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0] - pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1] - pixel_number |= ((x >> 2) & 1) << 2; // pn[2] = x[2] - pixel_number |= ((y >> 1) & 1) << 3; // pn[3] = y[1] - pixel_number |= ((y >> 0) & 1) << 4; // pn[4] = y[0] - pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2] - break; - case 2: - pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0] - pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1] - pixel_number |= ((x >> 2) & 1) << 2; // pn[2] = x[2] - pixel_number |= ((y >> 0) & 1) << 3; // pn[3] = y[0] - pixel_number |= ((y >> 1) & 1) << 4; // pn[4] = y[1] - pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2] - break; - case 4: - pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0] - pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1] - pixel_number |= ((y >> 0) & 1) << 2; // pn[2] = y[0] - pixel_number |= ((x >> 2) & 1) << 3; // pn[3] = x[2] - pixel_number |= ((y >> 1) & 1) << 4; // pn[4] = y[1] - pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2] - break; - } - sample_offset = sample_number * (tile_bytes / num_samples); - element_offset = sample_offset + (pixel_number * element_bytes); - } - offset = slice_offset + tile_offset + element_offset; - return offset; -} - -static inline GLint r600_log2(GLint n) -{ - GLint log2 = 0; - - while (n >>= 1) - ++log2; - return log2; -} - -static inline GLint r600_2d_tile_helper(const struct radeon_renderbuffer * rrb, - GLint x, GLint y, GLint is_depth, GLint is_stencil) -{ - GLint group_bytes = rrb->group_bytes; - GLint num_channels = rrb->num_channels; - GLint num_banks = rrb->num_banks; - GLint r7xx_bank_op = rrb->r7xx_bank_op; - /* */ - GLint group_bits = r600_log2(group_bytes); - GLint channel_bits = r600_log2(num_channels); - GLint bank_bits = r600_log2(num_banks); - GLint element_bytes = rrb->cpp; - GLint num_samples = 1; - GLint tile_width = 8; - GLint tile_height = 8; - GLint tile_thickness = 1; - GLint macro_tile_width = num_banks; - GLint macro_tile_height = num_channels; - GLint pitch_elements = (rrb->pitch / element_bytes) / tile_width; - GLint height = rrb->base.Height / tile_height; - GLint z = 0; - GLint sample_number = 0; - /* */ - GLint tile_bytes; - GLint macro_tile_bytes; - GLint macro_tiles_per_row; - GLint macro_tiles_per_slice; - GLint slice_offset; - GLint macro_tile_row_index; - GLint macro_tile_column_index; - GLint macro_tile_offset; - GLint pixel_number = 0; - GLint element_offset; - GLint bank = 0; - GLint channel = 0; - GLint total_offset; - GLint group_mask = (1 << group_bits) - 1; - GLint offset_low; - GLint offset_high; - GLint offset = 0; - - switch (num_channels) { - case 2: - default: - // channel[0] = x[3] ^ y[3] - channel |= (((x >> 3) ^ (y >> 3)) & 1) << 0; - break; - case 4: - // channel[0] = x[4] ^ y[3] - channel |= (((x >> 4) ^ (y >> 3)) & 1) << 0; - // channel[1] = x[3] ^ y[4] - channel |= (((x >> 3) ^ (y >> 4)) & 1) << 1; - break; - case 8: - // channel[0] = x[5] ^ y[3] - channel |= (((x >> 5) ^ (y >> 3)) & 1) << 0; - // channel[0] = x[4] ^ x[5] ^ y[4] - channel |= (((x >> 4) ^ (x >> 5) ^ (y >> 4)) & 1) << 1; - // channel[0] = x[3] ^ y[5] - channel |= (((x >> 3) ^ (y >> 5)) & 1) << 2; - break; - } - - switch (num_banks) { - case 4: - // bank[0] = x[3] ^ y[4 + log2(num_channels)] - bank |= (((x >> 3) ^ (y >> (4 + channel_bits))) & 1) << 0; - if (r7xx_bank_op) - // bank[1] = x[3] ^ y[4 + log2(num_channels)] ^ x[5] - bank |= (((x >> 4) ^ (y >> (3 + channel_bits)) ^ (x >> 5)) & 1) << 1; - else - // bank[1] = x[4] ^ y[3 + log2(num_channels)] - bank |= (((x >> 4) ^ (y >> (3 + channel_bits))) & 1) << 1; - break; - case 8: - // bank[0] = x[3] ^ y[5 + log2(num_channels)] - bank |= (((x >> 3) ^ (y >> (5 + channel_bits))) & 1) << 0; - // bank[1] = x[4] ^ y[4 + log2(num_channels)] ^ y[5 + log2(num_channels)] - bank |= (((x >> 4) ^ (y >> (4 + channel_bits)) ^ (y >> (5 + channel_bits))) & 1) << 1; - if (r7xx_bank_op) - // bank[2] = x[5] ^ y[3 + log2(num_channels)] ^ x[6] - bank |= (((x >> 5) ^ (y >> (3 + channel_bits)) ^ (x >> 6)) & 1) << 2; - else - // bank[2] = x[5] ^ y[3 + log2(num_channels)] - bank |= (((x >> 5) ^ (y >> (3 + channel_bits))) & 1) << 2; - break; - } - - tile_bytes = tile_width * tile_height * tile_thickness * element_bytes * num_samples; - macro_tile_bytes = macro_tile_width * macro_tile_height * tile_bytes; - macro_tiles_per_row = pitch_elements / macro_tile_width; - macro_tiles_per_slice = macro_tiles_per_row * (height / macro_tile_height); - slice_offset = (z / tile_thickness) * macro_tiles_per_slice * macro_tile_bytes; - macro_tile_row_index = (y / tile_height) / macro_tile_height; - macro_tile_column_index = (x / tile_width) / macro_tile_width; - macro_tile_offset = ((macro_tile_row_index * macro_tiles_per_row) + macro_tile_column_index) * macro_tile_bytes; - - if (is_depth) { - GLint pixel_offset = 0; - - pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0] - pixel_number |= ((y >> 0) & 1) << 1; // pn[1] = y[0] - pixel_number |= ((x >> 1) & 1) << 2; // pn[2] = x[1] - pixel_number |= ((y >> 1) & 1) << 3; // pn[3] = y[1] - pixel_number |= ((x >> 2) & 1) << 4; // pn[4] = x[2] - pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2] - switch (element_bytes) { - case 2: - pixel_offset = pixel_number * element_bytes * num_samples; - break; - case 4: - /* stencil and depth data are stored separately within a tile. - * stencil is stored in a contiguous tile before the depth tile. - * stencil element is 1 byte, depth element is 3 bytes. - * stencil tile is 64 bytes. - */ - if (is_stencil) - pixel_offset = pixel_number * 1 * num_samples; - else - pixel_offset = (pixel_number * 3 * num_samples) + 64; - break; - } - element_offset = pixel_offset + (sample_number * element_bytes); - } else { - GLint sample_offset; - - switch (element_bytes) { - case 1: - pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0] - pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1] - pixel_number |= ((x >> 2) & 1) << 2; // pn[2] = x[2] - pixel_number |= ((y >> 1) & 1) << 3; // pn[3] = y[1] - pixel_number |= ((y >> 0) & 1) << 4; // pn[4] = y[0] - pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2] - break; - case 2: - pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0] - pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1] - pixel_number |= ((x >> 2) & 1) << 2; // pn[2] = x[2] - pixel_number |= ((y >> 0) & 1) << 3; // pn[3] = y[0] - pixel_number |= ((y >> 1) & 1) << 4; // pn[4] = y[1] - pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2] - break; - case 4: - pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0] - pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1] - pixel_number |= ((y >> 0) & 1) << 2; // pn[2] = y[0] - pixel_number |= ((x >> 2) & 1) << 3; // pn[3] = x[2] - pixel_number |= ((y >> 1) & 1) << 4; // pn[4] = y[1] - pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2] - break; - } - sample_offset = sample_number * (tile_bytes / num_samples); - element_offset = sample_offset + (pixel_number * element_bytes); - } - total_offset = (slice_offset + macro_tile_offset) >> (channel_bits + bank_bits); - total_offset += element_offset; - - offset_low = total_offset & group_mask; - offset_high = (total_offset & ~group_mask) << (channel_bits + bank_bits); - offset = (bank << (group_bits + channel_bits)) + (channel << group_bits) + offset_low + offset_high; - - return offset; -} - -/* depth buffers */ -static GLubyte *r600_ptr_depth(const struct radeon_renderbuffer * rrb, - GLint x, GLint y) -{ - GLubyte *ptr = rrb->bo->ptr; - GLint offset; - if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE) - offset = r600_2d_tile_helper(rrb, x, y, 1, 0); - else - offset = r600_1d_tile_helper(rrb, x, y, 1, 0); - return &ptr[offset]; -} - -static GLubyte *r600_ptr_stencil(const struct radeon_renderbuffer * rrb, - GLint x, GLint y) -{ - GLubyte *ptr = rrb->bo->ptr; - GLint offset; - if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE) - offset = r600_2d_tile_helper(rrb, x, y, 1, 1); - else - offset = r600_1d_tile_helper(rrb, x, y, 1, 1); - return &ptr[offset]; -} - -static GLubyte *r600_ptr_color(const struct radeon_renderbuffer * rrb, - GLint x, GLint y) -{ - GLubyte *ptr = rrb->bo->ptr; - uint32_t mask = RADEON_BO_FLAGS_MACRO_TILE | RADEON_BO_FLAGS_MICRO_TILE; - GLint offset; - - if (rrb->has_surface || !(rrb->bo->flags & mask)) { - offset = x * rrb->cpp + y * rrb->pitch; - } else { - if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE) - offset = r600_2d_tile_helper(rrb, x, y, 0, 0); - else - offset = r600_1d_tile_helper(rrb, x, y, 0, 0); - } - return &ptr[offset]; -} - -#else /* radeon tiling on r300-r500 has 4 states, macro-linear/micro-linear @@ -528,8 +210,6 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, return &ptr[offset]; } -#endif - /* * Note that all information needed to access pixels in a renderbuffer * should be obtained through the gl_renderbuffer parameter, not per-context @@ -589,15 +269,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_RGB565 #define TAG2(x,y) radeon##x##_RGB565##y -#if defined(RADEON_R600) -#define GET_VALUE(_x, _y) (LE16_TO_CPU(*(GLushort*)(r600_ptr_color(rrb, _x + x_off, _y + y_off)))) -#define PUT_VALUE(_x, _y, d) { \ - GLushort *_ptr = (GLushort*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \ - *_ptr = CPU_TO_LE16(d); \ -} while (0) -#else #define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) -#endif #include "spantmp2.h" #define SPANTMP_PIXEL_FMT GL_RGB @@ -605,15 +277,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_RGB565_REV #define TAG2(x,y) radeon##x##_RGB565_REV##y -#if defined(RADEON_R600) -#define GET_VALUE(_x, _y) (LE16_TO_CPU(*(GLushort*)(r600_ptr_color(rrb, _x + x_off, _y + y_off)))) -#define PUT_VALUE(_x, _y, d) { \ - GLushort *_ptr = (GLushort*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \ - *_ptr = CPU_TO_LE16(d); \ -} while (0) -#else #define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) -#endif #include "spantmp2.h" /* 16 bit, ARGB1555 color spanline and pixel functions @@ -623,15 +287,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_ARGB1555 #define TAG2(x,y) radeon##x##_ARGB1555##y -#if defined(RADEON_R600) -#define GET_VALUE(_x, _y) (LE16_TO_CPU(*(GLushort*)(r600_ptr_color(rrb, _x + x_off, _y + y_off)))) -#define PUT_VALUE(_x, _y, d) { \ - GLushort *_ptr = (GLushort*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \ - *_ptr = CPU_TO_LE16(d); \ -} while (0) -#else #define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) -#endif #include "spantmp2.h" #define SPANTMP_PIXEL_FMT GL_BGRA @@ -639,15 +295,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_ARGB1555_REV #define TAG2(x,y) radeon##x##_ARGB1555_REV##y -#if defined(RADEON_R600) -#define GET_VALUE(_x, _y) (LE16_TO_CPU(*(GLushort*)(r600_ptr_color(rrb, _x + x_off, _y + y_off)))) -#define PUT_VALUE(_x, _y, d) { \ - GLushort *_ptr = (GLushort*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \ - *_ptr = CPU_TO_LE16(d); \ -} while (0) -#else #define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) -#endif #include "spantmp2.h" /* 16 bit, RGBA4 color spanline and pixel functions @@ -657,15 +305,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_ARGB4444 #define TAG2(x,y) radeon##x##_ARGB4444##y -#if defined(RADEON_R600) -#define GET_VALUE(_x, _y) (LE16_TO_CPU(*(GLushort*)(r600_ptr_color(rrb, _x + x_off, _y + y_off)))) -#define PUT_VALUE(_x, _y, d) { \ - GLushort *_ptr = (GLushort*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \ - *_ptr = CPU_TO_LE16(d); \ -} while (0) -#else #define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) -#endif #include "spantmp2.h" #define SPANTMP_PIXEL_FMT GL_BGRA @@ -673,15 +313,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_ARGB4444_REV #define TAG2(x,y) radeon##x##_ARGB4444_REV##y -#if defined(RADEON_R600) -#define GET_VALUE(_x, _y) (LE16_TO_CPU(*(GLushort*)(r600_ptr_color(rrb, _x + x_off, _y + y_off)))) -#define PUT_VALUE(_x, _y, d) { \ - GLushort *_ptr = (GLushort*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \ - *_ptr = CPU_TO_LE16(d); \ -} while (0) -#else #define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) -#endif #include "spantmp2.h" /* 32 bit, xRGB8888 color spanline and pixel functions @@ -691,19 +323,11 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_xRGB8888 #define TAG2(x,y) radeon##x##_xRGB8888##y -#if defined(RADEON_R600) -#define GET_VALUE(_x, _y) ((LE32_TO_CPU(*(GLuint*)(r600_ptr_color(rrb, _x + x_off, _y + y_off))) | 0xff000000)) -#define PUT_VALUE(_x, _y, d) { \ - GLuint *_ptr = (GLuint*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \ - *_ptr = CPU_TO_LE32(d); \ -} while (0) -#else #define GET_VALUE(_x, _y) ((*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) | 0xff000000)) #define PUT_VALUE(_x, _y, d) { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ *_ptr = d; \ } while (0) -#endif #include "spantmp2.h" /* 32 bit, ARGB8888 color spanline and pixel functions @@ -713,19 +337,11 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_ARGB8888 #define TAG2(x,y) radeon##x##_ARGB8888##y -#if defined(RADEON_R600) -#define GET_VALUE(_x, _y) (LE32_TO_CPU(*(GLuint*)(r600_ptr_color(rrb, _x + x_off, _y + y_off)))) -#define PUT_VALUE(_x, _y, d) { \ - GLuint *_ptr = (GLuint*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \ - *_ptr = CPU_TO_LE32(d); \ -} while (0) -#else #define GET_VALUE(_x, _y) (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))) #define PUT_VALUE(_x, _y, d) { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ *_ptr = d; \ } while (0) -#endif #include "spantmp2.h" /* 32 bit, BGRx8888 color spanline and pixel functions @@ -735,19 +351,11 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_BGRx8888 #define TAG2(x,y) radeon##x##_BGRx8888##y -#if defined(RADEON_R600) -#define GET_VALUE(_x, _y) ((LE32_TO_CPU(*(GLuint*)(r600_ptr_color(rrb, _x + x_off, _y + y_off))) | 0x000000ff)) -#define PUT_VALUE(_x, _y, d) { \ - GLuint *_ptr = (GLuint*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \ - *_ptr = CPU_TO_LE32(d); \ -} while (0) -#else #define GET_VALUE(_x, _y) ((*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) | 0x000000ff)) #define PUT_VALUE(_x, _y, d) { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ *_ptr = d; \ } while (0) -#endif #include "spantmp2.h" /* 32 bit, BGRA8888 color spanline and pixel functions @@ -757,15 +365,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_BGRA8888 #define TAG2(x,y) radeon##x##_BGRA8888##y -#if defined(RADEON_R600) -#define GET_VALUE(_x, _y) (LE32_TO_CPU(*(GLuint*)(r600_ptr_color(rrb, _x + x_off, _y + y_off)))) -#define PUT_VALUE(_x, _y, d) { \ - GLuint *_ptr = (GLuint*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \ - *_ptr = CPU_TO_LE32(d); \ -} while (0) -#else #define GET_PTR(X,Y) radeon_ptr_4byte(rrb, (X) + x_off, (Y) + y_off) -#endif #include "spantmp2.h" /* ================================================================ @@ -789,9 +389,6 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #if defined(RADEON_R200) #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)r200_depth_2byte(rrb, _x + x_off, _y + y_off) = d -#elif defined(RADEON_R600) -#define WRITE_DEPTH( _x, _y, d ) \ - *(GLushort *)r600_ptr_depth(rrb, _x + x_off, _y + y_off) = CPU_TO_LE16(d) #else #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)radeon_ptr_2byte_8x2(rrb, _x + x_off, _y + y_off) = d @@ -800,9 +397,6 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #if defined(RADEON_R200) #define READ_DEPTH( d, _x, _y ) \ d = *(GLushort *)r200_depth_2byte(rrb, _x + x_off, _y + y_off) -#elif defined(RADEON_R600) -#define READ_DEPTH( d, _x, _y ) \ - d = LE16_TO_CPU(*(GLushort *)r600_ptr_depth(rrb, _x + x_off, _y + y_off)) #else #define READ_DEPTH( d, _x, _y ) \ d = *(GLushort *)radeon_ptr_2byte_8x2(rrb, _x + x_off, _y + y_off) @@ -818,25 +412,7 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, */ #define VALUE_TYPE GLuint -#if defined(RADEON_R300) -#define WRITE_DEPTH( _x, _y, d ) \ -do { \ - GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ - GLuint tmp = LE32_TO_CPU(*_ptr); \ - tmp &= 0x000000ff; \ - tmp |= ((d << 8) & 0xffffff00); \ - *_ptr = CPU_TO_LE32(tmp); \ -} while (0) -#elif defined(RADEON_R600) -#define WRITE_DEPTH( _x, _y, d ) \ -do { \ - GLuint *_ptr = (GLuint*)r600_ptr_depth( rrb, _x + x_off, _y + y_off ); \ - GLuint tmp = LE32_TO_CPU(*_ptr); \ - tmp &= 0xff000000; \ - tmp |= ((d) & 0x00ffffff); \ - *_ptr = CPU_TO_LE32(tmp); \ -} while (0) -#elif defined(RADEON_R200) +#if defined(RADEON_R200) #define WRITE_DEPTH( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)r200_depth_4byte( rrb, _x + x_off, _y + y_off ); \ @@ -856,17 +432,7 @@ do { \ } while (0) #endif -#if defined(RADEON_R300) -#define READ_DEPTH( d, _x, _y ) \ - do { \ - d = (LE32_TO_CPU(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))) & 0xffffff00) >> 8; \ - }while(0) -#elif defined(RADEON_R600) -#define READ_DEPTH( d, _x, _y ) \ - do { \ - d = (LE32_TO_CPU(*(GLuint*)(r600_ptr_depth(rrb, _x + x_off, _y + y_off))) & 0x00ffffff); \ - }while(0) -#elif defined(RADEON_R200) +#if defined(RADEON_R200) #define READ_DEPTH( d, _x, _y ) \ do { \ d = LE32_TO_CPU(*(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off))) & 0x00ffffff; \ @@ -887,27 +453,7 @@ do { \ */ #define VALUE_TYPE GLuint -#if defined(RADEON_R300) -#define WRITE_DEPTH( _x, _y, d ) \ -do { \ - GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ - *_ptr = CPU_TO_LE32((((d) & 0xff000000) >> 24) | (((d) & 0x00ffffff) << 8)); \ -} while (0) -#elif defined(RADEON_R600) -#define WRITE_DEPTH( _x, _y, d ) \ -do { \ - GLuint *_ptr = (GLuint*)r600_ptr_depth( rrb, _x + x_off, _y + y_off ); \ - GLuint tmp = LE32_TO_CPU(*_ptr); \ - tmp &= 0xff000000; \ - tmp |= ((d) & 0x00ffffff); \ - *_ptr = CPU_TO_LE32(tmp); \ - _ptr = (GLuint*)r600_ptr_stencil(rrb, _x + x_off, _y + y_off); \ - tmp = LE32_TO_CPU(*_ptr); \ - tmp &= 0xffffff00; \ - tmp |= ((d) >> 24) & 0xff; \ - *_ptr = CPU_TO_LE32(tmp); \ -} while (0) -#elif defined(RADEON_R200) +#if defined(RADEON_R200) #define WRITE_DEPTH( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)r200_depth_4byte( rrb, _x + x_off, _y + y_off ); \ @@ -921,19 +467,7 @@ do { \ } while (0) #endif -#if defined(RADEON_R300) -#define READ_DEPTH( d, _x, _y ) \ - do { \ - GLuint tmp = (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \ - d = LE32_TO_CPU(((tmp & 0x000000ff) << 24) | ((tmp & 0xffffff00) >> 8)); \ - }while(0) -#elif defined(RADEON_R600) -#define READ_DEPTH( d, _x, _y ) \ - do { \ - d = (LE32_TO_CPU(*(GLuint*)(r600_ptr_depth(rrb, _x + x_off, _y + y_off))) & 0x00ffffff); \ - d |= ((LE32_TO_CPU(*(GLuint*)(r600_ptr_stencil(rrb, _x + x_off, _y + y_off))) << 24) & 0xff000000); \ - }while(0) -#elif defined(RADEON_R200) +#if defined(RADEON_R200) #define READ_DEPTH( d, _x, _y ) \ do { \ d = LE32_TO_CPU(*(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off))); \ @@ -953,25 +487,7 @@ do { \ /* 24 bit depth, 8 bit stencil depthbuffer functions */ -#ifdef RADEON_R300 -#define WRITE_STENCIL( _x, _y, d ) \ -do { \ - GLuint *_ptr = (GLuint*)radeon_ptr_4byte(rrb, _x + x_off, _y + y_off); \ - GLuint tmp = LE32_TO_CPU(*_ptr); \ - tmp &= 0xffffff00; \ - tmp |= (d) & 0xff; \ - *_ptr = CPU_TO_LE32(tmp); \ -} while (0) -#elif defined(RADEON_R600) -#define WRITE_STENCIL( _x, _y, d ) \ -do { \ - GLuint *_ptr = (GLuint*)r600_ptr_stencil(rrb, _x + x_off, _y + y_off); \ - GLuint tmp = LE32_TO_CPU(*_ptr); \ - tmp &= 0xffffff00; \ - tmp |= (d) & 0xff; \ - *_ptr = CPU_TO_LE32(tmp); \ -} while (0) -#elif defined(RADEON_R200) +#if defined(RADEON_R200) #define WRITE_STENCIL( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)r200_depth_4byte(rrb, _x + x_off, _y + y_off); \ @@ -991,21 +507,7 @@ do { \ } while (0) #endif -#ifdef RADEON_R300 -#define READ_STENCIL( d, _x, _y ) \ -do { \ - GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ - GLuint tmp = LE32_TO_CPU(*_ptr); \ - d = tmp & 0x000000ff; \ -} while (0) -#elif defined(RADEON_R600) -#define READ_STENCIL( d, _x, _y ) \ -do { \ - GLuint *_ptr = (GLuint*)r600_ptr_stencil( rrb, _x + x_off, _y + y_off ); \ - GLuint tmp = LE32_TO_CPU(*_ptr); \ - d = tmp & 0x000000ff; \ -} while (0) -#elif defined(RADEON_R200) +#if defined(RADEON_R200) #define READ_STENCIL( d, _x, _y ) \ do { \ GLuint *_ptr = (GLuint*)r200_depth_4byte( rrb, _x + x_off, _y + y_off ); \ diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 557d6d457dc..1a1161e4cce 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -578,19 +578,6 @@ gl_format radeonChooseTextureFormat(struct gl_context * ctx, case GL_RGBA32F_ARB: return MESA_FORMAT_RGBA_FLOAT32; -#ifdef RADEON_R300 - case GL_DEPTH_COMPONENT: - case GL_DEPTH_COMPONENT16: - return MESA_FORMAT_Z16; - case GL_DEPTH_COMPONENT24: - case GL_DEPTH_COMPONENT32: - case GL_DEPTH_STENCIL_EXT: - case GL_DEPTH24_STENCIL8_EXT: - if (rmesa->radeonScreen->chip_family >= CHIP_FAMILY_RV515) - return MESA_FORMAT_S8_Z24; - else - return MESA_FORMAT_Z16; -#else case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16: case GL_DEPTH_COMPONENT24: @@ -598,7 +585,6 @@ gl_format radeonChooseTextureFormat(struct gl_context * ctx, case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: return MESA_FORMAT_S8_Z24; -#endif /* EXT_texture_sRGB */ case GL_SRGB: -- 2.30.2