summaryrefslogtreecommitdiff
path: root/shared-core/nv04_graph.c
diff options
context:
space:
mode:
authorStephane Marchesin <marchesin@icps.u-strasbg.fr>2007-09-21 22:04:45 +0200
committerStephane Marchesin <marchesin@icps.u-strasbg.fr>2007-09-21 22:04:50 +0200
commit74c6f2f47a9977fef8fcc7c698862d5bd2f54336 (patch)
treeb1ef6fff80017d36a82bb3be9c63f62efcf57fe8 /shared-core/nv04_graph.c
parentbc5423f16838257a040a55b88df9588d268fda06 (diff)
nouveau: add some checks to the nv04 graph switching code.
Diffstat (limited to 'shared-core/nv04_graph.c')
-rw-r--r--shared-core/nv04_graph.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/shared-core/nv04_graph.c b/shared-core/nv04_graph.c
index f1117cd6..2cf052cf 100644
--- a/shared-core/nv04_graph.c
+++ b/shared-core/nv04_graph.c
@@ -352,13 +352,38 @@ void nouveau_nv04_context_switch(struct drm_device *dev)
struct nouveau_channel *next, *last;
int chid;
+ if (!dev) {
+ DRM_DEBUG("Invalid drm_device\n");
+ return;
+ }
+ dev_priv = dev->dev_private;
+ if (!dev_priv) {
+ DRM_DEBUG("Invalid drm_nouveau_private\n");
+ return;
+ }
+ if (!dev_priv->fifos) {
+ DRM_DEBUG("Invalid drm_nouveau_private->fifos\n");
+ return;
+ }
+
chid = NV_READ(NV03_PFIFO_CACHE1_PUSH1)&(nouveau_fifo_number(dev)-1);
next = dev_priv->fifos[chid];
+ if (!next) {
+ DRM_DEBUG("Invalid next channel\n");
+ return;
+ }
+
chid = (NV_READ(NV04_PGRAPH_CTX_USER) >> 24) & (nouveau_fifo_number(dev)-1);
last = dev_priv->fifos[chid];
- DRM_INFO("NV: PGRAPH context switch interrupt channel %x -> %x\n",last->id, next->id);
+ if (!last) {
+ DRM_DEBUG("WARNING: Invalid last channel, switch to %x\n",
+ next->id);
+ } else {
+ DRM_INFO("NV: PGRAPH context switch interrupt channel %x -> %x\n",
+ last->id, next->id);
+ }
/* NV_WRITE(NV03_PFIFO_CACHES, 0x0);
NV_WRITE(NV04_PFIFO_CACHE0_PULL0, 0x0);