summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
diff options
context:
space:
mode:
authorPeter Daifuku <pdaifuku@nvidia.com>2017-10-27 18:46:53 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-03 02:27:12 -0400
commitde399ccb0019513a5f9e8f2bcadb02486f99bc80 (patch)
treef3bc9e054f501fd4c9cf8c20b614ae160c8a6dd1 /drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
parent566223689538531783a86091f052f70a6ebdef29 (diff)
gpu: nvgpu: fix patch buf count update for vidmem
gr_gk20a_ctx_patch_write_begin() updates the patch buffer data_count when the associated graphics context memory buffer has been CPU-mapped; it was doing so by looking for a non-null cpu_va. However, if the graphics context has been allocated from vidmem, cpu_va is always 0, so we can't tell if nvgpu_mem_begin() was called for the context buffer or not. Instead: - add a cpu_accessible flag to the nvgpu_mem struct and set it in nvgpu_mem_begin() - return the value of that flag in nvgpu_mem_cpu_accessible() - gr_gk20a_ctx_patch_write_begin() now calls this new function instead of checking cpu_va. Bug 2012077 JIRA ESRM-74 Change-Id: I8401699f30b4ae7154111721c25c7ec3ff95d329 Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1587293 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
index 6feacff7..bae50347 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_mem.h
@@ -122,6 +122,7 @@ struct nvgpu_mem {
122 size_t aligned_size; 122 size_t aligned_size;
123 u64 gpu_va; 123 u64 gpu_va;
124 bool skip_wmb; 124 bool skip_wmb;
125 bool cpu_accessible;
125 126
126 /* 127 /*
127 * Set when a nvgpu_mem struct is not a "real" nvgpu_mem struct. Instead 128 * Set when a nvgpu_mem struct is not a "real" nvgpu_mem struct. Instead
@@ -211,6 +212,15 @@ static inline bool nvgpu_mem_is_valid(struct nvgpu_mem *mem)
211} 212}
212 213
213/* 214/*
215 * Returns true if the passed nvgpu_mem can be accessed by the CPU by virtue
216 * of having called nvgpu_mem_begin successfully.
217 */
218static inline bool nvgpu_mem_cpu_accessible(struct nvgpu_mem *mem)
219{
220 return mem->cpu_accessible;
221}
222
223/*
214 * Create a nvgpu_sgt of the default implementation 224 * Create a nvgpu_sgt of the default implementation
215 */ 225 */
216struct nvgpu_sgt *nvgpu_sgt_create(struct gk20a *g); 226struct nvgpu_sgt *nvgpu_sgt_create(struct gk20a *g);