diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2014-11-26 01:23:34 -0500 |
---|---|---|
committer | Deepak Nibade <dnibade@nvidia.com> | 2016-12-27 04:52:02 -0500 |
commit | 230779e25b16af48d4fb7add7a22fce4bb1bb474 (patch) | |
tree | d02645336138bfe0fbe53f5ce9d7f3c959749666 /drivers/gpu/nvgpu/gp10b/gr_gp10b.c | |
parent | 1f11c7ffe745571753903fdca7024d4428bd99bd (diff) |
gpu: nvgpu: gp10b: Calc global context buffer size
In gp10b we need to limit global context buffer size, and it needs
to be 128b aligned.
Change-Id: I51570e2457a374c09be4d611e683ae30917f9fc0
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/657911
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/gr_gp10b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c index 7a316106..b8fbc28e 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c | |||
@@ -305,6 +305,34 @@ static void gr_gp10b_buffer_size_defaults(struct gk20a *g) | |||
305 | gr_scc_pagepool_total_pages_hwmax_value_v(); | 305 | gr_scc_pagepool_total_pages_hwmax_value_v(); |
306 | } | 306 | } |
307 | 307 | ||
308 | static int gr_gp10b_calc_global_ctx_buffer_size(struct gk20a *g) | ||
309 | { | ||
310 | struct gr_gk20a *gr = &g->gr; | ||
311 | int size; | ||
312 | |||
313 | gr->attrib_cb_size = gr->attrib_cb_default_size | ||
314 | + (gr->attrib_cb_default_size >> 1); | ||
315 | gr->alpha_cb_size = gr->alpha_cb_default_size | ||
316 | + (gr->alpha_cb_default_size >> 1); | ||
317 | |||
318 | gr->attrib_cb_size = min(gr->attrib_cb_size, | ||
319 | gr_gpc0_ppc0_cbm_beta_cb_size_v_f(0xffffffff)); | ||
320 | gr->alpha_cb_size = min(gr->attrib_cb_size, | ||
321 | gr_gpc0_ppc0_cbm_alpha_cb_size_v_f(0xffffffff)); | ||
322 | |||
323 | size = gr->attrib_cb_size * | ||
324 | gr_gpc0_ppc0_cbm_beta_cb_size_v_granularity_v() * | ||
325 | gr->max_tpc_count; | ||
326 | |||
327 | size += gr->alpha_cb_size * | ||
328 | gr_gpc0_ppc0_cbm_alpha_cb_size_v_granularity_v() * | ||
329 | gr->max_tpc_count; | ||
330 | |||
331 | size = ALIGN(size, 128); | ||
332 | |||
333 | return size; | ||
334 | } | ||
335 | |||
308 | void gp10b_init_gr(struct gpu_ops *gops) | 336 | void gp10b_init_gr(struct gpu_ops *gops) |
309 | { | 337 | { |
310 | gm20b_init_gr(gops); | 338 | gm20b_init_gr(gops); |
@@ -314,4 +342,6 @@ void gp10b_init_gr(struct gpu_ops *gops) | |||
314 | gops->gr.add_zbc_color = gr_gp10b_add_zbc_color; | 342 | gops->gr.add_zbc_color = gr_gp10b_add_zbc_color; |
315 | gops->gr.add_zbc_depth = gr_gp10b_add_zbc_depth; | 343 | gops->gr.add_zbc_depth = gr_gp10b_add_zbc_depth; |
316 | gops->gr.buffer_size_defaults = gr_gp10b_buffer_size_defaults; | 344 | gops->gr.buffer_size_defaults = gr_gp10b_buffer_size_defaults; |
345 | gops->gr.calc_global_ctx_buffer_size = | ||
346 | gr_gp10b_calc_global_ctx_buffer_size; | ||
317 | } | 347 | } |