Re: [PATCH] drm/tidss: dispc: Rewrite naive plane positioning code

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

 



On 10/02/2020 15:21, Ville Syrjälä wrote:
> On Sun, Feb 09, 2020 at 02:50:09PM +0200, Jyri Sarha wrote:
>> On 07/02/2020 20:45, Ville Syrjälä wrote:
>>> On Fri, Feb 07, 2020 at 08:26:17PM +0200, Jyri Sarha wrote:
>>>> On 07/02/2020 20:18, Jyri Sarha wrote:
>>>>> The old implementation of placing planes on the CRTC while configuring
>>>>> the planes was naive and relied on the order in which the planes were
>>>>> configured, enabled, and disabled. The situation where a plane's zpos
>>>>> was changed on the fly was completely broken. The usual symptoms of
>>>>> this problem was scrambled display and a flood of sync lost errors,
>>>>> when a plane was active in two layers at the same time, or a missing
>>>>> plane, in case when a layer was accidentally disabled.
>>>>>
>>>>> The rewrite takes a more straight forward approach when when HW is
>>>>> concerned. The plane positioning registers are in the CRTC (or
>>>>> actually OVR) register space and it is more natural to configure them
>>>>> in a one go when configuring the CRTC. This is easy since we have
>>>>> access to the whole atomic state when updating the CRTC configuration.
>>>>>
>>>>
>>>> While implementing this fix it caught me by surprise that
>>>> crtc->state->state (pointer up to full atomic state) is NULL when
>>>> crtc_enable() or -flush() is called. So I take the plane-state directly
>>>> from the plane->state and just assume that it is pointing to the same
>>>> atomic state with the crtc state I am having. I that alraight?
>>>
>>> IMO you should never use plane->state etc. Better pass down the
>>> full atomic state everywhere. Otherwise you can never even consider
>>> increasing the commit queue depth since you'd end up accessing the
>>> wrong state.
>>>
>>
>> Ok. I did explore this a bit and it starts to look like that I have to
>> store the planes' zpos values in the driver after all. Only the changes
>> are available in the drm_atomic_state being commited so I have to
>> maintain the full state myself. That is if I should not use plane->state
>> in crtc_enable() or -flush().
> 
> You have the full old and new states around for each
> crtc/plane/connector in the state. So not sure what you mean
> by having only the changes available?
> 

If (by using the drm_atomic_state pointer in old_crtc_state paremeter)
I loop the planes trough with for_each_oldnew_plane_in_state(), I will
only see the planes that were part of the drm atomic request sent from
the user-space. I just tested that again.

But is it a requirement that an user-space applications should always
send the full state, and that the driver should assume that all
mode_config objects that are not there in drm_atomic_state should be
disabled?

At least the implementation of drm_atomic_get_plane_state() (used by at
least drm_atomic_normalize_zpos() and drm_mode_config_helper_suspend())
seems to suggest otherwise. When getting the plane state it first tries
drm_atomic_get_existing_plane_state(), but if it can not find the state
from the given drm_atomic_state, it goes down to the actual plane and
calls plane->funcs->atomic_duplicate_state(plane) to get it from the
plane-object itself.

>>
>>>>
>>>> Why is the crtc->state->state NULL? Is it a bug or is there some reason
>>>> to it?
>>>
>>> Currently swap_state() moves that state pointer from the new obj state
>>> to the old obj state, and clears the one in the new obj state. Not entirely
>>> sure why, but maybe just so there isn't a stale ->state pointer hanging 
>>> around in the obj->state after the swap?
>>>
>>> I think a better way could be to not clobber the old obj state at
>>> all, leave the new_obj_state->state alone, and just clear the ->state
>>> pointer .duplicate_state(). But that would require reviewing a bunch
>>> of code to find all the places where old_obj_state->state gets used
>>> during the commit.
>>>
>>
>> I think those places are many, since at least I did not figure out any
>> other way to access the full commit behind the atomic helpers.
> 
> I haven't examined how many drivers depend on the current behaviour.
> But fixing up the core/helpers should be pretty trivial.
> 


-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux