diff --git a/drm/command_processor.h b/drm/command_processor.h index 0e244de..d96176a 100644 --- a/drm/command_processor.h +++ b/drm/command_processor.h @@ -1,5 +1,10 @@ #pragma once +#define _NOP 0x10 +#define _3D_LOAD_VBPNTR 0x2f +#define _3D_DRAW_VBUF_2 0x34 +#define _3D_DRAW_IMMD_2 0x35 + #define TYPE_0_COUNT(c) (((c) & 0x3fff) << 16) #define TYPE_0_ONE_REG (1 << 15) #define TYPE_0_BASE_INDEX(i) (((i) & 0x1fff) << 0) @@ -33,7 +38,3 @@ do { \ ib[ix++].u32 = (0b11 << 30) | TYPE_3_COUNT(count) | TYPE_3_OPCODE(opcode); \ } while (0); - -#define _3D_LOAD_VBPNTR 0x2f -#define _3D_DRAW_VBUF_2 0x34 -#define _3D_DRAW_IMMD_2 0x35 diff --git a/drm/single_color.c b/drm/single_color.c index 8b8ae22..e1c76ab 100644 --- a/drm/single_color.c +++ b/drm/single_color.c @@ -47,17 +47,6 @@ int indirect_buffer() , RB3D_CCTL__INDEPENDENT_COLORFORMAT_ENABLE(1) ); - T0V(RB3D_COLOROFFSET0, 0x00000000); // value replaced by kernel from relocs - ib[ix++].u32 = 0xc0001000; - ib[ix++].u32 = 0x0; - - T0V(RB3D_COLORPITCH0 - , RB3D_COLORPITCH__COLORPITCH(1600 >> 1) - | RB3D_COLORPITCH__COLORFORMAT(6) // ARGB8888 - ); - ib[ix++].u32 = 0xc0001000; - ib[ix++].u32 = 0x0; - T0V(ZB_BW_CNTL, 0x00000000); T0V(ZB_DEPTHCLEARVALUE, 0x00000000); T0V(SC_HYPERZ_EN, 0x00000000); @@ -279,6 +268,25 @@ int indirect_buffer() | GA_COLOR_CONTROL__PROVOKING_VERTEX(3) ); + ////////////////////////////////////////////////////////////////////////////// + // CB + ////////////////////////////////////////////////////////////////////////////// + + T0V(RB3D_COLOROFFSET0 + , 0x00000000 // value replaced by kernel from relocs + ); + T3(_NOP, 0); + ib[ix++].u32 = 0 * 4; // index into relocs array + + T0V(RB3D_COLORPITCH0 + , RB3D_COLORPITCH__COLORPITCH(1600 >> 1) + | RB3D_COLORPITCH__COLORFORMAT(6) // ARGB8888 + ); + // The COLORPITCH NOP is ignored/not applied due to + // RADEON_CS_KEEP_TILING_FLAGS, but is still required. + T3(_NOP, 0); + ib[ix++].u32 = 0 * 4; // index into relocs array + ////////////////////////////////////////////////////////////////////////////// // SC ////////////////////////////////////////////////////////////////////////////// diff --git a/drm/vertex_color.c b/drm/vertex_color.c index 5c52ee7..b851090 100644 --- a/drm/vertex_color.c +++ b/drm/vertex_color.c @@ -47,17 +47,6 @@ int indirect_buffer() , RB3D_CCTL__INDEPENDENT_COLORFORMAT_ENABLE(1) ); - T0V(RB3D_COLOROFFSET0, 0x00000000); // value replaced by kernel from relocs - ib[ix++].u32 = 0xc0001000; - ib[ix++].u32 = 0x0; - - T0V(RB3D_COLORPITCH0 - , RB3D_COLORPITCH__COLORPITCH(1600 >> 1) - | RB3D_COLORPITCH__COLORFORMAT(6) // ARGB8888 - ); - ib[ix++].u32 = 0xc0001000; - ib[ix++].u32 = 0x0; - T0V(ZB_BW_CNTL, 0x00000000); T0V(ZB_DEPTHCLEARVALUE, 0x00000000); T0V(SC_HYPERZ_EN, 0x00000000); @@ -278,6 +267,25 @@ int indirect_buffer() | GA_COLOR_CONTROL__PROVOKING_VERTEX(3) ); + ////////////////////////////////////////////////////////////////////////////// + // CB + ////////////////////////////////////////////////////////////////////////////// + + T0V(RB3D_COLOROFFSET0 + , 0x00000000 // value replaced by kernel from relocs + ); + T3(_NOP, 0); + ib[ix++].u32 = 0 * 4; // index into relocs array + + T0V(RB3D_COLORPITCH0 + , RB3D_COLORPITCH__COLORPITCH(1600 >> 1) + | RB3D_COLORPITCH__COLORFORMAT(6) // ARGB8888 + ); + // The COLORPITCH NOP is ignored/not applied due to + // RADEON_CS_KEEP_TILING_FLAGS, but is still required. + T3(_NOP, 0); + ib[ix++].u32 = 0 * 4; // index into relocs array + ////////////////////////////////////////////////////////////////////////////// // SC ////////////////////////////////////////////////////////////////////////////// diff --git a/drm/vertex_color_aos.c b/drm/vertex_color_aos.c index a8abf9a..ede01c4 100644 --- a/drm/vertex_color_aos.c +++ b/drm/vertex_color_aos.c @@ -58,17 +58,6 @@ int indirect_buffer() , RB3D_CCTL__INDEPENDENT_COLORFORMAT_ENABLE(1) ); - T0V(RB3D_COLOROFFSET0, 0x00000000); // value replaced by kernel from relocs - ib[ix++].u32 = 0xc0001000; - ib[ix++].u32 = 0x0; - - T0V(RB3D_COLORPITCH0 - , RB3D_COLORPITCH__COLORPITCH(1600 >> 1) - | RB3D_COLORPITCH__COLORFORMAT(6) // ARGB8888 - ); - ib[ix++].u32 = 0xc0001000; - ib[ix++].u32 = 0x0; - T0V(ZB_BW_CNTL, 0x00000000); T0V(ZB_DEPTHCLEARVALUE, 0x00000000); T0V(SC_HYPERZ_EN, 0x00000000); @@ -289,6 +278,25 @@ int indirect_buffer() | GA_COLOR_CONTROL__PROVOKING_VERTEX(3) ); + ////////////////////////////////////////////////////////////////////////////// + // CB + ////////////////////////////////////////////////////////////////////////////// + + T0V(RB3D_COLOROFFSET0 + , 0x00000000 // value replaced by kernel from relocs + ); + T3(_NOP, 0); + ib[ix++].u32 = 0 * 4; // index into relocs array + + T0V(RB3D_COLORPITCH0 + , RB3D_COLORPITCH__COLORPITCH(1600 >> 1) + | RB3D_COLORPITCH__COLORFORMAT(6) // ARGB8888 + ); + // The COLORPITCH NOP is ignored/not applied due to + // RADEON_CS_KEEP_TILING_FLAGS, but is still required. + T3(_NOP, 0); + ib[ix++].u32 = 0 * 4; // index into relocs array + ////////////////////////////////////////////////////////////////////////////// // SC ////////////////////////////////////////////////////////////////////////////// @@ -396,9 +404,9 @@ int indirect_buffer() // modifies this to be an offset relative to the GEM buffer handles given via // NOP: - ib[ix++].u32 = 0xc0001000; + T3(_NOP, 0); ib[ix++].u32 = 1 * 4; // index into relocs array for VAP_VTX_AOS_ADDR0 - ib[ix++].u32 = 0xc0001000; + T3(_NOP, 0); ib[ix++].u32 = 1 * 4; // index into relocs array for VAP_VTX_AOS_ADDR1 //////////////////////////////////////////////////////////////////////////////