[PATCH libdrm] drm/amdgpu: add new low overhead command submission API. (v2)

Dave Airlie airlied at gmail.com
Thu Aug 10 19:43:42 UTC 2017


On 10 August 2017 at 23:56, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> Hi Dave,
>
> On 18 July 2017 at 04:52, Dave Airlie <airlied at gmail.com> wrote:
>
>> +int amdgpu_cs_submit_raw(amdgpu_device_handle dev,
>> +                        amdgpu_context_handle context,
>> +                        amdgpu_bo_list_handle bo_list_handle,
>> +                        int num_chunks,
>> +                        struct drm_amdgpu_cs_chunk *chunks,
>> +                        uint64_t *seq_no)
>> +{
>> +       union drm_amdgpu_cs cs = {0};
>> +       uint64_t *chunk_array;
>> +       int i, r;
>> +       if (num_chunks == 0)
>> +               return -EINVAL;
>> +
>> +       chunk_array = alloca(sizeof(uint64_t) * num_chunks);
> Out of curiosity:
> Does malloc/free produce noticeable overhead that lead you you alloca?

The preexisting code for these ioctls used alloca so I just followed
the existing pattern.

I doubt we'd notice malloc/free, but we shouldn't also be sending more
than 5-10 chunks
even in the future, so stack alloc should be fine.

> num_chunks is signed - should we bail on negative values, can we make
> it unsigned?

Possibly, I don't see random users of this API appearing though, but yeah could
change the if <= 0.

Dave.


More information about the amd-gfx mailing list