[PATCH 3/7] drm/amd/display: Add handling for new "active color format" property

Daniel Vetter daniel at ffwll.ch
Wed Jan 10 13:09:32 UTC 2024


On Wed, 10 Jan 2024 at 13:53, Andri Yngvason <andri at yngvason.is> wrote:
>
> mið., 10. jan. 2024 kl. 11:10 skrifaði Daniel Vetter <daniel at ffwll.ch>:
> >
> > On Tue, Jan 09, 2024 at 06:11:00PM +0000, Andri Yngvason wrote:
> > > +     /* Extract information from crtc to communicate it to userspace as connector properties */
> > > +     for_each_new_connector_in_state(state, connector, new_con_state, i) {
> > > +             struct drm_crtc *crtc = new_con_state->crtc;
> > > +             struct dc_stream_state *stream;
> > > +
> > > +             if (crtc) {
> > > +                     new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
> > > +                     dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
> > > +                     stream = dm_new_crtc_state->stream;
> > > +
> > > +                     if (stream) {
> > > +                             drm_connector_set_active_color_format_property(connector,
> > > +                                     convert_dc_pixel_encoding_into_drm_color_format(
> > > +                                             dm_new_crtc_state->stream->timing.pixel_encoding));
> > > +                     }
> > > +             } else {
> > > +                     drm_connector_set_active_color_format_property(connector, 0);
> >
> > Just realized an even bigger reason why your current design doesn't work:
> > You don't have locking here.
> >
> > And you cannot grab the required lock, which is
> > drm_dev->mode_config.mutex, because that would result in deadlocks. So
> > this really needs to use the atomic state based design I've described.
> >
>
> Maybe we should just drop "actual color format" and instead fail the
> modeset if the "preferred color format" property cannot be satisfied?
> It seems like the simplest thing to do here, though it is perhaps less
> convenient for userspace. In that case, the "preferred color format"
> property should just be called "color format".

Yeah that's more in line with how other atomic properties work. This
way userspace can figure out what works with a TEST_ONLY commit too.
And for this to work you probably want to have an "automatic" setting
too.
-Sima
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list