summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2013-05-18 21:43:43 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2013-05-18 21:43:43 +0000
commit261c47efe0c1ea4aa33977ee9023cece7d30f030 (patch)
tree1d9218dbcfd49f803e8e00d4a79960a41119c70e /sys
parent0f141804ae6cdff0856d192edbf9dc9afe6d0588 (diff)
Add parameters describing the usable part of the GTT and enable the checks
that use them.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/i915/i915_drv.h10
-rw-r--r--sys/dev/pci/drm/i915/i915_gem.c13
-rw-r--r--sys/dev/pci/drm/i915/i915_gem_tiling.c6
3 files changed, 16 insertions, 13 deletions
diff --git a/sys/dev/pci/drm/i915/i915_drv.h b/sys/dev/pci/drm/i915/i915_drv.h
index 96a1d4b11e6..c8facd23913 100644
--- a/sys/dev/pci/drm/i915/i915_drv.h
+++ b/sys/dev/pci/drm/i915/i915_drv.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: i915_drv.h,v 1.20 2013/05/11 15:56:28 kettenis Exp $ */
+/* $OpenBSD: i915_drv.h,v 1.21 2013/05/18 21:43:42 kettenis Exp $ */
/* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
*/
/*
@@ -646,6 +646,11 @@ struct inteldrm_softc {
*/
struct list_head unbound_list;
+ /** Usable portion of the GTT for GEM */
+ unsigned long gtt_start;
+ unsigned long gtt_mappable_end;
+ unsigned long gtt_end;
+
/**
* List of objects currently involved in rendering from the
* ringbuffer.
@@ -714,6 +719,9 @@ struct inteldrm_softc {
/* storage for physical objects */
struct drm_i915_gem_phys_object *phys_objs[I915_MAX_PHYS_OBJECT];
+
+ /* accounting, useful for userland debugging */
+ size_t gtt_total;
} mm;
/* for hangcheck */
diff --git a/sys/dev/pci/drm/i915/i915_gem.c b/sys/dev/pci/drm/i915/i915_gem.c
index 8d20ab76fda..c110d3b33f8 100644
--- a/sys/dev/pci/drm/i915/i915_gem.c
+++ b/sys/dev/pci/drm/i915/i915_gem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i915_gem.c,v 1.20 2013/05/11 19:03:41 kettenis Exp $ */
+/* $OpenBSD: i915_gem.c,v 1.21 2013/05/18 21:43:42 kettenis Exp $ */
/*
* Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org>
*
@@ -2067,7 +2067,6 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
size = map_and_fenceable ? fence_size : obj->base.size;
-#ifdef notyet
/* If the object is bigger than the entire aperture, reject it early
* before evicting everything in a vain attempt to find space.
*/
@@ -2076,7 +2075,6 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
DRM_ERROR("Attempting to bind an object larger than the aperture\n");
return -E2BIG;
}
-#endif
if ((ret = bus_dmamap_create(dev_priv->agpdmat, size, 1,
size, 0, BUS_DMA_WAITOK, &obj->dmamap)) != 0) {
@@ -2141,12 +2139,8 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
obj->dmamap->dm_segs[0].ds_len == fence_size &&
(obj->dmamap->dm_segs[0].ds_addr & (fence_alignment - 1)) == 0;
-#ifdef notyet
mappable =
obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end;
-#else
- mappable = true;
-#endif
obj->map_and_fenceable = mappable && fenceable;
@@ -3093,6 +3087,11 @@ i915_gem_init(struct drm_device *dev)
dev->gtt_total = (uint32_t)(gtt_end - gtt_start);
inteldrm_set_max_obj_size(dev_priv);
+ dev_priv->mm.gtt_start = gtt_start;
+ dev_priv->mm.gtt_mappable_end = gtt_end;
+ dev_priv->mm.gtt_end = gtt_end;
+ dev_priv->mm.gtt_total = gtt_end - gtt_start;
+
ret = i915_gem_init_hw(dev);
if (ret != 0) {
DRM_UNLOCK();
diff --git a/sys/dev/pci/drm/i915/i915_gem_tiling.c b/sys/dev/pci/drm/i915/i915_gem_tiling.c
index 7c12259585f..498bcd5ff70 100644
--- a/sys/dev/pci/drm/i915/i915_gem_tiling.c
+++ b/sys/dev/pci/drm/i915/i915_gem_tiling.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i915_gem_tiling.c,v 1.4 2013/05/18 16:45:34 kettenis Exp $ */
+/* $OpenBSD: i915_gem_tiling.c,v 1.5 2013/05/18 21:43:42 kettenis Exp $ */
/*
* Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org>
*
@@ -388,11 +388,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
obj->map_and_fenceable =
obj->dmamap == NULL ||
-#ifdef notyet
(obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end &&
-#else
- (
-#endif
i915_gem_object_fence_ok(obj, args->tiling_mode));
/* Rebind if we need a change of alignment */