diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-07-11 01:46:01 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-09-20 02:08:02 -0400 |
commit | e432d48f87543731fff2b19563420877d8a0c4cc (patch) | |
tree | 2438f7fdc935695cf4551fb5060a91b17bf559b5 /drivers/gpu/drm/nouveau/nouveau_object.c | |
parent | 658e86ee2db9500aea529a04008cce10972416bc (diff) |
drm/nvd0: lets not attempt to dereference a nv50_display pointer
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_object.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_object.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index 4406c1751069..02222c540aee 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
@@ -693,6 +693,7 @@ nouveau_gpuobj_channel_init_pramin(struct nouveau_channel *chan) | |||
693 | static int | 693 | static int |
694 | nvc0_gpuobj_channel_init(struct nouveau_channel *chan, struct nouveau_vm *vm) | 694 | nvc0_gpuobj_channel_init(struct nouveau_channel *chan, struct nouveau_vm *vm) |
695 | { | 695 | { |
696 | struct drm_nouveau_private *dev_priv = chan->dev->dev_private; | ||
696 | struct drm_device *dev = chan->dev; | 697 | struct drm_device *dev = chan->dev; |
697 | struct nouveau_gpuobj *pgd = NULL; | 698 | struct nouveau_gpuobj *pgd = NULL; |
698 | struct nouveau_vm_pgd *vpgd; | 699 | struct nouveau_vm_pgd *vpgd; |
@@ -722,6 +723,9 @@ nvc0_gpuobj_channel_init(struct nouveau_channel *chan, struct nouveau_vm *vm) | |||
722 | nv_wo32(chan->ramin, 0x020c, 0x000000ff); | 723 | nv_wo32(chan->ramin, 0x020c, 0x000000ff); |
723 | 724 | ||
724 | /* map display semaphore buffers into channel's vm */ | 725 | /* map display semaphore buffers into channel's vm */ |
726 | if (dev_priv->card_type >= NV_D0) | ||
727 | return 0; | ||
728 | |||
725 | for (i = 0; i < 2; i++) { | 729 | for (i = 0; i < 2; i++) { |
726 | struct nv50_display_crtc *dispc = &nv50_display(dev)->crtc[i]; | 730 | struct nv50_display_crtc *dispc = &nv50_display(dev)->crtc[i]; |
727 | 731 | ||
@@ -875,18 +879,18 @@ nouveau_gpuobj_channel_takedown(struct nouveau_channel *chan) | |||
875 | 879 | ||
876 | NV_DEBUG(dev, "ch%d\n", chan->id); | 880 | NV_DEBUG(dev, "ch%d\n", chan->id); |
877 | 881 | ||
878 | if (dev_priv->card_type >= NV_50) { | 882 | if (dev_priv->card_type >= NV_50 && dev_priv->card_type <= NV_C0) { |
879 | struct nv50_display *disp = nv50_display(dev); | 883 | struct nv50_display *disp = nv50_display(dev); |
880 | 884 | ||
881 | for (i = 0; i < dev->mode_config.num_crtc; i++) { | 885 | for (i = 0; i < dev->mode_config.num_crtc; i++) { |
882 | struct nv50_display_crtc *dispc = &disp->crtc[i]; | 886 | struct nv50_display_crtc *dispc = &disp->crtc[i]; |
883 | nouveau_bo_vma_del(dispc->sem.bo, &chan->dispc_vma[i]); | 887 | nouveau_bo_vma_del(dispc->sem.bo, &chan->dispc_vma[i]); |
884 | } | 888 | } |
885 | |||
886 | nouveau_vm_ref(NULL, &chan->vm, chan->vm_pd); | ||
887 | nouveau_gpuobj_ref(NULL, &chan->vm_pd); | ||
888 | } | 889 | } |
889 | 890 | ||
891 | nouveau_vm_ref(NULL, &chan->vm, chan->vm_pd); | ||
892 | nouveau_gpuobj_ref(NULL, &chan->vm_pd); | ||
893 | |||
890 | if (drm_mm_initialized(&chan->ramin_heap)) | 894 | if (drm_mm_initialized(&chan->ramin_heap)) |
891 | drm_mm_takedown(&chan->ramin_heap); | 895 | drm_mm_takedown(&chan->ramin_heap); |
892 | nouveau_gpuobj_ref(NULL, &chan->ramin); | 896 | nouveau_gpuobj_ref(NULL, &chan->ramin); |