summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2013-05-09 16:06:41 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2013-05-09 16:06:41 +0000
commitdc6f22cc477ac2269ad3975da80225fe4bf9a7bf (patch)
tree3d39e78ace3cc16df1172361893978331d1dd719 /sys/dev/pci
parentb37f1e8b552b00d9c38d20890494052c9427134c (diff)
A few more changes to reduce the diffs to the Linux code.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/i915/i915_gem.c56
1 files changed, 34 insertions, 22 deletions
diff --git a/sys/dev/pci/drm/i915/i915_gem.c b/sys/dev/pci/drm/i915/i915_gem.c
index 6e560602e07..ffb6402dccb 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.17 2013/05/09 15:00:41 kettenis Exp $ */
+/* $OpenBSD: i915_gem.c,v 1.18 2013/05/09 16:06:40 kettenis Exp $ */
/*
* Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org>
*
@@ -457,7 +457,7 @@ out:
}
int
-i915_gem_check_wedge(struct inteldrm_softc *dev_priv,
+i915_gem_check_wedge(struct drm_i915_private *dev_priv,
bool interruptible)
{
if (atomic_read(&dev_priv->mm.wedged)) {
@@ -547,7 +547,7 @@ int
i915_wait_seqno(struct intel_ring_buffer *ring, uint32_t seqno)
{
struct drm_device *dev = ring->dev;
- drm_i915_private_t *dev_priv = dev->dev_private;
+ struct drm_i915_private *dev_priv = dev->dev_private;
bool interruptible = dev_priv->mm.interruptible;
int ret;
@@ -1014,17 +1014,28 @@ done:
return (ret);
}
+/**
+ * i915_gem_mmap_gtt_ioctl - prepare an object for GTT mmap'ing
+ * @dev: DRM device
+ * @data: GTT mapping ioctl data
+ * @file: GEM object info
+ *
+ * Simply returns the fake offset to userspace so it can mmap it.
+ * The mmap call will end up in drm_gem_mmap(), which will set things
+ * up so we can get faults in the handler above.
+ *
+ * The fault handler will take care of binding the object into the GTT
+ * (since it may have been evicted to make room for something), allocating
+ * a fence register, and mapping the appropriate aperture address into
+ * userspace.
+ */
int
i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
- struct drm_file *file)
+ struct drm_file *file)
{
- struct inteldrm_softc *dev_priv;
- struct drm_i915_gem_mmap_gtt *args;
-
- dev_priv = dev->dev_private;
- args = data;
+ struct drm_i915_gem_mmap_gtt *args = data;
- return (i915_gem_mmap_gtt(file, dev, args->handle, &args->offset));
+ return i915_gem_mmap_gtt(file, dev, args->handle, &args->offset);
}
/* Immediately discard the backing storage */
@@ -1135,7 +1146,7 @@ i915_gem_object_move_to_active(struct drm_i915_gem_object *obj,
struct intel_ring_buffer *ring)
{
struct drm_device *dev = obj->base.dev;
- drm_i915_private_t *dev_priv = dev->dev_private;
+ struct drm_i915_private *dev_priv = dev->dev_private;
u32 seqno = intel_ring_get_seqno(ring);
BUG_ON(ring == NULL);
@@ -1170,8 +1181,8 @@ i915_gem_object_move_to_active(struct drm_i915_gem_object *obj,
void
i915_gem_object_move_to_inactive(struct drm_i915_gem_object *obj)
{
- struct drm_device *dev = obj->base.dev;
- struct inteldrm_softc *dev_priv = dev->dev_private;
+ struct drm_device *dev = obj->base.dev;
+ struct drm_i915_private *dev_priv = dev->dev_private;
BUG_ON(obj->base.write_domain & ~I915_GEM_GPU_DOMAINS);
BUG_ON(!obj->active);
@@ -1200,7 +1211,7 @@ i915_gem_object_move_to_inactive(struct drm_i915_gem_object *obj)
int
i915_gem_handle_seqno_wrap(struct drm_device *dev)
{
- drm_i915_private_t *dev_priv = dev->dev_private;
+ struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_ring_buffer *ring;
int ret, i, j;
@@ -1232,7 +1243,7 @@ i915_gem_handle_seqno_wrap(struct drm_device *dev)
int
i915_gem_get_seqno(struct drm_device *dev, u32 *seqno)
{
- drm_i915_private_t *dev_priv = dev->dev_private;
+ struct drm_i915_private *dev_priv = dev->dev_private;
/* reserve 0 for non-seqno */
if (dev_priv->next_seqno == 0) {
@@ -1369,7 +1380,7 @@ i915_gem_reset_ring_lists(drm_i915_private_t *dev_priv,
void
i915_gem_reset_fences(struct drm_device *dev)
{
- drm_i915_private_t *dev_priv = dev->dev_private;
+ struct drm_i915_private *dev_priv = dev->dev_private;
int i;
for (i = 0; i < dev_priv->num_fence_regs; i++) {
@@ -1391,7 +1402,7 @@ i915_gem_reset_fences(struct drm_device *dev)
void
i915_gem_reset(struct drm_device *dev)
{
- drm_i915_private_t *dev_priv = dev->dev_private;
+ struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj;
struct intel_ring_buffer *ring;
int i;
@@ -1480,7 +1491,7 @@ i915_gem_retire_requests(struct drm_device *dev)
void
i915_gem_retire_work_handler(void *arg1, void *unused)
{
- struct inteldrm_softc *dev_priv = arg1;
+ drm_i915_private_t *dev_priv = arg1;
struct drm_device *dev;
struct intel_ring_buffer *ring;
bool idle;
@@ -1506,6 +1517,7 @@ i915_gem_retire_work_handler(void *arg1, void *unused)
idle &= list_empty(&ring->request_list);
}
+
if (!dev_priv->mm.suspended && !idle)
timeout_add_sec(&dev_priv->mm.retire_timer, 1);
if (idle)
@@ -1855,7 +1867,7 @@ i915_gem_object_update_fence(struct drm_i915_gem_object *obj,
struct drm_i915_fence_reg *fence,
bool enable)
{
- drm_i915_private_t *dev_priv = obj->base.dev->dev_private;
+ struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
int reg = fence_number(dev_priv, fence);
i915_gem_write_fence(obj->base.dev, reg, enable ? obj : NULL);
@@ -1895,7 +1907,7 @@ i915_gem_object_flush_fence(struct drm_i915_gem_object *obj)
int
i915_gem_object_put_fence(struct drm_i915_gem_object *obj)
{
- drm_i915_private_t *dev_priv = obj->base.dev->dev_private;
+ struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
int ret;
ret = i915_gem_object_flush_fence(obj);
@@ -1916,7 +1928,7 @@ i915_gem_object_put_fence(struct drm_i915_gem_object *obj)
struct drm_i915_fence_reg *
i915_find_fence_reg(struct drm_device *dev)
{
- drm_i915_private_t *dev_priv = dev->dev_private;
+ struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_fence_reg *reg, *avail;
int i;
@@ -1963,7 +1975,7 @@ int
i915_gem_object_get_fence(struct drm_i915_gem_object *obj)
{
struct drm_device *dev = obj->base.dev;
- drm_i915_private_t *dev_priv = dev->dev_private;
+ struct drm_i915_private *dev_priv = dev->dev_private;
bool enable = obj->tiling_mode != I915_TILING_NONE;
struct drm_i915_fence_reg *reg;
int ret;