Commit 918be888 authored by Dave Airlie's avatar Dave Airlie

drm/mgag200: on cards with < 2MB VRAM default to 16-bit

This aligns with what the userspace -mga driver does in
the same situation.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent f5395ba3
...@@ -282,6 +282,11 @@ int mgag200_fbdev_init(struct mga_device *mdev) ...@@ -282,6 +282,11 @@ int mgag200_fbdev_init(struct mga_device *mdev)
{ {
struct mga_fbdev *mfbdev; struct mga_fbdev *mfbdev;
int ret; int ret;
int bpp_sel = 32;
/* prefer 16bpp on low end gpus with limited VRAM */
if (IS_G200_SE(mdev) && mdev->mc.vram_size < (2048*1024))
bpp_sel = 16;
mfbdev = devm_kzalloc(mdev->dev->dev, sizeof(struct mga_fbdev), GFP_KERNEL); mfbdev = devm_kzalloc(mdev->dev->dev, sizeof(struct mga_fbdev), GFP_KERNEL);
if (!mfbdev) if (!mfbdev)
...@@ -301,7 +306,7 @@ int mgag200_fbdev_init(struct mga_device *mdev) ...@@ -301,7 +306,7 @@ int mgag200_fbdev_init(struct mga_device *mdev)
/* disable all the possible outputs/crtcs before entering KMS mode */ /* disable all the possible outputs/crtcs before entering KMS mode */
drm_helper_disable_unused_functions(mdev->dev); drm_helper_disable_unused_functions(mdev->dev);
drm_fb_helper_initial_config(&mfbdev->helper, 32); drm_fb_helper_initial_config(&mfbdev->helper, bpp_sel);
return 0; return 0;
} }
......
...@@ -217,7 +217,10 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -217,7 +217,10 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags)
drm_mode_config_init(dev); drm_mode_config_init(dev);
dev->mode_config.funcs = (void *)&mga_mode_funcs; dev->mode_config.funcs = (void *)&mga_mode_funcs;
dev->mode_config.preferred_depth = 24; if (IS_G200_SE(mdev) && mdev->mc.vram_size < (2048*1024))
dev->mode_config.preferred_depth = 16;
else
dev->mode_config.preferred_depth = 24;
dev->mode_config.prefer_shadow = 1; dev->mode_config.prefer_shadow = 1;
r = mgag200_modeset_init(mdev); r = mgag200_modeset_init(mdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment