OSDN Git Service

drm/tegra: Implement fbdev emulation as in-kernel client
authorThomas Zimmermann <tzimmermann@suse.de>
Thu, 30 Mar 2023 08:36:07 +0000 (10:36 +0200)
committerThierry Reding <treding@nvidia.com>
Thu, 6 Apr 2023 10:18:56 +0000 (12:18 +0200)
commit71ec16f45ef8d10e20c58e85f7d3644e324d3c13
tree0c82e8068a181f57f62ae1eae52d8a302a591036
parent25dda38e0b07941f291a442ac470b0637b7b3e60
drm/tegra: Implement fbdev emulation as in-kernel client

Move code from ad-hoc fbdev callbacks into DRM client functions
and remove the old callbacks. The functions instruct the client
to poll for changed output or restore the display. The DRM core
calls both, the old callbacks and the new client helpers, from
the same places. The new functions perform the same operation as
before, so there's no change in functionality.

Replace all code that initializes or releases fbdev emulation
throughout the driver. Instead initialize the fbdev client by a
single call to tegra_fbdev_setup() after tegra has registered
its DRM device. As in most drivers, tegra's fbdev emulation now
acts like a regular DRM client.

The fbdev client setup consists of the initial preparation and the
hot-plugging of the display. The latter creates the fbdev device
and sets up the fbdev framebuffer. The setup performs display
hot-plugging once. If no display can be detected, DRM probe helpers
re-run the detection on each hotplug event.

A call to drm_dev_unregister() releases the client automatically.
No further action is required within tegra. If the fbdev
framebuffer has been fully set up, struct fb_ops.fb_destroy
implements the release. For partially initialized emulation, the
fbdev client reverts the initial setup.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/drm.c
drivers/gpu/drm/tegra/drm.h
drivers/gpu/drm/tegra/fbdev.c