summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/i915
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/pci/drm/i915')
-rw-r--r--sys/dev/pci/drm/i915/i915_drv.h8
-rw-r--r--sys/dev/pci/drm/i915/i915_gem.c106
-rw-r--r--sys/dev/pci/drm/i915/i915_gem_execbuffer.c14
3 files changed, 14 insertions, 114 deletions
diff --git a/sys/dev/pci/drm/i915/i915_drv.h b/sys/dev/pci/drm/i915/i915_drv.h
index a40b14cf4fd..b9f3fb4b04b 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.57 2015/04/03 13:10:59 jsg Exp $ */
+/* $OpenBSD: i915_drv.h,v 1.58 2015/04/05 11:53:53 kettenis Exp $ */
/* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
*/
/*
@@ -1591,12 +1591,6 @@ i915_gem_object_unpin_fence(struct drm_i915_gem_object *obj)
}
}
-static inline int
-i915_gem_object_is_purgeable(struct drm_i915_gem_object *obj)
-{
- return obj->madv == I915_MADV_DONTNEED;
-}
-
void i915_gem_retire_requests(struct drm_device *dev);
void i915_gem_retire_requests_ring(struct intel_ring_buffer *ring);
int __must_check i915_gem_check_wedge(struct drm_i915_private *dev_priv,
diff --git a/sys/dev/pci/drm/i915/i915_gem.c b/sys/dev/pci/drm/i915/i915_gem.c
index 014d4b3a6a7..617820915fe 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.85 2015/02/12 08:48:32 jsg Exp $ */
+/* $OpenBSD: i915_gem.c,v 1.86 2015/04/05 11:53:53 kettenis Exp $ */
/*
* Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org>
*
@@ -79,11 +79,6 @@ static void i915_gem_shrink_all(struct drm_i915_private *dev_priv);
#endif
static void i915_gem_object_truncate(struct drm_i915_gem_object *obj);
-static inline int timespec_to_jiffies(const struct timespec *);
-static inline int timespec_valid(const struct timespec *);
-static struct timespec ns_to_timespec(const int64_t);
-static inline int64_t timespec_to_ns(const struct timespec *);
-
extern int ticks;
static inline void i915_gem_object_fence_lost(struct drm_i915_gem_object *obj)
@@ -332,27 +327,6 @@ drm_clflush_virt_range(void *addr, size_t len)
pmap_flush_cache((vaddr_t)addr, len);
}
-static inline unsigned long
-__copy_to_user(void *to, const void *from, unsigned len)
-{
- if (copyout(from, to, len))
- return len;
- return 0;
-}
-
-static inline unsigned long
-__copy_to_user_inatomic(void *to, const void *from, unsigned len)
-{
- struct cpu_info *ci = curcpu();
- int error;
-
- ci->ci_inatomic = 1;
- error = copyout(from, to, len);
- ci->ci_inatomic = 0;
-
- return (error ? len : 0);
-}
-
static inline int
__copy_to_user_swizzled(char __user *cpu_vaddr,
const char *gpu_vaddr, int gpu_offset,
@@ -379,27 +353,6 @@ __copy_to_user_swizzled(char __user *cpu_vaddr,
return 0;
}
-static inline unsigned long
-__copy_from_user(void *to, const void *from, unsigned len)
-{
- if (copyin(from, to, len))
- return len;
- return 0;
-}
-
-static inline unsigned long
-__copy_from_user_inatomic_nocache(void *to, const void *from, unsigned len)
-{
- struct cpu_info *ci = curcpu();
- int error;
-
- ci->ci_inatomic = 1;
- error = copyin(from, to, len);
- ci->ci_inatomic = 0;
-
- return (error ? len : 0);
-}
-
static inline int
__copy_from_user_swizzled(char *gpu_vaddr, int gpu_offset,
const char __user *cpu_vaddr,
@@ -1832,7 +1785,11 @@ i915_gem_object_truncate(struct drm_i915_gem_object *obj)
obj->madv = __I915_MADV_PURGED;
}
-// i915_gem_object_is_purgeable
+static inline int
+i915_gem_object_is_purgeable(struct drm_i915_gem_object *obj)
+{
+ return obj->madv == I915_MADV_DONTNEED;
+}
static void
i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj)
@@ -4649,54 +4606,3 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc)
return cnt;
}
#endif /* notyet */
-
-#define NSEC_PER_SEC 1000000000L
-
-static inline int64_t
-timespec_to_ns(const struct timespec *ts)
-{
- return ((ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec);
-}
-
-static inline int
-timespec_to_jiffies(const struct timespec *ts)
-{
- long long to_ticks;
-
- to_ticks = (long long)hz * ts->tv_sec + ts->tv_nsec / (tick * 1000);
- if (to_ticks > INT_MAX)
- to_ticks = INT_MAX;
-
- return ((int)to_ticks);
-}
-
-static struct timespec
-ns_to_timespec(const int64_t nsec)
-{
- struct timespec ts;
- int32_t rem;
-
- if (nsec == 0) {
- ts.tv_sec = 0;
- ts.tv_nsec = 0;
- return (ts);
- }
-
- ts.tv_sec = nsec / NSEC_PER_SEC;
- rem = nsec % NSEC_PER_SEC;
- if (rem < 0) {
- ts.tv_sec--;
- rem += NSEC_PER_SEC;
- }
- ts.tv_nsec = rem;
- return (ts);
-}
-
-static inline int
-timespec_valid(const struct timespec *ts)
-{
- if (ts->tv_sec < 0 || ts->tv_sec > 100000000 ||
- ts->tv_nsec < 0 || ts->tv_nsec >= 1000000000)
- return (0);
- return (1);
-}
diff --git a/sys/dev/pci/drm/i915/i915_gem_execbuffer.c b/sys/dev/pci/drm/i915/i915_gem_execbuffer.c
index 36eb6051a3f..0b4f56765ed 100644
--- a/sys/dev/pci/drm/i915/i915_gem_execbuffer.c
+++ b/sys/dev/pci/drm/i915/i915_gem_execbuffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i915_gem_execbuffer.c,v 1.35 2015/02/12 08:48:32 jsg Exp $ */
+/* $OpenBSD: i915_gem_execbuffer.c,v 1.36 2015/04/05 11:53:53 kettenis Exp $ */
/*
* Copyright (c) 2008-2009 Owain G. Ainsworth <oga@openbsd.org>
*
@@ -265,7 +265,7 @@ i915_gem_execbuffer_relocate_object(struct drm_i915_gem_object *obj,
count = ARRAY_SIZE(stack_reloc);
remain -= count;
- if (DRM_COPY_FROM_USER(r, user_relocs, count*sizeof(r[0])))
+ if (__copy_from_user_inatomic(r, user_relocs, count*sizeof(r[0])))
return -EFAULT;
do {
@@ -276,7 +276,7 @@ i915_gem_execbuffer_relocate_object(struct drm_i915_gem_object *obj,
return ret;
if (r->presumed_offset != offset &&
- DRM_COPY_TO_USER(&user_relocs->presumed_offset,
+ __copy_to_user_inatomic(&user_relocs->presumed_offset,
&r->presumed_offset,
sizeof(r->presumed_offset))) {
return -EFAULT;
@@ -560,7 +560,7 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev,
user_relocs = (void __user *)(uintptr_t)exec[i].relocs_ptr;
- if (DRM_COPY_FROM_USER(reloc+total, user_relocs,
+ if (copy_from_user(reloc+total, user_relocs,
exec[i].relocation_count * sizeof(*reloc))) {
ret = -EFAULT;
mutex_lock(&dev->struct_mutex);
@@ -577,7 +577,7 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev,
* relocations were valid.
*/
for (j = 0; j < exec[i].relocation_count; j++) {
- if (DRM_COPY_TO_USER(&user_relocs[j].presumed_offset,
+ if (copy_to_user(&user_relocs[j].presumed_offset,
&invalid_offset,
sizeof(invalid_offset))) {
ret = -EFAULT;
@@ -1230,7 +1230,7 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
args->buffer_count);
return -ENOMEM;
}
- ret = DRM_COPY_FROM_USER(exec2_list,
+ ret = copy_from_user(exec2_list,
(struct drm_i915_relocation_entry __user *)
(uintptr_t) args->buffers_ptr,
sizeof(*exec2_list) * args->buffer_count);
@@ -1244,7 +1244,7 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
ret = i915_gem_do_execbuffer(dev, data, file, args, exec2_list);
if (!ret) {
/* Copy the new buffer offsets back to the user's exec list. */
- ret = DRM_COPY_TO_USER((void __user *)(uintptr_t)args->buffers_ptr,
+ ret = copy_to_user((void __user *)(uintptr_t)args->buffers_ptr,
exec2_list,
sizeof(*exec2_list) * args->buffer_count);
if (ret) {