drm: improve NOP/reloc comments

This commit is contained in:
Zack Buhman 2025-10-14 20:12:12 -05:00
parent 9d974cd113
commit 95e9ba85ae
4 changed files with 64 additions and 39 deletions

View File

@ -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

View File

@ -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
//////////////////////////////////////////////////////////////////////////////

View File

@ -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
//////////////////////////////////////////////////////////////////////////////

View File

@ -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
//////////////////////////////////////////////////////////////////////////////