Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 228586
b: refs/heads/master
c: 6dccd31
h: refs/heads/master
v: v3
  • Loading branch information
Francisco Jerez committed Dec 8, 2010
1 parent a219e9f commit 8354c65
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 38cf189fa13e988f85efb6de26315e762cecc260
refs/heads/master: 6dccd311dd4b104b3bc53cb67aef414141d11c9f
36 changes: 22 additions & 14 deletions trunk/drivers/gpu/drm/nouveau/nouveau_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ nouveau_channel_put_unlocked(struct nouveau_channel **pchan)
struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph;
struct nouveau_crypt_engine *pcrypt = &dev_priv->engine.crypt;
unsigned long flags;
int ret;

/* decrement the refcount, and we're done if there's still refs */
if (likely(!atomic_dec_and_test(&chan->users))) {
Expand All @@ -297,19 +296,7 @@ nouveau_channel_put_unlocked(struct nouveau_channel **pchan)
nouveau_debugfs_channel_fini(chan);

/* give it chance to idle */
nouveau_fence_update(chan);
if (chan->fence.sequence != chan->fence.sequence_ack) {
struct nouveau_fence *fence = NULL;

ret = nouveau_fence_new(chan, &fence, true);
if (ret == 0) {
ret = nouveau_fence_wait(fence, false, false);
nouveau_fence_unref(&fence);
}

if (ret)
NV_ERROR(dev, "Failed to idle channel %d.\n", chan->id);
}
nouveau_channel_idle(chan);

/* ensure all outstanding fences are signaled. they should be if the
* above attempts at idling were OK, but if we failed this'll tell TTM
Expand Down Expand Up @@ -388,6 +375,27 @@ nouveau_channel_ref(struct nouveau_channel *chan,
*pchan = chan;
}

void
nouveau_channel_idle(struct nouveau_channel *chan)
{
struct drm_device *dev = chan->dev;
struct nouveau_fence *fence = NULL;
int ret;

nouveau_fence_update(chan);

if (chan->fence.sequence != chan->fence.sequence_ack) {
ret = nouveau_fence_new(chan, &fence, true);
if (!ret) {
ret = nouveau_fence_wait(fence, false, false);
nouveau_fence_unref(&fence);
}

if (ret)
NV_ERROR(dev, "Failed to idle channel %d.\n", chan->id);
}
}

/* cleans up all the fifos from file_priv */
void
nouveau_channel_cleanup(struct drm_device *dev, struct drm_file *file_priv)
Expand Down
16 changes: 2 additions & 14 deletions trunk/drivers/gpu/drm/nouveau/nouveau_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,22 +197,10 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)

NV_INFO(dev, "Idling channels...\n");
for (i = 0; i < pfifo->channels; i++) {
struct nouveau_fence *fence = NULL;

chan = dev_priv->channels.ptr[i];
if (!chan || !chan->pushbuf_bo)
continue;

ret = nouveau_fence_new(chan, &fence, true);
if (ret == 0) {
ret = nouveau_fence_wait(fence, false, false);
nouveau_fence_unref(&fence);
}

if (ret) {
NV_ERROR(dev, "Failed to idle channel %d for suspend\n",
chan->id);
}
if (chan && chan->pushbuf_bo)
nouveau_channel_idle(chan);
}

pgraph->fifo_access(dev, false);
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/gpu/drm/nouveau/nouveau_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@ extern void nouveau_channel_put_unlocked(struct nouveau_channel **);
extern void nouveau_channel_put(struct nouveau_channel **);
extern void nouveau_channel_ref(struct nouveau_channel *chan,
struct nouveau_channel **pchan);
extern void nouveau_channel_idle(struct nouveau_channel *chan);

/* nouveau_object.c */
#define NVOBJ_CLASS(d,c,e) do { \
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/gpu/drm/nouveau/nouveau_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,9 @@ int nouveau_ioctl_gpuobj_free(struct drm_device *dev, void *data,
if (IS_ERR(chan))
return PTR_ERR(chan);

/* Synchronize with the user channel */
nouveau_channel_idle(chan);

ret = nouveau_ramht_remove(chan, objfree->handle);
nouveau_channel_put(&chan);
return ret;
Expand Down

0 comments on commit 8354c65

Please sign in to comment.