summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c8
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h4
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c2
-rw-r--r--drivers/gpu/nvgpu/gm20b/gr_gm20b.c2
-rw-r--r--drivers/gpu/nvgpu/vgpu/gr_vgpu.c77
5 files changed, 87 insertions, 6 deletions
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
588 case NVGPU_GPU_IOCTL_ZBC_SET_TABLE: 588 case NVGPU_GPU_IOCTL_ZBC_SET_TABLE:
589 set_table_args = (struct nvgpu_gpu_zbc_set_table_args *)buf; 589 set_table_args = (struct nvgpu_gpu_zbc_set_table_args *)buf;
590 590
591 /* not supported for vgpu */
592 if (gk20a_gpu_is_virtual(dev))
593 return -ENOMEM;
594
595 zbc_val = kzalloc(sizeof(struct zbc_entry), GFP_KERNEL); 591 zbc_val = kzalloc(sizeof(struct zbc_entry), GFP_KERNEL);
596 if (zbc_val == NULL) 592 if (zbc_val == NULL)
597 return -ENOMEM; 593 return -ENOMEM;
@@ -616,7 +612,7 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
616 if (!err) { 612 if (!err) {
617 err = gk20a_busy(dev); 613 err = gk20a_busy(dev);
618 if (!err) { 614 if (!err) {
619 err = gk20a_gr_zbc_set_table(g, &g->gr, 615 err = g->ops.gr.zbc_set_table(g, &g->gr,
620 zbc_val); 616 zbc_val);
621 gk20a_idle(dev); 617 gk20a_idle(dev);
622 } 618 }
@@ -635,7 +631,7 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
635 zbc_tbl->type = query_table_args->type; 631 zbc_tbl->type = query_table_args->type;
636 zbc_tbl->index_size = query_table_args->index_size; 632 zbc_tbl->index_size = query_table_args->index_size;
637 633
638 err = gr_gk20a_query_zbc(g, &g->gr, zbc_tbl); 634 err = g->ops.gr.zbc_query_table(g, &g->gr, zbc_tbl);
639 635
640 if (!err) { 636 if (!err) {
641 switch (zbc_tbl->type) { 637 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 {
152 struct zbc_entry *color_val, u32 index); 152 struct zbc_entry *color_val, u32 index);
153 int (*add_zbc_depth)(struct gk20a *g, struct gr_gk20a *gr, 153 int (*add_zbc_depth)(struct gk20a *g, struct gr_gk20a *gr,
154 struct zbc_entry *depth_val, u32 index); 154 struct zbc_entry *depth_val, u32 index);
155 int (*zbc_set_table)(struct gk20a *g, struct gr_gk20a *gr,
156 struct zbc_entry *zbc_val);
157 int (*zbc_query_table)(struct gk20a *g, struct gr_gk20a *gr,
158 struct zbc_query_params *query_params);
155 u32 (*pagepool_default_size)(struct gk20a *g); 159 u32 (*pagepool_default_size)(struct gk20a *g);
156 int (*init_ctx_state)(struct gk20a *g); 160 int (*init_ctx_state)(struct gk20a *g);
157 int (*alloc_gr_ctx)(struct gk20a *g, 161 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)
7325 gops->gr.detect_sm_arch = gr_gk20a_detect_sm_arch; 7325 gops->gr.detect_sm_arch = gr_gk20a_detect_sm_arch;
7326 gops->gr.add_zbc_color = gr_gk20a_add_zbc_color; 7326 gops->gr.add_zbc_color = gr_gk20a_add_zbc_color;
7327 gops->gr.add_zbc_depth = gr_gk20a_add_zbc_depth; 7327 gops->gr.add_zbc_depth = gr_gk20a_add_zbc_depth;
7328 gops->gr.zbc_set_table = gk20a_gr_zbc_set_table;
7329 gops->gr.zbc_query_table = gr_gk20a_query_zbc;
7328 gops->gr.pagepool_default_size = gr_gk20a_pagepool_default_size; 7330 gops->gr.pagepool_default_size = gr_gk20a_pagepool_default_size;
7329 gops->gr.init_ctx_state = gr_gk20a_init_ctx_state; 7331 gops->gr.init_ctx_state = gr_gk20a_init_ctx_state;
7330 gops->gr.alloc_gr_ctx = gr_gk20a_alloc_gr_ctx; 7332 gops->gr.alloc_gr_ctx = gr_gk20a_alloc_gr_ctx;
diff --git a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c
index 8351b554..74a43a6c 100644
--- a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/gr_gm20b.c
@@ -1103,6 +1103,8 @@ void gm20b_init_gr(struct gpu_ops *gops)
1103 gops->gr.detect_sm_arch = gr_gm20b_detect_sm_arch; 1103 gops->gr.detect_sm_arch = gr_gm20b_detect_sm_arch;
1104 gops->gr.add_zbc_color = gr_gk20a_add_zbc_color; 1104 gops->gr.add_zbc_color = gr_gk20a_add_zbc_color;
1105 gops->gr.add_zbc_depth = gr_gk20a_add_zbc_depth; 1105 gops->gr.add_zbc_depth = gr_gk20a_add_zbc_depth;
1106 gops->gr.zbc_set_table = gk20a_gr_zbc_set_table;
1107 gops->gr.zbc_query_table = gr_gk20a_query_zbc;
1106 gops->gr.pagepool_default_size = gr_gm20b_pagepool_default_size; 1108 gops->gr.pagepool_default_size = gr_gm20b_pagepool_default_size;
1107 gops->gr.init_ctx_state = gr_gk20a_init_ctx_state; 1109 gops->gr.init_ctx_state = gr_gk20a_init_ctx_state;
1108 gops->gr.alloc_gr_ctx = gr_gm20b_alloc_gr_ctx; 1110 gops->gr.alloc_gr_ctx = gr_gm20b_alloc_gr_ctx;
diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
index 8d0bb6cf..f6f12c7b 100644
--- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
@@ -661,6 +661,81 @@ static u32 vgpu_gr_get_fbp_en_mask(struct gk20a *g)
661 return fbp_en_mask; 661 return fbp_en_mask;
662} 662}
663 663
664static int vgpu_gr_add_zbc(struct gk20a *g, struct gr_gk20a *gr,
665 struct zbc_entry *zbc_val)
666{
667 struct gk20a_platform *platform = gk20a_get_platform(g->dev);
668 struct tegra_vgpu_cmd_msg msg = {0};
669 struct tegra_vgpu_zbc_set_table_params *p = &msg.params.zbc_set_table;
670 int err;
671
672 gk20a_dbg_fn("");
673
674 msg.cmd = TEGRA_VGPU_CMD_ZBC_SET_TABLE;
675 msg.handle = platform->virt_handle;
676
677 p->type = zbc_val->type;
678 p->format = zbc_val->format;
679 switch (p->type) {
680 case GK20A_ZBC_TYPE_COLOR:
681 memcpy(p->color_ds, zbc_val->color_ds, sizeof(p->color_ds));
682 memcpy(p->color_l2, zbc_val->color_l2, sizeof(p->color_l2));
683 break;
684 case GK20A_ZBC_TYPE_DEPTH:
685 p->depth = zbc_val->depth;
686 break;
687 default:
688 return -EINVAL;
689 }
690
691 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
692
693 return (err || msg.ret) ? -ENOMEM : 0;
694}
695
696static int vgpu_gr_query_zbc(struct gk20a *g, struct gr_gk20a *gr,
697 struct zbc_query_params *query_params)
698{
699 struct gk20a_platform *platform = gk20a_get_platform(g->dev);
700 struct tegra_vgpu_cmd_msg msg = {0};
701 struct tegra_vgpu_zbc_query_table_params *p =
702 &msg.params.zbc_query_table;
703 int err;
704
705 gk20a_dbg_fn("");
706
707 msg.cmd = TEGRA_VGPU_CMD_ZBC_QUERY_TABLE;
708 msg.handle = platform->virt_handle;
709
710 p->type = query_params->type;
711 p->index_size = query_params->index_size;
712
713 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
714 if (err || msg.ret)
715 return -ENOMEM;
716
717 switch (query_params->type) {
718 case GK20A_ZBC_TYPE_COLOR:
719 memcpy(query_params->color_ds, p->color_ds,
720 sizeof(query_params->color_ds));
721 memcpy(query_params->color_l2, p->color_l2,
722 sizeof(query_params->color_l2));
723 break;
724 case GK20A_ZBC_TYPE_DEPTH:
725 query_params->depth = p->depth;
726 break;
727 case GK20A_ZBC_TYPE_INVALID:
728 query_params->index_size = p->index_size;
729 break;
730 default:
731 return -EINVAL;
732 }
733 query_params->ref_cnt = p->ref_cnt;
734 query_params->format = p->format;
735
736 return 0;
737}
738
664static void vgpu_remove_gr_support(struct gr_gk20a *gr) 739static void vgpu_remove_gr_support(struct gr_gk20a *gr)
665{ 740{
666 gk20a_dbg_fn(""); 741 gk20a_dbg_fn("");
@@ -782,4 +857,6 @@ void vgpu_init_gr_ops(struct gpu_ops *gops)
782 gops->gr.get_gpc_tpc_mask = vgpu_gr_get_gpc_tpc_mask; 857 gops->gr.get_gpc_tpc_mask = vgpu_gr_get_gpc_tpc_mask;
783 gops->gr.get_max_fbps_count = vgpu_gr_get_max_fbps_count; 858 gops->gr.get_max_fbps_count = vgpu_gr_get_max_fbps_count;
784 gops->gr.get_fbp_en_mask = vgpu_gr_get_fbp_en_mask; 859 gops->gr.get_fbp_en_mask = vgpu_gr_get_fbp_en_mask;
860 gops->gr.zbc_set_table = vgpu_gr_add_zbc;
861 gops->gr.zbc_query_table = vgpu_gr_query_zbc;
785} 862}