]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm: Remove drm_mode_config::fb_base
authorZack Rusin <zackr@vmware.com>
Wed, 19 Oct 2022 02:43:50 +0000 (22:43 -0400)
committerZack Rusin <zackr@vmware.com>
Thu, 20 Oct 2022 01:46:16 +0000 (21:46 -0400)
The fb_base in struct drm_mode_config has been unused for a long time.
Some drivers set it and some don't leading to a very confusing state
where the variable can't be relied upon, because there's no indication
as to which driver sets it and which doesn't.

The only usage of fb_base is internal to two drivers so instead of trying
to force it into all the drivers to get it into a coherent state
completely remove it.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Thomas Zimmermann <tzimemrmann@suse.de>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221019024401.394617-1-zack@kde.org
22 files changed:
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/ast/ast_mode.c
drivers/gpu/drm/gma500/framebuffer.c
drivers/gpu/drm/gma500/psb_drv.h
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
drivers/gpu/drm/mgag200/mgag200_mode.c
drivers/gpu/drm/msm/msm_fbdev.c
drivers/gpu/drm/nouveau/nouveau_display.c
drivers/gpu/drm/nouveau/nv04_fbcon.c
drivers/gpu/drm/omapdrm/omap_fbdev.c
drivers/gpu/drm/qxl/qxl_display.c
drivers/gpu/drm/radeon/radeon_display.c
drivers/gpu/drm/radeon/radeon_fb.c
drivers/gpu/drm/tegra/fb.c
drivers/gpu/drm/tiny/bochs.c
include/drm/drm_mode_config.h

index f4b5301ea2a02e2794b85a79b814a93742b5f710..09dec2561adf9272c624321dc435319fcac6adb2 100644 (file)
@@ -498,8 +498,6 @@ static int amdgpu_vkms_sw_init(void *handle)
        adev_to_drm(adev)->mode_config.preferred_depth = 24;
        adev_to_drm(adev)->mode_config.prefer_shadow = 1;
 
-       adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
-
        r = amdgpu_display_modeset_create_props(adev);
        if (r)
                return r;
index 288fce7dc0ed178305b443d93fe72906e603bbf6..05051d5d2ec31102ce3bad7fcba18127eb2c3ddc 100644 (file)
@@ -2800,8 +2800,6 @@ static int dce_v10_0_sw_init(void *handle)
 
        adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
 
-       adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
-
        r = amdgpu_display_modeset_create_props(adev);
        if (r)
                return r;
index cbe5250b31cb4e33ac7460a323690df56f955f70..c928bc9eb2026bd0d42f784ef15d977e97de77c4 100644 (file)
@@ -2918,8 +2918,6 @@ static int dce_v11_0_sw_init(void *handle)
 
        adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
 
-       adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
-
        r = amdgpu_display_modeset_create_props(adev);
        if (r)
                return r;
index b1c44fab074f32806266b054d4aa163816cd9c46..62315fd5a05f2f75d0f0b7b89abfea77bcc627c3 100644 (file)
@@ -2675,7 +2675,6 @@ static int dce_v6_0_sw_init(void *handle)
        adev_to_drm(adev)->mode_config.preferred_depth = 24;
        adev_to_drm(adev)->mode_config.prefer_shadow = 1;
        adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
-       adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
 
        r = amdgpu_display_modeset_create_props(adev);
        if (r)
index a22b45c9279227a2a28adf8aabebf2718c4dd1ba..87d5e4c21cb37d0142418dd0091807f0b5fb3b64 100644 (file)
@@ -2701,8 +2701,6 @@ static int dce_v8_0_sw_init(void *handle)
 
        adev_to_drm(adev)->mode_config.fb_modifiers_not_supported = true;
 
-       adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
-
        r = amdgpu_display_modeset_create_props(adev);
        if (r)
                return r;
index c053cb79cd063eb3f9eab2e5a6fa2541f7d0ddc9..0db2a88cd4d7b946dca7aee886804fba9efd9026 100644 (file)
@@ -3816,8 +3816,6 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev)
        /* indicates support for immediate flip */
        adev_to_drm(adev)->mode_config.async_page_flip = true;
 
-       adev_to_drm(adev)->mode_config.fb_base = adev->gmc.aper_base;
-
        state = kzalloc(sizeof(*state), GFP_KERNEL);
        if (!state)
                return -ENOMEM;
