diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/nouveau/Makefile | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv30_fb.c | 87 |
4 files changed, 94 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile index 4a1db73b3669..b6ed6051ed3f 100644 --- a/drivers/gpu/drm/nouveau/Makefile +++ b/drivers/gpu/drm/nouveau/Makefile | |||
@@ -12,7 +12,7 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \ | |||
12 | nouveau_dp.o \ | 12 | nouveau_dp.o \ |
13 | nv04_timer.o \ | 13 | nv04_timer.o \ |
14 | nv04_mc.o nv40_mc.o nv50_mc.o \ | 14 | nv04_mc.o nv40_mc.o nv50_mc.o \ |
15 | nv04_fb.o nv10_fb.o nv40_fb.o nv50_fb.o \ | 15 | nv04_fb.o nv10_fb.o nv30_fb.o nv40_fb.o nv50_fb.o \ |
16 | nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o \ | 16 | nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o \ |
17 | nv04_graph.o nv10_graph.o nv20_graph.o \ | 17 | nv04_graph.o nv10_graph.o nv20_graph.o \ |
18 | nv40_graph.o nv50_graph.o \ | 18 | nv40_graph.o nv50_graph.o \ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 6b24186a103f..9f4b8f2e2ec8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -896,6 +896,10 @@ extern void nv10_fb_takedown(struct drm_device *); | |||
896 | extern void nv10_fb_set_region_tiling(struct drm_device *, int, uint32_t, | 896 | extern void nv10_fb_set_region_tiling(struct drm_device *, int, uint32_t, |
897 | uint32_t, uint32_t); | 897 | uint32_t, uint32_t); |
898 | 898 | ||
899 | /* nv30_fb.c */ | ||
900 | extern int nv30_fb_init(struct drm_device *); | ||
901 | extern void nv30_fb_takedown(struct drm_device *); | ||
902 | |||
899 | /* nv40_fb.c */ | 903 | /* nv40_fb.c */ |
900 | extern int nv40_fb_init(struct drm_device *); | 904 | extern int nv40_fb_init(struct drm_device *); |
901 | extern void nv40_fb_takedown(struct drm_device *); | 905 | extern void nv40_fb_takedown(struct drm_device *); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 0bf79bf8e61a..8d59c904b045 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -184,8 +184,8 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
184 | engine->timer.init = nv04_timer_init; | 184 | engine->timer.init = nv04_timer_init; |
185 | engine->timer.read = nv04_timer_read; | 185 | engine->timer.read = nv04_timer_read; |
186 | engine->timer.takedown = nv04_timer_takedown; | 186 | engine->timer.takedown = nv04_timer_takedown; |
187 | engine->fb.init = nv10_fb_init; | 187 | engine->fb.init = nv30_fb_init; |
188 | engine->fb.takedown = nv10_fb_takedown; | 188 | engine->fb.takedown = nv30_fb_takedown; |
189 | engine->fb.set_region_tiling = nv10_fb_set_region_tiling; | 189 | engine->fb.set_region_tiling = nv10_fb_set_region_tiling; |
190 | engine->graph.grclass = nv30_graph_grclass; | 190 | engine->graph.grclass = nv30_graph_grclass; |
191 | engine->graph.init = nv30_graph_init; | 191 | engine->graph.init = nv30_graph_init; |
diff --git a/drivers/gpu/drm/nouveau/nv30_fb.c b/drivers/gpu/drm/nouveau/nv30_fb.c new file mode 100644 index 000000000000..9d35c8b3b839 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nv30_fb.c | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Francisco Jerez. | ||
3 | * All Rights Reserved. | ||
4 | * | ||
5 | * Permission is hereby granted, free of charge, to any person obtaining | ||
6 | * a copy of this software and associated documentation files (the | ||
7 | * "Software"), to deal in the Software without restriction, including | ||
8 | * without limitation the rights to use, copy, modify, merge, publish, | ||
9 | * distribute, sublicense, and/or sell copies of the Software, and to | ||
10 | * permit persons to whom the Software is furnished to do so, subject to | ||
11 | * the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice (including the | ||
14 | * next paragraph) shall be included in all copies or substantial | ||
15 | * portions of the Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
20 | * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE | ||
21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | #include "drmP.h" | ||
28 | #include "drm.h" | ||
29 | #include "nouveau_drv.h" | ||
30 | #include "nouveau_drm.h" | ||
31 | |||
32 | static int | ||
33 | calc_ref(int b, int l, int i) | ||
34 | { | ||
35 | int j, x = 0; | ||
36 | |||
37 | for (j = 0; j < 4; j++) { | ||
38 | int n = (b >> (8 * j) & 0xf); | ||
39 | int m = (l >> (8 * i) & 0xff) + 2 * (n & 0x8 ? n - 0x10 : n); | ||
40 | |||
41 | x |= (0x80 | (m & 0x1f)) << (8 * j); | ||
42 | } | ||
43 | |||
44 | return x; | ||
45 | } | ||
46 | |||
47 | int | ||
48 | nv30_fb_init(struct drm_device *dev) | ||
49 | { | ||
50 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
51 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; | ||
52 | int i, j; | ||
53 | |||
54 | pfb->num_tiles = NV10_PFB_TILE__SIZE; | ||
55 | |||
56 | /* Turn all the tiling regions off. */ | ||
57 | for (i = 0; i < pfb->num_tiles; i++) | ||
58 | pfb->set_region_tiling(dev, i, 0, 0, 0); | ||
59 | |||
60 | /* Init the memory timing regs at 0x10037c/0x1003ac */ | ||
61 | if (dev_priv->chipset == 0x30 || | ||
62 | dev_priv->chipset == 0x31 || | ||
63 | dev_priv->chipset == 0x35) { | ||
64 | /* Related to ROP count */ | ||
65 | int n = (dev_priv->chipset == 0x31 ? 2 : 4); | ||
66 | int b = (dev_priv->chipset > 0x30 ? | ||
67 | nv_rd32(dev, 0x122c) & 0xf : 0); | ||
68 | int l = nv_rd32(dev, 0x1003d0); | ||
69 | |||
70 | for (i = 0; i < n; i++) { | ||
71 | for (j = 0; j < 3; j++) | ||
72 | nv_wr32(dev, 0x10037c + 0xc * i + 0x4 * j, | ||
73 | calc_ref(b, l, j)); | ||
74 | |||
75 | for (j = 0; j < 2; j++) | ||
76 | nv_wr32(dev, 0x1003ac + 0x8 * i + 0x4 * j, | ||
77 | calc_ref(b, l, j)); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | return 0; | ||
82 | } | ||
83 | |||
84 | void | ||
85 | nv30_fb_takedown(struct drm_device *dev) | ||
86 | { | ||
87 | } | ||