drm/vc4: Allow fb modifiers early enough to fill IN_FORMATS property
Subsystems (3)
PATCH 1/1 drm/vc4: Allow fb modifiers early enough to fill IN_FORMATS property
The KMS mode_config elements are currently configured in vc4_kms_load, that is called after all components are binded (component_bind_all). However, the CRTC component (for the Pixel Valve) needs to access the allow_fb_modifiers element at bind time, when initializing its planes through drm_universal_plane_init.
This helpers checks allow_fb_modifiers to decide whether to fill the IN_FORMATS property. Because allow_fb_modifiers is still set to false at this point, the property is never filled and userspace cannot retrieve the combination of supported formats and modifiers.
Fix this by setting allow_fb_modifiers right after calling drm_mode_config_init (which initializes the structure), before binding the components of the driver.
--- drivers/gpu/drm/vc4/vc4_drv.c | 1 + drivers/gpu/drm/vc4/vc4_kms.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_drv.c +1 -0
@@ -273,6 +273,7 @@ static int vc4_drm_bind(struct device *dev) goto dev_put;drm_mode_config_init (drm); + drm->mode_config.allow_fb_modifiers = true;vc4_gem_init (drm);
drivers/gpu/drm/vc4/vc4_kms.c +0 -1
@@ -530,7 +530,6 @@ int vc4_kms_load(struct drm_device *dev) dev->mode_config.funcs = &vc4_mode_funcs; dev->mode_config.preferred_depth =24 ; dev->mode_config.async_page_flip = true; - dev->mode_config.allow_fb_modifiers = true;drm_modeset_lock_init (&vc4->ctm_state_lock);
Signature · 1 line
2.20.1
Quoted 6 lines · Paul Kocialkowski
The KMS
mode_configelements are currently configured invc4_kms_load, that is called after all components are binded (component_bind_all). However, the CRTC component (for the Pixel Valve) needs to access theallow_fb_modifierselement at bind time, when initializing its planes throughdrm_universal_plane_init.
Quoted 8 lines
This helpers checks
allow_fb_modifiersto decide whether to fill theIN_FORMATSproperty. Becauseallow_fb_modifiersis still set to false at this point, the property is never filled and userspace cannot retrieve the combination of supported formats and modifiers.Fix this by setting
allow_fb_modifiersright after callingdrm_mode_config_init(which initializes the structure), before binding the components of the driver.
This makes me wonder if the flag could be removed and replaced with "did non-NULL modifiers get supplied to plane init?" I think I've tripped over this flag in other KMS hacking, too.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 13 lines · Eric Anholt
Quoted 11 lines · Paul Kocialkowski
The KMS
mode_configelements are currently configured invc4_kms_load, that is called after all components are binded (component_bind_all). However, the CRTC component (for the Pixel Valve) needs to access theallow_fb_modifierselement at bind time, when initializing its planes throughdrm_universal_plane_init.This helpers checks
allow_fb_modifiersto decide whether to fill theIN_FORMATSproperty. Becauseallow_fb_modifiersis still set to false at this point, the property is never filled and userspace cannot retrieve the combination of supported formats and modifiers.
Quoted 7 lines
Quoted 3 lines
Fix this by setting
allow_fb_modifiersright after callingdrm_mode_config_init(which initializes the structure), before binding the components of the driver.This makes me wonder if the flag could be removed and replaced with "did non-NULL modifiers get supplied to plane init?" I think I've tripped over this flag in other KMS hacking, too.
Sounds like a good idea to me. Just setting it in plane_init should work I think ...
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 18 lines · Daniel Vetter
Quoted 17 lines · Eric Anholt
Quoted 14 lines · Paul Kocialkowski
The KMS
mode_configelements are currently configured invc4_kms_load, that is called after all components are binded (component_bind_all). However, the CRTC component (for the Pixel Valve) needs to access theallow_fb_modifierselement at bind time, when initializing its planes throughdrm_universal_plane_init.This helpers checks
allow_fb_modifiersto decide whether to fill theIN_FORMATSproperty. Becauseallow_fb_modifiersis still set to false at this point, the property is never filled and userspace cannot retrieve the combination of supported formats and modifiers.Fix this by setting
allow_fb_modifiersright after callingdrm_mode_config_init(which initializes the structure), before binding the components of the driver.
Quoted 6 lines
Quoted 3 lines
This makes me wonder if the flag could be removed and replaced with "did non-NULL modifiers get supplied to plane init?" I think I've tripped over this flag in other KMS hacking, too.
Sounds like a good idea to me. Just setting it in
plane_initshould work I think ...
Yeah, we probably need to keep the flag around since it's used in various places, but we could totally have it auto-set as soon as a plane is registered with a list of modifiers.
I was also thinking of allowing the core to fill-in the IN_FORMATS prop even without this flag set, which would only list formats (but not modifiers).
What do you think?
Cheers,
Paul
Signature · 8 lines
Paul Kocialkowski, Bootlin (formerly Free Electrons) Embedded Linux and kernel engineering https://bootlin.com _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel