From 08f37cba39d846bc635098c4adae0c4a5629161a Mon Sep 17 00:00:00 2001 From: Sami Kiminki Date: Mon, 17 Aug 2015 21:05:19 +0300 Subject: gpu: nvgpu: Prepare for per-GPU CDE program numbers Add gpu_ops for CDE, and add get_program_numbers function pointer for determining horizontal and vertical CDE swizzler programs. This allows different GPUs to have their own specific requirements for choosing the CDE firmware programs. Bug 1604102 Change-Id: Ib37c13abb017c8eb1c32adc8cbc6b5984488222e Signed-off-by: Sami Kiminki Reviewed-on: http://git-master/r/784899 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gm20b/cde_gm20b.c | 53 +++++++++++++++++++++++++++++++++++++ drivers/gpu/nvgpu/gm20b/cde_gm20b.h | 23 ++++++++++++++++ drivers/gpu/nvgpu/gm20b/hal_gm20b.c | 2 ++ 3 files changed, 78 insertions(+) create mode 100644 drivers/gpu/nvgpu/gm20b/cde_gm20b.c create mode 100644 drivers/gpu/nvgpu/gm20b/cde_gm20b.h (limited to 'drivers/gpu/nvgpu/gm20b') diff --git a/drivers/gpu/nvgpu/gm20b/cde_gm20b.c b/drivers/gpu/nvgpu/gm20b/cde_gm20b.c new file mode 100644 index 00000000..d23ba8c5 --- /dev/null +++ b/drivers/gpu/nvgpu/gm20b/cde_gm20b.c @@ -0,0 +1,53 @@ +/* + * GM20B 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_gm20b.h" + +enum programs { + PROG_HPASS = 0, + PROG_VPASS_LARGE = 1, + PROG_VPASS_SMALL = 2, + PROG_HPASS_DEBUG = 3, + PROG_VPASS_LARGE_DEBUG = 4, + PROG_VPASS_SMALL_DEBUG = 5, + PROG_PASSTHROUGH = 6, +}; + +static void gm20b_cde_get_program_numbers(struct gk20a *g, + u32 block_height_log2, + int *hprog_out, int *vprog_out) +{ + int hprog = PROG_HPASS; + int vprog = (block_height_log2 >= 2) ? + PROG_VPASS_LARGE : PROG_VPASS_SMALL; + if (g->cde_app.shader_parameter == 1) { + hprog = PROG_PASSTHROUGH; + vprog = PROG_PASSTHROUGH; + } else if (g->cde_app.shader_parameter == 2) { + hprog = PROG_HPASS_DEBUG; + vprog = (block_height_log2 >= 2) ? + PROG_VPASS_LARGE_DEBUG : + PROG_VPASS_SMALL_DEBUG; + } + + *hprog_out = hprog; + *vprog_out = vprog; +} + +void gm20b_init_cde_ops(struct gpu_ops *gops) +{ + gops->cde.get_program_numbers = gm20b_cde_get_program_numbers; +} diff --git a/drivers/gpu/nvgpu/gm20b/cde_gm20b.h b/drivers/gpu/nvgpu/gm20b/cde_gm20b.h new file mode 100644 index 00000000..66e303f5 --- /dev/null +++ b/drivers/gpu/nvgpu/gm20b/cde_gm20b.h @@ -0,0 +1,23 @@ +/* + * GM20B 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_GM20B_CDE +#define _NVHOST_GM20B_CDE + +struct gpu_ops; + +void gm20b_init_cde_ops(struct gpu_ops *gops); + +#endif diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c index 1ab65836..e32f8943 100644 --- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c @@ -32,6 +32,7 @@ #include #include "regops_gm20b.h" #include "debug_gm20b.h" +#include "cde_gm20b.h" #define FUSE_OPT_PRIV_SEC_DIS_0 0x264 #define PRIV_SECURITY_DISABLE 0x01 @@ -133,6 +134,7 @@ int gm20b_init_hal(struct gk20a *g) gm20b_init_clk_ops(gops); gm20b_init_regops(gops); gm20b_init_debug_ops(gops); + gm20b_init_cde_ops(gops); gops->name = "gm20b"; c->twod_class = FERMI_TWOD_A; -- cgit v1.2.2