diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 50 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/gr_gv11b.c | 27 |
2 files changed, 48 insertions, 29 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index d4c461af..dbf9ff05 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |||
@@ -3985,7 +3985,8 @@ static int gr_gk20a_load_zbc_table(struct gk20a *g, struct gr_gk20a *gr) | |||
3985 | int gr_gk20a_load_zbc_default_table(struct gk20a *g, struct gr_gk20a *gr) | 3985 | int gr_gk20a_load_zbc_default_table(struct gk20a *g, struct gr_gk20a *gr) |
3986 | { | 3986 | { |
3987 | struct zbc_entry zbc_val; | 3987 | struct zbc_entry zbc_val; |
3988 | u32 i, err; | 3988 | u32 i; |
3989 | int err; | ||
3989 | 3990 | ||
3990 | nvgpu_mutex_init(&gr->zbc_lock); | 3991 | nvgpu_mutex_init(&gr->zbc_lock); |
3991 | 3992 | ||
@@ -4001,6 +4002,9 @@ int gr_gk20a_load_zbc_default_table(struct gk20a *g, struct gr_gk20a *gr) | |||
4001 | zbc_val.color_l2[0] = 0xff000000; | 4002 | zbc_val.color_l2[0] = 0xff000000; |
4002 | zbc_val.color_ds[3] = 0x3f800000; | 4003 | zbc_val.color_ds[3] = 0x3f800000; |
4003 | err = gr_gk20a_add_zbc(g, gr, &zbc_val); | 4004 | err = gr_gk20a_add_zbc(g, gr, &zbc_val); |
4005 | if (err != 0) { | ||
4006 | goto color_fail; | ||
4007 | } | ||
4004 | 4008 | ||
4005 | /* Transparent black = (fmt 1 = zero) */ | 4009 | /* Transparent black = (fmt 1 = zero) */ |
4006 | zbc_val.format = gr_ds_zbc_color_fmt_val_zero_v(); | 4010 | zbc_val.format = gr_ds_zbc_color_fmt_val_zero_v(); |
@@ -4008,7 +4012,10 @@ int gr_gk20a_load_zbc_default_table(struct gk20a *g, struct gr_gk20a *gr) | |||
4008 | zbc_val.color_ds[i] = 0; | 4012 | zbc_val.color_ds[i] = 0; |
4009 | zbc_val.color_l2[i] = 0; | 4013 | zbc_val.color_l2[i] = 0; |
4010 | } | 4014 | } |
4011 | err |= gr_gk20a_add_zbc(g, gr, &zbc_val); | 4015 | err = gr_gk20a_add_zbc(g, gr, &zbc_val); |
4016 | if (err != 0) { | ||
4017 | goto color_fail; | ||
4018 | } | ||
4012 | 4019 | ||
4013 | /* Opaque white (i.e. solid white) = (fmt 2 = uniform 1) */ | 4020 | /* Opaque white (i.e. solid white) = (fmt 2 = uniform 1) */ |
4014 | zbc_val.format = gr_ds_zbc_color_fmt_val_unorm_one_v(); | 4021 | zbc_val.format = gr_ds_zbc_color_fmt_val_unorm_one_v(); |
@@ -4016,42 +4023,47 @@ int gr_gk20a_load_zbc_default_table(struct gk20a *g, struct gr_gk20a *gr) | |||
4016 | zbc_val.color_ds[i] = 0x3f800000; | 4023 | zbc_val.color_ds[i] = 0x3f800000; |
4017 | zbc_val.color_l2[i] = 0xffffffff; | 4024 | zbc_val.color_l2[i] = 0xffffffff; |
4018 | } | 4025 | } |
4019 | err |= gr_gk20a_add_zbc(g, gr, &zbc_val); | 4026 | err = gr_gk20a_add_zbc(g, gr, &zbc_val); |
4020 | 4027 | if (err != 0) { | |
4021 | if (!err) | 4028 | goto color_fail; |
4022 | gr->max_default_color_index = 3; | ||
4023 | else { | ||
4024 | nvgpu_err(g, | ||
4025 | "fail to load default zbc color table"); | ||
4026 | return err; | ||
4027 | } | 4029 | } |
4028 | 4030 | ||
4031 | gr->max_default_color_index = 3; | ||
4032 | |||
4029 | /* load default depth table */ | 4033 | /* load default depth table */ |
4030 | zbc_val.type = GK20A_ZBC_TYPE_DEPTH; | 4034 | zbc_val.type = GK20A_ZBC_TYPE_DEPTH; |
4031 | 4035 | ||
4032 | zbc_val.format = gr_ds_zbc_z_fmt_val_fp32_v(); | 4036 | zbc_val.format = gr_ds_zbc_z_fmt_val_fp32_v(); |
4033 | zbc_val.depth = 0x3f800000; | 4037 | zbc_val.depth = 0x3f800000; |
4034 | err = gr_gk20a_add_zbc(g, gr, &zbc_val); | 4038 | err = gr_gk20a_add_zbc(g, gr, &zbc_val); |
4039 | if (err != 0) { | ||
4040 | goto depth_fail; | ||
4041 | } | ||
4035 | 4042 | ||
4036 | zbc_val.format = gr_ds_zbc_z_fmt_val_fp32_v(); | 4043 | zbc_val.format = gr_ds_zbc_z_fmt_val_fp32_v(); |
4037 | zbc_val.depth = 0; | 4044 | zbc_val.depth = 0; |
4038 | err |= gr_gk20a_add_zbc(g, gr, &zbc_val); | 4045 | err = gr_gk20a_add_zbc(g, gr, &zbc_val); |
4039 | 4046 | if (err != 0) { | |
4040 | if (!err) | 4047 | goto depth_fail; |
4041 | gr->max_default_depth_index = 2; | ||
4042 | else { | ||
4043 | nvgpu_err(g, | ||
4044 | "fail to load default zbc depth table"); | ||
4045 | return err; | ||
4046 | } | 4048 | } |
4047 | 4049 | ||
4050 | gr->max_default_depth_index = 2; | ||
4051 | |||
4048 | if (g->ops.gr.load_zbc_s_default_tbl) { | 4052 | if (g->ops.gr.load_zbc_s_default_tbl) { |
4049 | err = g->ops.gr.load_zbc_s_default_tbl(g, gr); | 4053 | err = g->ops.gr.load_zbc_s_default_tbl(g, gr); |
4050 | if (err) | 4054 | if (err != 0) { |
4051 | return err; | 4055 | return err; |
4056 | } | ||
4052 | } | 4057 | } |
4053 | 4058 | ||
4054 | return 0; | 4059 | return 0; |
4060 | |||
4061 | color_fail: | ||
4062 | nvgpu_err(g, "fail to load default zbc color table"); | ||
4063 | return err; | ||
4064 | depth_fail: | ||
4065 | nvgpu_err(g, "fail to load default zbc depth table"); | ||
4066 | return err; | ||
4055 | } | 4067 | } |
4056 | 4068 | ||
4057 | int _gk20a_gr_zbc_set_table(struct gk20a *g, struct gr_gk20a *gr, | 4069 | int _gk20a_gr_zbc_set_table(struct gk20a *g, struct gr_gk20a *gr, |
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c index 8b3253a1..296d8e90 100644 --- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c | |||
@@ -1121,7 +1121,7 @@ int gr_gv11b_load_stencil_default_tbl(struct gk20a *g, | |||
1121 | struct gr_gk20a *gr) | 1121 | struct gr_gk20a *gr) |
1122 | { | 1122 | { |
1123 | struct zbc_entry zbc_val; | 1123 | struct zbc_entry zbc_val; |
1124 | u32 err; | 1124 | int err; |
1125 | 1125 | ||
1126 | /* load default stencil table */ | 1126 | /* load default stencil table */ |
1127 | zbc_val.type = GV11B_ZBC_TYPE_STENCIL; | 1127 | zbc_val.type = GV11B_ZBC_TYPE_STENCIL; |
@@ -1129,23 +1129,30 @@ int gr_gv11b_load_stencil_default_tbl(struct gk20a *g, | |||
1129 | zbc_val.depth = 0x0; | 1129 | zbc_val.depth = 0x0; |
1130 | zbc_val.format = ZBC_STENCIL_CLEAR_FMT_U8; | 1130 | zbc_val.format = ZBC_STENCIL_CLEAR_FMT_U8; |
1131 | err = gr_gk20a_add_zbc(g, gr, &zbc_val); | 1131 | err = gr_gk20a_add_zbc(g, gr, &zbc_val); |
1132 | 1132 | if (err != 0) { | |
1133 | goto fail; | ||
1134 | } | ||
1133 | zbc_val.depth = 0x1; | 1135 | zbc_val.depth = 0x1; |
1134 | zbc_val.format = ZBC_STENCIL_CLEAR_FMT_U8; | 1136 | zbc_val.format = ZBC_STENCIL_CLEAR_FMT_U8; |
1135 | err |= gr_gk20a_add_zbc(g, gr, &zbc_val); | 1137 | err = gr_gk20a_add_zbc(g, gr, &zbc_val); |
1138 | if (err != 0) { | ||
1139 | goto fail; | ||
1140 | } | ||
1136 | 1141 | ||
1137 | zbc_val.depth = 0xff; | 1142 | zbc_val.depth = 0xff; |
1138 | zbc_val.format = ZBC_STENCIL_CLEAR_FMT_U8; | 1143 | zbc_val.format = ZBC_STENCIL_CLEAR_FMT_U8; |
1139 | err |= gr_gk20a_add_zbc(g, gr, &zbc_val); | 1144 | err = gr_gk20a_add_zbc(g, gr, &zbc_val); |
1140 | 1145 | if (err != 0) { | |
1141 | if (!err) { | 1146 | goto fail; |
1142 | gr->max_default_s_index = 3; | ||
1143 | } else { | ||
1144 | nvgpu_err(g, "fail to load default zbc stencil table"); | ||
1145 | return err; | ||
1146 | } | 1147 | } |
1147 | 1148 | ||
1149 | gr->max_default_s_index = 3; | ||
1150 | |||
1148 | return 0; | 1151 | return 0; |
1152 | |||
1153 | fail: | ||
1154 | nvgpu_err(g, "fail to load default zbc stencil table"); | ||
1155 | return err; | ||
1149 | } | 1156 | } |
1150 | 1157 | ||
1151 | int gr_gv11b_load_stencil_tbl(struct gk20a *g, struct gr_gk20a *gr) | 1158 | int gr_gv11b_load_stencil_tbl(struct gk20a *g, struct gr_gk20a *gr) |