index 4355754d69b5614bafab03a93ff4c67960db9105..c7443317c747cab918fb565e7bfea468c1c06017 100644 (file)
@@ -1767,7 +1767,6 @@ static const struct drm_mode_config_funcs ast_mode_config_funcs = {
 int ast_mode_config_init(struct ast_private *ast)
 {
        struct drm_device *dev = &ast->base;
-       struct pci_dev *pdev = to_pci_dev(dev->dev);
        int ret;
 
        ret = drmm_mode_config_init(dev);
@@ -1778,7 +1777,6 @@ int ast_mode_config_init(struct ast_private *ast)
        dev->mode_config.min_width = 0;
        dev->mode_config.min_height = 0;
        dev->mode_config.preferred_depth = 24;
-       dev->mode_config.fb_base = pci_resource_start(pdev, 0);
 
        if (ast->chip == AST2100 ||
            ast->chip == AST2200 ||
index aa3ecf771fd3691ceda363648662f50d3af5f0ee..5f502a0048ab803b966694f2a92669617d1968f2 100644 (file)
@@ -286,7 +286,7 @@ static int psbfb_create(struct drm_fb_helper *fb_helper,
 
        info->fbops = &psbfb_unaccel_ops;
 
-       info->fix.smem_start = dev->mode_config.fb_base;
+       info->fix.smem_start = dev_priv->fb_base;
        info->fix.smem_len = size;
        info->fix.ywrapstep = 0;
        info->fix.ypanstep = 0;
@@ -296,7 +296,7 @@ static int psbfb_create(struct drm_fb_helper *fb_helper,
        info->screen_size = size;
 
        if (dev_priv->gtt.stolen_size) {
-               info->apertures->ranges[0].base = dev->mode_config.fb_base;
+               info->apertures->ranges[0].base = dev_priv->fb_base;
                info->apertures->ranges[0].size = dev_priv->gtt.stolen_size;
        }
 
@@ -527,7 +527,7 @@ void psb_modeset_init(struct drm_device *dev)
 
        /* set memory base */
        /* Oaktrail and Poulsbo should use BAR 2*/
-       pci_read_config_dword(pdev, PSB_BSM, (u32 *)&(dev->mode_config.fb_base));
+       pci_read_config_dword(pdev, PSB_BSM, (u32 *)&(dev_priv->fb_base));
 
        /* num pipes is 2 for PSB but 1 for Mrst */
        for (i = 0; i < dev_priv->num_pipe; i++)
index ae544b69fc4759a5ce756a414a6c508d9e46c1a1..a5df6d2f2cabdaa18a98143e554efac5fb80371d 100644 (file)
@@ -523,6 +523,7 @@ struct drm_psb_private {
        uint32_t blc_adj2;
 
        struct drm_fb_helper *fb_helper;
+       resource_size_t fb_base;
 
        bool dsr_enable;
        u32 dsr_fb_update;
index fe4269c5aa0ab7b5ffc8b2af6cd5f37d5e2e7357..5a2e1cac06b2ec787f916c716aadc0aa874e2f84 100644 (file)
@@ -105,7 +105,6 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv)
        dev->mode_config.max_width = 1920;
        dev->mode_config.max_height = 1200;
 
-       dev->mode_config.fb_base = priv->fb_base;
        dev->mode_config.preferred_depth = 32;
        dev->mode_config.prefer_shadow = 1;
 
@@ -212,7 +211,7 @@ static int hibmc_hw_map(struct hibmc_drm_private *priv)
 {
        struct drm_device *dev = &priv->dev;
        struct pci_dev *pdev = to_pci_dev(dev->dev);
-       resource_size_t addr, size, ioaddr, iosize;
+       resource_size_t ioaddr, iosize;
 
        ioaddr = pci_resource_start(pdev, 1);
        iosize = pci_resource_len(pdev, 1);
@@ -222,16 +221,6 @@ static int hibmc_hw_map(struct hibmc_drm_private *priv)
                return -ENOMEM;
        }
 
-       addr = pci_resource_start(pdev, 0);
-       size = pci_resource_len(pdev, 0);
-       priv->fb_map = devm_ioremap(dev->dev, addr, size);
-       if (!priv->fb_map) {
-               drm_err(dev, "Cannot map framebuffer\n");
-               return -ENOMEM;
-       }
-       priv->fb_base = addr;
-       priv->fb_size = size;
-
        return 0;
 }
 
@@ -271,7 +260,8 @@ static int hibmc_load(struct drm_device *dev)
        if (ret)
                goto err;
 
-       ret = drmm_vram_helper_init(dev, pci_resource_start(pdev, 0), priv->fb_size);
+       ret = drmm_vram_helper_init(dev, pci_resource_start(pdev, 0),
+                                   pci_resource_len(pdev, 0));
        if (ret) {
                drm_err(dev, "Error initializing VRAM MM; %d\n", ret);
                goto err;
index 7d263f4d707845858a7f9f6253efe8a6d1c974be..4a0cd22c10e211d60b4ae6aca70a7527125a8284 100644 (file)
@@ -32,9 +32,6 @@ struct hibmc_connector {
 struct hibmc_drm_private {
        /* hw */
        void __iomem   *mmio;
-       void __iomem   *fb_map;
-       resource_size_t  fb_base;
-       resource_size_t  fb_size;
 
        /* drm */
        struct drm_device dev;
index 758629da95d93c8067f4feb1ce68fc8576d718af..0a5aaf78172a6784742ad0ef9e5bed4427cadd6c 100644 (file)
@@ -824,7 +824,6 @@ int mgag200_mode_config_init(struct mga_device *mdev, resource_size_t vram_avail
        dev->mode_config.max_width = MGAG200_MAX_FB_WIDTH;
        dev->mode_config.max_height = MGAG200_MAX_FB_HEIGHT;
        dev->mode_config.preferred_depth = 24;
-       dev->mode_config.fb_base = mdev->vram_res->start;
        dev->mode_config.funcs = &mgag200_mode_config_funcs;
        dev->mode_config.helper_private = &mgag200_mode_config_helper_funcs;
 
index 46168eccfac4af3900e031e5b8f50f3ed3ac0543..b373e3000320313f54d970ce7432f679455d5ba1 100644 (file)
@@ -109,8 +109,6 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
 
        drm_fb_helper_fill_info(fbi, helper, sizes);
 
-       dev->mode_config.fb_base = paddr;
-
        fbi->screen_base = msm_gem_get_vaddr(bo);
        if (IS_ERR(fbi->screen_base)) {
                ret = PTR_ERR(fbi->screen_base);
index a2f5df568ca542ca6b4538047cf77d3399e75183..928fdfa8e8e56e39314e03016bff208f67636247 100644 (file)
@@ -672,7 +672,6 @@ nouveau_display_create(struct drm_device *dev)
        drm_mode_create_dvi_i_properties(dev);
 
        dev->mode_config.funcs = &nouveau_mode_config_funcs;
-       dev->mode_config.fb_base = device->func->resource_addr(device, 1);
 
        dev->mode_config.min_width = 0;
        dev->mode_config.min_height = 0;
index 92f3fb6765abfc9e69aedc35a2030493be359c72..c30b8dacd86b37bf24eb4052159fbca6d2052785 100644 (file)
@@ -137,6 +137,8 @@ nv04_fbcon_accel_init(struct fb_info *info)
        struct nouveau_channel *chan = drm->channel;
        struct nvif_device *device = &drm->client.device;
        struct nvif_push *push = chan->chan.push;
+       struct nvkm_device *nvkm_device = nvxx_device(&drm->client.device);
+       resource_size_t fb_base = nvkm_device->func->resource_addr(nvkm_device, 1);
        int surface_fmt, pattern_fmt, rect_fmt;
        int ret;
 
@@ -210,8 +212,8 @@ nv04_fbcon_accel_init(struct fb_info *info)
                               0x0188, chan->vram.handle);
        PUSH_NVSQ(push, NV042, 0x0300, surface_fmt,
                               0x0304, info->fix.line_length | (info->fix.line_length << 16),
-                              0x0308, info->fix.smem_start - dev->mode_config.fb_base,
-                              0x030c, info->fix.smem_start - dev->mode_config.fb_base);
+                              0x0308, info->fix.smem_start - fb_base,
+                              0x030c, info->fix.smem_start - fb_base);
 
        PUSH_NVSQ(push, NV043, 0x0000, nfbdev->rop.handle);
        PUSH_NVSQ(push, NV043, 0x0300, 0x55);
index 40706c5aad7b5c9b39ad64b1d7607f8ca0d34d41..ed67dd25794c8cb53afc6dfe2859612a24eecb22 100644 (file)
@@ -177,8 +177,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 
        drm_fb_helper_fill_info(fbi, helper, sizes);
 
-       dev->mode_config.fb_base = dma_addr;
-
        fbi->screen_buffer = omap_gem_vaddr(fbdev->bo);
        fbi->screen_size = fbdev->bo->size;
        fbi->fix.smem_start = dma_addr;
index a152a7c6db21574b95436d8586416cec860fbf32..6492a70e3c396a5b18590a5bf342c18b31560646 100644 (file)
@@ -1261,8 +1261,6 @@ int qxl_modeset_init(struct qxl_device *qdev)
        qdev->ddev.mode_config.max_width = 8192;
        qdev->ddev.mode_config.max_height = 8192;
 
-       qdev->ddev.mode_config.fb_base = qdev->vram_base;
-
        drm_mode_create_suggested_offset_properties(&qdev->ddev);
        qxl_mode_create_hotplug_mode_update_property(qdev);
 
index ca5598ae8bfcf749b74e4dccc02fc5afb374877c..9bed1a6cb16332b777491912f481cd6679876e87 100644 (file)
@@ -1604,8 +1604,6 @@ int radeon_modeset_init(struct radeon_device *rdev)
 
        rdev->ddev->mode_config.fb_modifiers_not_supported = true;
 
-       rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
-
        ret = radeon_modeset_create_props(rdev);
        if (ret) {
                return ret;
index 6ccea51d40722f543593eae15764297d36393dcc..cc6754d88b819c07f3f89c5d732865fab780e709 100644 (file)
@@ -276,7 +276,7 @@ static int radeonfb_create(struct drm_fb_helper *helper,
        drm_fb_helper_fill_info(info, &rfbdev->helper, sizes);
 
        /* setup aperture base/size for vesafb takeover */
-       info->apertures->ranges[0].base = rdev->ddev->mode_config.fb_base;
+       info->apertures->ranges[0].base = rdev->mc.aper_base;
        info->apertures->ranges[0].size = rdev->mc.aper_size;
 
        /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
index 9291209154a7a947e6d7d2bbfb4057e6e592b4d4..bce71c0ccc9ef6576f3277b653f3e7416eb75ef7 100644 (file)
@@ -280,7 +280,6 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
                }
        }
 
-       drm->mode_config.fb_base = (resource_size_t)bo->iova;
        info->screen_base = (void __iomem *)bo->vaddr + offset;
        info->screen_size = size;
        info->fix.smem_start = (unsigned long)(bo->iova + offset);
index a51262289aefdb7f1af86554fdc3066a67dcc9c8..04682f831544c759af9d52ddb0a21e74e9fb59aa 100644 (file)
@@ -543,7 +543,6 @@ static int bochs_kms_init(struct bochs_device *bochs)
        bochs->dev->mode_config.max_width = 8192;
        bochs->dev->mode_config.max_height = 8192;
 
-       bochs->dev->mode_config.fb_base = bochs->fb_base;
        bochs->dev->mode_config.preferred_depth = 24;
        bochs->dev->mode_config.prefer_shadow = 0;
        bochs->dev->mode_config.prefer_shadow_fbdev = 1;
index 6b5e012953484a56855a7453e6094d7e838ec8bd..5362702fffe1a6a94b4a9d6ae61bc00269e7b82b 100644 (file)
@@ -345,7 +345,6 @@ struct drm_mode_config_funcs {
  * @max_width: maximum fb pixel width on this device
  * @max_height: maximum fb pixel height on this device
  * @funcs: core driver provided mode setting functions
- * @fb_base: base address of the framebuffer
  * @poll_enabled: track polling support for this device
  * @poll_running: track polling status for this device
  * @delayed_event: track delayed poll uevent deliver for this device
@@ -542,7 +541,6 @@ struct drm_mode_config {
        int min_width, min_height;
        int max_width, max_height;
        const struct drm_mode_config_funcs *funcs;
-       resource_size_t fb_base;
 
        /* output poll support */
        bool poll_enabled;