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/radeon Fix little arithmetic ...



details:   https://anonhg.NetBSD.org/src/rev/67d7f387e75d
branches:  trunk
changeset: 330972:67d7f387e75d
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jul 26 05:23:11 2014 +0000

description:
Fix little arithmetic mistakes in radeon_gart.c.

Unlikely to fix the failing ring tests on boot, though.

diffstat:

 sys/external/bsd/drm2/dist/drm/radeon/radeon_gart.c |  22 +++++++++++++++-----
 1 files changed, 16 insertions(+), 6 deletions(-)

diffs (55 lines):

diff -r 6ce33929c0c9 -r 67d7f387e75d sys/external/bsd/drm2/dist/drm/radeon/radeon_gart.c
--- a/sys/external/bsd/drm2/dist/drm/radeon/radeon_gart.c       Sat Jul 26 04:54:20 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon_gart.c       Sat Jul 26 05:23:11 2014 +0000
@@ -262,9 +262,14 @@
     unsigned gpu_npages)
 {
 
-       if (rdev->gart.rg_table_map != NULL)
+       if (rdev->gart.rg_table_map != NULL) {
+               const unsigned entsize =
+                   rdev->gart.table_size / rdev->gart.num_gpu_pages;
+
                bus_dmamap_sync(rdev->ddev->dmat, rdev->gart.rg_table_map,
-                   gpu_pgstart*4, gpu_npages*4, BUS_DMASYNC_PREWRITE);
+                   gpu_pgstart*entsize, gpu_npages*entsize,
+                   BUS_DMASYNC_PREWRITE);
+       }
 }
 
 static void
@@ -273,9 +278,14 @@
 {
 
        membar_sync();          /* XXX overkill */
-       if (rdev->gart.rg_table_map != NULL)
+       if (rdev->gart.rg_table_map != NULL) {
+               const unsigned entsize =
+                   rdev->gart.table_size / rdev->gart.num_gpu_pages;
+
                bus_dmamap_sync(rdev->ddev->dmat, rdev->gart.rg_table_map,
-                   gpu_pgstart*4, gpu_npages*4, BUS_DMASYNC_POSTWRITE);
+                   gpu_pgstart*entsize, gpu_npages*entsize,
+                   BUS_DMASYNC_POSTWRITE);
+       }
        radeon_gart_tlb_flush(rdev);
 }
 #endif
@@ -289,7 +299,7 @@
     unsigned npages)
 {
        const unsigned gpu_per_cpu = (PAGE_SIZE / RADEON_GPU_PAGE_SIZE);
-       const unsigned gpu_npages = (npages / gpu_per_cpu);
+       const unsigned gpu_npages = (npages * gpu_per_cpu);
        const unsigned gpu_pgstart = (gpu_start / RADEON_GPU_PAGE_SIZE);
        const unsigned pgstart = (gpu_pgstart / gpu_per_cpu);
        unsigned pgno, gpu_pgno;
@@ -367,7 +377,7 @@
     unsigned npages, struct page **pages, bus_dmamap_t dmamap)
 {
        const unsigned gpu_per_cpu = (PAGE_SIZE / RADEON_GPU_PAGE_SIZE);
-       const unsigned gpu_npages = (npages / gpu_per_cpu);
+       const unsigned gpu_npages = (npages * gpu_per_cpu);
        const unsigned gpu_pgstart = (gpu_start / RADEON_GPU_PAGE_SIZE);
        const unsigned pgstart = (gpu_pgstart / gpu_per_cpu);
        unsigned pgno, gpu_pgno;



Home | Main Index | Thread Index | Old Index