On 17 January 2018 at 21:06, Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl> wrote:
> On Wed, Jan 17, 2018 at 11:38 AM, Samuel Pitoiset
> <samuel.pitoi...@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.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to