From df67ff6a75cba1fc96ae5fbe7dba260250eae9fd Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Thu, 16 Apr 2015 11:57:10 -0700 Subject: gpu: nvgpu: add zbc support to vgpu For both adding and querying zbc entry, added callbacks in gr ops. Native gpu driver (gk20a) and vgpu will both hook there. For vgpu, it will add or query zbc entry from RM server. Bug 1558561 Change-Id: If8a4850ecfbff41d8592664f5f93ad8c25f6fbce Signed-off-by: Richard Zhao Reviewed-on: http://git-master/r/732775 (cherry picked from commit a3787cf971128904c2712338087685b02673065d) Reviewed-on: http://git-master/r/737880 (cherry picked from commit fca2a0457c968656dc29455608f35acab094d816) Reviewed-on: http://git-master/r/753278 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | 8 ++------ drivers/gpu/nvgpu/gk20a/gk20a.h | 4 ++++ drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') diff --git a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c index d73eae86..88a933b8 100644 --- a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c @@ -588,10 +588,6 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg case NVGPU_GPU_IOCTL_ZBC_SET_TABLE: set_table_args = (struct nvgpu_gpu_zbc_set_table_args *)buf; - /* not supported for vgpu */ - if (gk20a_gpu_is_virtual(dev)) - return -ENOMEM; - zbc_val = kzalloc(sizeof(struct zbc_entry), GFP_KERNEL); if (zbc_val == NULL) return -ENOMEM; @@ -616,7 +612,7 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg if (!err) { err = gk20a_busy(dev); if (!err) { - err = gk20a_gr_zbc_set_table(g, &g->gr, + err = g->ops.gr.zbc_set_table(g, &g->gr, zbc_val); gk20a_idle(dev); } @@ -635,7 +631,7 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg zbc_tbl->type = query_table_args->type; zbc_tbl->index_size = query_table_args->index_size; - err = gr_gk20a_query_zbc(g, &g->gr, zbc_tbl); + err = g->ops.gr.zbc_query_table(g, &g->gr, zbc_tbl); if (!err) { switch (zbc_tbl->type) { diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 29fa4021..a52d97f3 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -152,6 +152,10 @@ struct gpu_ops { struct zbc_entry *color_val, u32 index); int (*add_zbc_depth)(struct gk20a *g, struct gr_gk20a *gr, struct zbc_entry *depth_val, u32 index); + int (*zbc_set_table)(struct gk20a *g, struct gr_gk20a *gr, + struct zbc_entry *zbc_val); + int (*zbc_query_table)(struct gk20a *g, struct gr_gk20a *gr, + struct zbc_query_params *query_params); u32 (*pagepool_default_size)(struct gk20a *g); int (*init_ctx_state)(struct gk20a *g); int (*alloc_gr_ctx)(struct gk20a *g, diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 85d1a886..603fc3a4 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -7325,6 +7325,8 @@ void gk20a_init_gr_ops(struct gpu_ops *gops) gops->gr.detect_sm_arch = gr_gk20a_detect_sm_arch; gops->gr.add_zbc_color = gr_gk20a_add_zbc_color; gops->gr.add_zbc_depth = gr_gk20a_add_zbc_depth; + gops->gr.zbc_set_table = gk20a_gr_zbc_set_table; + gops->gr.zbc_query_table = gr_gk20a_query_zbc; gops->gr.pagepool_default_size = gr_gk20a_pagepool_default_size; gops->gr.init_ctx_state = gr_gk20a_init_ctx_state; gops->gr.alloc_gr_ctx = gr_gk20a_alloc_gr_ctx; -- cgit v1.2.2