gpu: nvgpu: Support ZBC color tracking

The compression state tracking user space API already accepts and
returns the ZBC color used for the surface. Actually store the color
in kernel so that the feature works.

Bug 1536227
Bug 1524301

Change-Id: I264e1eeb90f0c4d40fe35fc2479b0ce83e19a7d7
Signed-off-by: Lauri Peltonen <lpeltonen@nvidia.com>
Reviewed-on: http://git-master/r/497476
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Tested-by: Jussi Rasanen <jrasanen@nvidia.com>
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Lauri Peltonen
2014-09-10 19:46:26 +03:00
committed by Dan Willemsen
parent 9c17175a35
commit 41f6befed0
4 changed files with 16 additions and 6 deletions

View File

@@ -1069,7 +1069,8 @@ int gk20a_prepare_compressible_read(
u64 compbits_hoffset, u64 compbits_voffset, u64 compbits_hoffset, u64 compbits_voffset,
u32 width, u32 height, u32 block_height_log2, u32 width, u32 height, u32 block_height_log2,
u32 submit_flags, struct nvhost_fence *fence, u32 submit_flags, struct nvhost_fence *fence,
u32 *valid_compbits, struct gk20a_fence **fence_out) u32 *valid_compbits, u32 *zbc_color,
struct gk20a_fence **fence_out)
{ {
int err = 0; int err = 0;
struct gk20a_buffer_state *state; struct gk20a_buffer_state *state;
@@ -1142,6 +1143,9 @@ int gk20a_prepare_compressible_read(
if (valid_compbits) if (valid_compbits)
*valid_compbits = state->valid_compbits; *valid_compbits = state->valid_compbits;
if (zbc_color)
*zbc_color = state->zbc_color;
out: out:
mutex_unlock(&state->lock); mutex_unlock(&state->lock);
dma_buf_put(dmabuf); dma_buf_put(dmabuf);
@@ -1149,7 +1153,7 @@ out:
} }
int gk20a_mark_compressible_write(struct gk20a *g, u32 buffer_fd, int gk20a_mark_compressible_write(struct gk20a *g, u32 buffer_fd,
u32 valid_compbits, u64 offset) u32 valid_compbits, u64 offset, u32 zbc_color)
{ {
int err; int err;
struct gk20a_buffer_state *state; struct gk20a_buffer_state *state;
@@ -1172,6 +1176,7 @@ int gk20a_mark_compressible_write(struct gk20a *g, u32 buffer_fd,
/* Update the compbits state. */ /* Update the compbits state. */
state->valid_compbits = valid_compbits; state->valid_compbits = valid_compbits;
state->zbc_color = zbc_color;
/* Discard previous compbit job fence. */ /* Discard previous compbit job fence. */
gk20a_fence_put(state->fence); gk20a_fence_put(state->fence);

View File

@@ -262,8 +262,10 @@ int gk20a_prepare_compressible_read(
u64 compbits_hoffset, u64 compbits_voffset, u64 compbits_hoffset, u64 compbits_voffset,
u32 width, u32 height, u32 block_height_log2, u32 width, u32 height, u32 block_height_log2,
u32 submit_flags, struct nvhost_fence *fence, u32 submit_flags, struct nvhost_fence *fence,
u32 *valid_compbits, struct gk20a_fence **fence_out); u32 *valid_compbits, u32 *zbc_color,
struct gk20a_fence **fence_out);
int gk20a_mark_compressible_write( int gk20a_mark_compressible_write(
struct gk20a *g, u32 buffer_fd, u32 valid_compbits, u64 offset); struct gk20a *g, u32 buffer_fd, u32 valid_compbits, u64 offset,
u32 zbc_color);
#endif #endif

View File

@@ -97,7 +97,7 @@ static int gk20a_ctrl_prepare_compressible_read(
args->compbits_hoffset, args->compbits_voffset, args->compbits_hoffset, args->compbits_voffset,
args->width, args->height, args->block_height_log2, args->width, args->height, args->block_height_log2,
flags, &fence, &args->valid_compbits, flags, &fence, &args->valid_compbits,
&fence_out); &args->zbc_color, &fence_out);
gk20a_idle(g->dev); gk20a_idle(g->dev);
if (ret) if (ret)
@@ -139,7 +139,7 @@ static int gk20a_ctrl_mark_compressible_write(
gk20a_busy(g->dev); gk20a_busy(g->dev);
ret = gk20a_mark_compressible_write(g, args->handle, ret = gk20a_mark_compressible_write(g, args->handle,
args->valid_compbits, args->offset); args->valid_compbits, args->offset, args->zbc_color);
gk20a_idle(g->dev); gk20a_idle(g->dev);
return ret; return ret;

View File

@@ -192,6 +192,9 @@ struct gk20a_buffer_state {
/* A bitmask of valid sets of compbits (0 = uncompressed). */ /* A bitmask of valid sets of compbits (0 = uncompressed). */
u32 valid_compbits; u32 valid_compbits;
/* The ZBC color used on this buffer. */
u32 zbc_color;
/* This struct reflects the state of the buffer when this /* This struct reflects the state of the buffer when this
* fence signals. */ * fence signals. */
struct gk20a_fence *fence; struct gk20a_fence *fence;