Skip to content

Commit 6848c29

Browse files
author
Thomas Zimmermann
committed
drm/aperture: Convert drivers to aperture interfaces
Mass-convert all drivers from FB helpers to aperture interfaces. No functional changes besides checking for returned errno codes. Signed-off-by: Thomas Zimmermann <[email protected]> Acked-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 2916059 commit 6848c29

File tree

19 files changed

+67
-56
lines changed

19 files changed

+67
-56
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424

2525
#include <drm/amdgpu_drm.h>
26+
#include <drm/drm_aperture.h>
2627
#include <drm/drm_drv.h>
2728
#include <drm/drm_gem.h>
2829
#include <drm/drm_vblank.h>
@@ -1196,7 +1197,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
11961197
#endif
11971198

11981199
/* Get rid of things like offb */
1199-
ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "amdgpudrmfb");
1200+
ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "amdgpudrmfb");
12001201
if (ret)
12011202
return ret;
12021203

drivers/gpu/drm/armada/armada_drv.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/of_graph.h>
1010
#include <linux/platform_device.h>
1111

12+
#include <drm/drm_aperture.h>
1213
#include <drm/drm_atomic_helper.h>
1314
#include <drm/drm_drv.h>
1415
#include <drm/drm_ioctl.h>
@@ -94,9 +95,7 @@ static int armada_drm_bind(struct device *dev)
9495
}
9596

9697
/* Remove early framebuffers */
97-
ret = drm_fb_helper_remove_conflicting_framebuffers(NULL,
98-
"armada-drm-fb",
99-
false);
98+
ret = drm_aperture_remove_framebuffers(false, "armada-drm-fb");
10099
if (ret) {
101100
dev_err(dev, "[" DRM_NAME ":%s] can't kick out simple-fb: %d\n",
102101
__func__, ret);

drivers/gpu/drm/ast/ast_drv.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
#include <linux/module.h>
3131
#include <linux/pci.h>
3232

33+
#include <drm/drm_aperture.h>
3334
#include <drm/drm_atomic_helper.h>
3435
#include <drm/drm_crtc_helper.h>
3536
#include <drm/drm_drv.h>
36-
#include <drm/drm_fb_helper.h>
3737
#include <drm/drm_gem_vram_helper.h>
3838
#include <drm/drm_probe_helper.h>
3939

@@ -89,23 +89,18 @@ static const struct pci_device_id ast_pciidlist[] = {
8989

9090
MODULE_DEVICE_TABLE(pci, ast_pciidlist);
9191

92-
static void ast_kick_out_firmware_fb(struct pci_dev *pdev)
92+
static int ast_remove_conflicting_framebuffers(struct pci_dev *pdev)
9393
{
94-
struct apertures_struct *ap;
9594
bool primary = false;
95+
resource_size_t base, size;
9696

97-
ap = alloc_apertures(1);
98-
if (!ap)
99-
return;
100-
101-
ap->ranges[0].base = pci_resource_start(pdev, 0);
102-
ap->ranges[0].size = pci_resource_len(pdev, 0);
103-
97+
base = pci_resource_start(pdev, 0);
98+
size = pci_resource_len(pdev, 0);
10499
#ifdef CONFIG_X86
105100
primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
106101
#endif
107-
drm_fb_helper_remove_conflicting_framebuffers(ap, "astdrmfb", primary);
108-
kfree(ap);
102+
103+
return drm_aperture_remove_conflicting_framebuffers(base, size, primary, "astdrmfb");
109104
}
110105

111106
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)
114109
struct drm_device *dev;
115110
int ret;
116111

117-
ast_kick_out_firmware_fb(pdev);
112+
ret = ast_remove_conflicting_framebuffers(pdev);
113+
if (ret)
114+
return ret;
118115

119116
ret = pcim_enable_device(pdev);
120117
if (ret)

drivers/gpu/drm/bochs/bochs_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <linux/pci.h>
77

88
#include <drm/drm_drv.h>
9+
#include <drm/drm_aperture.h>
910
#include <drm/drm_atomic_helper.h>
1011
#include <drm/drm_managed.h>
1112

@@ -109,7 +110,7 @@ static int bochs_pci_probe(struct pci_dev *pdev,
109110
return -ENOMEM;
110111
}
111112

112-
ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "bochsdrmfb");
113+
ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "bochsdrmfb");
113114
if (ret)
114115
return ret;
115116

drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/module.h>
1515
#include <linux/pci.h>
1616

17+
#include <drm/drm_aperture.h>
1718
#include <drm/drm_atomic_helper.h>
1819
#include <drm/drm_drv.h>
1920
#include <drm/drm_gem_framebuffer_helper.h>
@@ -313,8 +314,7 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
313314
struct drm_device *dev;
314315
int ret;
315316

