aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.19.8/1619-drm-amdgpu-Only-clear-dumb-buffers-if-ring-is-enable.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.19.8/1619-drm-amdgpu-Only-clear-dumb-buffers-if-ring-is-enable.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.19.8/1619-drm-amdgpu-Only-clear-dumb-buffers-if-ring-is-enable.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.19.8/1619-drm-amdgpu-Only-clear-dumb-buffers-if-ring-is-enable.patch b/common/recipes-kernel/linux/linux-yocto-4.19.8/1619-drm-amdgpu-Only-clear-dumb-buffers-if-ring-is-enable.patch
new file mode 100644
index 00000000..dbfbb2d8
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.19.8/1619-drm-amdgpu-Only-clear-dumb-buffers-if-ring-is-enable.patch
@@ -0,0 +1,56 @@
+From 3b3caf2a008a967759b775ecce3803571891507a Mon Sep 17 00:00:00 2001
+From: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
+Date: Mon, 11 Mar 2019 14:16:29 -0400
+Subject: [PATCH 1619/2940] drm/amdgpu: Only clear dumb buffers if ring is
+ enabled
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The buffers should be cleared when possible but we also don't want
+buffer creation to fail in the rare case where the ring isn't ready
+during the call. This could happen during some suspend/resume sequences.
+
+Cc: Christian König <ckoenig.leichtzumerken@gmail.com>
+Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
+Reviewed-by: Christian König <christian.koenig@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+index 72242b121d2b..edf27fcebcc2 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+@@ -821,18 +821,25 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
+ struct amdgpu_device *adev = dev->dev_private;
+ struct drm_gem_object *gobj;
+ uint32_t handle;
++ u64 flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
+ u32 domain;
+ int r;
+
++ /*
++ * The buffer returned from this function should be cleared, but
++ * it can only be done if the ring is enabled or we'll fail to
++ * create the buffer.
++ */
++ if (adev->mman.buffer_funcs_enabled)
++ flags |= AMDGPU_GEM_CREATE_VRAM_CLEARED;
++
+ args->pitch = amdgpu_align_pitch(adev, args->width,
+ DIV_ROUND_UP(args->bpp, 8), 0);
+ args->size = (u64)args->pitch * args->height;
+ args->size = ALIGN(args->size, PAGE_SIZE);
+ domain = amdgpu_bo_get_preferred_pin_domain(adev,
+ amdgpu_display_supported_domains(adev));
+- r = amdgpu_gem_object_create(adev, args->size, 0, domain,
+- AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
+- AMDGPU_GEM_CREATE_VRAM_CLEARED,
++ r = amdgpu_gem_object_create(adev, args->size, 0, domain, flags,
+ ttm_bo_type_device, NULL, &gobj);
+ if (r)
+ return -ENOMEM;
+--
+2.17.1
+