Re: [PATCH] drm/amdgpu: Always align dumb buffer at PAGE_SIZE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The kernel could report the true alignment from the ioctl instead of 0.

Marek

On Fri, Sep 23, 2022 at 1:31 AM Christian König <christian.koenig@xxxxxxx> wrote:
Am 23.09.22 um 07:28 schrieb lepton:
> On Thu, Sep 22, 2022 at 10:14 PM Christian König
> <christian.koenig@xxxxxxx> wrote:
>> Am 23.09.22 um 01:04 schrieb Lepton Wu:
>>> Since size has been aligned to PAGE_SIZE already, just align it
>>> to PAGE_SIZE so later the buffer can be used as a texture in mesa
>>> after https://nam11.safelinks.protection.outlook.com/?url="">
>>> Otherwise, si_texture_create_object will fail at line
>>> "buf->alignment < tex->surface.alignment"
>> I don't think that those Mesa checks are a good idea in the first place.
>>
>> The alignment value is often specified as zero when it doesn't matter
>> because the minimum alignment can never be less than the page size.
> Are you suggesting to change those mesa checks?

Yes, the minimum alignment of allocations is always 4096 because that's
the page size of the GPU.

> While that can be
> done, I still think a kernel side "fix" is still
> useful since it doesn't hurt while can fix issues for some versions of mesa.

No, we have tons of places where we don't specify and alignment for
buffers because it never mattered. I certainly don't want to fix all of
those.

Regards,
Christian.

>> Christian.
>>
>>> Signed-off-by: Lepton Wu <
ytht.net@xxxxxxxxx>
>>> ---
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> index 8ef31d687ef3b..8dca0c920d3ce 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> @@ -928,7 +928,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
>>>        args->size = ALIGN(args->size, PAGE_SIZE);
>>>        domain = amdgpu_bo_get_preferred_domain(adev,
>>>                                amdgpu_display_supported_domains(adev, flags));
>>> -     r = amdgpu_gem_object_create(adev, args->size, 0, domain, flags,
>>> +     r = amdgpu_gem_object_create(adev, args->size, PAGE_SIZE, domain, flags,
>>>                                     ttm_bo_type_device, NULL, &gobj);
>>>        if (r)
>>>                return -ENOMEM;


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux