Re: [PATCH] drm/radeon: change si_default_state table from global to static
On 4/4/22 6:32 AM, Christian König wrote: Am 04.04.22 um 15:01 schrieb Tom Rix: On 4/4/22 5:34 AM, Christian König wrote: Am 04.04.22 um 14:32 schrieb Tom Rix: On 4/3/22 8:23 AM, Christian König wrote: Am 02.04.22 um 18:27 schrieb Tom Rix: Smatch reports these issues si_blit_shaders.c:31:11: warning: symbol 'si_default_state' was not declared. Should it be static? si_blit_shaders.c:253:11: warning: symbol 'si_default_size' was not declared. Should it be static? Both symbols are only used in si.c. Single file symbols should be static. So move the si_default_state and si_default_size to si.c and change their storage-class-specifier to static. Remove unneeded si_blit_shaders.[c|h] Uff, well NAK. IIRC this was intentionally moved into a separate file because it is rather large and not related to anything in si.c. It's unlikely that we are ever going to update it, but I would still rather want to keep it separated. You should rather just include si_blit_shaders.h in si_blit_shaders.c. Do you mean #include "si_blit_shaders.c" in si.c or similar ? No, as far as I can see you are getting this warning because of a missing previous prototype for the exported array. This can be avoided if you add si_blit_shaders.h as an include to si_blit_shaders.c. The warning is a symptom. There are about 5-6 similar big, global tables in radeon/ with similar one file uses. These global tables should become static. Moving the table to si_blit_shader.h would keep it separated, adding the 'static' would remove it from the globals. *.c removed, Makefile updated. Sound like that would work for me as well. Main concern is to keep that in a separate file. But why do you want to drop it from globals in the first place? Generally the least needed access should be used. For security https://cwe.mitre.org/data/definitions/1108.html A big global table can hide introduced code. For the compiler global variables (can not/harder to) be optimized. Tom Christian. Tom Regards, Christian. This could have the same effect of while keeping these separate failes Tom Regards, Christian. Signed-off-by: Tom Rix --- drivers/gpu/drm/radeon/Makefile | 2 +- drivers/gpu/drm/radeon/si.c | 224 +++- drivers/gpu/drm/radeon/si_blit_shaders.c | 253 --- drivers/gpu/drm/radeon/si_blit_shaders.h | 32 --- 4 files changed, 224 insertions(+), 287 deletions(-) delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.c delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.h diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index 11c97edde54d..664381f4eb07 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile @@ -44,7 +44,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \ evergreen.o evergreen_cs.o evergreen_blit_shaders.o \ evergreen_hdmi.o radeon_trace_points.o ni.o cayman_blit_shaders.o \ atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \ - si_blit_shaders.o radeon_prime.o cik.o cik_blit_shaders.o \ + radeon_prime.o cik.o cik_blit_shaders.o \ r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o rv740_dpm.o \ rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o trinity_dpm.o \ trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o ci_smc.o \ diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 8d5e4b25609d..a4032702e302 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -38,7 +38,6 @@ #include "radeon_asic.h" #include "radeon_audio.h" #include "radeon_ucode.h" -#include "si_blit_shaders.h" #include "si.h" #include "sid.h" @@ -3553,6 +3552,229 @@ static int si_cp_load_microcode(struct radeon_device *rdev) return 0; } +static const u32 si_default_state[] = { + 0xc0066900, + 0x, + 0x0060, /* DB_RENDER_CONTROL */ + 0x, /* DB_COUNT_CONTROL */ + 0x, /* DB_DEPTH_VIEW */ + 0x002a, /* DB_RENDER_OVERRIDE */ + 0x, /* DB_RENDER_OVERRIDE2 */ + 0x, /* DB_HTILE_DATA_BASE */ + + 0xc0046900, + 0x0008, + 0x, /* DB_DEPTH_BOUNDS_MIN */ + 0x, /* DB_DEPTH_BOUNDS_MAX */ + 0x, /* DB_STENCIL_CLEAR */ + 0x, /* DB_DEPTH_CLEAR */ + + 0xc0036900, + 0x000f, + 0x, /* DB_DEPTH_INFO */ + 0x, /* DB_Z_INFO */ + 0x, /* DB_STENCIL_INFO */ + + 0xc0016900, + 0x0080, + 0x, /* PA_SC_WINDOW_OFFSET */ + + 0xc00d6900, + 0x0083, + 0x, /* PA_SC_CLIPRECT_RULE */ + 0x, /* PA_SC_CLIPRECT_0_TL */ + 0x20002000, /* PA_SC_CLIPRECT_0_BR */ + 0x, + 0x20002000, + 0x, + 0x20002000, + 0x, + 0x20002000, + 0x, /* PA_SC_EDGERULE */ + 0x, /*
Re: [PATCH] drm/radeon: change si_default_state table from global to static
Am 04.04.22 um 15:01 schrieb Tom Rix: On 4/4/22 5:34 AM, Christian König wrote: Am 04.04.22 um 14:32 schrieb Tom Rix: On 4/3/22 8:23 AM, Christian König wrote: Am 02.04.22 um 18:27 schrieb Tom Rix: Smatch reports these issues si_blit_shaders.c:31:11: warning: symbol 'si_default_state' was not declared. Should it be static? si_blit_shaders.c:253:11: warning: symbol 'si_default_size' was not declared. Should it be static? Both symbols are only used in si.c. Single file symbols should be static. So move the si_default_state and si_default_size to si.c and change their storage-class-specifier to static. Remove unneeded si_blit_shaders.[c|h] Uff, well NAK. IIRC this was intentionally moved into a separate file because it is rather large and not related to anything in si.c. It's unlikely that we are ever going to update it, but I would still rather want to keep it separated. You should rather just include si_blit_shaders.h in si_blit_shaders.c. Do you mean #include "si_blit_shaders.c" in si.c or similar ? No, as far as I can see you are getting this warning because of a missing previous prototype for the exported array. This can be avoided if you add si_blit_shaders.h as an include to si_blit_shaders.c. The warning is a symptom. There are about 5-6 similar big, global tables in radeon/ with similar one file uses. These global tables should become static. Moving the table to si_blit_shader.h would keep it separated, adding the 'static' would remove it from the globals. *.c removed, Makefile updated. Sound like that would work for me as well. Main concern is to keep that in a separate file. But why do you want to drop it from globals in the first place? Christian. Tom Regards, Christian. This could have the same effect of while keeping these separate failes Tom Regards, Christian. Signed-off-by: Tom Rix --- drivers/gpu/drm/radeon/Makefile | 2 +- drivers/gpu/drm/radeon/si.c | 224 +++- drivers/gpu/drm/radeon/si_blit_shaders.c | 253 --- drivers/gpu/drm/radeon/si_blit_shaders.h | 32 --- 4 files changed, 224 insertions(+), 287 deletions(-) delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.c delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.h diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index 11c97edde54d..664381f4eb07 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile @@ -44,7 +44,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \ evergreen.o evergreen_cs.o evergreen_blit_shaders.o \ evergreen_hdmi.o radeon_trace_points.o ni.o cayman_blit_shaders.o \ atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \ - si_blit_shaders.o radeon_prime.o cik.o cik_blit_shaders.o \ + radeon_prime.o cik.o cik_blit_shaders.o \ r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o rv740_dpm.o \ rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o trinity_dpm.o \ trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o ci_smc.o \ diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 8d5e4b25609d..a4032702e302 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -38,7 +38,6 @@ #include "radeon_asic.h" #include "radeon_audio.h" #include "radeon_ucode.h" -#include "si_blit_shaders.h" #include "si.h" #include "sid.h" @@ -3553,6 +3552,229 @@ static int si_cp_load_microcode(struct radeon_device *rdev) return 0; } +static const u32 si_default_state[] = { + 0xc0066900, + 0x, + 0x0060, /* DB_RENDER_CONTROL */ + 0x, /* DB_COUNT_CONTROL */ + 0x, /* DB_DEPTH_VIEW */ + 0x002a, /* DB_RENDER_OVERRIDE */ + 0x, /* DB_RENDER_OVERRIDE2 */ + 0x, /* DB_HTILE_DATA_BASE */ + + 0xc0046900, + 0x0008, + 0x, /* DB_DEPTH_BOUNDS_MIN */ + 0x, /* DB_DEPTH_BOUNDS_MAX */ + 0x, /* DB_STENCIL_CLEAR */ + 0x, /* DB_DEPTH_CLEAR */ + + 0xc0036900, + 0x000f, + 0x, /* DB_DEPTH_INFO */ + 0x, /* DB_Z_INFO */ + 0x, /* DB_STENCIL_INFO */ + + 0xc0016900, + 0x0080, + 0x, /* PA_SC_WINDOW_OFFSET */ + + 0xc00d6900, + 0x0083, + 0x, /* PA_SC_CLIPRECT_RULE */ + 0x, /* PA_SC_CLIPRECT_0_TL */ + 0x20002000, /* PA_SC_CLIPRECT_0_BR */ + 0x, + 0x20002000, + 0x, + 0x20002000, + 0x, + 0x20002000, + 0x, /* PA_SC_EDGERULE */ + 0x, /* PA_SU_HARDWARE_SCREEN_OFFSET */ + 0x000f, /* CB_TARGET_MASK */ + 0x000f, /* CB_SHADER_MASK */ + + 0xc0226900, + 0x0094, + 0x8000, /* PA_SC_VPORT_SCISSOR_0_TL */ + 0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */ + 0x8000, + 0x20002000, + 0x8000, +
Re: [PATCH] drm/radeon: change si_default_state table from global to static
On 4/4/22 5:34 AM, Christian König wrote: Am 04.04.22 um 14:32 schrieb Tom Rix: On 4/3/22 8:23 AM, Christian König wrote: Am 02.04.22 um 18:27 schrieb Tom Rix: Smatch reports these issues si_blit_shaders.c:31:11: warning: symbol 'si_default_state' was not declared. Should it be static? si_blit_shaders.c:253:11: warning: symbol 'si_default_size' was not declared. Should it be static? Both symbols are only used in si.c. Single file symbols should be static. So move the si_default_state and si_default_size to si.c and change their storage-class-specifier to static. Remove unneeded si_blit_shaders.[c|h] Uff, well NAK. IIRC this was intentionally moved into a separate file because it is rather large and not related to anything in si.c. It's unlikely that we are ever going to update it, but I would still rather want to keep it separated. You should rather just include si_blit_shaders.h in si_blit_shaders.c. Do you mean #include "si_blit_shaders.c" in si.c or similar ? No, as far as I can see you are getting this warning because of a missing previous prototype for the exported array. This can be avoided if you add si_blit_shaders.h as an include to si_blit_shaders.c. The warning is a symptom. There are about 5-6 similar big, global tables in radeon/ with similar one file uses. These global tables should become static. Moving the table to si_blit_shader.h would keep it separated, adding the 'static' would remove it from the globals. *.c removed, Makefile updated. Tom Regards, Christian. This could have the same effect of while keeping these separate failes Tom Regards, Christian. Signed-off-by: Tom Rix --- drivers/gpu/drm/radeon/Makefile | 2 +- drivers/gpu/drm/radeon/si.c | 224 +++- drivers/gpu/drm/radeon/si_blit_shaders.c | 253 --- drivers/gpu/drm/radeon/si_blit_shaders.h | 32 --- 4 files changed, 224 insertions(+), 287 deletions(-) delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.c delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.h diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index 11c97edde54d..664381f4eb07 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile @@ -44,7 +44,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \ evergreen.o evergreen_cs.o evergreen_blit_shaders.o \ evergreen_hdmi.o radeon_trace_points.o ni.o cayman_blit_shaders.o \ atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \ - si_blit_shaders.o radeon_prime.o cik.o cik_blit_shaders.o \ + radeon_prime.o cik.o cik_blit_shaders.o \ r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o rv740_dpm.o \ rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o trinity_dpm.o \ trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o ci_smc.o \ diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 8d5e4b25609d..a4032702e302 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -38,7 +38,6 @@ #include "radeon_asic.h" #include "radeon_audio.h" #include "radeon_ucode.h" -#include "si_blit_shaders.h" #include "si.h" #include "sid.h" @@ -3553,6 +3552,229 @@ static int si_cp_load_microcode(struct radeon_device *rdev) return 0; } +static const u32 si_default_state[] = { + 0xc0066900, + 0x, + 0x0060, /* DB_RENDER_CONTROL */ + 0x, /* DB_COUNT_CONTROL */ + 0x, /* DB_DEPTH_VIEW */ + 0x002a, /* DB_RENDER_OVERRIDE */ + 0x, /* DB_RENDER_OVERRIDE2 */ + 0x, /* DB_HTILE_DATA_BASE */ + + 0xc0046900, + 0x0008, + 0x, /* DB_DEPTH_BOUNDS_MIN */ + 0x, /* DB_DEPTH_BOUNDS_MAX */ + 0x, /* DB_STENCIL_CLEAR */ + 0x, /* DB_DEPTH_CLEAR */ + + 0xc0036900, + 0x000f, + 0x, /* DB_DEPTH_INFO */ + 0x, /* DB_Z_INFO */ + 0x, /* DB_STENCIL_INFO */ + + 0xc0016900, + 0x0080, + 0x, /* PA_SC_WINDOW_OFFSET */ + + 0xc00d6900, + 0x0083, + 0x, /* PA_SC_CLIPRECT_RULE */ + 0x, /* PA_SC_CLIPRECT_0_TL */ + 0x20002000, /* PA_SC_CLIPRECT_0_BR */ + 0x, + 0x20002000, + 0x, + 0x20002000, + 0x, + 0x20002000, + 0x, /* PA_SC_EDGERULE */ + 0x, /* PA_SU_HARDWARE_SCREEN_OFFSET */ + 0x000f, /* CB_TARGET_MASK */ + 0x000f, /* CB_SHADER_MASK */ + + 0xc0226900, + 0x0094, + 0x8000, /* PA_SC_VPORT_SCISSOR_0_TL */ + 0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */ + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, +
Re: [PATCH] drm/radeon: change si_default_state table from global to static
Am 04.04.22 um 14:32 schrieb Tom Rix: On 4/3/22 8:23 AM, Christian König wrote: Am 02.04.22 um 18:27 schrieb Tom Rix: Smatch reports these issues si_blit_shaders.c:31:11: warning: symbol 'si_default_state' was not declared. Should it be static? si_blit_shaders.c:253:11: warning: symbol 'si_default_size' was not declared. Should it be static? Both symbols are only used in si.c. Single file symbols should be static. So move the si_default_state and si_default_size to si.c and change their storage-class-specifier to static. Remove unneeded si_blit_shaders.[c|h] Uff, well NAK. IIRC this was intentionally moved into a separate file because it is rather large and not related to anything in si.c. It's unlikely that we are ever going to update it, but I would still rather want to keep it separated. You should rather just include si_blit_shaders.h in si_blit_shaders.c. Do you mean #include "si_blit_shaders.c" in si.c or similar ? No, as far as I can see you are getting this warning because of a missing previous prototype for the exported array. This can be avoided if you add si_blit_shaders.h as an include to si_blit_shaders.c. Regards, Christian. This could have the same effect of while keeping these separate failes Tom Regards, Christian. Signed-off-by: Tom Rix --- drivers/gpu/drm/radeon/Makefile | 2 +- drivers/gpu/drm/radeon/si.c | 224 +++- drivers/gpu/drm/radeon/si_blit_shaders.c | 253 --- drivers/gpu/drm/radeon/si_blit_shaders.h | 32 --- 4 files changed, 224 insertions(+), 287 deletions(-) delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.c delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.h diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index 11c97edde54d..664381f4eb07 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile @@ -44,7 +44,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \ evergreen.o evergreen_cs.o evergreen_blit_shaders.o \ evergreen_hdmi.o radeon_trace_points.o ni.o cayman_blit_shaders.o \ atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \ - si_blit_shaders.o radeon_prime.o cik.o cik_blit_shaders.o \ + radeon_prime.o cik.o cik_blit_shaders.o \ r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o rv740_dpm.o \ rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o trinity_dpm.o \ trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o ci_smc.o \ diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 8d5e4b25609d..a4032702e302 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -38,7 +38,6 @@ #include "radeon_asic.h" #include "radeon_audio.h" #include "radeon_ucode.h" -#include "si_blit_shaders.h" #include "si.h" #include "sid.h" @@ -3553,6 +3552,229 @@ static int si_cp_load_microcode(struct radeon_device *rdev) return 0; } +static const u32 si_default_state[] = { + 0xc0066900, + 0x, + 0x0060, /* DB_RENDER_CONTROL */ + 0x, /* DB_COUNT_CONTROL */ + 0x, /* DB_DEPTH_VIEW */ + 0x002a, /* DB_RENDER_OVERRIDE */ + 0x, /* DB_RENDER_OVERRIDE2 */ + 0x, /* DB_HTILE_DATA_BASE */ + + 0xc0046900, + 0x0008, + 0x, /* DB_DEPTH_BOUNDS_MIN */ + 0x, /* DB_DEPTH_BOUNDS_MAX */ + 0x, /* DB_STENCIL_CLEAR */ + 0x, /* DB_DEPTH_CLEAR */ + + 0xc0036900, + 0x000f, + 0x, /* DB_DEPTH_INFO */ + 0x, /* DB_Z_INFO */ + 0x, /* DB_STENCIL_INFO */ + + 0xc0016900, + 0x0080, + 0x, /* PA_SC_WINDOW_OFFSET */ + + 0xc00d6900, + 0x0083, + 0x, /* PA_SC_CLIPRECT_RULE */ + 0x, /* PA_SC_CLIPRECT_0_TL */ + 0x20002000, /* PA_SC_CLIPRECT_0_BR */ + 0x, + 0x20002000, + 0x, + 0x20002000, + 0x, + 0x20002000, + 0x, /* PA_SC_EDGERULE */ + 0x, /* PA_SU_HARDWARE_SCREEN_OFFSET */ + 0x000f, /* CB_TARGET_MASK */ + 0x000f, /* CB_SHADER_MASK */ + + 0xc0226900, + 0x0094, + 0x8000, /* PA_SC_VPORT_SCISSOR_0_TL */ + 0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */ + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x, /* PA_SC_VPORT_ZMIN_0 */ + 0x3f80, /* PA_SC_VPORT_ZMAX_0 */ + + 0xc0026900, + 0x00d9, +
Re: [PATCH] drm/radeon: change si_default_state table from global to static
On 4/3/22 8:23 AM, Christian König wrote: Am 02.04.22 um 18:27 schrieb Tom Rix: Smatch reports these issues si_blit_shaders.c:31:11: warning: symbol 'si_default_state' was not declared. Should it be static? si_blit_shaders.c:253:11: warning: symbol 'si_default_size' was not declared. Should it be static? Both symbols are only used in si.c. Single file symbols should be static. So move the si_default_state and si_default_size to si.c and change their storage-class-specifier to static. Remove unneeded si_blit_shaders.[c|h] Uff, well NAK. IIRC this was intentionally moved into a separate file because it is rather large and not related to anything in si.c. It's unlikely that we are ever going to update it, but I would still rather want to keep it separated. You should rather just include si_blit_shaders.h in si_blit_shaders.c. Do you mean #include "si_blit_shaders.c" in si.c or similar ? This could have the same effect of while keeping these separate failes Tom Regards, Christian. Signed-off-by: Tom Rix --- drivers/gpu/drm/radeon/Makefile | 2 +- drivers/gpu/drm/radeon/si.c | 224 +++- drivers/gpu/drm/radeon/si_blit_shaders.c | 253 --- drivers/gpu/drm/radeon/si_blit_shaders.h | 32 --- 4 files changed, 224 insertions(+), 287 deletions(-) delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.c delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.h diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index 11c97edde54d..664381f4eb07 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile @@ -44,7 +44,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \ evergreen.o evergreen_cs.o evergreen_blit_shaders.o \ evergreen_hdmi.o radeon_trace_points.o ni.o cayman_blit_shaders.o \ atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \ - si_blit_shaders.o radeon_prime.o cik.o cik_blit_shaders.o \ + radeon_prime.o cik.o cik_blit_shaders.o \ r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o rv740_dpm.o \ rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o trinity_dpm.o \ trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o ci_smc.o \ diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 8d5e4b25609d..a4032702e302 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -38,7 +38,6 @@ #include "radeon_asic.h" #include "radeon_audio.h" #include "radeon_ucode.h" -#include "si_blit_shaders.h" #include "si.h" #include "sid.h" @@ -3553,6 +3552,229 @@ static int si_cp_load_microcode(struct radeon_device *rdev) return 0; } +static const u32 si_default_state[] = { + 0xc0066900, + 0x, + 0x0060, /* DB_RENDER_CONTROL */ + 0x, /* DB_COUNT_CONTROL */ + 0x, /* DB_DEPTH_VIEW */ + 0x002a, /* DB_RENDER_OVERRIDE */ + 0x, /* DB_RENDER_OVERRIDE2 */ + 0x, /* DB_HTILE_DATA_BASE */ + + 0xc0046900, + 0x0008, + 0x, /* DB_DEPTH_BOUNDS_MIN */ + 0x, /* DB_DEPTH_BOUNDS_MAX */ + 0x, /* DB_STENCIL_CLEAR */ + 0x, /* DB_DEPTH_CLEAR */ + + 0xc0036900, + 0x000f, + 0x, /* DB_DEPTH_INFO */ + 0x, /* DB_Z_INFO */ + 0x, /* DB_STENCIL_INFO */ + + 0xc0016900, + 0x0080, + 0x, /* PA_SC_WINDOW_OFFSET */ + + 0xc00d6900, + 0x0083, + 0x, /* PA_SC_CLIPRECT_RULE */ + 0x, /* PA_SC_CLIPRECT_0_TL */ + 0x20002000, /* PA_SC_CLIPRECT_0_BR */ + 0x, + 0x20002000, + 0x, + 0x20002000, + 0x, + 0x20002000, + 0x, /* PA_SC_EDGERULE */ + 0x, /* PA_SU_HARDWARE_SCREEN_OFFSET */ + 0x000f, /* CB_TARGET_MASK */ + 0x000f, /* CB_SHADER_MASK */ + + 0xc0226900, + 0x0094, + 0x8000, /* PA_SC_VPORT_SCISSOR_0_TL */ + 0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */ + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x, /* PA_SC_VPORT_ZMIN_0 */ + 0x3f80, /* PA_SC_VPORT_ZMAX_0 */ + + 0xc0026900, + 0x00d9, + 0x, /* CP_RINGID */ + 0x, /* CP_VMID */ + + 0xc0046900, + 0x0100, + 0x, /* VGT_MAX_VTX_INDX */ + 0x, /* VGT_MIN_VTX_INDX */ + 0x, /* VGT_INDX_OFFSET */ + 0x, /* VGT_MULTI_PRIM_IB_RESET_INDX */ + +
Re: [PATCH] drm/radeon: change si_default_state table from global to static
Am 02.04.22 um 18:27 schrieb Tom Rix: Smatch reports these issues si_blit_shaders.c:31:11: warning: symbol 'si_default_state' was not declared. Should it be static? si_blit_shaders.c:253:11: warning: symbol 'si_default_size' was not declared. Should it be static? Both symbols are only used in si.c. Single file symbols should be static. So move the si_default_state and si_default_size to si.c and change their storage-class-specifier to static. Remove unneeded si_blit_shaders.[c|h] Uff, well NAK. IIRC this was intentionally moved into a separate file because it is rather large and not related to anything in si.c. It's unlikely that we are ever going to update it, but I would still rather want to keep it separated. You should rather just include si_blit_shaders.h in si_blit_shaders.c. Regards, Christian. Signed-off-by: Tom Rix --- drivers/gpu/drm/radeon/Makefile | 2 +- drivers/gpu/drm/radeon/si.c | 224 +++- drivers/gpu/drm/radeon/si_blit_shaders.c | 253 --- drivers/gpu/drm/radeon/si_blit_shaders.h | 32 --- 4 files changed, 224 insertions(+), 287 deletions(-) delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.c delete mode 100644 drivers/gpu/drm/radeon/si_blit_shaders.h diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index 11c97edde54d..664381f4eb07 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile @@ -44,7 +44,7 @@ radeon-y += radeon_device.o radeon_asic.o radeon_kms.o \ evergreen.o evergreen_cs.o evergreen_blit_shaders.o \ evergreen_hdmi.o radeon_trace_points.o ni.o cayman_blit_shaders.o \ atombios_encoders.o radeon_semaphore.o radeon_sa.o atombios_i2c.o si.o \ - si_blit_shaders.o radeon_prime.o cik.o cik_blit_shaders.o \ + radeon_prime.o cik.o cik_blit_shaders.o \ r600_dpm.o rs780_dpm.o rv6xx_dpm.o rv770_dpm.o rv730_dpm.o rv740_dpm.o \ rv770_smc.o cypress_dpm.o btc_dpm.o sumo_dpm.o sumo_smc.o trinity_dpm.o \ trinity_smc.o ni_dpm.o si_smc.o si_dpm.o kv_smc.o kv_dpm.o ci_smc.o \ diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 8d5e4b25609d..a4032702e302 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -38,7 +38,6 @@ #include "radeon_asic.h" #include "radeon_audio.h" #include "radeon_ucode.h" -#include "si_blit_shaders.h" #include "si.h" #include "sid.h" @@ -3553,6 +3552,229 @@ static int si_cp_load_microcode(struct radeon_device *rdev) return 0; } +static const u32 si_default_state[] = { + 0xc0066900, + 0x, + 0x0060, /* DB_RENDER_CONTROL */ + 0x, /* DB_COUNT_CONTROL */ + 0x, /* DB_DEPTH_VIEW */ + 0x002a, /* DB_RENDER_OVERRIDE */ + 0x, /* DB_RENDER_OVERRIDE2 */ + 0x, /* DB_HTILE_DATA_BASE */ + + 0xc0046900, + 0x0008, + 0x, /* DB_DEPTH_BOUNDS_MIN */ + 0x, /* DB_DEPTH_BOUNDS_MAX */ + 0x, /* DB_STENCIL_CLEAR */ + 0x, /* DB_DEPTH_CLEAR */ + + 0xc0036900, + 0x000f, + 0x, /* DB_DEPTH_INFO */ + 0x, /* DB_Z_INFO */ + 0x, /* DB_STENCIL_INFO */ + + 0xc0016900, + 0x0080, + 0x, /* PA_SC_WINDOW_OFFSET */ + + 0xc00d6900, + 0x0083, + 0x, /* PA_SC_CLIPRECT_RULE */ + 0x, /* PA_SC_CLIPRECT_0_TL */ + 0x20002000, /* PA_SC_CLIPRECT_0_BR */ + 0x, + 0x20002000, + 0x, + 0x20002000, + 0x, + 0x20002000, + 0x, /* PA_SC_EDGERULE */ + 0x, /* PA_SU_HARDWARE_SCREEN_OFFSET */ + 0x000f, /* CB_TARGET_MASK */ + 0x000f, /* CB_SHADER_MASK */ + + 0xc0226900, + 0x0094, + 0x8000, /* PA_SC_VPORT_SCISSOR_0_TL */ + 0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */ + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x8000, + 0x20002000, + 0x, /* PA_SC_VPORT_ZMIN_0 */ + 0x3f80, /* PA_SC_VPORT_ZMAX_0 */ + + 0xc0026900, + 0x00d9, + 0x, /* CP_RINGID */ + 0x, /* CP_VMID */ + + 0xc0046900, + 0x0100, + 0x, /* VGT_MAX_VTX_INDX */ + 0x, /* VGT_MIN_VTX_INDX */ + 0x, /*