[Mesa-dev] [PATCH 04/23] radv: Add a PM4 sequence data structure + utils.

Dave Airlie airlied at gmail.com
Wed Jan 17 22:51:02 UTC 2018


On 17 January 2018 at 21:06, Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl> wrote:
> On Wed, Jan 17, 2018 at 11:38 AM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> Can't this be moved into a new file? Or event better in AMD common code?
>
> Would you think this is usable by radeonsi? They already have their
> own PM4 structure integrating bo's as well (which are incompatible
> between radeonsi and radv).

So I don't think it's necessary we try and share this stuff up front,
if the opportunity is there
then it can happen in tree in a more controlled fashion.

However....
>>> +
>>> +void radv_pm4_start_reg_set_idx(struct radv_pm4_builder *builder,
>>> uint32_t reg, uint32_t index, uint32_t count)
>>> +{
>>> +       if (reg >= SI_CONFIG_REG_OFFSET && reg < SI_CONFIG_REG_END) {
>>> +               radv_pm4_emit(builder, PKT3(PKT3_SET_CONFIG_REG, count,
>>> 0));
>>> +               radv_pm4_emit(builder, (reg - SI_CONFIG_REG_OFFSET) >> 2 |
>>> (index << 28));
>>> +       } else if (reg >= SI_SH_REG_OFFSET && reg < SI_SH_REG_END) {
>>> +               radv_pm4_emit(builder, PKT3(PKT3_SET_SH_REG, count, 0));
>>> +               radv_pm4_emit(builder, (reg - SI_SH_REG_OFFSET) >> 2 |
>>> (index << 28));
>>> +       } else if (reg >= SI_CONTEXT_REG_OFFSET && reg <
>>> SI_CONTEXT_REG_END) {
>>> +               radv_pm4_emit(builder, PKT3(PKT3_SET_CONTEXT_REG, count,
>>> 0));
>>> +               radv_pm4_emit(builder, (reg - SI_CONTEXT_REG_OFFSET) >> 2
>>> | (index << 28));
>>> +       } else if (reg >= CIK_UCONFIG_REG_OFFSET && reg <
>>> CIK_UCONFIG_REG_END) {
>>> +               radv_pm4_emit(builder, PKT3(PKT3_SET_UCONFIG_REG, count,
>>> 0));
>>> +               radv_pm4_emit(builder, (reg - CIK_UCONFIG_REG_OFFSET) >> 2
>>> | (index << 28));
>>> +       } else
>>> +               unreachable("Unknown register space for register!");
>>> +}
>>> +

I dislike this, I've always disliked this in radeonsi as well, it
means writing PM4
packets via this and writing them to the cmd stream use different interfaces.

We either want to have separate API for each type of register like we have for
cmd stream or we want to introduce this sort of interface for CS
packet building,
but either was I'd really prefer this to be consistent.

I think also this should be inline, since reg will more than likely be const so
most of the function would disappear.

Dave.


More information about the mesa-dev mailing list