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 Adapt the Intel ringbuffer co...
details: https://anonhg.NetBSD.org/src/rev/51723dd3e8ff
branches: riastradh-drm2
changeset: 788527:51723dd3e8ff
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Sep 08 15:54:20 2013 +0000
description:
Adapt the Intel ringbuffer code to NetBSD.
diffstat:
sys/external/bsd/drm2/dist/drm/i915/i915_dma.c | 15 ---
sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c | 56 ++++++++--
sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.h | 6 +-
sys/external/bsd/drm2/i915drm/intel_pm.c | 10 +-
sys/external/bsd/drm2/i915drm/intel_ringbuffer.c | 86 ------------------
5 files changed, 55 insertions(+), 118 deletions(-)
diffs (truncated from 336 to 300 lines):
diff -r ac0c6ec8934d -r 51723dd3e8ff sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c Sun Sep 08 15:52:20 2013 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c Sun Sep 08 15:54:20 2013 +0000
@@ -239,19 +239,11 @@
DRM_DEBUG_DRIVER("%s\n", __func__);
-#ifdef __NetBSD__
- if (!ring->virtual_start_mapped) {
- DRM_ERROR("can not ioremap virtual address for"
- " ring buffer\n");
- return -ENOMEM;
- }
-#else
if (ring->virtual_start == NULL) {
DRM_ERROR("can not ioremap virtual address for"
" ring buffer\n");
return -ENOMEM;
}
-#endif
/* Program Hardware Status Page */
if (!ring->status_page.page_addr) {
@@ -834,17 +826,10 @@
if (drm_core_check_feature(dev, DRIVER_MODESET))
return -ENODEV;
-#ifdef __NetBSD__
- if (!dev_priv || !LP_RING(dev_priv)->virtual_start_mapped) {
- DRM_ERROR("called with no initialization\n");
- return -EINVAL;
- }
-#else
if (!dev_priv || !LP_RING(dev_priv)->virtual_start) {
DRM_ERROR("called with no initialization\n");
return -EINVAL;
}
-#endif
RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
diff -r ac0c6ec8934d -r 51723dd3e8ff sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c Sun Sep 08 15:52:20 2013 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c Sun Sep 08 15:54:20 2013 +0000
@@ -464,7 +464,12 @@
goto err_unref;
pc->gtt_offset = obj->gtt_offset;
+#ifdef __NetBSD__
+ pc->cpu_page = kmap(container_of(TAILQ_FIRST(&obj->igo_pageq),
+ struct page, p_vmp));
+#else
pc->cpu_page = kmap(sg_page(obj->pages->sgl));
+#endif
if (pc->cpu_page == NULL)
goto err_unpin;
@@ -492,7 +497,11 @@
obj = pc->obj;
+#ifdef __NetBSD__
+ kunmap(container_of(TAILQ_FIRST(&obj->igo_pageq), struct page, p_vmp));
+#else
kunmap(sg_page(obj->pages->sgl));
+#endif
i915_gem_object_unpin(obj);
drm_gem_object_unreference(&obj->base);
@@ -1067,7 +1076,11 @@
if (obj == NULL)
return;
+#ifdef __NetBSD__
+ kunmap(container_of(TAILQ_FIRST(&obj->igo_pageq), struct page, p_vmp));
+#else
kunmap(sg_page(obj->pages->sgl));
+#endif
i915_gem_object_unpin(obj);
drm_gem_object_unreference(&obj->base);
ring->status_page.obj = NULL;
@@ -1094,7 +1107,13 @@
}
ring->status_page.gfx_addr = obj->gtt_offset;
+#ifdef __NetBSD__
+ ring->status_page.page_addr =
+ kmap(container_of(TAILQ_FIRST(&obj->igo_pageq), struct page,
+ p_vmp));
+#else
ring->status_page.page_addr = kmap(sg_page(obj->pages->sgl));
+#endif
if (ring->status_page.page_addr == NULL) {
ret = -ENOMEM;
goto err_unpin;
@@ -1195,22 +1214,17 @@
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;
- }
- ring->virtual_start_mapped = true;
+ ring->virtual_start = drm_ioremap(dev, &ring->virtual_start_map);
#else
ring->virtual_start =
ioremap_wc(dev_priv->mm.gtt->gma_bus_addr + obj->gtt_offset,
ring->size);
+#endif
if (ring->virtual_start == NULL) {
DRM_ERROR("Failed to map ringbuffer.\n");
ret = -EINVAL;
goto err_unpin;
}
-#endif
ret = ring->init(ring);
if (ret)
@@ -1229,7 +1243,7 @@
err_unmap:
#ifdef __NetBSD__
drm_iounmap(dev, &ring->virtual_start_map);
- ring->virtual_start_mapped = false;
+ ring->virtual_start = NULL;
#else
iounmap(ring->virtual_start);
#endif
@@ -1262,7 +1276,7 @@
#ifdef __NetBSD__
drm_iounmap(dev_priv->dev, &ring->virtual_start_map);
- ring->virtual_start_mapped = false;
+ ring->virtual_start = NULL;
#else
iounmap(ring->virtual_start);
#endif
@@ -1388,6 +1402,18 @@
return -EBUSY;
}
+#ifdef __NetBSD__ /* XXX */
+# define __iomem __ring_iomem
+
+static inline void
+iowrite32(uint32_t value, uint32_t __ring_iomem *ptr)
+{
+
+ __insn_barrier();
+ *ptr = value;
+}
+#endif
+
static int intel_wrap_ring_buffer(struct intel_ring_buffer *ring)
{
uint32_t __iomem *virt;
@@ -1399,7 +1425,8 @@
return ret;
}
- virt = ring->virtual_start + ring->tail;
+ virt = (void __iomem *)((char __iomem *)ring->virtual_start +
+ ring->tail);
rem /= 4;
while (rem--)
iowrite32(MI_NOOP, virt++);
@@ -1410,6 +1437,8 @@
return 0;
}
+#undef __iomem
+
int intel_ring_idle(struct intel_ring_buffer *ring)
{
u32 seqno;
@@ -1763,12 +1792,11 @@
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) {
+ ring->virtual_start = drm_ioremap(dev, &ring->virtual_start_map);
+ if (ring->virtual_start == NULL) {
DRM_ERROR("cannot ioremap virtual address for ring buffer\n");
- return ret;
+ return -EIO;
}
- ring->virtual_start_mapped = true;
#else
ring->virtual_start = ioremap_wc(start, size);
if (ring->virtual_start == NULL) {
diff -r ac0c6ec8934d -r 51723dd3e8ff sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.h
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.h Sun Sep 08 15:52:20 2013 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.h Sun Sep 08 15:54:20 2013 +0000
@@ -39,6 +39,10 @@
#define I915_READ_SYNC_0(ring) I915_READ(RING_SYNC_0((ring)->mmio_base))
#define I915_READ_SYNC_1(ring) I915_READ(RING_SYNC_1((ring)->mmio_base))
+#ifdef __NetBSD__
+# define __ring_iomem
+#endif
+
struct intel_ring_buffer {
const char *name;
enum intel_ring_id {
@@ -50,7 +54,7 @@
u32 mmio_base;
#ifdef __NetBSD__
struct drm_local_map virtual_start_map;
- bool virtual_start_mapped;
+ void __ring_iomem *virtual_start;
#else
void __iomem *virtual_start;
#endif
diff -r ac0c6ec8934d -r 51723dd3e8ff sys/external/bsd/drm2/i915drm/intel_pm.c
--- a/sys/external/bsd/drm2/i915drm/intel_pm.c Sun Sep 08 15:52:20 2013 +0000
+++ b/sys/external/bsd/drm2/i915drm/intel_pm.c Sun Sep 08 15:54:20 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intel_pm.c,v 1.1.2.4 2013/07/24 04:02:12 riastradh Exp $ */
+/* $NetBSD: intel_pm.c,v 1.1.2.5 2013/09/08 15:54:20 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
/* intel_pm.c stubs */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_pm.c,v 1.1.2.4 2013/07/24 04:02:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_pm.c,v 1.1.2.5 2013/09/08 15:54:20 riastradh Exp $");
#include "i915_drv.h"
@@ -112,6 +112,12 @@
/* XXX END KLUDGEY COPYPASTA FROM intel_pm.c */
void
+i915_update_gfx_val(struct drm_i915_private *dev_priv)
+{
+ KASSERT(dev_priv->info->gen != 5); /* XXX gen<6 */
+}
+
+void
intel_disable_fbc(struct drm_device *dev __unused)
{
}
diff -r ac0c6ec8934d -r 51723dd3e8ff sys/external/bsd/drm2/i915drm/intel_ringbuffer.c
--- a/sys/external/bsd/drm2/i915drm/intel_ringbuffer.c Sun Sep 08 15:52:20 2013 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/* $NetBSD: intel_ringbuffer.c,v 1.1.2.2 2013/07/24 04:02:12 riastradh Exp $ */
-
-/*-
- * Copyright (c) 2013 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Taylor R. Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* intel_ringbuffer.c stubs */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_ringbuffer.c,v 1.1.2.2 2013/07/24 04:02:12 riastradh Exp $");
-
-#include "i915_drv.h"
-
-void
-intel_cleanup_ring_buffer(struct intel_ring_buffer *ring __unused)
-{
-}
-
-int
-intel_render_ring_init_dri(struct drm_device *dev __unused, u64 start __unused,
- u32 size __unused)
-{
- return 0;
-}
-
Home |
Main Index |
Thread Index |
Old Index