From 95a271905918d91468134728079c3025ea58b537 Mon Sep 17 00:00:00 2001 From: Sami Kiminki Date: Tue, 18 Aug 2015 19:34:51 +0300 Subject: gpu: nvgpu: Add CDE program number selection for GP10B Add CDE program number selection for GP10B. Bug 1604102 Change-Id: I0054e670e3bc6b8c2380124eb58204088aaae275 Signed-off-by: Sami Kiminki Reviewed-on: http://git-master/r/785459 Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gp10b/Makefile | 3 +- drivers/gpu/nvgpu/gp10b/cde_gp10b.c | 64 +++++++++++++++++++++++++++++++++++++ drivers/gpu/nvgpu/gp10b/cde_gp10b.h | 23 +++++++++++++ drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 2 ++ 4 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/nvgpu/gp10b/cde_gp10b.c create mode 100644 drivers/gpu/nvgpu/gp10b/cde_gp10b.h (limited to 'drivers/gpu/nvgpu/gp10b') diff --git a/drivers/gpu/nvgpu/gp10b/Makefile b/drivers/gpu/nvgpu/gp10b/Makefile index 688965da..ad198327 100644 --- a/drivers/gpu/nvgpu/gp10b/Makefile +++ b/drivers/gpu/nvgpu/gp10b/Makefile @@ -22,6 +22,7 @@ obj-$(CONFIG_GK20A) += \ hal_gp10b.o \ rpfb_gp10b.o \ gp10b_gating_reglist.o \ - regops_gp10b.o + regops_gp10b.o \ + cde_gp10b.o obj-$(CONFIG_TEGRA_GK20A) += platform_gp10b_tegra.o diff --git a/drivers/gpu/nvgpu/gp10b/cde_gp10b.c b/drivers/gpu/nvgpu/gp10b/cde_gp10b.c new file mode 100644 index 00000000..acb8aee3 --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/cde_gp10b.c @@ -0,0 +1,64 @@ +/* + * GP10B CDE + * + * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include "gk20a/gk20a.h" +#include "cde_gp10b.h" + +enum gp10b_programs { + GP10B_PROG_HPASS = 0, + GP10B_PROG_HPASS_4K = 1, + GP10B_PROG_VPASS = 2, + GP10B_PROG_VPASS_4K = 3, + GP10B_PROG_HPASS_DEBUG = 4, + GP10B_PROG_HPASS_4K_DEBUG = 5, + GP10B_PROG_VPASS_DEBUG = 6, + GP10B_PROG_VPASS_4K_DEBUG = 7, + GP10B_PROG_PASSTHROUGH = 8, +}; + +static void gp10b_cde_get_program_numbers(struct gk20a *g, + u32 block_height_log2, + int *hprog_out, int *vprog_out) +{ + int hprog, vprog; + + if (g->cde_app.shader_parameter == 1) { + hprog = GP10B_PROG_PASSTHROUGH; + vprog = GP10B_PROG_PASSTHROUGH; + } else { + hprog = GP10B_PROG_HPASS; + vprog = GP10B_PROG_VPASS; + if (g->cde_app.shader_parameter == 2) { + hprog = GP10B_PROG_HPASS_DEBUG; + vprog = GP10B_PROG_VPASS_DEBUG; + } + if (g->mm.bypass_smmu) { + if (!g->mm.disable_bigpage) { + gk20a_warn(&g->dev->dev, + "when bypass_smmu is 1, disable_bigpage must be 1 too"); + } + hprog |= 1; + vprog |= 1; + } + } + + *hprog_out = hprog; + *vprog_out = vprog; +} + +void gp10b_init_cde_ops(struct gpu_ops *gops) +{ + gops->cde.get_program_numbers = gp10b_cde_get_program_numbers; +} diff --git a/drivers/gpu/nvgpu/gp10b/cde_gp10b.h b/drivers/gpu/nvgpu/gp10b/cde_gp10b.h new file mode 100644 index 00000000..52f785f1 --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/cde_gp10b.h @@ -0,0 +1,23 @@ +/* + * GP10B CDE + * + * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#ifndef _NVHOST_GP10B_CDE +#define _NVHOST_GP10B_CDE + +struct gpu_ops; + +void gp10b_init_cde_ops(struct gpu_ops *gops); + +#endif diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index 9eba5571..983b985d 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c @@ -31,6 +31,7 @@ #include "gp10b/fifo_gp10b.h" #include "gp10b/gp10b_gating_reglist.h" #include "gp10b/regops_gp10b.h" +#include "gp10b/cde_gp10b.h" #include "gm20b/gr_gm20b.h" #include "gm20b/fifo_gm20b.h" @@ -103,6 +104,7 @@ int gp10b_init_hal(struct gk20a *g) gp10b_init_pmu_ops(gops); gk20a_init_debug_ops(gops); gp10b_init_regops(gops); + gp10b_init_cde_ops(gops); gops->name = "gp10b"; c->twod_class = FERMI_TWOD_A; -- cgit v1.2.2