316-
ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev,
317-
"hibmcdrmfb");
317+
ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "hibmcdrmfb");
318318
if (ret)
319319
return ret;
320320

drivers/gpu/drm/i915/i915_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <linux/vt.h>
4141
#include <acpi/video.h>
4242

43+
#include <drm/drm_aperture.h>
4344
#include <drm/drm_atomic_helper.h>
4445
#include <drm/drm_ioctl.h>
4546
#include <drm/drm_irq.h>
@@ -557,7 +558,7 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
557558
if (ret)
558559
goto err_perf;
559560

560-
ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "inteldrmfb");
561+
ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "inteldrmfb");
561562
if (ret)
562563
goto err_ggtt;
563564

drivers/gpu/drm/meson/meson_drv.c

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/platform_device.h>
1616
#include <linux/soc/amlogic/meson-canvas.h>
1717

18+
#include <drm/drm_aperture.h>
1819
#include <drm/drm_atomic_helper.h>
1920
#include <drm/drm_drv.h>
2021
#include <drm/drm_fb_helper.h>
@@ -156,23 +157,6 @@ static void meson_vpu_init(struct meson_drm *priv)
156157
writel_relaxed(value, priv->io_base + _REG(VPU_WRARB_MODE_L2C1));
157158
}
158159

159-
static void meson_remove_framebuffers(void)
160-
{
161-
struct apertures_struct *ap;
162-
163-
ap = alloc_apertures(1);
164-
if (!ap)
165-
return;
166-
167-
/* The framebuffer can be located anywhere in RAM */
168-
ap->ranges[0].base = 0;
169-
ap->ranges[0].size = ~0;
170-
171-
drm_fb_helper_remove_conflicting_framebuffers(ap, "meson-drm-fb",
172-
false);
173-
kfree(ap);
174-
}
175-
176160
struct meson_drm_soc_attr {
177161
struct meson_drm_soc_limits limits;
178162
const struct soc_device_attribute *attrs;
@@ -297,8 +281,13 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
297281
}
298282
}
299283

300-
/* Remove early framebuffers (ie. simplefb) */
301-
meson_remove_framebuffers();
284+
/*
285+
* Remove early framebuffers (ie. simplefb). The framebuffer can be
286+
* located anywhere in RAM
287+
*/
288+
ret = drm_aperture_remove_framebuffers(false, "meson-drm-fb");
289+
if (ret)
290+
goto free_drm;
302291

303292
ret = drmm_mode_config_init(drm);
304293
if (ret)

drivers/gpu/drm/mgag200/mgag200_drv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/pci.h>
1212
#include <linux/vmalloc.h>
1313

14+
#include <drm/drm_aperture.h>
1415
#include <drm/drm_drv.h>
1516
#include <drm/drm_file.h>
1617
#include <drm/drm_ioctl.h>
@@ -341,7 +342,9 @@ mgag200_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
341342
struct drm_device *dev;
342343
int ret;
343344

344-
drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "mgag200drmfb");
345+
ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "mgag200drmfb");
346+
if (ret)
347+
return ret;
345348

346349
ret = pcim_enable_device(pdev);
347350
if (ret)

drivers/gpu/drm/msm/msm_fbdev.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Author: Rob Clark <[email protected]>
55
*/
66

7+
#include <drm/drm_aperture.h>
78
#include <drm/drm_crtc.h>
89
#include <drm/drm_fb_helper.h>
910
#include <drm/drm_fourcc.h>
@@ -168,7 +169,9 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev)
168169
}
169170

170171
/* the fw fb could be anywhere in memory */
171-
drm_fb_helper_remove_conflicting_framebuffers(NULL, "msm", false);
172+
ret = drm_aperture_remove_framebuffers(false, "msm");
173+
if (ret)
174+
goto fini;
172175

173176
ret = drm_fb_helper_initial_config(helper, 32);
174177
if (ret)

drivers/gpu/drm/nouveau/nouveau_drm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/vga_switcheroo.h>
3131
#include <linux/mmu_notifier.h>
3232

33+
#include <drm/drm_aperture.h>
3334
#include <drm/drm_crtc_helper.h>
3435
#include <drm/drm_gem_ttm_helper.h>
3536
#include <drm/drm_ioctl.h>
@@ -737,7 +738,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
737738
nvkm_device_del(&device);
738739

739740
/* Remove conflicting drivers (vesafb, efifb etc). */
740-
ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "nouveaufb");
741+
ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "nouveaufb");
741742
if (ret)
742743
return ret;
743744

drivers/gpu/drm/qxl/qxl_drv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@
2929
*/
3030

3131
#include "qxl_drv.h"
32+
3233
#include <linux/console.h>
3334
#include <linux/module.h>
3435
#include <linux/pci.h>
36+
#include <linux/vgaarb.h>
3537

3638
#include <drm/drm.h>
39+
#include <drm/drm_aperture.h>
3740
#include <drm/drm_atomic_helper.h>
3841
#include <drm/drm_drv.h>
3942
#include <drm/drm_file.h>
@@ -93,7 +96,7 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
9396
if (ret)
9497
return ret;
9598

96-
ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "qxl");
99+
ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "qxl");
97100
if (ret)
98101
goto disable_pci;
99102

drivers/gpu/drm/radeon/radeon_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <linux/mmu_notifier.h>
3939
#include <linux/pci.h>
4040

41+
#include <drm/drm_aperture.h>
4142
#include <drm/drm_agpsupport.h>
4243
#include <drm/drm_crtc_helper.h>
4344
#include <drm/drm_drv.h>
@@ -330,7 +331,7 @@ static int radeon_pci_probe(struct pci_dev *pdev,
330331
return -EPROBE_DEFER;
331332

332333
/* Get rid of things like offb */
333-
ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "radeondrmfb");
334+
ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "radeondrmfb");
334335
if (ret)
335336
return ret;
336337

drivers/gpu/drm/sun4i/sun4i_drv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/of_reserved_mem.h>
1414
#include <linux/platform_device.h>
1515

16+
#include <drm/drm_aperture.h>
1617
#include <drm/drm_atomic_helper.h>
1718
#include <drm/drm_drv.h>
1819
#include <drm/drm_fb_cma_helper.h>
@@ -99,7 +100,9 @@ static int sun4i_drv_bind(struct device *dev)
99100
drm->irq_enabled = true;
100101

101102
/* Remove early framebuffers (ie. simplefb) */
102-
drm_fb_helper_remove_conflicting_framebuffers(NULL, "sun4i-drm-fb", false);
103+
ret = drm_aperture_remove_framebuffers(false, "sun4i-drm-fb");
104+
if (ret)
105+
goto cleanup_mode_config;
103106

104107
sun4i_framebuffer_init(drm);
105108

drivers/gpu/drm/tegra/drm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/module.h>
1212
#include <linux/platform_device.h>
1313

14+
#include <drm/drm_aperture.h>
1415
#include <drm/drm_atomic.h>
1516
#include <drm/drm_atomic_helper.h>
1617
#include <drm/drm_debugfs.h>
@@ -1198,8 +1199,7 @@ static int host1x_drm_probe(struct host1x_device *dev)
11981199

11991200
drm_mode_config_reset(drm);
12001201

1201-
err = drm_fb_helper_remove_conflicting_framebuffers(NULL, "tegradrmfb",
1202-
false);
1202+
err = drm_aperture_remove_framebuffers(false, "tegradrmfb");
12031203
if (err < 0)
12041204
goto hub;
12051205

drivers/gpu/drm/tiny/cirrus.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <video/cirrus.h>
2525
#include <video/vga.h>
2626

27+
#include <drm/drm_aperture.h>
2728
#include <drm/drm_atomic_helper.h>
2829
#include <drm/drm_atomic_state_helper.h>
2930
#include <drm/drm_connector.h>
@@ -549,7 +550,7 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
549550
struct cirrus_device *cirrus;
550551
int ret;
551552

552-
ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "cirrusdrmfb");
553+
ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "cirrusdrmfb");
553554
if (ret)
554555
return ret;
555556

drivers/gpu/drm/vboxvideo/vbox_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/pci.h>
1313
#include <linux/vt_kern.h>
1414

15+
#include <drm/drm_aperture.h>
1516
#include <drm/drm_crtc_helper.h>
1617
#include <drm/drm_drv.h>
1718
#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)
4243
if (!vbox_check_supported(VBE_DISPI_ID_HGSMI))
4344
return -ENODEV;
4445

45-
ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "vboxvideodrmfb");
46+
ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, "vboxvideodrmfb");
4647
if (ret)
4748
return ret;
4849

drivers/gpu/drm/vc4/vc4_drv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/platform_device.h>
3131
#include <linux/pm_runtime.h>
3232

33+
#include <drm/drm_aperture.h>
3334
#include <drm/drm_atomic_helper.h>
3435
#include <drm/drm_drv.h>
3536
#include <drm/drm_fb_cma_helper.h>
@@ -266,7 +267,9 @@ static int vc4_drm_bind(struct device *dev)
266267
if (ret)
267268
goto unbind_all;
268269

269-
drm_fb_helper_remove_conflicting_framebuffers(NULL, "vc4drmfb", false);
270+
ret = drm_aperture_remove_framebuffers(false, "vc4drmfb");
271+
if (ret)
272+
goto unbind_all;
270273

271274
ret = vc4_kms_load(drm);
272275
if (ret < 0)

0 commit comments

Comments
 (0)