drm/ttm: Fix memory space allocation v2
authorThomas Hellstrom <thellstrom@vmware.com>
Mon, 14 Sep 2015 08:24:41 +0000 (01:24 -0700)
committerThomas Hellstrom <thellstrom@vmware.com>
Tue, 15 Sep 2015 07:57:01 +0000 (00:57 -0700)
commite30f3963f2c3c03119d71f1804bdb94ccd33580b
tree37454b0b70d4d38df05f043a9cc69553efa63f7a
parent2e586a7e017a502410ba1c1a7411179e1d3fbb2b
drm/ttm: Fix memory space allocation v2

In the event that TTM doesn't find a compatible memory type for the
driver's first placement choice (placement without eviction), TTM
returns -EINVAL without trying the driver's second choice.
This causes problems on vmwgfx when VRAM is disabled before first modeset
and during VT switches when fbdev is not enabled.

Fix this by also trying the driver's second choice before returning
-EINVAL.

v2: Also check that man->use_type is true for the driver's second choice.
Fixes a bug where disallowed memory types could be used.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
drivers/gpu/drm/ttm/ttm_bo.c