Skip to content

Commit

Permalink
drm/ofdrm: Add ofdrm for Open Firmware framebuffers
Browse files Browse the repository at this point in the history
Open Firmware provides basic display output via the 'display' node.
DT platform code already provides a device that represents the node's
framebuffer. Add a DRM driver for the device. The display mode and
color format is pre-initialized by the system's firmware. Runtime
modesetting via DRM is not possible. The display is useful during
early boot stages or as error fallback.

Similar functionality is already provided by fbdev's offb driver,
which is insufficient for modern userspace. The old driver includes
support for BootX device tree, which can be found on old 32-bit
PowerPC Macintosh systems. If these are still in use, the
functionality can be added to ofdrm or implemented in a new
driver. As with simpledrm, the fbdev driver cannot be selected if
ofdrm is already enabled.

Two notable points about the driver:

 * Reading the framebuffer aperture from the device tree is not
reliable on all systems. Ofdrm takes the heuristics and a comment
from offb to pick the correct range.

 * No resource management may be tied to the underlying PCI device.
Otherwise the handover to the native driver will fail with a resource
conflict. PCI management is therefore done as part of the platform
device's cleanup.

The driver has been tested on qemu's ppc64le emulation. The device
hand-over has been tested with bochs.

v5:
	* use drm_atomic_helper_check_crtc_primary_plane()
v4:
	* set preferred depth to the correct value
	* set bpp value for console emulation
	* output scanout-buffer parameters with drm_dbg()
v3:
	* reintegrate FWFB helpers into ofdrm
	* use damage iterator
	* sync GEM BOs with drm_gem_fb_{begin,end}_cpu_access()
	* fix various atomic_check helpers
	* remove CRTC atomic_{enable,disable} (Javier)
	* compute stride with drm_format_info_min_pitch() (Daniel)
v2:
	* removed simple-pipe helpers
	* built driver on top of FWFB helpers
	* merged all init code into single function
	* make PCI support optional (Michal)
	* support COMPILE_TEST (Javier)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

convert
Link: https://patchwork.freedesktop.org/patch/msgid/20221011150712.3928-2-tzimmermann@suse.de
  • Loading branch information
Thomas Zimmermann committed Oct 14, 2022
1 parent 9a0cdcd commit c8a1775
Show file tree
Hide file tree
Showing 5 changed files with 779 additions and 0 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -6653,6 +6653,7 @@ L: dri-devel@lists.freedesktop.org
S: Maintained
T: git git://anongit.freedesktop.org/drm/drm-misc
F: drivers/gpu/drm/drm_aperture.c
F: drivers/gpu/drm/tiny/ofdrm.c
F: drivers/gpu/drm/tiny/simpledrm.c
F: drivers/video/aperture.c
F: include/drm/drm_aperture.h
Expand Down
13 changes: 13 additions & 0 deletions drivers/gpu/drm/tiny/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ config DRM_GM12U320
This is a KMS driver for projectors which use the GM12U320 chipset
for video transfer over USB2/3, such as the Acer C120 mini projector.

config DRM_OFDRM
tristate "Open Firmware display driver"
depends on DRM && OF && (PPC || COMPILE_TEST)
select APERTURE_HELPERS
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
help
DRM driver for Open Firmware framebuffers.

This driver assumes that the display hardware has been initialized
by the Open Firmware before the kernel boots. Scanout buffer, size,
and display format must be provided via device tree.

config DRM_PANEL_MIPI_DBI
tristate "DRM support for MIPI DBI compatible panels"
depends on DRM && SPI
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/tiny/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
obj-$(CONFIG_DRM_BOCHS) += bochs.o
obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus.o
obj-$(CONFIG_DRM_GM12U320) += gm12u320.o
obj-$(CONFIG_DRM_OFDRM) += ofdrm.o
obj-$(CONFIG_DRM_PANEL_MIPI_DBI) += panel-mipi-dbi.o
obj-$(CONFIG_DRM_SIMPLEDRM) += simpledrm.o
obj-$(CONFIG_TINYDRM_HX8357D) += hx8357d.o
Expand Down
Loading

0 comments on commit c8a1775

Please sign in to comment.