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/i915drm Cope with multi-page segments.



details:   https://anonhg.NetBSD.org/src/rev/1b3ebb47d435
branches:  trunk
changeset: 993018:1b3ebb47d435
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 14:48:35 2018 +0000

description:
Cope with multi-page segments.

diffstat:

 sys/external/bsd/drm2/i915drm/intel_gtt.c |  31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)

diffs (53 lines):

diff -r 257f0e30ae14 -r 1b3ebb47d435 sys/external/bsd/drm2/i915drm/intel_gtt.c
--- a/sys/external/bsd/drm2/i915drm/intel_gtt.c Mon Aug 27 14:48:21 2018 +0000
+++ b/sys/external/bsd/drm2/i915drm/intel_gtt.c Mon Aug 27 14:48:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_gtt.c,v 1.8 2018/08/27 07:17:01 riastradh Exp $  */
+/*     $NetBSD: intel_gtt.c,v 1.9 2018/08/27 14:48:35 riastradh Exp $  */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /* Intel GTT stubs */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_gtt.c,v 1.8 2018/08/27 07:17:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_gtt.c,v 1.9 2018/08/27 14:48:35 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/bus.h>
@@ -170,17 +170,24 @@
 
        for (seg = 0; seg < dmamap->dm_nsegs; seg++) {
                const bus_addr_t addr = dmamap->dm_segs[seg].ds_addr;
-
-               KASSERT(dmamap->dm_segs[seg].ds_len == PAGE_SIZE);
+               bus_size_t len;
 
-               /* XXX Respect flags.  */
-               error = agp_i810_write_gtt_entry(isc, va, addr, gtt_flags);
-               if (error)
-                       device_printf(agp_i810_sc->as_dev,
-                           "write gtt entry"
-                           " %"PRIxMAX" -> %"PRIxMAX" failed: %d\n",
-                           (uintmax_t)va, (uintmax_t)(addr | 1), error);
-               va += PAGE_SIZE;
+               for (len = dmamap->dm_segs[seg].ds_len;
+                    len >= PAGE_SIZE;
+                    len -= PAGE_SIZE, va += PAGE_SIZE) {
+                       /* XXX Respect flags.  */
+                       error = agp_i810_write_gtt_entry(isc, va, addr,
+                           gtt_flags);
+                       if (error)
+                               device_printf(agp_i810_sc->as_dev,
+                                   "write gtt entry"
+                                   " %"PRIxMAX" -> %"PRIxMAX" failed: %d\n",
+                                   (uintmax_t)va, (uintmax_t)(addr | 1),
+                                   error);
+               }
+               KASSERTMSG(len == 0,
+                   "segment length not divisible by PAGE_SIZE: %jx",
+                   dmamap->dm_segs[seg].ds_len);
        }
        agp_i810_post_gtt_entry(isc, (va - PAGE_SIZE));
        intel_gtt_chipset_flush();



Home | Main Index | Thread Index | Old Index