From 1f11c7ffe745571753903fdca7024d4428bd99bd Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 13 Nov 2014 14:55:51 +0200 Subject: gpu: nvgpu: gp10b: Add new supported kind Bug 1567274 Change-Id: I38c3ffd6129893b02f6bef878a579925cf2bfa1e Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/606931 GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/gp10b/Makefile | 1 + drivers/gpu/nvgpu/gp10b/fb_gp10b.c | 96 +++++++++++++++++++++++++++++++++ drivers/gpu/nvgpu/gp10b/fb_gp10b.h | 21 ++++++++ drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 4 +- drivers/gpu/nvgpu/gp10b/hw_gmmu_gp10b.h | 28 ++++++++++ 5 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/nvgpu/gp10b/fb_gp10b.c create mode 100644 drivers/gpu/nvgpu/gp10b/fb_gp10b.h (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gp10b/Makefile b/drivers/gpu/nvgpu/gp10b/Makefile index ecb09cf6..6f1fb9e2 100644 --- a/drivers/gpu/nvgpu/gp10b/Makefile +++ b/drivers/gpu/nvgpu/gp10b/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_GK20A) += \ mc_gp10b.o \ ltc_gp10b.o \ mm_gp10b.o \ + fb_gp10b.o \ hal_gp10b.o obj-$(CONFIG_TEGRA_GK20A) += platform_gp10b_tegra.o diff --git a/drivers/gpu/nvgpu/gp10b/fb_gp10b.c b/drivers/gpu/nvgpu/gp10b/fb_gp10b.c new file mode 100644 index 00000000..df35c5b0 --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/fb_gp10b.c @@ -0,0 +1,96 @@ +/* + * GP10B FB + * + * Copyright (c) 2014, 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 + +#include "gk20a/gk20a.h" +#include "gm20b/fb_gm20b.h" +#include "gk20a/kind_gk20a.h" + +#include "hw_gmmu_gp10b.h" + +static void gp10b_init_uncompressed_kind_map(void) +{ + gm20b_init_uncompressed_kind_map(); + + gk20a_uc_kind_map[gmmu_pte_kind_z16_2cz_v()] = + gk20a_uc_kind_map[gmmu_pte_kind_z16_ms2_2cz_v()] = + gk20a_uc_kind_map[gmmu_pte_kind_z16_ms4_2cz_v()] = + gk20a_uc_kind_map[gmmu_pte_kind_z16_ms8_2cz_v()] = + gk20a_uc_kind_map[gmmu_pte_kind_z16_ms16_2cz_v()] = + gmmu_pte_kind_z16_v(); + + gk20a_uc_kind_map[gmmu_pte_kind_c32_ms4_4cbra_v()] = + gk20a_uc_kind_map[gmmu_pte_kind_c64_ms4_4cbra_v()] = + gmmu_pte_kind_generic_16bx2_v(); +} + +static bool gp10b_kind_supported(u8 k) +{ + return (k >= gmmu_pte_kind_z16_2cz_v() && + k <= gmmu_pte_kind_z16_ms8_2cz_v()) + || k == gmmu_pte_kind_z16_ms16_2cz_v() + || k == gmmu_pte_kind_c32_ms4_4cbra_v() + || k == gmmu_pte_kind_c64_ms4_4cbra_v(); +} + +static bool gp10b_kind_z(u8 k) +{ + return (k >= gmmu_pte_kind_z16_2cz_v() && + k <= gmmu_pte_kind_z16_ms8_2cz_v()) || + k == gmmu_pte_kind_z16_ms16_2cz_v(); +} + +static bool gp10b_kind_compressible(u8 k) +{ + return (k >= gmmu_pte_kind_z16_2cz_v() && + k <= gmmu_pte_kind_z16_ms8_2cz_v()) || + k == gmmu_pte_kind_z16_ms16_2cz_v() || + (k >= gmmu_pte_kind_z16_4cz_v() && + k <= gmmu_pte_kind_z16_ms16_4cz_v()); +} + +static bool gp10b_kind_zbc(u8 k) +{ + return (k >= gmmu_pte_kind_z16_2cz_v() && + k <= gmmu_pte_kind_z16_ms8_2cz_v()) || + k == gmmu_pte_kind_z16_ms16_2cz_v(); +} + +static void gp10b_init_kind_attr(void) +{ + u16 k; + + gm20b_init_kind_attr(); + + for (k = 0; k < 256; k++) { + if (gp10b_kind_supported((u8)k)) + gk20a_kind_attr[k] |= GK20A_KIND_ATTR_SUPPORTED; + if (gp10b_kind_compressible((u8)k)) + gk20a_kind_attr[k] |= GK20A_KIND_ATTR_COMPRESSIBLE; + if (gp10b_kind_z((u8)k)) + gk20a_kind_attr[k] |= GK20A_KIND_ATTR_Z; + if (gp10b_kind_zbc((u8)k)) + gk20a_kind_attr[k] |= GK20A_KIND_ATTR_ZBC; + } +} + +void gp10b_init_fb(struct gpu_ops *gops) +{ + gm20b_init_fb(gops); + + gp10b_init_uncompressed_kind_map(); + gp10b_init_kind_attr(); +} diff --git a/drivers/gpu/nvgpu/gp10b/fb_gp10b.h b/drivers/gpu/nvgpu/gp10b/fb_gp10b.h new file mode 100644 index 00000000..76efd331 --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/fb_gp10b.h @@ -0,0 +1,21 @@ +/* + * GP10B FB + * + * Copyright (c) 2014, 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 _NVGPU_GP10B_FB +#define _NVGPU_GP10B_FB +struct gpu_ops; + +void gp10b_init_fb(struct gpu_ops *gops); +#endif diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index acd1b73c..a739ce77 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c @@ -24,9 +24,9 @@ #include "gp10b/mc_gp10b.h" #include "gp10b/ltc_gp10b.h" #include "gp10b/mm_gp10b.h" +#include "gp10b/fb_gp10b.h" #include "gm20b/gr_gm20b.h" -#include "gm20b/fb_gm20b.h" #include "gm20b/gm20b_gating_reglist.h" #include "gm20b/fifo_gm20b.h" #include "gm20b/gr_ctx_gm20b.h" @@ -91,7 +91,7 @@ int gp10b_init_hal(struct gk20a *g) gp10b_init_mc(gops); gp10b_init_gr(gops); gp10b_init_ltc(gops); - gm20b_init_fb(gops); + gp10b_init_fb(gops); gm20b_init_fifo(gops); gm20b_init_gr_ctx(gops); gp10b_init_mm(gops); diff --git a/drivers/gpu/nvgpu/gp10b/hw_gmmu_gp10b.h b/drivers/gpu/nvgpu/gp10b/hw_gmmu_gp10b.h index f6020434..5a0f9fe2 100644 --- a/drivers/gpu/nvgpu/gp10b/hw_gmmu_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/hw_gmmu_gp10b.h @@ -270,6 +270,26 @@ static inline u32 gmmu_pte_kind_z16_ms16_2z_v(void) { return 0x0000000b; } +static inline u32 gmmu_pte_kind_z16_2cz_v(void) +{ + return 0x00000036; +} +static inline u32 gmmu_pte_kind_z16_ms2_2cz_v(void) +{ + return 0x00000037; +} +static inline u32 gmmu_pte_kind_z16_ms4_2cz_v(void) +{ + return 0x00000038; +} +static inline u32 gmmu_pte_kind_z16_ms8_2cz_v(void) +{ + return 0x00000039; +} +static inline u32 gmmu_pte_kind_z16_ms16_2cz_v(void) +{ + return 0x0000005f; +} static inline u32 gmmu_pte_kind_z16_4cz_v(void) { return 0x0000000c; @@ -1026,6 +1046,10 @@ static inline u32 gmmu_pte_kind_c32_ms4_2bra_v(void) { return 0x000000e3; } +static inline u32 gmmu_pte_kind_c32_ms4_4cbra_v(void) +{ + return 0x0000002c; +} static inline u32 gmmu_pte_kind_c32_ms8_ms16_2c_v(void) { return 0x000000e4; @@ -1086,6 +1110,10 @@ static inline u32 gmmu_pte_kind_c64_ms4_2bra_v(void) { return 0x000000f1; } +static inline u32 gmmu_pte_kind_c64_ms4_4cbra_v(void) +{ + return 0x0000002d; +} static inline u32 gmmu_pte_kind_c64_ms8_ms16_2c_v(void) { return 0x000000f2; -- cgit v1.2.2