Source-Changes-HG archive

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

[src/riastradh-drm2]: src/sys/external/bsd/drm2/dist/drm/i915 Switch intel_ri...



details:   https://anonhg.NetBSD.org/src/rev/43db6f574379
branches:  riastradh-drm2
changeset: 788267:43db6f574379
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jul 24 02:59:46 2013 +0000

description:
Switch intel_ring_buffers from Linux ioremap to drm_ioremap.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c |  40 ++++++++++++++++++
 sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.h |   8 +++
 2 files changed, 48 insertions(+), 0 deletions(-)

diffs (113 lines):

diff -r 6e03fa55300e -r 43db6f574379 sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c    Wed Jul 24 02:59:29 2013 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c    Wed Jul 24 02:59:46 2013 +0000
@@ -1181,6 +1181,21 @@
        if (ret)
                goto err_unpin;
 
+#ifdef __NetBSD__
+       ring->virtual_start_map.offset = (dev_priv->mm.gtt->gma_bus_addr +
+           obj->gtt_offset);
+       ring->virtual_start_map.size = ring->size;
+       ring->virtual_start_map.flags = 0;
+       ring->virtual_start_map.flags |= _DRM_RESTRICTED;
+       ring->virtual_start_map.flags |= _DRM_KERNEL;
+       ring->virtual_start_map.flags |= _DRM_WRITE_COMBINING;
+       ring->virtual_start_map.flags |= _DRM_DRIVER;
+       ret = drm_ioremap(dev, &ring->virtual_start_map);
+       if (ret) {
+               DRM_ERROR("failed to map ring buffer\n");
+               goto err_unpin;
+       }
+#else
        ring->virtual_start =
                ioremap_wc(dev_priv->mm.gtt->gma_bus_addr + obj->gtt_offset,
                           ring->size);
@@ -1189,6 +1204,7 @@
                ret = -EINVAL;
                goto err_unpin;
        }
+#endif
 
        ret = ring->init(ring);
        if (ret)
@@ -1205,7 +1221,11 @@
        return 0;
 
 err_unmap:
+#ifdef __NetBSD__
+       drm_iounmap(dev, &ring->virtual_start_map);
+#else
        iounmap(ring->virtual_start);
+#endif
 err_unpin:
        i915_gem_object_unpin(obj);
 err_unref:
@@ -1233,7 +1253,11 @@
 
        I915_WRITE_CTL(ring, 0);
 
+#ifdef __NetBSD__
+       drm_iounmap(dev, &ring->virtual_start_map);
+#else
        iounmap(ring->virtual_start);
+#endif
 
        i915_gem_object_unpin(ring->obj);
        drm_gem_object_unreference(&ring->obj->base);
@@ -1722,12 +1746,28 @@
        if (IS_I830(ring->dev) || IS_845G(ring->dev))
                ring->effective_size -= 128;
 
+#ifdef __NetBSD__
+       ring->virtual_start_map.offset = start;
+       ring->virtual_start_map.size = size;
+       ring->virtual_start_map.type = _DRM_REGISTERS;
+       ring->virtual_start_map.flags = 0;
+       ring->virtual_start_map.flags |= _DRM_RESTRICTED;
+       ring->virtual_start_map.flags |= _DRM_KERNEL;
+       ring->virtual_start_map.flags |= _DRM_WRITE_COMBINING;
+       ring->virtual_start_map.flags |= _DRM_DRIVER;
+       ret = drm_ioremap(dev, &ring->virtual_start_map);
+       if (ret) {
+               DRM_ERROR("cannot ioremap virtual address for ring buffer\n");
+               return ret;
+       }
+#else
        ring->virtual_start = ioremap_wc(start, size);
        if (ring->virtual_start == NULL) {
                DRM_ERROR("can not ioremap virtual address for"
                          " ring buffer\n");
                return -ENOMEM;
        }
+#endif
 
        if (!I915_NEED_GFX_HWS(dev)) {
                ret = init_phys_hws_pga(ring);
diff -r 6e03fa55300e -r 43db6f574379 sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.h
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.h    Wed Jul 24 02:59:29 2013 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.h    Wed Jul 24 02:59:46 2013 +0000
@@ -48,7 +48,11 @@
        } id;
 #define I915_NUM_RINGS 3
        u32             mmio_base;
+#ifdef __NetBSD__
+       struct drm_local_map    virtual_start_map;
+#else
        void            __iomem *virtual_start;
+#endif
        struct          drm_device *dev;
        struct          drm_i915_gem_object *obj;
 
@@ -205,7 +209,11 @@
 static inline void intel_ring_emit(struct intel_ring_buffer *ring,
                                   u32 data)
 {
+#ifdef __NetBSD__
+       DRM_WRITE32(&ring->virtual_start_map, ring->tail, data);
+#else
        iowrite32(data, ring->virtual_start + ring->tail);
+#endif
        ring->tail += 4;
 }
 void intel_ring_advance(struct intel_ring_buffer *ring);



Home | Main Index | Thread Index | Old Index