Commit a8f42325 authored by Sinclair Yeh's avatar Sinclair Yeh Committed by Ben Hutchings

drm/vmwgfx: Filter out modes those cannot be supported by the current VRAM size.

commit 9a72384d upstream.

When screen objects are enabled, the bpp is assumed to be 32, otherwise
it is set to 16.

v2:
* Use u32 instead of u64 for assumed_bpp.
* Fixed mechanism to check for screen objects
* Limit the back buffer size to VRAM.
Signed-off-by: default avatarSinclair Yeh <syeh@vmware.com>
Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
[bwh: Backported to 3.2: drop changes for dev_priv->prim_bb_mem]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 80437614
...@@ -1826,6 +1826,14 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, ...@@ -1826,6 +1826,14 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,
DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC)
}; };
int i; int i;
u32 assumed_bpp = 2;
/*
* If using screen objects, then assume 32-bpp because that's what the
* SVGA device is assuming
*/
if (dev_priv->sou_priv)
assumed_bpp = 4;
/* Add preferred mode */ /* Add preferred mode */
{ {
...@@ -1836,8 +1844,9 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, ...@@ -1836,8 +1844,9 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,
mode->vdisplay = du->pref_height; mode->vdisplay = du->pref_height;
vmw_guess_mode_timing(mode); vmw_guess_mode_timing(mode);
if (vmw_kms_validate_mode_vram(dev_priv, mode->hdisplay * 2, if (vmw_kms_validate_mode_vram(dev_priv,
mode->vdisplay)) { mode->hdisplay * assumed_bpp,
mode->vdisplay)) {
drm_mode_probed_add(connector, mode); drm_mode_probed_add(connector, mode);
} else { } else {
drm_mode_destroy(dev, mode); drm_mode_destroy(dev, mode);
...@@ -1859,7 +1868,8 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, ...@@ -1859,7 +1868,8 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector,
bmode->vdisplay > max_height) bmode->vdisplay > max_height)
continue; continue;
if (!vmw_kms_validate_mode_vram(dev_priv, bmode->hdisplay * 2, if (!vmw_kms_validate_mode_vram(dev_priv,
bmode->hdisplay * assumed_bpp,
bmode->vdisplay)) bmode->vdisplay))
continue; continue;
......
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