summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Kleiner <mario.kleiner.de@gmail.com>2014-05-28 05:22:18 +0200
committerBen Skeggs <bskeggs@redhat.com>2014-06-11 16:02:07 +1000
commitc1438cf3940ea18ca42eddef9aa4bc088ac5589d (patch)
tree61b175085e892d730e5ce40e746a9d855ae8b634
parentd3ce6ebcb24101a851f80fafa3b02cd42d78076c (diff)
disp/nv04-nv40: abort scanoutpos query on vga analog.
nv04_disp_scanoutpos() must abort to trigger simple timestamping fallback if vtotal/htotal regs return zero. This happens if the output isn't a digital output, but a vga analog output, as the regs don't get initialized in that case. Fixes timestamping failure on nv-40 and earlier with vga output. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Cc: <stable@vger.kernel.org> # 3.14+
-rw-r--r--lib/core/os.h7
-rw-r--r--nvkm/engine/disp/nv04.c8
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/core/os.h b/lib/core/os.h
index 3f3c2ae4..867d8128 100644
--- a/lib/core/os.h
+++ b/lib/core/os.h
@@ -112,6 +112,13 @@ order_base_2(u64 base)
}
/******************************************************************************
+ * errno
+ *****************************************************************************/
+
+#define ENOTSUPP 524
+
+
+/******************************************************************************
* endianness
*****************************************************************************/
diff --git a/nvkm/engine/disp/nv04.c b/nvkm/engine/disp/nv04.c
index 6c89af79..94a2cc69 100644
--- a/nvkm/engine/disp/nv04.c
+++ b/nvkm/engine/disp/nv04.c
@@ -51,6 +51,14 @@ nv04_disp_scanoutpos(struct nouveau_object *object, u32 mthd,
args->htotal = nv_rd32(priv, 0x680824 + (head * 0x2000)) & 0xffff;
args->hblanke = args->htotal - 1;
+ /*
+ * If output is vga instead of digital then vtotal/htotal is invalid
+ * so we have to give up and trigger the timestamping fallback in the
+ * drm core.
+ */
+ if (!args->vtotal || !args->htotal)
+ return -ENOTSUPP;
+
args->time[0] = ktime_to_ns(ktime_get());
line = nv_rd32(priv, 0x600868 + (head * 0x2000));
args->time[1] = ktime_to_ns(ktime_get());