From: Egbert Eich <eich@xxxxxxx> This adds a command line parameter to override the preferred bpp on mga g200 server chips, so you can run some servers with low VRAM at a higher resolution but at 16bpp. Signed-off-by: Rob Clark <robdclark@xxxxxxxxx> --- An old patch from Egbert that never seemed to land upstream. I've rebased it since it seems useful. drivers/gpu/drm/mgag200/mgag200_drv.c | 11 +++++++++++ drivers/gpu/drm/mgag200/mgag200_main.c | 14 ++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 9ac0078..97166a8 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -22,9 +22,12 @@ * functions */ int mgag200_modeset = -1; +int mgag200_preferred_depth __read_mostly = 0; MODULE_PARM_DESC(modeset, "Disable/Enable modesetting"); module_param_named(modeset, mgag200_modeset, int, 0400); +MODULE_PARM_DESC(preferreddepth, "Set preferred bpp"); +module_param_named(preferreddepth, mgag200_preferred_depth, int, 0400); static struct drm_driver driver; @@ -120,6 +123,14 @@ static int __init mgag200_init(void) if (mgag200_modeset == 0) return -EINVAL; + switch (mgag200_preferred_depth) { + case 0: /* driver default */ + case 16: + case 24: + break; + default: + return -EINVAL; + } return drm_pci_init(&driver, &mgag200_pci_driver); } diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c index dce8a3e..6411268 100644 --- a/drivers/gpu/drm/mgag200/mgag200_main.c +++ b/drivers/gpu/drm/mgag200/mgag200_main.c @@ -14,6 +14,8 @@ #include <drm/drm_crtc_helper.h> #include "mgag200_drv.h" +extern int mgag200_preferred_depth __read_mostly; + static void mga_user_framebuffer_destroy(struct drm_framebuffer *fb) { struct mga_framebuffer *mga_fb = to_mga_framebuffer(fb); @@ -226,10 +228,14 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags) drm_mode_config_init(dev); dev->mode_config.funcs = (void *)&mga_mode_funcs; - if (IS_G200_SE(mdev) && mdev->mc.vram_size < (2048*1024)) - dev->mode_config.preferred_depth = 16; - else - dev->mode_config.preferred_depth = 24; + if (mgag200_preferred_depth == 0) { + if (IS_G200_SE(mdev) && mdev->mc.vram_size < (2048*1024)) + dev->mode_config.preferred_depth = 16; + else + dev->mode_config.preferred_depth = 24; + } else { + dev->mode_config.preferred_depth = mgag200_preferred_depth; + } dev->mode_config.prefer_shadow = 1; r = mgag200_modeset_init(mdev); -- 2.9.3 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel