-/* $OpenBSD: drm_linux.h,v 1.23 2015/04/12 12:14:30 jsg Exp $ */
+/* $OpenBSD: drm_linux.h,v 1.24 2015/04/12 17:10:07 kettenis Exp $ */
/*
* Copyright (c) 2013, 2014 Mark Kettenis
*
#define time_after(a,b) ((long)(b) - (long)(a) < 0)
#define time_after_eq(a,b) ((long)(b) - (long)(a) <= 0)
+static inline void
+set_normalized_timespec(struct timespec *ts, time_t sec, int64_t nsec)
+{
+ while (nsec > NSEC_PER_SEC) {
+ nsec -= NSEC_PER_SEC;
+ sec++;
+ }
+
+ ts->tv_sec = sec;
+ ts->tv_nsec = nsec;
+}
+
static inline int64_t
timespec_to_ns(const struct timespec *ts)
{
-/* $OpenBSD: i915_gem.c,v 1.90 2015/04/12 03:54:10 jsg Exp $ */
+/* $OpenBSD: i915_gem.c,v 1.91 2015/04/12 17:10:07 kettenis Exp $ */
/*
* Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org>
*
return (int)end;
case 0: /* Timeout */
if (timeout)
- timeout->tv_sec = timeout->tv_nsec = 0;
+ set_normalized_timespec(timeout, 0, 0);
return -ETIME;
default: /* Completed */
WARN_ON(end < 0); /* We're not aware of other errors */
}
if (was_empty) {
timeout_add_sec(&dev_priv->mm.retire_timer, 1);
- intel_mark_busy(ring->dev);
+ intel_mark_busy(dev_priv->dev);
}
}
static void i915_gem_verify_gtt(struct drm_device *dev)
{
+#if WATCH_GTT
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ struct drm_i915_gem_object *obj;
+ int err = 0;
+
+ list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) {
+ if (obj->gtt_space == NULL) {
+ printk(KERN_ERR "object found on GTT list with no space reserved\n");
+ err++;
+ continue;
+ }
+
+ if (obj->cache_level != obj->gtt_space->color) {
+ printk(KERN_ERR "object reserved space [%08lx, %08lx] with wrong color, cache_level=%x, color=%lx\n",
+ obj->gtt_space->start,
+ obj->gtt_space->start + obj->gtt_space->size,
+ obj->cache_level,
+ obj->gtt_space->color);
+ err++;
+ continue;
+ }
+
+ if (!i915_gem_valid_gtt_space(dev,
+ obj->gtt_space,
+ obj->cache_level)) {
+ printk(KERN_ERR "invalid GTT space found at [%08lx, %08lx] - color=%x\n",
+ obj->gtt_space->start,
+ obj->gtt_space->start + obj->gtt_space->size,
+ obj->cache_level);
+ err++;
+ continue;
+ }
+ }
+
+ WARN_ON(err);
+#endif
}
/**
struct drm_device *dev = obj->base.dev;
drm_i915_private_t *dev_priv = dev->dev_private;
+ trace_i915_gem_object_destroy(obj);
+
if (obj->phys_obj)
i915_gem_detach_phys_object(dev, obj);
-/* $OpenBSD: i915_gem_execbuffer.c,v 1.37 2015/04/11 04:36:10 jsg Exp $ */
+/* $OpenBSD: i915_gem_execbuffer.c,v 1.38 2015/04/12 17:10:07 kettenis Exp $ */
/*
* Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org>
*
goto err;
#ifdef __linux__
}
+#endif
trace_i915_gem_ring_dispatch(ring, intel_ring_get_seqno(ring), flags);
-#endif
i915_gem_execbuffer_move_to_active(&objects, ring);
i915_gem_execbuffer_retire_commands(dev, file, ring);
-/* $OpenBSD: i915_irq.c,v 1.24 2015/04/11 14:39:37 jsg Exp $ */
+/* $OpenBSD: i915_irq.c,v 1.25 2015/04/12 17:10:07 kettenis Exp $ */
/* i915_irq.c -- IRQ support for the I915 -*- linux-c -*-
*/
/*
#include <dev/pci/drm/drmP.h>
#include <dev/pci/drm/i915_drm.h>
#include "i915_drv.h"
+#include "i915_trace.h"
#include "intel_drv.h"
/* For display hotplug interrupt */
if (ring->obj == NULL)
return;
-// trace_i915_gem_request_complete(ring, ring->get_seqno(ring, false));
+ trace_i915_gem_request_complete(ring, ring->get_seqno(ring, false));
wake_up_all(ring);
if (i915_enable_hangcheck) {
-/* $OpenBSD: i915_trace.h,v 1.10 2013/12/15 11:42:10 kettenis Exp $ */
+/* $OpenBSD: i915_trace.h,v 1.11 2015/04/12 17:10:07 kettenis Exp $ */
/*
* Copyright (c) 2013 Mark Kettenis <kettenis@openbsd.org>
*
{
}
+static inline void
+trace_i915_gem_object_destroy(struct drm_i915_gem_object *obj)
+{
+}
+
static inline void
trace_i915_gem_request_add(struct intel_ring_buffer *ring, u32 seqno)
{
}
+static inline void
+trace_i915_gem_request_complete(struct intel_ring_buffer *ring, u32 seqno)
+{
+}
+
static inline void
trace_i915_gem_request_retire(struct intel_ring_buffer *ring, u32 seqno)
{
{
}
+static inline void
+trace_i915_ring_wait_begin(struct intel_ring_buffer *ring)
+{
+}
+
+static inline void
+trace_i915_ring_wait_end(struct intel_ring_buffer *ring)
+{
+}
+
+static inline void
+trace_i915_flip_request(int plane, struct drm_i915_gem_object *obj)
+{
+}
+
+static inline void
+trace_i915_flip_complete(int plane, struct drm_i915_gem_object *obj)
+{
+}
+
static inline void
trace_i915_gem_object_change_domain(struct drm_i915_gem_object *obj,
u32 old_read, u32 old_write)
trace_i915_gem_evict_everything(struct drm_device *dev)
{
}
+
+static inline void
+trace_i915_gem_ring_dispatch(struct intel_ring_buffer *ring, u32 seqno,
+ u32 flags)
+{
+}
+
+static inline void
+trace_i915_gem_ring_flush(struct intel_ring_buffer *ring, u32 invalidate,
+ u32 flush)
+{
+}
-/* $OpenBSD: intel_display.c,v 1.48 2015/04/12 11:26:54 jsg Exp $ */
+/* $OpenBSD: intel_display.c,v 1.49 2015/04/12 17:10:07 kettenis Exp $ */
/*
* Copyright © 2006-2007 Intel Corporation
*
#include "intel_drv.h"
#include <dev/pci/drm/i915_drm.h>
#include "i915_drv.h"
+#include "i915_trace.h"
#include <dev/pci/drm/drm_dp_helper.h>
#include <dev/pci/drm/drm_crtc_helper.h>
task_add(systq, &work->task);
-// trace_i915_flip_complete(intel_crtc->plane, work->pending_flip_obj);
+ trace_i915_flip_complete(intel_crtc->plane, work->pending_flip_obj);
}
void intel_finish_page_flip(struct drm_device *dev, int pipe)
intel_mark_fb_busy(obj);
mutex_unlock(&dev->struct_mutex);
-// trace_i915_flip_request(intel_crtc->plane, obj);
+ trace_i915_flip_request(intel_crtc->plane, obj);
return 0;
-/* $OpenBSD: intel_ringbuffer.c,v 1.27 2015/04/12 11:26:54 jsg Exp $ */
+/* $OpenBSD: intel_ringbuffer.c,v 1.28 2015/04/12 17:10:07 kettenis Exp $ */
/*
* Copyright © 2008-2010 Intel Corporation
*
#include <dev/pci/drm/drmP.h>
#include "i915_drv.h"
#include <dev/pci/drm/i915_drm.h>
+#include "i915_trace.h"
#include "intel_drv.h"
/*
if (ret != -ENOSPC)
return ret;
-// trace_i915_ring_wait_begin(ring);
+ trace_i915_ring_wait_begin(ring);
/* With GEM the hangcheck timer should kick us out of the loop,
* leaving it early runs the risk of corrupting GEM state (due
* to running on almost untested codepaths). But on resume
ring->head = I915_READ_HEAD(ring);
ring->space = ring_space(ring);
if (ring->space >= n) {
-// trace_i915_ring_wait_end(ring);
+ trace_i915_ring_wait_end(ring);
return 0;
}
if (ret)
return ret;
} while (!time_after(ticks, end));
-// trace_i915_ring_wait_end(ring);
+ trace_i915_ring_wait_end(ring);
return -EBUSY;
}
if (ret)
return ret;
-// trace_i915_gem_ring_flush(ring, 0, I915_GEM_GPU_DOMAINS);
+ trace_i915_gem_ring_flush(ring, 0, I915_GEM_GPU_DOMAINS);
ring->gpu_caches_dirty = false;
return 0;
if (ret)
return ret;
-// trace_i915_gem_ring_flush(ring, I915_GEM_GPU_DOMAINS, flush_domains);
+ trace_i915_gem_ring_flush(ring, I915_GEM_GPU_DOMAINS, flush_domains);
ring->gpu_caches_dirty = false;
return 0;