OSDN Git Service

drm/vmwgfx: Check pin count before attempting to move a buffer
authorSinclair Yeh <syeh@vmware.com>
Wed, 29 Jun 2016 20:20:26 +0000 (13:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jul 2016 16:47:35 +0000 (09:47 -0700)
commite587d4e630827c5207ee15986fc83e29d78073c9
tree9d33f9b0e38f4a3165e642af20e8ba3ceaa78b76
parentb40c9ac7286e6a5578649098861c7bfcd40451de
drm/vmwgfx: Check pin count before attempting to move a buffer

commit 4ed7e2242b637bc4af0416e4aa9f945db30fb44a upstream.

In certain scenarios, e.g. when fbdev is enabled, we can get into
a situation where a vmw_framebuffer_pin() is called on a buffer
that is already pinned.

When this happens, ttm_bo_validate() will unintentially remove the
TTM_PL_FLAG_NO_EVICT flag, thus unpinning it, and leaving no way
to actually pin the buffer again.

To prevent this, if a buffer is already pinned, then instead of
calling ttm_bo_validate(), just make sure the proposed placement is
compatible with the existing placement.

Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c