summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/comptags.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/comptags.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/comptags.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/comptags.c b/drivers/gpu/nvgpu/common/linux/comptags.c
index f55989f7..92e8aa3e 100644
--- a/drivers/gpu/nvgpu/common/linux/comptags.c
+++ b/drivers/gpu/nvgpu/common/linux/comptags.c
@@ -46,7 +46,6 @@ int gk20a_alloc_comptags(struct gk20a *g,
46{ 46{
47 struct gk20a_dmabuf_priv *priv = dma_buf_get_drvdata(buf->dmabuf, 47 struct gk20a_dmabuf_priv *priv = dma_buf_get_drvdata(buf->dmabuf,
48 buf->dev); 48 buf->dev);
49 u32 ctaglines_allocsize;
50 u32 offset; 49 u32 offset;
51 int err; 50 int err;
52 51
@@ -56,18 +55,24 @@ int gk20a_alloc_comptags(struct gk20a *g,
56 if (!lines) 55 if (!lines)
57 return -EINVAL; 56 return -EINVAL;
58 57
59 ctaglines_allocsize = lines;
60
61 /* store the allocator so we can use it when we free the ctags */ 58 /* store the allocator so we can use it when we free the ctags */
62 priv->comptag_allocator = allocator; 59 priv->comptag_allocator = allocator;
63 err = gk20a_comptaglines_alloc(allocator, &offset, 60 err = gk20a_comptaglines_alloc(allocator, &offset, lines);
64 ctaglines_allocsize); 61 if (!err) {
65 if (err) 62 priv->comptags.offset = offset;
66 return err; 63 priv->comptags.lines = lines;
64 } else {
65 priv->comptags.offset = 0;
66 priv->comptags.lines = 0;
67 }
67 68
68 priv->comptags.offset = offset; 69 /*
69 priv->comptags.lines = lines; 70 * We don't report an error here if comptag alloc failed. The
70 priv->comptags.allocated_lines = ctaglines_allocsize; 71 * caller will simply fallback to incompressible kinds. It
72 * would not be safe to re-allocate comptags anyways on
73 * successive calls, as that would break map aliasing.
74 */
75 priv->comptags.allocated = true;
71 76
72 return 0; 77 return 0;
73} 78}