disp: msm: perform delayed buf attach during secure transitions

While transitioning from secure usecases, the secure
context bank is attached back only during the commit
phase. This leads to invalid secure context-bank device
issue, when the prime_to_fd call is made for the next
frame. Avoid it, by attaching to default drm device
during the prime_to_fd call and reattach it to the
secure context-bank device at the delayed import time.

Change-Id: I43e6da7f117f20746943a48b5f2657e9ae2947ea
Signed-off-by: Veera Sundaram Sankaran <veeras@codeaurora.org>
This commit is contained in:
Veera Sundaram Sankaran
2019-12-13 12:03:29 -08:00
committed by Gerrit - the friendly Code Review server
parent e7f3931297
commit a9574eb8c2
2 changed files with 45 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com>
*
@@ -133,15 +133,26 @@ struct drm_gem_object *msm_gem_prime_import(struct drm_device *dev,
}
if (flags & ION_FLAG_SECURE) {
if (flags & ION_FLAG_CP_PIXEL)
if (flags & ION_FLAG_CP_PIXEL) {
attach_dev = kms->funcs->get_address_space_device(kms,
MSM_SMMU_DOMAIN_SECURE);
/*
* While transitioning from secure use-cases, the
* secure-cb might still not be attached back, while
* the prime_fd_to_handle call is made for the next
* frame. Attach those buffers to default drm device
* and reattaching with the correct context-bank
* will be handled in msm_gem_delayed_import
*/
if (!attach_dev)
attach_dev = dev->dev;
else if ((flags & ION_FLAG_CP_SEC_DISPLAY)
|| (flags & ION_FLAG_CP_CAMERA_PREVIEW))
} else if ((flags & ION_FLAG_CP_SEC_DISPLAY)
|| (flags & ION_FLAG_CP_CAMERA_PREVIEW)) {
attach_dev = dev->dev;
else
} else {
DRM_ERROR("invalid ion secure flag: 0x%lx\n", flags);
}
} else {
attach_dev = kms->funcs->get_address_space_device(kms,
MSM_SMMU_DOMAIN_UNSECURE);