@@ -180,6 +180,12 @@ int amdgpu_crtc_page_flip_target(struct drm_crtc *crtc,
obj = new_amdgpu_fb->obj;
new_abo = gem_to_amdgpu_bo(obj);
+ if (amdgpu_ttm_adev(new_abo->tbo.bdev) != adev) {
+ DRM_ERROR("Foreign BOs not allowed in the display engine\n");
+ r = -EINVAL;
+ goto cleanup;
+ }
+
/* pin the new buffer */
r = amdgpu_bo_reserve(new_abo, false);
if (unlikely(r != 0)) {
@@ -1915,6 +1915,11 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
*/
obj = amdgpu_fb->obj;
abo = gem_to_amdgpu_bo(obj);
+ if (amdgpu_ttm_adev(abo->tbo.bdev) != adev) {
+ DRM_ERROR("Foreign BOs not allowed in the display engine\n");
+ return -EINVAL;
+ }
+
r = amdgpu_bo_reserve(abo, false);
if (unlikely(r != 0))
return r;
@@ -1954,6 +1954,11 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
*/
obj = amdgpu_fb->obj;
abo = gem_to_amdgpu_bo(obj);
+ if (amdgpu_ttm_adev(abo->tbo.bdev) != adev) {
+ DRM_ERROR("Foreign BOs not allowed in the display engine\n");
+ return -EINVAL;
+ }
+
r = amdgpu_bo_reserve(abo, false);
if (unlikely(r != 0))
return r;
@@ -1868,6 +1868,11 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
*/
obj = amdgpu_fb->obj;
abo = gem_to_amdgpu_bo(obj);
+ if (amdgpu_ttm_adev(abo->tbo.bdev) != adev) {
+ DRM_ERROR("Foreign BOs not allowed in the display engine\n");
+ return -EINVAL;
+ }
+
r = amdgpu_bo_reserve(abo, false);
if (unlikely(r != 0))
return r;
@@ -1846,6 +1846,11 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
*/
obj = amdgpu_fb->obj;
abo = gem_to_amdgpu_bo(obj);
+ if (amdgpu_ttm_adev(abo->tbo.bdev) != adev) {
+ DRM_ERROR("Foreign BOs not allowed in the display engine\n");
+ return -EINVAL;
+ }
+
r = amdgpu_bo_reserve(abo, false);
if (unlikely(r != 0))
return r;
@@ -1621,6 +1621,11 @@ static int dm_plane_helper_prepare_fb(
obj = afb->obj;
rbo = gem_to_amdgpu_bo(obj);
+ if (amdgpu_ttm_adev(rbo->tbo.bdev)->ddev != plane->dev) {
+ DRM_ERROR("Foreign BOs not allowed in the display engine\n");
+ return -EINVAL;
+ }
+
r = amdgpu_bo_reserve(rbo, false);
if (unlikely(r != 0))
return r;