diff options
Diffstat (limited to 'common/recipes-kernel/linux/files/0293-drm-amdgpu-add-optional-dependencies-to-the-CS-IOCTL.patch')
-rw-r--r-- | common/recipes-kernel/linux/files/0293-drm-amdgpu-add-optional-dependencies-to-the-CS-IOCTL.patch | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/files/0293-drm-amdgpu-add-optional-dependencies-to-the-CS-IOCTL.patch b/common/recipes-kernel/linux/files/0293-drm-amdgpu-add-optional-dependencies-to-the-CS-IOCTL.patch new file mode 100644 index 00000000..dd0ecc41 --- /dev/null +++ b/common/recipes-kernel/linux/files/0293-drm-amdgpu-add-optional-dependencies-to-the-CS-IOCTL.patch @@ -0,0 +1,108 @@ +From 2b48d323b26c37555df3447e11ab9e962eccdc26 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com> +Date: Fri, 19 Jun 2015 17:31:29 +0200 +Subject: [PATCH 0293/1050] drm/amdgpu: add optional dependencies to the CS + IOCTL v2 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +v2: remove unrelated whitespace change, fix C comment + +Signed-off-by: Christian König <christian.koenig@amd.com> +Reviewed-by: Alex Deucher <alexander.deucher@amd.com> +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 59 +++++++++++++++++++++++++++++++++- + 1 file changed, 58 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +index 84ba1d1..d63135b 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +@@ -226,6 +226,9 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) + } + break; + ++ case AMDGPU_CHUNK_ID_DEPENDENCIES: ++ break; ++ + default: + r = -EINVAL; + goto out; +@@ -663,6 +666,55 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, + return 0; + } + ++static int amdgpu_cs_dependencies(struct amdgpu_device *adev, ++ struct amdgpu_cs_parser *p) ++{ ++ struct amdgpu_ib *ib; ++ int i, j, r; ++ ++ if (!p->num_ibs) ++ return 0; ++ ++ /* Add dependencies to first IB */ ++ ib = &p->ibs[0]; ++ for (i = 0; i < p->nchunks; ++i) { ++ struct drm_amdgpu_cs_chunk_dep *deps; ++ struct amdgpu_cs_chunk *chunk; ++ unsigned num_deps; ++ ++ chunk = &p->chunks[i]; ++ ++ if (chunk->chunk_id != AMDGPU_CHUNK_ID_DEPENDENCIES) ++ continue; ++ ++ deps = (struct drm_amdgpu_cs_chunk_dep *)chunk->kdata; ++ num_deps = chunk->length_dw * 4 / ++ sizeof(struct drm_amdgpu_cs_chunk_dep); ++ ++ for (j = 0; j < num_deps; ++j) { ++ struct amdgpu_fence *fence; ++ struct amdgpu_ring *ring; ++ ++ r = amdgpu_cs_get_ring(adev, deps[j].ip_type, ++ deps[j].ip_instance, ++ deps[j].ring, &ring); ++ if (r) ++ return r; ++ ++ r = amdgpu_fence_recreate(ring, p->filp, ++ deps[j].handle, ++ &fence); ++ if (r) ++ return r; ++ ++ amdgpu_sync_fence(&ib->sync, fence); ++ amdgpu_fence_unref(&fence); ++ } ++ } ++ ++ return 0; ++} ++ + int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) + { + struct amdgpu_device *adev = dev->dev_private; +@@ -697,11 +749,16 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) + else + DRM_ERROR("Failed to process the buffer list %d!\n", r); + } +- } else { ++ } ++ ++ if (!r) { + reserved_buffers = true; + r = amdgpu_cs_ib_fill(adev, &parser); + } + ++ if (!r) ++ r = amdgpu_cs_dependencies(adev, &parser); ++ + if (r) { + amdgpu_cs_parser_fini(&parser, r, reserved_buffers); + up_read(&adev->exclusive_lock); +-- +1.9.1 + |