Commit 10a8fce846c1b12ebb29b036d1a15efc65eddbb5

Authored by Dave Airlie

Merge branch 'vmwgfx-fixes-3.18' of git://people.freedesktop.org/~thomash/linux

A critical 3.18 regression fix from Rob, (thanks!)
A fix to avoid advertizing modes we can't support from Sinclair
  (welcome Sinclair!)
and a fix for an incorrect  hash key computation from me that is
  completely harmless, but can wait 'til the next merge window if necessary.
  (I can't really bother stable with this one).

* 'vmwgfx-fixes-3.18' of git://people.freedesktop.org/~thomash/linux:
  drm/vmwgfx: Filter out modes those cannot be supported by the current VRAM size.
  drm/vmwgfx: Fix hash key computation
  drm/vmwgfx: fix lock breakage

Showing 3 changed files Side-by-side Diff

drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
... ... @@ -246,7 +246,8 @@
246 246 struct drm_hash_item *hash;
247 247 int ret;
248 248  
249   - ret = drm_ht_find_item(&man->resources, user_key, &hash);
  249 + ret = drm_ht_find_item(&man->resources, user_key | (res_type << 24),
  250 + &hash);
250 251 if (likely(ret != 0))
251 252 return -EINVAL;
252 253  
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
... ... @@ -688,7 +688,11 @@
688 688 goto out_err0;
689 689 }
690 690  
691   - if (unlikely(dev_priv->prim_bb_mem < dev_priv->vram_size))
  691 + /*
  692 + * Limit back buffer size to VRAM size. Remove this once
  693 + * screen targets are implemented.
  694 + */
  695 + if (dev_priv->prim_bb_mem > dev_priv->vram_size)
692 696 dev_priv->prim_bb_mem = dev_priv->vram_size;
693 697  
694 698 mutex_unlock(&dev_priv->hw_mutex);
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
... ... @@ -187,7 +187,7 @@
187 187 * can do this since the caller in the drm core doesn't check anything
188 188 * which is protected by any looks.
189 189 */
190   - drm_modeset_unlock(&crtc->mutex);
  190 + drm_modeset_unlock_crtc(crtc);
191 191 drm_modeset_lock_all(dev_priv->dev);
192 192  
193 193 /* A lot of the code assumes this */
... ... @@ -252,7 +252,7 @@
252 252 ret = 0;
253 253 out:
254 254 drm_modeset_unlock_all(dev_priv->dev);
255   - drm_modeset_lock(&crtc->mutex, NULL);
  255 + drm_modeset_lock_crtc(crtc);
256 256  
257 257 return ret;
258 258 }
... ... @@ -273,7 +273,7 @@
273 273 * can do this since the caller in the drm core doesn't check anything
274 274 * which is protected by any looks.
275 275 */
276   - drm_modeset_unlock(&crtc->mutex);
  276 + drm_modeset_unlock_crtc(crtc);
277 277 drm_modeset_lock_all(dev_priv->dev);
278 278  
279 279 vmw_cursor_update_position(dev_priv, shown,
... ... @@ -281,7 +281,7 @@
281 281 du->cursor_y + du->hotspot_y);
282 282  
283 283 drm_modeset_unlock_all(dev_priv->dev);
284   - drm_modeset_lock(&crtc->mutex, NULL);
  284 + drm_modeset_lock_crtc(crtc);
285 285  
286 286 return 0;
287 287 }
288 288  
... ... @@ -1950,7 +1950,15 @@
1950 1950 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC)
1951 1951 };
1952 1952 int i;
  1953 + u32 assumed_bpp = 2;
1953 1954  
  1955 + /*
  1956 + * If using screen objects, then assume 32-bpp because that's what the
  1957 + * SVGA device is assuming
  1958 + */
  1959 + if (dev_priv->sou_priv)
  1960 + assumed_bpp = 4;
  1961 +
1954 1962 /* Add preferred mode */
1955 1963 {
1956 1964 mode = drm_mode_duplicate(dev, &prefmode);
... ... @@ -1960,8 +1968,9 @@
1960 1968 mode->vdisplay = du->pref_height;
1961 1969 vmw_guess_mode_timing(mode);
1962 1970  
1963   - if (vmw_kms_validate_mode_vram(dev_priv, mode->hdisplay * 2,
1964   - mode->vdisplay)) {
  1971 + if (vmw_kms_validate_mode_vram(dev_priv,
  1972 + mode->hdisplay * assumed_bpp,
  1973 + mode->vdisplay)) {
1965 1974 drm_mode_probed_add(connector, mode);
1966 1975 } else {
1967 1976 drm_mode_destroy(dev, mode);
... ... @@ -1983,7 +1992,8 @@
1983 1992 bmode->vdisplay > max_height)
1984 1993 continue;
1985 1994  
1986   - if (!vmw_kms_validate_mode_vram(dev_priv, bmode->hdisplay * 2,
  1995 + if (!vmw_kms_validate_mode_vram(dev_priv,
  1996 + bmode->hdisplay * assumed_bpp,
1987 1997 bmode->vdisplay))
1988 1998 continue;
1989 1999