Commit 4d1defd7 authored by Francisco Jerez's avatar Francisco Jerez Committed by Ben Skeggs

drm/nv30: Fix PFB init for nv31.

Fixes a regression introduced by 58bbb63720c8997e0136fe1884101e7ca40d68fd
(fdo bug 29324).
Reported-by: default avatarJohannes Obermayr <johannesobermayr@gmx.de>
Signed-off-by: default avatarFrancisco Jerez <currojerez@riseup.net>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 0746b5da
...@@ -30,15 +30,25 @@ ...@@ -30,15 +30,25 @@
#include "nouveau_drm.h" #include "nouveau_drm.h"
static int static int
calc_ref(int b, int l, int i) calc_bias(struct drm_device *dev, int k, int i, int j)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
int b = (dev_priv->chipset > 0x30 ?
nv_rd32(dev, 0x122c + 0x10 * k + 0x4 * j) >> (4 * (i ^ 1)) :
0) & 0xf;
return 2 * (b & 0x8 ? b - 0x10 : b);
}
static int
calc_ref(struct drm_device *dev, int l, int k, int i)
{ {
int j, x = 0; int j, x = 0;
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
int n = (b >> (8 * j) & 0xf); int m = (l >> (8 * i) & 0xff) + calc_bias(dev, k, i, j);
int m = (l >> (8 * i) & 0xff) + 2 * (n & 0x8 ? n - 0x10 : n);
x |= (0x80 | (m & 0x1f)) << (8 * j); x |= (0x80 | clamp(m, 0, 0x1f)) << (8 * j);
} }
return x; return x;
...@@ -63,18 +73,16 @@ nv30_fb_init(struct drm_device *dev) ...@@ -63,18 +73,16 @@ nv30_fb_init(struct drm_device *dev)
dev_priv->chipset == 0x35) { dev_priv->chipset == 0x35) {
/* Related to ROP count */ /* Related to ROP count */
int n = (dev_priv->chipset == 0x31 ? 2 : 4); int n = (dev_priv->chipset == 0x31 ? 2 : 4);
int b = (dev_priv->chipset > 0x30 ?
nv_rd32(dev, 0x122c) & 0xf : 0);
int l = nv_rd32(dev, 0x1003d0); int l = nv_rd32(dev, 0x1003d0);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
nv_wr32(dev, 0x10037c + 0xc * i + 0x4 * j, nv_wr32(dev, 0x10037c + 0xc * i + 0x4 * j,
calc_ref(b, l, j)); calc_ref(dev, l, 0, j));
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
nv_wr32(dev, 0x1003ac + 0x8 * i + 0x4 * j, nv_wr32(dev, 0x1003ac + 0x8 * i + 0x4 * j,
calc_ref(b, l, j)); calc_ref(dev, l, 1, j));
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment