drm: Introduce drm_fb_helper_prepare()
To implement hotplug detection in a race-free manner, drivers must call drm_kms_helper_poll_init() before hotplug events can be triggered. Such events can be triggered right after any of the encoders or connectors are initialized. At the same time, if the drm_fb_helper_hotplug_event() helper is used by a driver, then the poll helper requires some parts of the FB helper to be initialized to prevent a crash. At the same time, drm_fb_helper_init() requires information that is not necessarily available at such an early stage (number of CRTCs and connectors), so it cannot be used yet. Add a new helper, drm_fb_helper_prepare(), that initializes the bare minimum needed to allow drm_kms_helper_poll_init() to execute and any subsequent hotplug events to be processed properly. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:

committed by
Dave Airlie

parent
3a4938799d
commit
10a2310265
@@ -276,7 +276,6 @@ static struct tegra_fbdev *tegra_fbdev_create(struct drm_device *drm,
|
||||
unsigned int num_crtc,
|
||||
unsigned int max_connectors)
|
||||
{
|
||||
struct drm_fb_helper *helper;
|
||||
struct tegra_fbdev *fbdev;
|
||||
int err;
|
||||
|
||||
@@ -286,8 +285,7 @@ static struct tegra_fbdev *tegra_fbdev_create(struct drm_device *drm,
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
fbdev->base.funcs = &tegra_fb_helper_funcs;
|
||||
helper = &fbdev->base;
|
||||
drm_fb_helper_prepare(drm, &fbdev->base, &tegra_fb_helper_funcs);
|
||||
|
||||
err = drm_fb_helper_init(drm, &fbdev->base, num_crtc, max_connectors);
|
||||
if (err < 0) {
|
||||
|
Reference in New Issue
Block a user