diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c index 2fad2f649..ad2ee159c 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 4e6a8ec95..492962344 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 7338f842e..18627f3e9 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 f06c465a8..89a2108b4 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;