drm: Add aperture helpers
Subsystems (22)
Thomas Zimmermann
maintainerv2 cover drm: Add aperture helpers
Adds helpers for maintaining aperture ownership. Currently wraps the infrastructure around fbdev's remove_conflicting_framebuffers().
For adding generic drivers to DRM, we need a hand-over mechanism that unloads the generic driver before loading the hardware's native driver. So far, this was supported for generic fbdev drivers, but not for DRM drivers.
As a first step, this patchset provides a DRM interface to release ownership of a framebuffer aperture. When called, all generic drivers for framebuffers in the range are being unloaded. At this point the functions wrap similar fbdev functionality. The old fbdev-based interface is being inlined into the new functionsa and drivers are converted.
The patchset is based on patches 3 and 4 of [1]. I incorporated the review comments and kept the acked-bys.
All converted drivers have been built at least once on either x86-64, aarch64 or arm.
[1] https://lore.kernel.org/dri-devel/[email protected]/
v2:
* fix docs for drm_aperture_remove_framebuffers()
Thomas Zimmermann (3):
drm/aperture: Add infrastructure for aperture ownership drm/aperture: Convert drivers to aperture interfaces drm/aperture: Inline fbdev conflict helpers into aperture helpers
Documentation/gpu/drm-internals.rst | 12 ++ drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 +- drivers/gpu/drm/armada/armada_drv.c | 5 +- drivers/gpu/drm/ast/ast_drv.c | 23 ++- drivers/gpu/drm/bochs/bochs_drv.c | 3 +- drivers/gpu/drm/drm_aperture.c | 131 ++++++++++++++++++ .../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 4 +- drivers/gpu/drm/i915/i915_drv.c | 3 +- drivers/gpu/drm/meson/meson_drv.c | 27 ++-- drivers/gpu/drm/mgag200/mgag200_drv.c | 5 +- drivers/gpu/drm/msm/msm_fbdev.c | 5 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 3 +- drivers/gpu/drm/qxl/qxl_drv.c | 5 +- drivers/gpu/drm/radeon/radeon_drv.c | 3 +- drivers/gpu/drm/sun4i/sun4i_drv.c | 5 +- drivers/gpu/drm/tegra/drm.c | 4 +- drivers/gpu/drm/tiny/cirrus.c | 3 +- drivers/gpu/drm/vboxvideo/vbox_drv.c | 3 +- drivers/gpu/drm/vc4/vc4_drv.c | 5 +- drivers/gpu/drm/virtio/virtgpu_drv.c | 10 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 4 +- include/drm/drm_aperture.h | 31 +++++ include/drm/drm_fb_helper.h | 51 ------- 24 files changed, 242 insertions(+), 108 deletions(-) create mode 100644 drivers/gpu/drm/drm_aperture.c create mode 100644 include/drm/drm_aperture.h
--
2.31.1
Thomas Zimmermann
maintainerPATCH v2 1/3 drm/aperture: Add infrastructure for aperture ownership
Platform devices might operate on firmware framebuffers, such as VESA or EFI. Before a native driver for the graphics hardware can take over the device, it has to remove any platform driver that operates on the firmware framebuffer. Aperture helpers provide the infrastructure for native drivers to remove the generic ones.
For now, this only concerns generic fbdev drivers. Code for removing these is provided by drm_fb_helper_remove_conflicting_framebuffers() et al. Simply wrap these functions for now. At a later point, code can be added for generic DRM drivers to acquire firmware framebuffers.
v2:
* fix docs for drm_aperture_remove_framebuffers()
--- Documentation/gpu/drm-internals.rst | 12 +++ drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_aperture.c | 114 ++++++++++++++++++++++++++++ include/drm/drm_aperture.h | 31 ++++++++ 4 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/drm_aperture.c create mode 100644 include/drm/drm_aperture.h
Documentation/gpu/drm-internals.rst +12 -0
@@ -75,6 +75,18 @@ update it, its value is mostly useless. The DRM core prints it to the kernel log at initialization time and passes it to userspace through the DRM_IOCTL_VERSION ioctl. +Managing Ownership of the Framebuffer Aperture +---------------------------------------------- + +.. kernel-doc:: drivers/gpu/drm/drm_aperture.c + :doc: overview + +.. kernel-doc:: include/drm/drm_aperture.h + :internal: + +.. kernel-doc:: drivers/gpu/drm/drm_aperture.c + :export: + Device Instance and Driver Handling -----------------------------------
drivers/gpu/drm/Makefile +1 -1
@@ -3,7 +3,7 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -drm-y := drm_auth.o drm_cache.o \ +drm-y := drm_aperture.o drm_auth.o drm_cache.o \ drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \ drm_drv.o \ drm_sysfs.o drm_hashtab.o drm_mm.o \
drivers/gpu/drm/drm_aperture.c new file +114 -0
114 lines not on this page · raw message
include/drm/drm_aperture.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: MIT */ + +#ifndef _DRM_APERTURE_H_ +#define _DRM_APERTURE_H_ + +#include <linux/types.h> + +struct pci_dev ; + +int drm_aperture_remove_conflicting_framebuffers (resource_size_t base,resource_size_t size, +bool primary,const char *name); + +int drm_aperture_remove_conflicting_pci_framebuffers (struct pci_dev *pdev,const char *name); + +/** +* drm_aperture_remove_framebuffers - remove all existing framebuffers +* @primary: also kick vga16fb if present +* @name: requesting driver name +* +* This function removes all graphics device drivers. Use this function on systems +* that can have their framebuffer located anywhere in memory. +* +* Returns: +* 0 on success, or a negative errno code otherwise +*/ +static inline int drm_aperture_remove_framebuffers (bool primary,const char *name) +{ +return drm_aperture_remove_conflicting_framebuffers (0 , (resource_size_t)-1 , primary, name); +} + +#endif
Signature · 1 line
2.31.1
Thomas Zimmermann
maintainerPATCH v2 2/3 drm/aperture: Convert drivers to aperture interfaces
In reply to Thomas ZimmermannMass-convert all drivers from FB helpers to aperture interfaces. No functional changes besides checking for returned errno codes.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- drivers/gpu/drm/armada/armada_drv.c | 5 ++-- drivers/gpu/drm/ast/ast_drv.c | 23 +++++++--------- drivers/gpu/drm/bochs/bochs_drv.c | 3 ++- .../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 4 +-- drivers/gpu/drm/i915/i915_drv.c | 3 ++- drivers/gpu/drm/meson/meson_drv.c | 27 ++++++------------- drivers/gpu/drm/mgag200/mgag200_drv.c | 5 +++- drivers/gpu/drm/msm/msm_fbdev.c | 5 +++- drivers/gpu/drm/nouveau/nouveau_drm.c | 3 ++- drivers/gpu/drm/qxl/qxl_drv.c | 5 +++- drivers/gpu/drm/radeon/radeon_drv.c | 3 ++- drivers/gpu/drm/sun4i/sun4i_drv.c | 5 +++- drivers/gpu/drm/tegra/drm.c | 4 +-- drivers/gpu/drm/tiny/cirrus.c | 3 ++- drivers/gpu/drm/vboxvideo/vbox_drv.c | 3 ++- drivers/gpu/drm/vc4/vc4_drv.c | 5 +++- drivers/gpu/drm/virtio/virtgpu_drv.c | 10 ++++--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 4 +-- 19 files changed, 67 insertions(+), 56 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
@@ -23,6 +23,7 @@*/ #include <drm/amdgpu_drm.h> +#include <drm/drm_aperture.h> #include <drm/drm_drv.h> #include <drm/drm_gem.h> #include <drm/drm_vblank.h>
@@ -1256,7 +1257,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,#endif /* Get rid of things like offb */ - ret =drm_fb_helper_remove_conflicting_pci_framebuffers (pdev,"amdgpudrmfb" ); + ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev,"amdgpudrmfb" );if (ret)return ret;
drivers/gpu/drm/armada/armada_drv.c +2 -3
@@ -9,6 +9,7 @@#include <linux/of_graph.h> #include <linux/platform_device.h> +#include <drm/drm_aperture.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_drv.h> #include <drm/drm_ioctl.h>
@@ -94,9 +95,7 @@ static int armada_drm_bind(struct device *dev) }/* Remove early framebuffers */ - ret =drm_fb_helper_remove_conflicting_framebuffers (NULL , -"armada-drm-fb" , - false); + ret =drm_aperture_remove_framebuffers (false,"armada-drm-fb" );if (ret) {dev_err (dev,"[" DRM_NAME ":%s] can't kick out simple-fb: %d\n" , __func__, ret);
drivers/gpu/drm/ast/ast_drv.c +10 -13
@@ -30,10 +30,10 @@#include <linux/module.h> #include <linux/pci.h> +#include <drm/drm_aperture.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_drv.h> -#include <drm/drm_fb_helper.h> #include <drm/drm_gem_vram_helper.h> #include <drm/drm_probe_helper.h>
@@ -89,23 +89,18 @@ static const struct pci_device_id ast_pciidlist[] = {MODULE_DEVICE_TABLE (pci, ast_pciidlist); -static void ast_kick_out_firmware_fb (struct pci_dev *pdev) +static int ast_remove_conflicting_framebuffers (struct pci_dev *pdev) { -struct apertures_struct *ap;bool primary = false; +resource_size_t base, size; - ap =alloc_apertures (1 ); -if (!ap) -return ; - - ap->ranges[0 ].base =pci_resource_start (pdev,0 ); - ap->ranges[0 ].size =pci_resource_len (pdev,0 ); - + base =pci_resource_start (pdev,0 ); + size =pci_resource_len (pdev,0 );#ifdef CONFIG_X86 primary = pdev->resource[PCI_ROM_RESOURCE ].flags &IORESOURCE_ROM_SHADOW ;#endif -drm_fb_helper_remove_conflicting_framebuffers (ap,"astdrmfb" , primary); -kfree (ap); + +return drm_aperture_remove_conflicting_framebuffers (base, size, primary,"astdrmfb" ); }static int ast_pci_probe (struct pci_dev *pdev,const struct pci_device_id *ent)
@@ -114,7 +109,9 @@ static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)struct drm_device *dev;int ret; -ast_kick_out_firmware_fb (pdev); + ret =ast_remove_conflicting_framebuffers (pdev); +if (ret) +return ret; ret =pcim_enable_device (pdev);if (ret)
drivers/gpu/drm/bochs/bochs_drv.c +2 -1
@@ -6,6 +6,7 @@#include <linux/pci.h> #include <drm/drm_drv.h> +#include <drm/drm_aperture.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_managed.h>
@@ -109,7 +110,7 @@ static int bochs_pci_probe(struct pci_dev *pdev,return -ENOMEM ; } - ret =drm_fb_helper_remove_conflicting_pci_framebuffers (pdev,"bochsdrmfb" ); + ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev,"bochsdrmfb" );if (ret)return ret;
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +2 -2
@@ -14,6 +14,7 @@#include <linux/module.h> #include <linux/pci.h> +#include <drm/drm_aperture.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_drv.h> #include <drm/drm_gem_framebuffer_helper.h>
@@ -313,8 +314,7 @@ static int hibmc_pci_probe(struct pci_dev *pdev,struct drm_device *dev;int ret; - ret =drm_fb_helper_remove_conflicting_pci_framebuffers (pdev, -"hibmcdrmfb" ); + ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev,"hibmcdrmfb" );if (ret)return ret;
drivers/gpu/drm/i915/i915_drv.c +2 -1
@@ -39,6 +39,7 @@#include <linux/vga_switcheroo.h> #include <linux/vt.h> +#include <drm/drm_aperture.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_ioctl.h> #include <drm/drm_irq.h>
@@ -553,7 +554,7 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)if (ret) goto err_perf; - ret =drm_fb_helper_remove_conflicting_pci_framebuffers (pdev,"inteldrmfb" ); + ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev,"inteldrmfb" );if (ret) goto err_ggtt;
drivers/gpu/drm/meson/meson_drv.c +8 -19
@@ -15,6 +15,7 @@#include <linux/platform_device.h> #include <linux/soc/amlogic/meson-canvas.h> +#include <drm/drm_aperture.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_drv.h> #include <drm/drm_fb_helper.h>
@@ -156,23 +157,6 @@ static void meson_vpu_init(struct meson_drm *priv)writel_relaxed (value, priv->io_base +_REG (VPU_WRARB_MODE_L2C1 )); } -static void meson_remove_framebuffers (void ) -{ -struct apertures_struct *ap; - - ap =alloc_apertures (1 ); -if (!ap) -return ; - -/* The framebuffer can be located anywhere in RAM */ - ap->ranges[0 ].base =0 ; - ap->ranges[0 ].size = ~0 ; - -drm_fb_helper_remove_conflicting_framebuffers (ap,"meson-drm-fb" , - false); -kfree (ap); -} -struct meson_drm_soc_attr {struct meson_drm_soc_limits limits;const struct soc_device_attribute *attrs;
@@ -297,8 +281,13 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) } } -/* Remove early framebuffers (ie. simplefb) */ -meson_remove_framebuffers (); +/* +* Remove early framebuffers (ie. simplefb). The framebuffer can be +* located anywhere in RAM +*/ + ret =drm_aperture_remove_framebuffers (false,"meson-drm-fb" ); +if (ret) + goto free_drm; ret =drmm_mode_config_init (drm);if (ret)
drivers/gpu/drm/mgag200/mgag200_drv.c +4 -1
@@ -11,6 +11,7 @@#include <linux/pci.h> #include <linux/vmalloc.h> +#include <drm/drm_aperture.h> #include <drm/drm_drv.h> #include <drm/drm_file.h> #include <drm/drm_ioctl.h>
@@ -341,7 +342,9 @@ mgag200_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)struct drm_device *dev;int ret; -drm_fb_helper_remove_conflicting_pci_framebuffers (pdev,"mgag200drmfb" ); + ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev,"mgag200drmfb" ); +if (ret) +return ret; ret =pcim_enable_device (pdev);if (ret)
drivers/gpu/drm/msm/msm_fbdev.c +4 -1
@@ -4,6 +4,7 @@* Author: Rob Clark <[email protected]> */ +#include <drm/drm_aperture.h> #include <drm/drm_crtc.h> #include <drm/drm_fb_helper.h> #include <drm/drm_fourcc.h>
@@ -168,7 +169,9 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) }/* the fw fb could be anywhere in memory */ -drm_fb_helper_remove_conflicting_framebuffers (NULL ,"msm" , false); + ret =drm_aperture_remove_framebuffers (false,"msm" ); +if (ret) + goto fini; ret =drm_fb_helper_initial_config (helper,32 );if (ret)
drivers/gpu/drm/nouveau/nouveau_drm.c +2 -1
@@ -30,6 +30,7 @@#include <linux/vga_switcheroo.h> #include <linux/mmu_notifier.h> +#include <drm/drm_aperture.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_gem_ttm_helper.h> #include <drm/drm_ioctl.h>
@@ -737,7 +738,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,nvkm_device_del (&device);/* Remove conflicting drivers (vesafb, efifb etc). */ - ret =drm_fb_helper_remove_conflicting_pci_framebuffers (pdev,"nouveaufb" ); + ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev,"nouveaufb" );if (ret)return ret;
drivers/gpu/drm/qxl/qxl_drv.c +4 -1
@@ -29,11 +29,14 @@*/ #include "qxl_drv.h" +#include <linux/console.h> #include <linux/module.h> #include <linux/pci.h> +#include <linux/vgaarb.h> #include <drm/drm.h> +#include <drm/drm_aperture.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_drv.h> #include <drm/drm_file.h>
@@ -93,7 +96,7 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (ret)return ret; - ret =drm_fb_helper_remove_conflicting_pci_framebuffers (pdev,"qxl" ); + ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev,"qxl" );if (ret) goto disable_pci;
drivers/gpu/drm/radeon/radeon_drv.c +2 -1
@@ -38,6 +38,7 @@#include <linux/mmu_notifier.h> #include <linux/pci.h> +#include <drm/drm_aperture.h> #include <drm/drm_agpsupport.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_drv.h>
@@ -330,7 +331,7 @@ static int radeon_pci_probe(struct pci_dev *pdev,return -EPROBE_DEFER ;/* Get rid of things like offb */ - ret =drm_fb_helper_remove_conflicting_pci_framebuffers (pdev,"radeondrmfb" ); + ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev,"radeondrmfb" );if (ret)return ret;
drivers/gpu/drm/sun4i/sun4i_drv.c +4 -1
@@ -13,6 +13,7 @@#include <linux/of_reserved_mem.h> #include <linux/platform_device.h> +#include <drm/drm_aperture.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_drv.h> #include <drm/drm_fb_cma_helper.h>
@@ -99,7 +100,9 @@ static int sun4i_drv_bind(struct device *dev) drm->irq_enabled = true;/* Remove early framebuffers (ie. simplefb) */ -drm_fb_helper_remove_conflicting_framebuffers (NULL ,"sun4i-drm-fb" , false); + ret =drm_aperture_remove_framebuffers (false,"sun4i-drm-fb" ); +if (ret) + goto cleanup_mode_config;sun4i_framebuffer_init (drm);
drivers/gpu/drm/tegra/drm.c +2 -2
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/platform_device.h> +#include <drm/drm_aperture.h> #include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_debugfs.h>
@@ -1198,8 +1199,7 @@ static int host1x_drm_probe(struct host1x_device *dev)drm_mode_config_reset (drm); - err =drm_fb_helper_remove_conflicting_framebuffers (NULL ,"tegradrmfb" , - false); + err =drm_aperture_remove_framebuffers (false,"tegradrmfb" );if (err <0 ) goto hub;
drivers/gpu/drm/tiny/cirrus.c +2 -1
@@ -24,6 +24,7 @@#include <video/cirrus.h> #include <video/vga.h> +#include <drm/drm_aperture.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_state_helper.h> #include <drm/drm_connector.h>
@@ -549,7 +550,7 @@ static int cirrus_pci_probe(struct pci_dev *pdev,struct cirrus_device *cirrus;int ret; - ret =drm_fb_helper_remove_conflicting_pci_framebuffers (pdev,"cirrusdrmfb" ); + ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev,"cirrusdrmfb" );if (ret)return ret;
drivers/gpu/drm/vboxvideo/vbox_drv.c +2 -1
@@ -12,6 +12,7 @@#include <linux/pci.h> #include <linux/vt_kern.h> +#include <drm/drm_aperture.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_drv.h> #include <drm/drm_fb_helper.h>
@@ -42,7 +43,7 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (!vbox_check_supported (VBE_DISPI_ID_HGSMI ))return -ENODEV ; - ret =drm_fb_helper_remove_conflicting_pci_framebuffers (pdev,"vboxvideodrmfb" ); + ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev,"vboxvideodrmfb" );if (ret)return ret;
drivers/gpu/drm/vc4/vc4_drv.c +4 -1
@@ -30,6 +30,7 @@#include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <drm/drm_aperture.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_drv.h> #include <drm/drm_fb_cma_helper.h>
@@ -266,7 +267,9 @@ static int vc4_drm_bind(struct device *dev)if (ret) goto unbind_all; -drm_fb_helper_remove_conflicting_framebuffers (NULL ,"vc4drmfb" , false); + ret =drm_aperture_remove_framebuffers (false,"vc4drmfb" ); +if (ret) + goto unbind_all; ret =vc4_kms_load (drm);if (ret <0 )
drivers/gpu/drm/virtio/virtgpu_drv.c +7 -3
@@ -31,6 +31,7 @@#include <linux/pci.h> #include <drm/drm.h> +#include <drm/drm_aperture.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_drv.h> #include <drm/drm_file.h>
@@ -50,13 +51,16 @@ static int virtio_gpu_pci_quirk(struct drm_device *dev, struct virtio_device *vdconst char *pname =dev_name (&pdev->dev);bool vga = (pdev->class >>8 ) ==PCI_CLASS_DISPLAY_VGA ;char unique[20 ]; +int ret;DRM_INFO ("pci: %s detected at %s\n" , vga ?"virtio-vga" :"virtio-gpu-pci" , pname); -if (vga) -drm_fb_helper_remove_conflicting_pci_framebuffers (pdev, -"virtiodrmfb" ); +if (vga) { + ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev,"virtiodrmfb" ); +if (ret) +return ret; + }/* * Normally the drm_dev_set_unique() call is done by core DRM.
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +2 -2
@@ -31,8 +31,8 @@#include <linux/pci.h> #include <linux/mem_encrypt.h> +#include <drm/drm_aperture.h> #include <drm/drm_drv.h> -#include <drm/drm_fb_helper.h> #include <drm/drm_ioctl.h> #include <drm/drm_sysfs.h> #include <drm/ttm/ttm_bo_driver.h>
@@ -1491,7 +1491,7 @@ static int vmw_probe(struct pci_dev *pdev, const struct pci_device_id *ent)struct vmw_private *vmw;int ret; - ret =drm_fb_helper_remove_conflicting_pci_framebuffers (pdev,"svgadrmfb" ); + ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev,"svgadrmfb" );if (ret)return ret;
Signature · 1 line
2.31.1
Thomas Zimmermann
maintainerPATCH v2 3/3 drm/aperture: Inline fbdev conflict helpers into aperture helpers
In reply to Thomas ZimmermannFbdev's helpers for handling conflicting framebuffer drivers are related to framebuffer apertures, not console emulation. Therefore remove them from drm_fb_helper.h and inline them into the aperture helpers. No functional changes.
--- drivers/gpu/drm/drm_aperture.c | 23 +++++++++++++-- include/drm/drm_fb_helper.h | 51 ---------------------------------- 2 files changed, 20 insertions(+), 54 deletions(-)
drivers/gpu/drm/drm_aperture.c +20 -3
@@ -1,7 +1,9 @@// SPDX-License-Identifier: MIT +#include <linux/fb.h> +#include <linux/vgaarb.h> +#include <drm/drm_aperture.h> -#include <drm/drm_fb_helper.h> /** * DOC: overview
@@ -78,6 +80,7 @@int drm_aperture_remove_conflicting_framebuffers (resource_size_t base,resource_size_t size,bool primary,const char *name) { +#if IS_REACHABLE (CONFIG_FB )struct apertures_struct *a;int ret;
@@ -88,10 +91,13 @@ int drm_aperture_remove_conflicting_framebuffers(resource_size_t base, resource_ a->ranges[0 ].base = base; a->ranges[0 ].size = size; - ret =drm_fb_helper_remove_conflicting_framebuffers (a, name, primary); + ret =remove_conflicting_framebuffers (a, name, primary);kfree (a);return ret; +#else +return 0 ; +#endif }EXPORT_SYMBOL (drm_aperture_remove_conflicting_framebuffers);
@@ -109,6 +115,17 @@ EXPORT_SYMBOL(drm_aperture_remove_conflicting_framebuffers);*/ int drm_aperture_remove_conflicting_pci_framebuffers (struct pci_dev *pdev,const char *name) { -return drm_fb_helper_remove_conflicting_pci_framebuffers (pdev, name); +int ret =0 ; + +/* +* WARNING: Apparently we must kick fbdev drivers before vgacon, +* otherwise the vga fbdev driver falls over. +*/ +#if IS_REACHABLE (CONFIG_FB ) + ret =remove_conflicting_pci_framebuffers (pdev, name); +#endif +if (ret ==0 ) + ret =vga_remove_vgacon (pdev); +return ret; }EXPORT_SYMBOL (drm_aperture_remove_conflicting_pci_framebuffers);
include/drm/drm_fb_helper.h +0 -51
61 lines not on this page · raw message
Signature · 1 line
2.31.1