From 41f6befed027c21fb9cecb0a1c0a1ad257c44704 Mon Sep 17 00:00:00 2001 From: Lauri Peltonen Date: Wed, 10 Sep 2014 19:46:26 +0300 Subject: 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 Reviewed-on: http://git-master/r/497476 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Tested-by: Jussi Rasanen Reviewed-by: Arto Merilainen Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/cde_gk20a.c | 9 +++++++-- drivers/gpu/nvgpu/gk20a/cde_gk20a.h | 6 ++++-- drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | 4 ++-- drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 3 +++ 4 files changed, 16 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/nvgpu') diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c index 2fad2f64..ad2ee159 100644 --- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c @@ -1069,7 +1069,8 @@ int gk20a_prepare_compressible_read( u64 compbits_hoffset, u64 compbits_voffset, u32 width, u32 height, u32 block_height_log2, 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; struct gk20a_buffer_state *state; @@ -1142,6 +1143,9 @@ int gk20a_prepare_compressible_read( if (valid_compbits) *valid_compbits = state->valid_compbits; + if (zbc_color) + *zbc_color = state->zbc_color; + out: mutex_unlock(&state->lock); dma_buf_put(dmabuf); @@ -1149,7 +1153,7 @@ out: } 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; struct gk20a_buffer_state *state; @@ -1172,6 +1176,7 @@ int gk20a_mark_compressible_write(struct gk20a *g, u32 buffer_fd, /* Update the compbits state. */ state->valid_compbits = valid_compbits; + state->zbc_color = zbc_color; /* Discard previous compbit job fence. */ gk20a_fence_put(state->fence); diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.h b/drivers/gpu/nvgpu/gk20a/cde_gk20a.h index 4e6a8ec9..49296234 100644 --- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.h @@ -262,8 +262,10 @@ int gk20a_prepare_compressible_read( u64 compbits_hoffset, u64 compbits_voffset, u32 width, u32 height, u32 block_height_log2, 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( - 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 diff --git a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c index 7338f842..18627f3e 100644 --- a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c @@ -97,7 +97,7 @@ static int gk20a_ctrl_prepare_compressible_read( args->compbits_hoffset, args->compbits_voffset, args->width, args->height, args->block_height_log2, flags, &fence, &args->valid_compbits, - &fence_out); + &args->zbc_color, &fence_out); gk20a_idle(g->dev); if (ret) @@ -139,7 +139,7 @@ static int gk20a_ctrl_mark_compressible_write( gk20a_busy(g->dev); 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); return ret; diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index f06c465a..89a2108b 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -192,6 +192,9 @@ struct gk20a_buffer_state { /* A bitmask of valid sets of compbits (0 = uncompressed). */ u32 valid_compbits; + /* The ZBC color used on this buffer. */ + u32 zbc_color; + /* This struct reflects the state of the buffer when this * fence signals. */ struct gk20a_fence *fence; -- cgit v1.2.2