summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/mgag200/mgag200_main.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2020-05-07 12:03:13 +0300
committerThomas Zimmermann <tzimmermann@suse.de>2020-05-11 17:40:17 +0300
commit5635b7cf8670367bbf32f8ef7e7d55e79bf227fc (patch)
tree1a5596b77a9e2921bdebe48a4d32207478e9ddcd /drivers/gpu/drm/mgag200/mgag200_main.c
parent0858083781b507acb99837d27e4071dc9b0bf976 (diff)
downloadlinux-5635b7cf8670367bbf32f8ef7e7d55e79bf227fc.tar.xz
drm/mgag200: Use managed mode-config initialization
Mode configuration is now cleanued up automatically. While at it, move all mode-config code into mgag200_mode.c. Done in preparation of switching mgag200 to simple-KMS helpers. v2: * improve commit message (Sam) * rebased during cherry pick * also move bpp_shift initialization Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Tested-by: John Donnelly <John.p.donnelly@oracle.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200507090315.21274-5-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/mgag200/mgag200_main.c')
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_main.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c
index 186197b8ffd3..fd651eda6f01 100644
--- a/drivers/gpu/drm/mgag200/mgag200_main.c
+++ b/drivers/gpu/drm/mgag200/mgag200_main.c
@@ -10,15 +10,8 @@
#include <linux/pci.h>
-#include <drm/drm_crtc_helper.h>
-#include <drm/drm_gem_framebuffer_helper.h>
-
#include "mgag200_drv.h"
-static const struct drm_mode_config_funcs mga_mode_funcs = {
- .fb_create = drm_gem_fb_create
-};
-
static int mga_probe_vram(struct mga_device *mdev, void __iomem *mem)
{
int offset;
@@ -135,27 +128,14 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags)
if (ret)
return ret;
- mdev->bpp_shifts[0] = 0;
- mdev->bpp_shifts[1] = 1;
- mdev->bpp_shifts[2] = 0;
- mdev->bpp_shifts[3] = 2;
-
ret = mgag200_mm_init(mdev);
if (ret)
goto err_mm;
- drm_mode_config_init(dev);
- dev->mode_config.funcs = (void *)&mga_mode_funcs;
- if (IS_G200_SE(mdev) && mdev->vram_fb_available < (2048*1024))
- dev->mode_config.preferred_depth = 16;
- else
- dev->mode_config.preferred_depth = 32;
- dev->mode_config.prefer_shadow = 1;
-
ret = mgag200_modeset_init(mdev);
if (ret) {
drm_err(dev, "Fatal error during modeset init: %d\n", ret);
- goto err_modeset;
+ goto err_mgag200_mm_fini;
}
ret = mgag200_cursor_init(mdev);
@@ -164,9 +144,7 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags)
return 0;
-err_modeset:
- drm_mode_config_cleanup(dev);
- mgag200_cursor_fini(mdev);
+err_mgag200_mm_fini:
mgag200_mm_fini(mdev);
err_mm:
dev->dev_private = NULL;
@@ -179,8 +157,6 @@ void mgag200_driver_unload(struct drm_device *dev)
if (mdev == NULL)
return;
- mgag200_modeset_fini(mdev);
- drm_mode_config_cleanup(dev);
mgag200_cursor_fini(mdev);
mgag200_mm_fini(mdev);
dev->dev_private = NULL;