[Mesa-dev] [PATCH 1/2] radv: add more assertions to make sure packets are correctly emitted
Samuel Pitoiset
samuel.pitoiset at gmail.com
Fri Jul 12 10:03:55 UTC 2019
On 7/12/19 11:54 AM, Bas Nieuwenhuizen wrote:
> On Fri, Jul 12, 2019 at 11:13 AM Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>> src/amd/vulkan/radv_cs.h | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/amd/vulkan/radv_cs.h b/src/amd/vulkan/radv_cs.h
>> index 5f8b59c34cb..2ba7da1fb44 100644
>> --- a/src/amd/vulkan/radv_cs.h
>> +++ b/src/amd/vulkan/radv_cs.h
>> @@ -42,7 +42,7 @@ static inline unsigned radeon_check_space(struct radeon_winsys *ws,
>>
>> static inline void radeon_set_config_reg_seq(struct radeon_cmdbuf *cs, unsigned reg, unsigned num)
>> {
>> - assert(reg < SI_CONTEXT_REG_OFFSET);
>> + assert(reg < SI_CONTEXT_REG_OFFSET && reg < SI_CONFIG_REG_END);
> Shouldn't the first condition be "reg >= SI_CONFIG_REG_OFFSET" ?
Right, will fix before pushing.
>
>
>> assert(cs->cdw + 2 + num <= cs->max_dw);
>> assert(num);
>> radeon_emit(cs, PKT3(PKT3_SET_CONFIG_REG, num, 0));
>> @@ -57,7 +57,7 @@ static inline void radeon_set_config_reg(struct radeon_cmdbuf *cs, unsigned reg,
>>
>> static inline void radeon_set_context_reg_seq(struct radeon_cmdbuf *cs, unsigned reg, unsigned num)
>> {
>> - assert(reg >= SI_CONTEXT_REG_OFFSET);
>> + assert(reg >= SI_CONTEXT_REG_OFFSET && reg < SI_CONTEXT_REG_END);
>> assert(cs->cdw + 2 + num <= cs->max_dw);
>> assert(num);
>> radeon_emit(cs, PKT3(PKT3_SET_CONTEXT_REG, num, 0));
>> @@ -75,7 +75,7 @@ static inline void radeon_set_context_reg_idx(struct radeon_cmdbuf *cs,
>> unsigned reg, unsigned idx,
>> unsigned value)
>> {
>> - assert(reg >= SI_CONTEXT_REG_OFFSET);
>> + assert(reg >= SI_CONTEXT_REG_OFFSET && reg < SI_CONTEXT_REG_END);
>> assert(cs->cdw + 3 <= cs->max_dw);
>> radeon_emit(cs, PKT3(PKT3_SET_CONTEXT_REG, 1, 0));
>> radeon_emit(cs, (reg - SI_CONTEXT_REG_OFFSET) >> 2 | (idx << 28));
>> --
>> 2.22.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list