Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/nouveau Fix up nouveau_bo.c



details:   https://anonhg.NetBSD.org/src/rev/262d7ef20239
branches:  trunk
changeset: 1028355:262d7ef20239
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 10:47:46 2021 +0000

description:
Fix up nouveau_bo.c

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c |  38 ++++++++++++--------
 1 files changed, 23 insertions(+), 15 deletions(-)

diffs (119 lines):

diff -r a75710f9aa0c -r 262d7ef20239 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c       Sun Dec 19 10:47:38 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c       Sun Dec 19 10:47:46 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_bo.c,v 1.17 2021/12/19 01:53:39 riastradh Exp $        */
+/*     $NetBSD: nouveau_bo.c,v 1.18 2021/12/19 10:47:46 riastradh Exp $        */
 
 /*
  * Copyright 2007 Dave Airlied
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_bo.c,v 1.17 2021/12/19 01:53:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_bo.c,v 1.18 2021/12/19 10:47:46 riastradh Exp $");
 
 #include <linux/dma-mapping.h>
 #include <linux/swiotlb.h>
@@ -207,7 +207,7 @@
        int i, pi = -1;
 
        if (!*size) {
-               NV_WARN(drm, "skipped size %016llx\n", *size);
+               NV_WARN(drm, "skipped size %016"PRIx64"\n", *size);
                return ERR_PTR(-EINVAL);
        }
 
@@ -557,7 +557,7 @@
                return;
 
 #ifdef __NetBSD__
-       bus_dma_tag_t dmat = device->func->dma_tag(device);
+       bus_dma_tag_t dmat = drm->dev->dmat;
        bus_dmamap_sync(dmat, ttm_dma->dma_address, 0,
            PAGE_SIZE*ttm_dma->ttm.num_pages,
            BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
@@ -586,7 +586,7 @@
                return;
 
 #ifdef __NetBSD__
-       bus_dma_tag_t dmat = device->func->dma_tag(device);
+       bus_dma_tag_t dmat = drm->dev->dmat;
        bus_dmamap_sync(dmat, ttm_dma->dma_address, 0,
            PAGE_SIZE*ttm_dma->ttm.num_pages,
            BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
@@ -1516,10 +1516,14 @@
 static int
 nouveau_bo_verify_access(struct ttm_buffer_object *bo, struct file *filp)
 {
+#ifdef __NetBSD__
+       struct drm_file *file = filp->f_data;
+#else
+       struct drm_file *file = filp->private_data;
+#endif
        struct nouveau_bo *nvbo = nouveau_bo(bo);
 
-       return drm_vma_node_verify_access(&nvbo->bo.base.vma_node,
-                                         filp->private_data);
+       return drm_vma_node_verify_access(&nvbo->bo.base.vma_node, file);
 }
 
 static int
@@ -1705,13 +1709,14 @@
        }
 #endif
 
+#ifdef __NetBSD__
+       __USE(i);
+       __USE(dev);
+       return ttm_bus_dma_populate(ttm_dma);
+#else
 #if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)
        if (swiotlb_nr_tbl()) {
-#ifdef __NetBSD__
-               return ttm_bus_dma_populate(ttm_dma);
-#else
                return ttm_dma_populate((void *)ttm, dev, ctx);
-#endif
        }
 #endif
 
@@ -1739,6 +1744,7 @@
                ttm_dma->dma_address[i] = addr;
        }
        return 0;
+#endif
 }
 
 static void
@@ -1763,16 +1769,17 @@
        }
 #endif
 
+#ifdef __NetBSD__
+       __USE(i);
+       __USE(dev);
+       ttm_bus_dma_unpopulate(ttm_dma);
+#else
 #if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)
        if (swiotlb_nr_tbl()) {
-#ifdef __NetBSD__
-               ttm_bus_dma_unpopulate(ttm_dma);
-#else
                ttm_dma_unpopulate((void *)ttm, dev);
 #endif
                return;
        }
-#endif
 
        for (i = 0; i < ttm->num_pages; i++) {
                if (ttm_dma->dma_address[i]) {
@@ -1782,6 +1789,7 @@
        }
 
        ttm_pool_unpopulate(ttm);
+#endif
 }
 
 #ifdef __NetBSD__



Home | Main Index | Thread Index | Old Index