@@ -22,9 +22,12 @@
* functions
*/
int mgag200_modeset = -1;
+int mgag200_preferred_depth __read_mostly;
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;
@@ -122,6 +125,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);
}
@@ -318,4 +318,6 @@ int mga_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
uint32_t handle, uint32_t width, uint32_t height);
int mga_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);
+extern int mgag200_preferred_depth __read_mostly;
+
#endif /* __MGAG200_DRV_H__ */
@@ -339,12 +339,21 @@ 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)) {
+ if (mgag200_preferred_depth == 0) {
/* prefer 16bpp on low end gpus with limited VRAM */
- mdev->preferred_bpp = dev->mode_config.preferred_depth = 16;
+ if (IS_G200_SE(mdev) && mdev->mc.vram_size <= 2048 * 1024) {
+ mdev->preferred_bpp =
+ dev->mode_config.preferred_depth = 16;
+ } else {
+ mdev->preferred_bpp = 32;
+ dev->mode_config.preferred_depth = 24;
+ }
} else {
- mdev->preferred_bpp = 32;
- dev->mode_config.preferred_depth = 24;
+ if (mgag200_preferred_depth == 16)
+ mdev->preferred_bpp = 16;
+ else /* mgag200_preferred_depth == 24 */
+ mdev->preferred_bpp = 32;
+ dev->mode_config.preferred_depth = mgag200_preferred_depth;
}
dev->mode_config.prefer_shadow = 1;