Re: pitch alignment questions

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

 



On 2019-01-11 10:37 p.m., Yu Zhao wrote:
> On Fri, Jan 11, 2019 at 04:27:44PM +0100, Michel Dänzer wrote:
>> On 2019-01-10 6:56 p.m., Przemek Socha wrote:
>>>
>>> [  147.846148] [drm:amdgpu_display_user_framebuffer_create [amdgpu]] Invalid 
>>> pitch: expecting 10752 but got 10624
>>> [  147.846155] [drm:drm_internal_framebuffer_create] could not create 
>>> framebuffer"
>>
>> Thanks, this confirms that the check is too strict. I've sent a patch
>> reverting this as well.
>>
>>
>> Yu, I like the idea behind your changes, but unfortunately it's more
>> complicated than that. If you want to work on similar checks which
>> accurately reflect the hardware constraints, people on the amd-gfx list
>> should be able to help with that.
> 
> Hi Michel, sorry for the troubles.

No worries, I missed these issues as well in my review.


> Background: after we turned on iommu with amd_iommu=force_isolation,
> we saw io page faults from amd gpu (stoney ridge). We tracked it
> down to userspace using 32-pixel pitch alignment, which seems smaller
> than the minimum alignment supported by the hw.

If that was the case, the corresponding surface would be displayed badly
distorted, because the hardware would use a different pitch.


> Instead of rejecting the alignment, we suspect, it uses 64-pixel
> alignment to do dma.

Actually, it's more likely that it would use the next smaller
well-aligned pitch, as it would probably simply ignore the least
significant bits smaller than the minimum alignment.


> The larger alignment sometimes causes out of bound memory accesses, thus
> the io page faults.

Per the above, this is more likely due to insufficient alignment of the
vertical size of the surface, resulting in the allocated memory being
too small.


> 1) how do properly validate pitch alignment passed to kernel space?

It's pretty complicated, I'm afraid. A case-insensitive search for
"display" in
https://gitlab.freedesktop.org/mesa/mesa/tree/master/src/amd/addrlib
might serve to give an idea of the complexity.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




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

  Powered by Linux