diff options
author | Francisco Jerez <currojerez@riseup.net> | 2010-08-06 14:32:25 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-08-09 01:16:37 -0400 |
commit | 4d1defd724485bb4cbecdcccf5c3fee5cd6a0d41 (patch) | |
tree | 089a5a7b61b91c62a555a896736d405c7cf2e129 /drivers/gpu/drm/nouveau/nv30_fb.c | |
parent | 0746b5da53af533e3e525aeea47d1020c8f99c67 (diff) |
drm/nv30: Fix PFB init for nv31.
Fixes a regression introduced by 58bbb63720c8997e0136fe1884101e7ca40d68fd
(fdo bug 29324).
Reported-by: Johannes Obermayr <johannesobermayr@gmx.de>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv30_fb.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv30_fb.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/nv30_fb.c b/drivers/gpu/drm/nouveau/nv30_fb.c index 9d35c8b3b839..4a3f2f095128 100644 --- a/drivers/gpu/drm/nouveau/nv30_fb.c +++ b/drivers/gpu/drm/nouveau/nv30_fb.c | |||
@@ -30,15 +30,25 @@ | |||
30 | #include "nouveau_drm.h" | 30 | #include "nouveau_drm.h" |
31 | 31 | ||
32 | static int | 32 | static int |
33 | calc_ref(int b, int l, int i) | 33 | calc_bias(struct drm_device *dev, int k, int i, int j) |
34 | { | ||
35 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
36 | int b = (dev_priv->chipset > 0x30 ? | ||
37 | nv_rd32(dev, 0x122c + 0x10 * k + 0x4 * j) >> (4 * (i ^ 1)) : | ||
38 | 0) & 0xf; | ||
39 | |||
40 | return 2 * (b & 0x8 ? b - 0x10 : b); | ||
41 | } | ||
42 | |||
43 | static int | ||
44 | calc_ref(struct drm_device *dev, int l, int k, int i) | ||
34 | { | 45 | { |
35 | int j, x = 0; | 46 | int j, x = 0; |
36 | 47 | ||
37 | for (j = 0; j < 4; j++) { | 48 | for (j = 0; j < 4; j++) { |
38 | int n = (b >> (8 * j) & 0xf); | 49 | int m = (l >> (8 * i) & 0xff) + calc_bias(dev, k, i, j); |
39 | int m = (l >> (8 * i) & 0xff) + 2 * (n & 0x8 ? n - 0x10 : n); | ||
40 | 50 | ||
41 | x |= (0x80 | (m & 0x1f)) << (8 * j); | 51 | x |= (0x80 | clamp(m, 0, 0x1f)) << (8 * j); |
42 | } | 52 | } |
43 | 53 | ||
44 | return x; | 54 | return x; |
@@ -63,18 +73,16 @@ nv30_fb_init(struct drm_device *dev) | |||
63 | dev_priv->chipset == 0x35) { | 73 | dev_priv->chipset == 0x35) { |
64 | /* Related to ROP count */ | 74 | /* Related to ROP count */ |
65 | int n = (dev_priv->chipset == 0x31 ? 2 : 4); | 75 | 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); | 76 | int l = nv_rd32(dev, 0x1003d0); |
69 | 77 | ||
70 | for (i = 0; i < n; i++) { | 78 | for (i = 0; i < n; i++) { |
71 | for (j = 0; j < 3; j++) | 79 | for (j = 0; j < 3; j++) |
72 | nv_wr32(dev, 0x10037c + 0xc * i + 0x4 * j, | 80 | nv_wr32(dev, 0x10037c + 0xc * i + 0x4 * j, |
73 | calc_ref(b, l, j)); | 81 | calc_ref(dev, l, 0, j)); |
74 | 82 | ||
75 | for (j = 0; j < 2; j++) | 83 | for (j = 0; j < 2; j++) |
76 | nv_wr32(dev, 0x1003ac + 0x8 * i + 0x4 * j, | 84 | nv_wr32(dev, 0x1003ac + 0x8 * i + 0x4 * j, |
77 | calc_ref(b, l, j)); | 85 | calc_ref(dev, l, 1, j)); |
78 | } | 86 | } |
79 | } | 87 | } |
80 | 88 | ||