diff mbox

drm/nouveau: kill nouveau_ttm_fault_reserve_notify handler to prevent useless buffer moves

Message ID 51DFFA52.6010102@canonical.com (mailing list archive)
State New, archived
Headers show

Commit Message

Maarten Lankhorst July 12, 2013, 12:45 p.m. UTC
I have no idea what this bogus restriction on placement is, but it breaks decoding 1080p
VDPAU at boot speed. With this patch applied I only need to bump the vdec clock to
get real-time 1080p decoding. It prevents a lot of VRAM <-> VRAM buffer moves.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
---

Comments

Ben Skeggs July 15, 2013, 6:05 a.m. UTC | #1
On Fri, Jul 12, 2013 at 10:45 PM, Maarten Lankhorst
<maarten.lankhorst@canonical.com> wrote:
> I have no idea what this bogus restriction on placement is, but it breaks decoding 1080p
> VDPAU at boot speed. With this patch applied I only need to bump the vdec clock to
> get real-time 1080p decoding. It prevents a lot of VRAM <-> VRAM buffer moves.
It's not bogus, and is required for pre-GF8 boards with VRAM > BAR size.

What configuration does the buffer that's getting moved here have
exactly?  The placement restriction isn't necessary on GF8, the rest
of the restrictions may currently be required still however.

Ben.


>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
> ---
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
> index d506da5..86eb321 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
> @@ -1339,34 +1339,6 @@ nouveau_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
>  }
>
>  static int
> -nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object *bo)
> -{
> -       struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
> -       struct nouveau_bo *nvbo = nouveau_bo(bo);
> -       struct nouveau_device *device = nv_device(drm->device);
> -       u32 mappable = pci_resource_len(device->pdev, 1) >> PAGE_SHIFT;
> -
> -       /* as long as the bo isn't in vram, and isn't tiled, we've got
> -        * nothing to do here.
> -        */
> -       if (bo->mem.mem_type != TTM_PL_VRAM) {
> -               if (nv_device(drm->device)->card_type < NV_50 ||
> -                   !nouveau_bo_tile_layout(nvbo))
> -                       return 0;
> -       }
> -
> -       /* make sure bo is in mappable vram */
> -       if (bo->mem.start + bo->mem.num_pages < mappable)
> -               return 0;
> -
> -
> -       nvbo->placement.fpfn = 0;
> -       nvbo->placement.lpfn = mappable;
> -       nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_VRAM, 0);
> -       return nouveau_bo_validate(nvbo, false, false);
> -}
> -
> -static int
>  nouveau_ttm_tt_populate(struct ttm_tt *ttm)
>  {
>         struct ttm_dma_tt *ttm_dma = (void *)ttm;
> @@ -1524,7 +1496,6 @@ struct ttm_bo_driver nouveau_bo_driver = {
>         .sync_obj_flush = nouveau_bo_fence_flush,
>         .sync_obj_unref = nouveau_bo_fence_unref,
>         .sync_obj_ref = nouveau_bo_fence_ref,
> -       .fault_reserve_notify = &nouveau_ttm_fault_reserve_notify,
>         .io_mem_reserve = &nouveau_ttm_io_mem_reserve,
>         .io_mem_free = &nouveau_ttm_io_mem_free,
>  };
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index d506da5..86eb321 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1339,34 +1339,6 @@  nouveau_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
 }
 
 static int
-nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object *bo)
-{
-	struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
-	struct nouveau_bo *nvbo = nouveau_bo(bo);
-	struct nouveau_device *device = nv_device(drm->device);
-	u32 mappable = pci_resource_len(device->pdev, 1) >> PAGE_SHIFT;
-
-	/* as long as the bo isn't in vram, and isn't tiled, we've got
-	 * nothing to do here.
-	 */
-	if (bo->mem.mem_type != TTM_PL_VRAM) {
-		if (nv_device(drm->device)->card_type < NV_50 ||
-		    !nouveau_bo_tile_layout(nvbo))
-			return 0;
-	}
-
-	/* make sure bo is in mappable vram */
-	if (bo->mem.start + bo->mem.num_pages < mappable)
-		return 0;
-
-
-	nvbo->placement.fpfn = 0;
-	nvbo->placement.lpfn = mappable;
-	nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_VRAM, 0);
-	return nouveau_bo_validate(nvbo, false, false);
-}
-
-static int
 nouveau_ttm_tt_populate(struct ttm_tt *ttm)
 {
 	struct ttm_dma_tt *ttm_dma = (void *)ttm;
@@ -1524,7 +1496,6 @@  struct ttm_bo_driver nouveau_bo_driver = {
 	.sync_obj_flush = nouveau_bo_fence_flush,
 	.sync_obj_unref = nouveau_bo_fence_unref,
 	.sync_obj_ref = nouveau_bo_fence_ref,
-	.fault_reserve_notify = &nouveau_ttm_fault_reserve_notify,
 	.io_mem_reserve = &nouveau_ttm_io_mem_reserve,
 	.io_mem_free = &nouveau_ttm_io_mem_free,
 };