aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_fence.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-02-01 23:57:05 -0500
committerBen Skeggs <bskeggs@redhat.com>2011-02-24 15:44:30 -0500
commitec23802d616f4e33476cca5c7a975ce1682ad2d7 (patch)
treef712a215c8ca5aa69f61fd6d30b990b101bf68b3 /drivers/gpu/drm/nouveau/nouveau_fence.c
parente3b7ed5e9972dd4878a5390fd3147a973cbe2d05 (diff)
drm/nv50: drop explicit yields in favour of smaller PFIFO timeslice
This gives a small, but noticeable performance gain at lower performance levels, and unchanged at the higher ones. With this commit, we're now using the same timeslice size as the NVIDIA binary driver currently does, and dropping an unknown bit that NVIDIA no longer appear to set. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_fence.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fence.c52
1 files changed, 6 insertions, 46 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index 7eef3a11aaa1..8b46392b0ca9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -330,18 +330,9 @@ semaphore_acquire(struct nouveau_channel *chan, struct nouveau_semaphore *sema)
330 int ret; 330 int ret;
331 331
332 if (dev_priv->chipset < 0x84) { 332 if (dev_priv->chipset < 0x84) {
333 if (dev_priv->chipset < 0x50) { 333 ret = RING_SPACE(chan, 3);
334 ret = RING_SPACE(chan, 3); 334 if (ret)
335 if (ret) 335 return ret;
336 return ret;
337 } else {
338 ret = RING_SPACE(chan, 5);
339 if (ret)
340 return ret;
341
342 BEGIN_RING(chan, NvSubSw, NV_SW_YIELD, 1);
343 OUT_RING (chan, 0);
344 }
345 336
346 BEGIN_RING(chan, NvSubSw, NV_SW_SEMAPHORE_OFFSET, 2); 337 BEGIN_RING(chan, NvSubSw, NV_SW_SEMAPHORE_OFFSET, 2);
347 OUT_RING (chan, sema->mem->start); 338 OUT_RING (chan, sema->mem->start);
@@ -351,29 +342,10 @@ semaphore_acquire(struct nouveau_channel *chan, struct nouveau_semaphore *sema)
351 struct nouveau_vma *vma = &dev_priv->fence.bo->vma; 342 struct nouveau_vma *vma = &dev_priv->fence.bo->vma;
352 u64 offset = vma->offset + sema->mem->start; 343 u64 offset = vma->offset + sema->mem->start;
353 344
354 /* 345 ret = RING_SPACE(chan, 5);
355 * NV50 tries to be too smart and context-switch
356 * between semaphores instead of doing a "first come,
357 * first served" strategy like previous cards
358 * do.
359 *
360 * That's bad because the ACQUIRE latency can get as
361 * large as the PFIFO context time slice in the
362 * typical DRI2 case where you have several
363 * outstanding semaphores at the same moment.
364 *
365 * If we're going to ACQUIRE, force the card to
366 * context switch before, just in case the matching
367 * RELEASE is already scheduled to be executed in
368 * another channel.
369 */
370
371 ret = RING_SPACE(chan, 7);
372 if (ret) 346 if (ret)
373 return ret; 347 return ret;
374 348
375 BEGIN_RING(chan, NvSubSw, 0x0080, 1);
376 OUT_RING (chan, 0);
377 BEGIN_RING(chan, NvSubSw, 0x0010, 4); 349 BEGIN_RING(chan, NvSubSw, 0x0010, 4);
378 OUT_RING (chan, upper_32_bits(offset)); 350 OUT_RING (chan, upper_32_bits(offset));
379 OUT_RING (chan, lower_32_bits(offset)); 351 OUT_RING (chan, lower_32_bits(offset));
@@ -413,7 +385,7 @@ semaphore_release(struct nouveau_channel *chan, struct nouveau_semaphore *sema)
413 int ret; 385 int ret;
414 386
415 if (dev_priv->chipset < 0x84) { 387 if (dev_priv->chipset < 0x84) {
416 ret = RING_SPACE(chan, (dev_priv->chipset != 0x50) ? 4 : 6); 388 ret = RING_SPACE(chan, 4);
417 if (ret) 389 if (ret)
418 return ret; 390 return ret;
419 391
@@ -421,22 +393,12 @@ semaphore_release(struct nouveau_channel *chan, struct nouveau_semaphore *sema)
421 OUT_RING (chan, sema->mem->start); 393 OUT_RING (chan, sema->mem->start);
422 BEGIN_RING(chan, NvSubSw, NV_SW_SEMAPHORE_RELEASE, 1); 394 BEGIN_RING(chan, NvSubSw, NV_SW_SEMAPHORE_RELEASE, 1);
423 OUT_RING (chan, 1); 395 OUT_RING (chan, 1);
424 if (dev_priv->chipset == 0x50) {
425 BEGIN_RING(chan, NvSubSw, NV_SW_YIELD, 1);
426 OUT_RING (chan, 0);
427 }
428 } else 396 } else
429 if (dev_priv->chipset < 0xc0) { 397 if (dev_priv->chipset < 0xc0) {
430 struct nouveau_vma *vma = &dev_priv->fence.bo->vma; 398 struct nouveau_vma *vma = &dev_priv->fence.bo->vma;
431 u64 offset = vma->offset + sema->mem->start; 399 u64 offset = vma->offset + sema->mem->start;
432 400
433 /* 401 ret = RING_SPACE(chan, 5);
434 * Emits release and forces the card to context switch right
435 * afterwards, there may be another channel waiting for the
436 * semaphore
437 */
438
439 ret = RING_SPACE(chan, 7);
440 if (ret) 402 if (ret)
441 return ret; 403 return ret;
442 404
@@ -445,8 +407,6 @@ semaphore_release(struct nouveau_channel *chan, struct nouveau_semaphore *sema)
445 OUT_RING (chan, lower_32_bits(offset)); 407 OUT_RING (chan, lower_32_bits(offset));
446 OUT_RING (chan, 1); 408 OUT_RING (chan, 1);
447 OUT_RING (chan, 2); /* RELEASE */ 409 OUT_RING (chan, 2); /* RELEASE */
448 BEGIN_RING(chan, NvSubSw, 0x0080, 1);
449 OUT_RING (chan, 0);
450 } else { 410 } else {
451 struct nouveau_vma *vma = &dev_priv->fence.bo->vma; 411 struct nouveau_vma *vma = &dev_priv->fence.bo->vma;
452 u64 offset = vma->offset + sema->mem->start; 412 u64 offset = vma->offset + sema->mem->start;