From 8c5b39353e7353b358c0da9d0de8691922e1179d Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Thu, 23 Oct 2014 14:17:52 +0300 Subject: gpu: nvgpu: cde: move GK20A_CDE to platform data CONFIG_GK20A_CDE has not even been used for enabling CDE, just for initializing it at boot time, and it was disabled; initialization has been done late when the engine is first used. Remove the config setting and add information about CDE support in gk20a platform data, forcing the initialization at boot time. Boot time init removes rare race conditions when CDE would be initialized by first user. Bug 200046882 Change-Id: I85d5fb73dc27acbbe203138d25f6e342de030d93 Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/562855 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/Kconfig | 8 -------- drivers/gpu/nvgpu/gk20a/cde_gk20a.c | 23 ++++------------------- drivers/gpu/nvgpu/gk20a/gk20a.c | 3 ++- drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 2 ++ drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c | 2 ++ 5 files changed, 10 insertions(+), 28 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/Kconfig b/drivers/gpu/nvgpu/Kconfig index 6797a719..5ebb96e3 100644 --- a/drivers/gpu/nvgpu/Kconfig +++ b/drivers/gpu/nvgpu/Kconfig @@ -12,14 +12,6 @@ config GK20A_DEFAULT_TIMEOUT help Default timeout for jobs in milliseconds. Set to zero for no timeout. -config GK20A_CDE - depends on GK20A - bool "Support compression bit switzzling through CDE" - default n - help - Say Y to allow compression bit swizzling - using pre-compiled shader. - config GK20A_PMU bool "Support GK20A PMU" depends on GK20A diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c index 22a422a3..d9fe9ef1 100644 --- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c @@ -879,16 +879,8 @@ int gk20a_cde_reload(struct gk20a *g) struct gk20a_cde_ctx *cde_ctx = cde_app->cde_ctx; int err, i; - if (!cde_app->initialised) { - err = gk20a_busy(g->dev); - if (err) - return err; - gk20a_init_cde_support(g); - gk20a_idle(g->dev); - if (!cde_app->initialised) - return -ENOSYS; - return 0; - } + if (!cde_app->initialised) + return -ENOSYS; err = gk20a_busy(g->dev); if (err) @@ -1044,11 +1036,8 @@ static int gk20a_buffer_convert_gpu_to_cde( const int gridw = roundup(xtiles, xalign) / xalign; const int gridh = roundup(ytiles, yalign) / yalign; - if (!g->cde_app.initialised) { - err = gk20a_cde_reload(g); - if (err) - return err; - } + if (!g->cde_app.initialised) + return -ENOSYS; if (xtiles > 4096 / 8 || ytiles > 4096 / 8) gk20a_warn(&g->dev->dev, "cde: surface is exceptionally large (xtiles=%d, ytiles=%d)", @@ -1087,16 +1076,12 @@ static int gk20a_buffer_convert_gpu_to_cde( err = gk20a_busy(g->dev); if (err) return err; - err = gk20a_init_cde_support(g); - if (err) - goto out; err = gk20a_cde_convert(g, dmabuf, 0, /* dst kind */ compbits_offset, 0, /* dst_size, 0 = auto */ fence_in, submit_flags, params, param, fence_out); -out: gk20a_idle(g->dev); return err; } diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 226b5ae3..5dda7d74 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -798,6 +798,7 @@ static int gk20a_pm_finalize_poweron(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct gk20a *g = get_gk20a(pdev); + struct gk20a_platform *platform = gk20a_get_platform(pdev); int err, nice_value; gk20a_dbg_fn(""); @@ -939,7 +940,7 @@ static int gk20a_pm_finalize_poweron(struct device *dev) trace_gk20a_finalize_poweron_done(dev_name(dev)); - if (IS_ENABLED(CONFIG_GK20A_CDE)) + if (platform->has_cde) gk20a_init_cde_support(g); #ifdef CONFIG_INPUT_CFBOOST diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h index aada1537..d5a1cc91 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h @@ -160,6 +160,8 @@ struct gk20a_platform { u64 virt_handle; struct task_struct *intr_handler; #endif + + bool has_cde; }; static inline struct gk20a_platform *gk20a_get_platform( diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c index ccbf932f..d7500929 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c @@ -543,4 +543,6 @@ struct gk20a_platform gm20b_tegra_platform = { .secure_alloc = gk20a_tegra_secure_alloc, .secure_page_alloc = gk20a_tegra_secure_page_alloc, .dump_platform_dependencies = gk20a_tegra_debug_dump, + + .has_cde = true, }; -- cgit v1.2.2