diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/fb_gp10b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/fb_gp10b.c | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/fb_gp10b.c b/drivers/gpu/nvgpu/gp10b/fb_gp10b.c new file mode 100644 index 00000000..5324b5ef --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/fb_gp10b.c | |||
@@ -0,0 +1,108 @@ | |||
1 | /* | ||
2 | * GP10B FB | ||
3 | * | ||
4 | * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/types.h> | ||
17 | |||
18 | #include "gk20a/gk20a.h" | ||
19 | #include "gm20b/fb_gm20b.h" | ||
20 | #include "gk20a/kind_gk20a.h" | ||
21 | |||
22 | #include "hw_gmmu_gp10b.h" | ||
23 | |||
24 | static void gp10b_init_uncompressed_kind_map(void) | ||
25 | { | ||
26 | gk20a_uc_kind_map[gmmu_pte_kind_z16_2cz_v()] = | ||
27 | gk20a_uc_kind_map[gmmu_pte_kind_z16_ms2_2cz_v()] = | ||
28 | gk20a_uc_kind_map[gmmu_pte_kind_z16_ms4_2cz_v()] = | ||
29 | gk20a_uc_kind_map[gmmu_pte_kind_z16_ms8_2cz_v()] = | ||
30 | gk20a_uc_kind_map[gmmu_pte_kind_z16_ms16_2cz_v()] = | ||
31 | gmmu_pte_kind_z16_v(); | ||
32 | |||
33 | gk20a_uc_kind_map[gmmu_pte_kind_c32_ms4_4cbra_v()] = | ||
34 | gk20a_uc_kind_map[gmmu_pte_kind_c64_ms4_4cbra_v()] = | ||
35 | gmmu_pte_kind_generic_16bx2_v(); | ||
36 | } | ||
37 | |||
38 | static bool gp10b_kind_supported(u8 k) | ||
39 | { | ||
40 | return (k >= gmmu_pte_kind_z16_2cz_v() && | ||
41 | k <= gmmu_pte_kind_z16_ms8_2cz_v()) | ||
42 | || k == gmmu_pte_kind_z16_ms16_2cz_v() | ||
43 | || k == gmmu_pte_kind_c32_ms4_4cbra_v() | ||
44 | || k == gmmu_pte_kind_c64_ms4_4cbra_v(); | ||
45 | } | ||
46 | |||
47 | static bool gp10b_kind_z(u8 k) | ||
48 | { | ||
49 | return (k >= gmmu_pte_kind_z16_2cz_v() && | ||
50 | k <= gmmu_pte_kind_z16_ms8_2cz_v()) || | ||
51 | k == gmmu_pte_kind_z16_ms16_2cz_v(); | ||
52 | } | ||
53 | |||
54 | static bool gp10b_kind_compressible(u8 k) | ||
55 | { | ||
56 | return (k >= gmmu_pte_kind_z16_2cz_v() && | ||
57 | k <= gmmu_pte_kind_z16_ms8_2cz_v()) || | ||
58 | k == gmmu_pte_kind_z16_ms16_2cz_v() || | ||
59 | (k >= gmmu_pte_kind_z16_4cz_v() && | ||
60 | k <= gmmu_pte_kind_z16_ms16_4cz_v()) || | ||
61 | k == gmmu_pte_kind_c32_ms4_4cbra_v() || | ||
62 | k == gmmu_pte_kind_c64_ms4_4cbra_v(); | ||
63 | } | ||
64 | |||
65 | static bool gp10b_kind_zbc(u8 k) | ||
66 | { | ||
67 | return (k >= gmmu_pte_kind_z16_2cz_v() && | ||
68 | k <= gmmu_pte_kind_z16_ms8_2cz_v()) || | ||
69 | k == gmmu_pte_kind_z16_ms16_2cz_v() || | ||
70 | k == gmmu_pte_kind_c32_ms4_4cbra_v() || | ||
71 | k == gmmu_pte_kind_c64_ms4_4cbra_v(); | ||
72 | } | ||
73 | |||
74 | static void gp10b_init_kind_attr(void) | ||
75 | { | ||
76 | u16 k; | ||
77 | |||
78 | for (k = 0; k < 256; k++) { | ||
79 | if (gp10b_kind_supported((u8)k)) | ||
80 | gk20a_kind_attr[k] |= GK20A_KIND_ATTR_SUPPORTED; | ||
81 | if (gp10b_kind_compressible((u8)k)) | ||
82 | gk20a_kind_attr[k] |= GK20A_KIND_ATTR_COMPRESSIBLE; | ||
83 | if (gp10b_kind_z((u8)k)) | ||
84 | gk20a_kind_attr[k] |= GK20A_KIND_ATTR_Z; | ||
85 | if (gp10b_kind_zbc((u8)k)) | ||
86 | gk20a_kind_attr[k] |= GK20A_KIND_ATTR_ZBC; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | static unsigned int gp10b_fb_compression_page_size(struct gk20a *g) | ||
91 | { | ||
92 | return SZ_64K; | ||
93 | } | ||
94 | |||
95 | static unsigned int gp10b_fb_compressible_page_size(struct gk20a *g) | ||
96 | { | ||
97 | return SZ_4K; | ||
98 | } | ||
99 | |||
100 | void gp10b_init_fb(struct gpu_ops *gops) | ||
101 | { | ||
102 | gm20b_init_fb(gops); | ||
103 | gops->fb.compression_page_size = gp10b_fb_compression_page_size; | ||
104 | gops->fb.compressible_page_size = gp10b_fb_compressible_page_size; | ||
105 | |||
106 | gp10b_init_uncompressed_kind_map(); | ||
107 | gp10b_init_kind_attr(); | ||
108 | } | ||