mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
drm/amdgpu: enable freesync for A+A configs
Some newer APUs can scanout directly from GTT, that saves us from allocating another bounce buffer in VRAM and enables freesync in such configurations. Without this patch creating a framebuffer from the imported BO will fail and userspace will fall back to a copy. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Shashank Sharma <shashank.sharma@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
53a5a27294
commit
cd9b0159be
2 changed files with 7 additions and 3 deletions
|
@ -926,8 +926,10 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev,
|
|||
struct drm_file *file_priv,
|
||||
const struct drm_mode_fb_cmd2 *mode_cmd)
|
||||
{
|
||||
struct drm_gem_object *obj;
|
||||
struct amdgpu_framebuffer *amdgpu_fb;
|
||||
struct drm_gem_object *obj;
|
||||
struct amdgpu_bo *bo;
|
||||
uint32_t domains;
|
||||
int ret;
|
||||
|
||||
obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]);
|
||||
|
@ -938,7 +940,9 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev,
|
|||
}
|
||||
|
||||
/* Handle is imported dma-buf, so cannot be migrated to VRAM for scanout */
|
||||
if (obj->import_attach) {
|
||||
bo = gem_to_amdgpu_bo(obj);
|
||||
domains = amdgpu_display_supported_domains(drm_to_adev(dev), bo->flags);
|
||||
if (obj->import_attach && !(domains & AMDGPU_GEM_DOMAIN_GTT)) {
|
||||
drm_dbg_kms(dev, "Cannot create framebuffer from imported dma_buf\n");
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
|
|
@ -897,7 +897,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
|
|||
return -EINVAL;
|
||||
|
||||
/* A shared bo cannot be migrated to VRAM */
|
||||
if (bo->prime_shared_count) {
|
||||
if (bo->prime_shared_count || bo->tbo.base.import_attach) {
|
||||
if (domain & AMDGPU_GEM_DOMAIN_GTT)
|
||||
domain = AMDGPU_GEM_DOMAIN_GTT;
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue