summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/cde_gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/cde_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/cde_gk20a.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c
index 57283343..49a1c1a8 100644
--- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Color decompression engine support 2 * Color decompression engine support
3 * 3 *
4 * Copyright (c) 2014, NVIDIA Corporation. All rights reserved. 4 * Copyright (c) 2014-2015, NVIDIA Corporation. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -979,17 +979,23 @@ __releases(&cde_app->mutex)
979 map_size = compbits_buf->size - map_offset; 979 map_size = compbits_buf->size - map_offset;
980 } 980 }
981 981
982 /* map the destination buffer */ 982 /* map the destination buffer, if not cached yet */
983 get_dma_buf(compbits_buf); /* a ref for gk20a_vm_map */ 983 /* races protected by the cde app mutex above */
984 map_vaddr = gk20a_vm_map(cde_ctx->vm, compbits_buf, 0, 984 map_vaddr = gk20a_vm_cde_mapped(cde_ctx->vm, compbits_buf);
985 NVGPU_MAP_BUFFER_FLAGS_CACHEABLE_TRUE,
986 compbits_kind, NULL, true,
987 gk20a_mem_flag_none,
988 map_offset, map_size);
989 if (!map_vaddr) { 985 if (!map_vaddr) {
990 dma_buf_put(compbits_buf); 986 /* take a ref for gk20a_vm_map, pair is in (cached) unmap */
991 err = -EINVAL; 987 get_dma_buf(compbits_buf);
992 goto exit_unlock; 988 map_vaddr = gk20a_vm_map(cde_ctx->vm, compbits_buf, 0,
989 NVGPU_MAP_BUFFER_FLAGS_CACHEABLE_TRUE,
990 compbits_kind, NULL, true,
991 gk20a_mem_flag_none,
992 map_offset, map_size);
993 if (!map_vaddr) {
994 dma_buf_put(compbits_buf);
995 err = -EINVAL;
996 goto exit_unlock;
997 }
998 gk20a_vm_mark_cde_mapped(cde_ctx->vm, compbits_buf, map_vaddr);
993 } 999 }
994 1000
995 /* store source buffer compression tags */ 1001 /* store source buffer compression tags */
@@ -1052,9 +1058,7 @@ __releases(&cde_app->mutex)
1052 1058
1053exit_unlock: 1059exit_unlock:
1054 1060
1055 /* unmap the buffers - channel holds references to them now */ 1061 /* leave map_vaddr mapped - released when unmapped from userspace */
1056 if (map_vaddr)
1057 gk20a_vm_unmap(cde_ctx->vm, map_vaddr);
1058 1062
1059 mutex_unlock(&g->cde_app.mutex); 1063 mutex_unlock(&g->cde_app.mutex);
1060 return err; 1064 return err;