summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux
diff options
context:
space:
mode:
authorSami Kiminki <skiminki@nvidia.com>2017-11-13 07:32:29 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-15 16:26:06 -0500
commit1f28b429a2fb73a260e0c9fe112dbbc6981ef4b4 (patch)
tree1f408ffccb9b6e45f65119d75d144b34592940b6 /drivers/gpu/nvgpu/common/linux
parent23396c58db7e9d9c974bb3334a159aad960afc3e (diff)
gpu: nvgpu: Always do full buffer compbits allocs
Remove parameter 'lines' from gk20a_alloc_or_get_comptags() and nvgpu_ctag_buffer_info. We're always doing full buffer allocs anyways. This simplifies the code a bit. Bug 1902982 Change-Id: Iacfc9cdba8cb75b31a7d44b175660252e09d605d Signed-off-by: Sami Kiminki <skiminki@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1597131 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-rw-r--r--drivers/gpu/nvgpu/common/linux/comptags.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/comptags.c b/drivers/gpu/nvgpu/common/linux/comptags.c
index 4a96e07b..7d095793 100644
--- a/drivers/gpu/nvgpu/common/linux/comptags.c
+++ b/drivers/gpu/nvgpu/common/linux/comptags.c
@@ -20,6 +20,7 @@
20 20
21#include <nvgpu/linux/vm.h> 21#include <nvgpu/linux/vm.h>
22 22
23#include "gk20a/gk20a.h"
23#include "dmabuf.h" 24#include "dmabuf.h"
24 25
25void gk20a_get_comptags(struct nvgpu_os_buffer *buf, 26void gk20a_get_comptags(struct nvgpu_os_buffer *buf,
@@ -42,26 +43,33 @@ void gk20a_get_comptags(struct nvgpu_os_buffer *buf,
42int gk20a_alloc_or_get_comptags(struct gk20a *g, 43int gk20a_alloc_or_get_comptags(struct gk20a *g,
43 struct nvgpu_os_buffer *buf, 44 struct nvgpu_os_buffer *buf,
44 struct gk20a_comptag_allocator *allocator, 45 struct gk20a_comptag_allocator *allocator,
45 u32 lines,
46 struct gk20a_comptags *comptags) 46 struct gk20a_comptags *comptags)
47{ 47{
48 struct gk20a_dmabuf_priv *priv = dma_buf_get_drvdata(buf->dmabuf, 48 struct gk20a_dmabuf_priv *priv = dma_buf_get_drvdata(buf->dmabuf,
49 buf->dev); 49 buf->dev);
50 u32 offset; 50 u32 offset;
51 int err; 51 int err;
52 unsigned int ctag_granularity;
53 u32 lines;
52 54
53 if (!priv) 55 if (!priv)
54 return -ENOSYS; 56 return -ENOSYS;
55 57
56 if (!lines)
57 return -EINVAL;
58
59 if (priv->comptags.allocated) { 58 if (priv->comptags.allocated) {
60 /* already allocated */ 59 /*
60 * already allocated
61 */
61 *comptags = priv->comptags; 62 *comptags = priv->comptags;
62 return 0; 63 return 0;
63 } 64 }
64 65
66 ctag_granularity = g->ops.fb.compression_page_size(g);
67 lines = DIV_ROUND_UP_ULL(buf->dmabuf->size, ctag_granularity);
68
69 /* 0-sized buffer? Shouldn't occur, but let's check anyways. */
70 if (lines < 1)
71 return -EINVAL;
72
65 /* store the allocator so we can use it when we free the ctags */ 73 /* store the allocator so we can use it when we free the ctags */
66 priv->comptag_allocator = allocator; 74 priv->comptag_allocator = allocator;
67 err = gk20a_comptaglines_alloc(allocator, &offset, lines); 75 err = gk20a_comptaglines_alloc(allocator, &offset, lines);