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/radeon Fix radeon framebuffer mmapping.



details:   https://anonhg.NetBSD.org/src/rev/e68bc86748bd
branches:  trunk
changeset: 797740:e68bc86748bd
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jul 26 07:02:13 2014 +0000

description:
Fix radeon framebuffer mmapping.

The framebuffer is not a system-RAM-backed, TTM-managed object;
rather, it is a VRAM-backed object.  So we have to use its bus
address, which is a little less sketchy with bus_space_mmap anyway.

diffstat:

 sys/external/bsd/drm2/radeon/radeondrmkmsfb.c |  22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diffs (47 lines):

diff -r 98907185cb92 -r e68bc86748bd sys/external/bsd/drm2/radeon/radeondrmkmsfb.c
--- a/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c     Sat Jul 26 06:37:53 2014 +0000
+++ b/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c     Sat Jul 26 07:02:13 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: radeondrmkmsfb.c,v 1.2 2014/07/25 16:35:43 riastradh Exp $     */
+/*     $NetBSD: radeondrmkmsfb.c,v 1.3 2014/07/26 07:02:13 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeondrmkmsfb.c,v 1.2 2014/07/25 16:35:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeondrmkmsfb.c,v 1.3 2014/07/26 07:02:13 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "vga.h"
@@ -273,21 +273,17 @@
        /* Treat low memory as the framebuffer itself.  */
        if (offset < genfb->sc_fbsize) {
                const unsigned num_pages __diagused = rbo->tbo.num_pages;
-               bus_addr_t addr;
                int flags = 0;
 
                KASSERT(genfb->sc_fbsize == (num_pages << PAGE_SHIFT));
-               KASSERT(num_pages == rbo->tbo.ttm->num_pages);
-               addr = page_to_phys(rbo->tbo.ttm->pages[offset >> PAGE_SHIFT]);
-               /* XXX CACHEABLE/  PREFETCHABLE?  WC?  WB?  */
-               if (ISSET(rbo->tbo.mem.placement, TTM_PL_FLAG_CACHED))
+               KASSERT(rbo->tbo.mem.bus.is_iomem);
+
+               if (ISSET(rbo->tbo.mem.placement, TTM_PL_FLAG_WC))
                        flags |= BUS_SPACE_MAP_PREFETCHABLE;
-               /*
-                * XXX Urk.  We assume bus_space_mmap can cope with
-                * normal system RAM addresses.
-                */
-               return bus_space_mmap(rbo->tbo.bdev->memt, addr, 0, prot,
-                   flags);
+
+               return bus_space_mmap(rbo->tbo.bdev->memt,
+                   rbo->tbo.mem.bus.base, rbo->tbo.mem.bus.offset + offset,
+                   prot, flags);
        }
 
        /* XXX Cargo-culted from genfb_pci.  */



Home | Main Index | Thread Index | Old Index