From 59652e050a8311d8419f5727c476f3f1fdb9a293 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Sat, 18 Apr 2015 14:47:36 +0000 Subject: another round of reducing the diff to linux --- sys/dev/pci/drm/drmP.h | 4 +- sys/dev/pci/drm/drm_atomic.h | 3 +- sys/dev/pci/drm/drm_edid.c | 8 ++-- sys/dev/pci/drm/drm_irq.c | 18 ++++---- sys/dev/pci/drm/drm_linux.h | 30 ++++++++++++- sys/dev/pci/drm/drm_mem_util.h | 4 +- sys/dev/pci/drm/drm_mm.h | 4 +- sys/dev/pci/drm/i915/i915_dma.c | 8 ++-- sys/dev/pci/drm/i915/i915_drv.c | 70 ++++++++++++++++++++++------- sys/dev/pci/drm/i915/i915_gem.c | 22 ++++----- sys/dev/pci/drm/i915/i915_gem_tiling.c | 8 ++-- sys/dev/pci/drm/i915/i915_suspend.c | 8 ++-- sys/dev/pci/drm/i915/intel_ddi.c | 7 +-- sys/dev/pci/drm/i915/intel_display.c | 10 ++--- sys/dev/pci/drm/i915/intel_opregion.c | 27 ++++++++++- sys/dev/pci/drm/i915/intel_panel.c | 4 +- sys/dev/pci/drm/i915/intel_pm.c | 6 +-- sys/dev/pci/drm/radeon/atom.c | 4 +- sys/dev/pci/drm/radeon/atombios_dp.c | 4 +- sys/dev/pci/drm/radeon/atombios_encoders.c | 8 +--- sys/dev/pci/drm/radeon/evergreen.c | 9 +--- sys/dev/pci/drm/radeon/evergreen_blit_kms.c | 4 +- sys/dev/pci/drm/radeon/evergreen_cs.c | 6 +-- sys/dev/pci/drm/radeon/ni.c | 3 +- sys/dev/pci/drm/radeon/r600_blit_kms.c | 14 +----- sys/dev/pci/drm/radeon/r600_cs.c | 9 +--- sys/dev/pci/drm/radeon/radeon.h | 4 +- sys/dev/pci/drm/radeon/radeon_atombios.c | 10 +---- sys/dev/pci/drm/radeon/radeon_benchmark.c | 4 +- sys/dev/pci/drm/radeon/radeon_clocks.c | 6 +-- sys/dev/pci/drm/radeon/radeon_combios.c | 7 +-- sys/dev/pci/drm/radeon/radeon_connectors.c | 7 +-- sys/dev/pci/drm/radeon/radeon_encoders.c | 4 +- sys/dev/pci/drm/radeon/radeon_fence.c | 4 +- sys/dev/pci/drm/radeon/radeon_gem.c | 11 ++--- sys/dev/pci/drm/radeon/radeon_irq_kms.c | 5 +-- sys/dev/pci/drm/radeon/radeon_pm.c | 11 +---- sys/dev/pci/drm/radeon/radeon_ring.c | 4 +- sys/dev/pci/drm/radeon/rv770.c | 4 +- sys/dev/pci/drm/ttm/ttm_bo_api.h | 10 ++--- sys/dev/pci/drm/ttm/ttm_bo_driver.h | 14 +++--- sys/dev/pci/drm/ttm/ttm_lock.h | 4 +- sys/dev/pci/drm/ttm/ttm_memory.h | 4 +- sys/dev/pci/drm/ttm/ttm_object.c | 4 +- sys/dev/pci/drm/ttm/ttm_object.h | 4 +- 45 files changed, 209 insertions(+), 214 deletions(-) (limited to 'sys/dev/pci/drm') diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index ad5b424b2c7..c2c0e169433 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drmP.h,v 1.194 2015/04/17 00:54:41 jsg Exp $ */ +/* $OpenBSD: drmP.h,v 1.195 2015/04/18 14:47:34 jsg Exp $ */ /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com */ @@ -89,6 +89,8 @@ #define DRM_SUSER(p) (suser(p, 0) == 0) #define DRM_MTRR_WC MDF_WRITECOMBINE +#define DRM_WAKEUP(x) wakeup(x) + extern int ticks; #define drm_msleep(x, msg) mdelay(x) diff --git a/sys/dev/pci/drm/drm_atomic.h b/sys/dev/pci/drm/drm_atomic.h index 6671c74cf59..e30fe1780f7 100644 --- a/sys/dev/pci/drm/drm_atomic.h +++ b/sys/dev/pci/drm/drm_atomic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_atomic.h,v 1.11 2013/10/01 20:06:57 kettenis Exp $ */ +/* $OpenBSD: drm_atomic.h,v 1.12 2015/04/18 14:47:34 jsg Exp $ */ /** * \file drm_atomic.h * Atomic operations used in the DRM which may or may not be provided by the OS. @@ -120,6 +120,7 @@ atomic_inc_not_zero(atomic_t *p) /* FIXME */ #define atomic_set_int(p, bits) atomic_setbits_int(p,bits) #define atomic_clear_int(p, bits) atomic_clearbits_int(p,bits) +#define atomic_clear_mask(bits, p) atomic_clearbits_int(p,bits) #define atomic_fetchadd_int(p, n) __sync_fetch_and_add(p, n) #define atomic_fetchsub_int(p, n) __sync_fetch_and_sub(p, n) diff --git a/sys/dev/pci/drm/drm_edid.c b/sys/dev/pci/drm/drm_edid.c index 9d4e415c09e..c3703d85125 100644 --- a/sys/dev/pci/drm/drm_edid.c +++ b/sys/dev/pci/drm/drm_edid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_edid.c,v 1.13 2015/04/18 11:05:32 jsg Exp $ */ +/* $OpenBSD: drm_edid.c,v 1.14 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright (c) 2006 Luc Verhaegen (quirks list) * Copyright (c) 2007-2008 Intel Corporation @@ -923,9 +923,9 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, return NULL; if (quirks & EDID_QUIRK_135_CLOCK_TOO_HIGH) - timing->pixel_clock = htole16(1088); + timing->pixel_clock = cpu_to_le16(1088); - mode->clock = letoh16(timing->pixel_clock) * 10; + mode->clock = le16_to_cpu(timing->pixel_clock) * 10; mode->hdisplay = hactive; mode->hsync_start = mode->hdisplay + hsync_offset; @@ -1362,7 +1362,7 @@ static int drm_cvt_modes(struct drm_connector *connector, const u8 empty[3] = { 0, 0, 0 }; for (i = 0; i < 4; i++) { - int width, height; + int uninitialized_var(width), height; cvt = &(timing->data.other_data.data.cvt[i]); if (!memcmp(cvt->code, empty, 3)) diff --git a/sys/dev/pci/drm/drm_irq.c b/sys/dev/pci/drm/drm_irq.c index a32f5d62020..8094c616553 100644 --- a/sys/dev/pci/drm/drm_irq.c +++ b/sys/dev/pci/drm/drm_irq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_irq.c,v 1.63 2015/04/15 09:48:19 kettenis Exp $ */ +/* $OpenBSD: drm_irq.c,v 1.64 2015/04/18 14:47:34 jsg Exp $ */ /** * \file drm_irq.c * IRQ support @@ -396,10 +396,10 @@ int drm_irq_uninstall(struct drm_device *dev) if (dev->num_crtcs) { spin_lock_irqsave(&dev->vbl_lock, irqflags); for (i = 0; i < dev->num_crtcs; i++) { - wakeup(&dev->vbl_queue[i]); + DRM_WAKEUP(&dev->vbl_queue[i]); dev->vblank_enabled[i] = 0; dev->last_vblank[i] = - dev->driver->get_vblank_counter(dev, i); + dev->driver->get_vblank_counter(dev, i); } spin_unlock_irqrestore(&dev->vbl_lock, irqflags); } @@ -481,9 +481,9 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc) * line duration, frame duration and pixel duration in * nanoseconds: */ - pixeldur_ns = (s64) 1000000000 / dotclock; - linedur_ns = (s64) ((u64) crtc->hwmode.crtc_htotal * - 1000000000) / dotclock; + pixeldur_ns = (s64) div64_u64(1000000000, dotclock); + linedur_ns = (s64) div64_u64(((u64) crtc->hwmode.crtc_htotal * + 1000000000), dotclock); framedur_ns = (s64) crtc->hwmode.crtc_vtotal * linedur_ns; } else DRM_ERROR("crtc %d: Can't calculate constants, dotclock = 0!\n", @@ -980,6 +980,7 @@ void drm_vblank_put(struct drm_device *dev, int crtc) (drm_vblank_offdelay > 0)) timeout_add_msec(&dev->vblank_disable_timer, drm_vblank_offdelay); } +EXPORT_SYMBOL(drm_vblank_put); /** * drm_vblank_off - disable vblank events on a CRTC @@ -999,7 +1000,7 @@ void drm_vblank_off(struct drm_device *dev, int crtc) spin_lock_irqsave(&dev->vbl_lock, irqflags); vblank_disable_and_save(dev, crtc); - wakeup(&dev->vbl_queue[crtc]); + DRM_WAKEUP(&dev->vbl_queue[crtc]); list = &dev->vbl_events; /* Send any queued vblank events, lest the natives grow disquiet */ @@ -1024,6 +1025,7 @@ void drm_vblank_off(struct drm_device *dev, int crtc) spin_unlock_irqrestore(&dev->vbl_lock, irqflags); } +EXPORT_SYMBOL(drm_vblank_off); /** * drm_vblank_pre_modeset - account for vblanks across mode sets @@ -1394,7 +1396,7 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc) crtc, (int) diff_ns); } - wakeup(&dev->vbl_queue[crtc]); + DRM_WAKEUP(&dev->vbl_queue[crtc]); drm_handle_vblank_events(dev, crtc); spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h index 571b5a189b1..f7d11876a3e 100644 --- a/sys/dev/pci/drm/drm_linux.h +++ b/sys/dev/pci/drm/drm_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.h,v 1.26 2015/04/18 11:41:28 jsg Exp $ */ +/* $OpenBSD: drm_linux.h,v 1.27 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright (c) 2013, 2014 Mark Kettenis * @@ -42,6 +42,8 @@ typedef bus_addr_t phys_addr_t; #define __must_check #define __init +#define uninitialized_var(x) x + #if BYTE_ORDER == BIG_ENDIAN #define __BIG_ENDIAN #else @@ -86,8 +88,17 @@ typedef bus_addr_t phys_addr_t; #define pr_fmt(fmt) fmt #endif +#define printk_once(fmt, arg...) ({ \ + static int __warned; \ + if (!__warned) { \ + printf(fmt, ## arg); \ + __warned = 1; \ + } \ +}) + #define printk(fmt, arg...) printf(fmt, ## arg) #define pr_warn(fmt, arg...) printf(pr_fmt(fmt), ## arg) +#define pr_warn_once(fmt, arg...) printk_once(pr_fmt(fmt), ## arg) #define pr_notice(fmt, arg...) printf(pr_fmt(fmt), ## arg) #define pr_crit(fmt, arg...) printf(pr_fmt(fmt), ## arg) #define pr_err(fmt, arg...) printf(pr_fmt(fmt), ## arg) @@ -221,6 +232,7 @@ IS_ERR_OR_NULL(const void *ptr) #define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var)) #endif +typedef struct rwlock rwlock_t; typedef struct mutex spinlock_t; #define DEFINE_SPINLOCK(x) struct mutex x @@ -279,6 +291,8 @@ extern struct timeval ns_to_timeval(const int64_t); #define msecs_to_jiffies(x) (((int64_t)(x)) * hz / 1000) #define time_after(a,b) ((long)(b) - (long)(a) < 0) #define time_after_eq(a,b) ((long)(b) - (long)(a) <= 0) +#define get_seconds() time_second +#define getrawmonotonic(x) nanouptime(x) static inline void set_normalized_timespec(struct timespec *ts, time_t sec, int64_t nsec) @@ -386,6 +400,12 @@ div_u64(uint64_t x, uint32_t y) return (x / y); } +static inline uint64_t +div64_u64(uint64_t x, uint64_t y) +{ + return (x / y); +} + static inline int64_t abs64(int64_t x) { @@ -532,6 +552,7 @@ iowrite32(u32 val, volatile void __iomem *addr) #define page_to_phys(page) (VM_PAGE_TO_PHYS(page)) #define page_to_pfn(pp) (VM_PAGE_TO_PHYS(pp) / PAGE_SIZE) #define offset_in_page(off) ((off) & PAGE_MASK) +#define set_page_dirty(page) atomic_clearbits_int(&page->pg_flags, PG_CLEAN) typedef int pgprot_t; #define pgprot_val(v) (v) @@ -597,6 +618,13 @@ in_dbg_master(void) return (0); } +static inline int +power_supply_is_system_supplied(void) +{ + /* XXX return 0 if on battery */ + return (1); +} + #ifdef __macppc__ static __inline int of_machine_is_compatible(const char *model) diff --git a/sys/dev/pci/drm/drm_mem_util.h b/sys/dev/pci/drm/drm_mem_util.h index f9582b54144..bed42982663 100644 --- a/sys/dev/pci/drm/drm_mem_util.h +++ b/sys/dev/pci/drm/drm_mem_util.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_mem_util.h,v 1.3 2015/04/11 04:36:10 jsg Exp $ */ +/* $OpenBSD: drm_mem_util.h,v 1.4 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright © 2008 Intel Corporation * @@ -67,7 +67,7 @@ static __inline void drm_free_large(void *ptr) free(ptr, M_DRM, 0); #ifdef notyet if (!is_vmalloc_addr(ptr)) - return free(ptr, M_DRM, 0); + return kfree(ptr); vfree(ptr); #endif diff --git a/sys/dev/pci/drm/drm_mm.h b/sys/dev/pci/drm/drm_mm.h index 24645f458bb..1651ee9142c 100644 --- a/sys/dev/pci/drm/drm_mm.h +++ b/sys/dev/pci/drm/drm_mm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_mm.h,v 1.2 2013/09/12 13:03:31 jsg Exp $ */ +/* $OpenBSD: drm_mm.h,v 1.3 2015/04/18 14:47:34 jsg Exp $ */ /************************************************************************** * * Copyright 2006-2008 Tungsten Graphics, Inc., Cedar Park, TX. USA. @@ -65,7 +65,7 @@ struct drm_mm { struct drm_mm_node head_node; struct list_head unused_nodes; int num_unused; - struct mutex unused_lock; + spinlock_t unused_lock; unsigned int scan_check_range : 1; unsigned scan_alignment; unsigned long scan_color; diff --git a/sys/dev/pci/drm/i915/i915_dma.c b/sys/dev/pci/drm/i915/i915_dma.c index cd6041a3a42..03820d86b71 100644 --- a/sys/dev/pci/drm/i915/i915_dma.c +++ b/sys/dev/pci/drm/i915/i915_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_dma.c,v 1.20 2015/04/17 00:54:42 jsg Exp $ */ +/* $OpenBSD: i915_dma.c,v 1.21 2015/04/18 14:47:34 jsg Exp $ */ /* i915_dma.c -- DMA support for the I915 -*- linux-c -*- */ /* @@ -334,6 +334,7 @@ i915_load_modeset_init(struct drm_device *dev) if (ret) goto cleanup_vga_switcheroo; #endif + intel_modeset_init(dev); ret = i915_gem_init(dev); @@ -359,7 +360,7 @@ i915_load_modeset_init(struct drm_device *dev) /* We're off and running w/KMS */ dev_priv->mm.suspended = 0; - return (0); + return 0; cleanup_irq: drm_irq_uninstall(dev); @@ -390,8 +391,7 @@ i915_driver_lastclose(struct drm_device *dev) DRM_ERROR("failed to idle hardware: %d\n", ret); } -int -i915_driver_open(struct drm_device *dev, struct drm_file *file) +int i915_driver_open(struct drm_device *dev, struct drm_file *file) { struct drm_i915_file_private *file_priv; diff --git a/sys/dev/pci/drm/i915/i915_drv.c b/sys/dev/pci/drm/i915/i915_drv.c index a71a13b150d..c8b341f739e 100644 --- a/sys/dev/pci/drm/i915/i915_drv.c +++ b/sys/dev/pci/drm/i915/i915_drv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_drv.c,v 1.82 2015/04/18 11:41:28 jsg Exp $ */ +/* $OpenBSD: i915_drv.c,v 1.83 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright (c) 2008-2009 Owain G. Ainsworth * @@ -178,10 +178,6 @@ void inteldrm_timeout(void *); void i915_alloc_ifp(struct inteldrm_softc *, struct pci_attach_args *); void i965_alloc_ifp(struct inteldrm_softc *, struct pci_attach_args *); -int i915_drm_freeze(struct drm_device *); -int __i915_drm_thaw(struct drm_device *); -int i915_drm_thaw(struct drm_device *); - #define INTEL_VGA_DEVICE(id, info) { \ .class = PCI_CLASS_DISPLAY << 16, \ .class_mask = 0xff0000, \ @@ -359,7 +355,7 @@ static const struct intel_device_info intel_haswell_m_info = { .has_force_wake = 1, }; -const static struct drm_pcidev inteldrm_pciidlist[] = { /* aka */ +static const struct drm_pcidev inteldrm_pciidlist[] = { /* aka */ INTEL_VGA_DEVICE(0x3577, &intel_i830_info), /* I830_M */ INTEL_VGA_DEVICE(0x2562, &intel_845g_info), /* 845_G */ INTEL_VGA_DEVICE(0x3582, &intel_i85x_info), /* I855_GM */ @@ -516,8 +512,7 @@ inteldrm_probe(struct device *parent, void *match, void *aux) inteldrm_pciidlist)); } -bool -i915_semaphore_is_enabled(struct drm_device *dev) +bool i915_semaphore_is_enabled(struct drm_device *dev) { if (INTEL_INFO(dev)->gen < 6) return 0; @@ -534,8 +529,7 @@ i915_semaphore_is_enabled(struct drm_device *dev) return 1; } -int -i915_drm_freeze(struct drm_device *dev) +static int i915_drm_freeze(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -572,8 +566,7 @@ i915_drm_freeze(struct drm_device *dev) return 0; } -int -__i915_drm_thaw(struct drm_device *dev) +static int __i915_drm_thaw(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; int error = 0; @@ -604,8 +597,7 @@ __i915_drm_thaw(struct drm_device *dev) return error; } -int -i915_drm_thaw(struct drm_device *dev) +static int i915_drm_thaw(struct drm_device *dev) { int error = 0; @@ -1493,12 +1485,12 @@ int i915_reset(struct drm_device *dev) i915_gem_reset(dev); ret = -ENODEV; - if (time_second - dev_priv->last_gpu_reset < 5) + if (get_seconds() - dev_priv->last_gpu_reset < 5) DRM_ERROR("GPU hanging too fast, declaring wedged!\n"); else ret = intel_gpu_reset(dev); - dev_priv->last_gpu_reset = time_second; + dev_priv->last_gpu_reset = get_seconds(); if (ret) { DRM_ERROR("Failed to reset chip.\n"); mutex_unlock(&dev->struct_mutex); @@ -1780,3 +1772,49 @@ __i915_write(16, w) __i915_write(32, l) __i915_write(64, q) #undef __i915_write + +static const struct register_whitelist { + uint64_t offset; + uint32_t size; + uint32_t gen_bitmask; /* support gens, 0x10 for 4, 0x30 for 4 and 5, etc. */ +} whitelist[] = { + { RING_TIMESTAMP(RENDER_RING_BASE), 8, 0xF0 }, +}; + +int i915_reg_read_ioctl(struct drm_device *dev, + void *data, struct drm_file *file) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + struct drm_i915_reg_read *reg = data; + struct register_whitelist const *entry = whitelist; + int i; + + for (i = 0; i < ARRAY_SIZE(whitelist); i++, entry++) { + if (entry->offset == reg->offset && + (1 << INTEL_INFO(dev)->gen & entry->gen_bitmask)) + break; + } + + if (i == ARRAY_SIZE(whitelist)) + return -EINVAL; + + switch (entry->size) { + case 8: + reg->val = I915_READ64(reg->offset); + break; + case 4: + reg->val = I915_READ(reg->offset); + break; + case 2: + reg->val = I915_READ16(reg->offset); + break; + case 1: + reg->val = I915_READ8(reg->offset); + break; + default: + WARN_ON(1); + return -EINVAL; + } + + return 0; +} diff --git a/sys/dev/pci/drm/i915/i915_gem.c b/sys/dev/pci/drm/i915/i915_gem.c index 4e5f4515520..013e2c67748 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.93 2015/04/18 11:41:28 jsg Exp $ */ +/* $OpenBSD: i915_gem.c,v 1.94 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright (c) 2008-2009 Owain G. Ainsworth * @@ -488,13 +488,11 @@ i915_gem_shmem_pread(struct drm_device *dev, #ifdef __linux__ page = sg_page(sg); - page_do_bit17_swizzling = obj_do_bit17_swizzling && - (page_to_phys(page) & (1 << 17)) != 0; #else page = obj->pages[i]; - page_do_bit17_swizzling = obj_do_bit17_swizzling && - (VM_PAGE_TO_PHYS(page) & (1 << 17)) != 0; #endif + page_do_bit17_swizzling = obj_do_bit17_swizzling && + (page_to_phys(page) & (1 << 17)) != 0; ret = shmem_pread_fast(page, shmem_page_offset, page_length, user_data, page_do_bit17_swizzling, @@ -854,13 +852,11 @@ i915_gem_shmem_pwrite(struct drm_device *dev, #ifdef __linux__ page = sg_page(sg); - page_do_bit17_swizzling = obj_do_bit17_swizzling && - (page_to_phys(page) & (1 << 17)) != 0; #else page = obj->pages[i]; - page_do_bit17_swizzling = obj_do_bit17_swizzling && - (VM_PAGE_TO_PHYS(page) & (1 << 17)) != 0; #endif + page_do_bit17_swizzling = obj_do_bit17_swizzling && + (page_to_phys(page) & (1 << 17)) != 0; ret = shmem_pwrite_fast(page, shmem_page_offset, page_length, user_data, page_do_bit17_swizzling, @@ -879,11 +875,9 @@ i915_gem_shmem_pwrite(struct drm_device *dev, mutex_lock(&dev->struct_mutex); next_page: -#ifdef __linux__ set_page_dirty(page); +#ifdef __linux__ mark_page_accessed(page); -#else - atomic_clearbits_int(&page->pg_flags, PG_CLEAN); #endif if (ret) @@ -1063,7 +1057,7 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno, return -ENODEV; /* Record current time in case interrupted by signal, or wedged * */ - nanouptime(&before); + getrawmonotonic(&before); #define EXIT_COND \ (i915_seqno_passed(ring->get_seqno(ring, false), seqno) || \ @@ -1108,7 +1102,7 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno, end = ret; } while (end == 0 && wait_forever); - nanouptime(&now); + getrawmonotonic(&now); ring->irq_put(ring); trace_i915_gem_request_wait_end(ring, seqno); diff --git a/sys/dev/pci/drm/i915/i915_gem_tiling.c b/sys/dev/pci/drm/i915/i915_gem_tiling.c index e579cd326df..f69ccbc1a32 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.17 2015/04/08 02:28:13 jsg Exp $ */ +/* $OpenBSD: i915_gem_tiling.c,v 1.18 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright (c) 2008-2009 Owain G. Ainsworth * @@ -500,11 +500,11 @@ i915_gem_object_do_bit_17_swizzle(struct drm_i915_gem_object *obj) for (i = 0; i < page_count; i++) { struct vm_page *page = obj->pages[i]; - char new_bit_17 = VM_PAGE_TO_PHYS(page) >> 17; + char new_bit_17 = page_to_phys(page) >> 17; if ((new_bit_17 & 0x1) != (test_bit(i, obj->bit_17) != 0)) { i915_gem_swizzle_page(page); - atomic_clearbits_int(&page->pg_flags, PG_CLEAN); + set_page_dirty(page); } } } @@ -531,7 +531,7 @@ i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj) for (i = 0; i < page_count; i++) { struct vm_page *page = obj->pages[i]; - if (VM_PAGE_TO_PHYS(page) & (1 << 17)) + if (page_to_phys(page) & (1 << 17)) set_bit(i, obj->bit_17); else clear_bit(i, obj->bit_17); diff --git a/sys/dev/pci/drm/i915/i915_suspend.c b/sys/dev/pci/drm/i915/i915_suspend.c index 3feaebfd2f3..5e8b7f775dd 100644 --- a/sys/dev/pci/drm/i915/i915_suspend.c +++ b/sys/dev/pci/drm/i915/i915_suspend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_suspend.c,v 1.5 2015/02/10 01:39:32 jsg Exp $ */ +/* $OpenBSD: i915_suspend.c,v 1.6 2015/04/18 14:47:34 jsg Exp $ */ /* * * Copyright 2008 (c) Intel Corporation @@ -625,7 +625,7 @@ static void i915_save_display(struct drm_device *dev) dev_priv->regfile.saveDSPARB = I915_READ(DSPARB); /* This is only meaningful in non-KMS mode */ - /* Don't save them in KMS mode */ + /* Don't regfile.save them in KMS mode */ i915_save_modeset_reg(dev); /* LVDS state */ @@ -675,10 +675,10 @@ static void i915_save_display(struct drm_device *dev) dev_priv->regfile.savePIPEA_DP_LINK_N = I915_READ(_PIPEA_DP_LINK_N); dev_priv->regfile.savePIPEB_DP_LINK_N = I915_READ(_PIPEB_DP_LINK_N); } - /* FIXME: save TV & SDVO state */ + /* FIXME: regfile.save TV & SDVO state */ } - /* Only save FBC state on the platform that supports FBC */ + /* Only regfile.save FBC state on the platform that supports FBC */ if (I915_HAS_FBC(dev)) { if (HAS_PCH_SPLIT(dev)) { dev_priv->regfile.saveDPFC_CB_BASE = I915_READ(ILK_DPFC_CB_BASE); diff --git a/sys/dev/pci/drm/i915/intel_ddi.c b/sys/dev/pci/drm/i915/intel_ddi.c index 98393624e3e..ce1dda6100c 100644 --- a/sys/dev/pci/drm/i915/intel_ddi.c +++ b/sys/dev/pci/drm/i915/intel_ddi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_ddi.c,v 1.13 2015/02/12 04:56:03 kettenis Exp $ */ +/* $OpenBSD: intel_ddi.c,v 1.14 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright © 2012 Intel Corporation * @@ -76,7 +76,8 @@ static enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder) return PORT_E; } else { - panic("Invalid DDI encoder type %d\n", type); + DRM_ERROR("Invalid DDI encoder type %d\n", type); + BUG(); } } @@ -1375,8 +1376,8 @@ void intel_ddi_prepare_link_retrain(struct drm_encoder *encoder) struct intel_dp *intel_dp = &intel_dig_port->dp; struct drm_i915_private *dev_priv = encoder->dev->dev_private; enum port port = intel_dig_port->port; - uint32_t val; bool wait = false; + uint32_t val; if (I915_READ(DP_TP_CTL(port)) & DP_TP_CTL_ENABLE) { val = I915_READ(DDI_BUF_CTL(port)); diff --git a/sys/dev/pci/drm/i915/intel_display.c b/sys/dev/pci/drm/i915/intel_display.c index cafd3832228..22100a6892b 100644 --- a/sys/dev/pci/drm/i915/intel_display.c +++ b/sys/dev/pci/drm/i915/intel_display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_display.c,v 1.49 2015/04/12 17:10:07 kettenis Exp $ */ +/* $OpenBSD: intel_display.c,v 1.50 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright © 2006-2007 Intel Corporation * @@ -1973,12 +1973,7 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, DRM_ERROR("Y tiled not allowed for scan out buffers\n"); return -EINVAL; default: -#ifdef notyet BUG(); -#else - DRM_ERROR("invalid tiling mode %d", obj->tiling_mode); - return -EINVAL; -#endif } dev_priv->mm.interruptible = false; @@ -7125,7 +7120,8 @@ static void do_intel_finish_page_flip(struct drm_device *dev, obj = work->old_fb_obj; - atomic_clear_int(&obj->pending_flip, 1 << intel_crtc->plane); + atomic_clear_mask(1 << intel_crtc->plane, + &obj->pending_flip); wake_up(&dev_priv->pending_flip_queue); task_add(systq, &work->task); diff --git a/sys/dev/pci/drm/i915/intel_opregion.c b/sys/dev/pci/drm/i915/intel_opregion.c index 2461c7a7382..39f51e4cdad 100644 --- a/sys/dev/pci/drm/i915/intel_opregion.c +++ b/sys/dev/pci/drm/i915/intel_opregion.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_opregion.c,v 1.7 2015/04/12 05:31:23 jsg Exp $ */ +/* $OpenBSD: intel_opregion.c,v 1.8 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright 2008 Intel Corporation * Copyright 2008 Red Hat @@ -434,6 +434,27 @@ blind_set: #endif } +static void intel_setup_cadls(struct drm_device *dev) +{ +#ifdef notyet + struct drm_i915_private *dev_priv = dev->dev_private; + struct intel_opregion *opregion = &dev_priv->opregion; + int i = 0; + u32 disp_id; + + /* Initialize the CADL field by duplicating the DIDL values. + * Technically, this is not always correct as display outputs may exist, + * but not active. This initialization is necessary for some Clevo + * laptops that check this field before processing the brightness and + * display switching hotkeys. Just like DIDL, CADL is NULL-terminated if + * there are less than eight devices. */ + do { + disp_id = ioread32(&opregion->acpi->didl[i]); + iowrite32(disp_id, &opregion->acpi->cadl[i]); + } while (++i < 8 && disp_id != 0); +#endif +} + void intel_opregion_init(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -443,8 +464,10 @@ void intel_opregion_init(struct drm_device *dev) return; if (opregion->acpi) { - if (drm_core_check_feature(dev, DRIVER_MODESET)) + if (drm_core_check_feature(dev, DRIVER_MODESET)) { intel_didl_outputs(dev); + intel_setup_cadls(dev); + } /* Notify BIOS we are ready to handle ACPI video ext notifs. * Right now, all the events are handled by the ACPI video module. diff --git a/sys/dev/pci/drm/i915/intel_panel.c b/sys/dev/pci/drm/i915/intel_panel.c index 9e316d4aaf6..13f36c874ec 100644 --- a/sys/dev/pci/drm/i915/intel_panel.c +++ b/sys/dev/pci/drm/i915/intel_panel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_panel.c,v 1.9 2015/04/18 11:05:32 jsg Exp $ */ +/* $OpenBSD: intel_panel.c,v 1.10 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright © 2006-2010 Intel Corporation * Copyright (c) 2006 Dave Airlie @@ -197,9 +197,7 @@ u32 intel_panel_get_max_backlight(struct drm_device *dev) /* XXX add code here to query mode clock or hardware clock * and program max PWM appropriately. */ -#ifdef notyet pr_warn_once("fixme: max PWM is zero\n"); -#endif return 1; } diff --git a/sys/dev/pci/drm/i915/intel_pm.c b/sys/dev/pci/drm/i915/intel_pm.c index 5701329e1ab..6edc48d71fc 100644 --- a/sys/dev/pci/drm/i915/intel_pm.c +++ b/sys/dev/pci/drm/i915/intel_pm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_pm.c,v 1.33 2015/04/18 11:41:29 jsg Exp $ */ +/* $OpenBSD: intel_pm.c,v 1.34 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright © 2012 Intel Corporation * @@ -2402,7 +2402,7 @@ static void ironlake_enable_drps(struct drm_device *dev) I915_READ(0x112e0); dev_priv->ips.last_time1 = jiffies_to_msecs(ticks); dev_priv->ips.last_count2 = I915_READ(0x112f4); - nanouptime(&dev_priv->ips.last_time2); + getrawmonotonic(&dev_priv->ips.last_time2); spin_unlock_irq(&mchdev_lock); } @@ -3113,7 +3113,7 @@ static void __i915_update_gfx_val(struct drm_i915_private *dev_priv) assert_spin_locked(&mchdev_lock); - nanouptime(&now); + getrawmonotonic(&now); timespecsub(&now, &dev_priv->ips.last_time2, &diff1); /* Don't divide by 0 */ diff --git a/sys/dev/pci/drm/radeon/atom.c b/sys/dev/pci/drm/radeon/atom.c index e17fb457b58..8082801a89b 100644 --- a/sys/dev/pci/drm/radeon/atom.c +++ b/sys/dev/pci/drm/radeon/atom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atom.c,v 1.6 2015/02/11 07:01:37 jsg Exp $ */ +/* $OpenBSD: atom.c,v 1.7 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * @@ -80,8 +80,6 @@ static int atom_dst_to_src[8][4] = { }; static int atom_def_dst[8] = { 0, 0, 1, 2, 0, 1, 2, 3 }; -extern int ticks; - static int debug_depth = 0; #ifdef ATOM_DEBUG static void debug_print_spaces(int n) diff --git a/sys/dev/pci/drm/radeon/atombios_dp.c b/sys/dev/pci/drm/radeon/atombios_dp.c index 914273da807..1a08b611c3d 100644 --- a/sys/dev/pci/drm/radeon/atombios_dp.c +++ b/sys/dev/pci/drm/radeon/atombios_dp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atombios_dp.c,v 1.5 2015/04/06 10:56:37 jsg Exp $ */ +/* $OpenBSD: atombios_dp.c,v 1.6 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright 2007-8 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -46,8 +46,6 @@ static char *pre_emph_names[] = { }; #endif -void radeon_atom_copy_swap(u8 *, u8 *, u8, bool); - /***** radeon AUX functions *****/ /* Atom needs data in little endian format diff --git a/sys/dev/pci/drm/radeon/atombios_encoders.c b/sys/dev/pci/drm/radeon/atombios_encoders.c index 02789d46516..4d0cbe811c0 100644 --- a/sys/dev/pci/drm/radeon/atombios_encoders.c +++ b/sys/dev/pci/drm/radeon/atombios_encoders.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atombios_encoders.c,v 1.8 2014/08/08 16:35:56 jsg Exp $ */ +/* $OpenBSD: atombios_encoders.c,v 1.9 2015/04/18 14:47:34 jsg Exp $ */ /* * Copyright 2007-11 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -32,12 +32,6 @@ extern int atom_debug; -u8 atombios_get_backlight_level(struct radeon_encoder *); -void atombios_set_backlight_level(struct radeon_encoder *, u8); -void radeon_atom_backlight_init(struct radeon_encoder *); -void radeon_add_atom_encoder(struct drm_device *, uint32_t, - uint32_t, u16); - static u8 radeon_atom_get_backlight_level_from_reg(struct radeon_device *rdev) { diff --git a/sys/dev/pci/drm/radeon/evergreen.c b/sys/dev/pci/drm/radeon/evergreen.c index e49eb39cf8b..b75f092b2ce 100644 --- a/sys/dev/pci/drm/radeon/evergreen.c +++ b/sys/dev/pci/drm/radeon/evergreen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evergreen.c,v 1.18 2015/04/06 14:10:59 jsg Exp $ */ +/* $OpenBSD: evergreen.c,v 1.19 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2010 Advanced Micro Devices, Inc. * @@ -50,13 +50,6 @@ void evergreen_fini(struct radeon_device *rdev); void evergreen_pcie_gen2_enable(struct radeon_device *rdev); extern void cayman_cp_int_cntl_setup(struct radeon_device *rdev, int ring, u32 cp_int_cntl); -void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev); -u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev); -void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *save); -void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *save); -void evergreen_mc_program(struct radeon_device *rdev); -int evergreen_mc_init(struct radeon_device *rdev); -void evergreen_irq_suspend(struct radeon_device *rdev); void evergreen_tiling_fields(unsigned tiling_flags, unsigned *bankw, unsigned *bankh, unsigned *mtaspect, diff --git a/sys/dev/pci/drm/radeon/evergreen_blit_kms.c b/sys/dev/pci/drm/radeon/evergreen_blit_kms.c index 9936e7daef3..18d71bca599 100644 --- a/sys/dev/pci/drm/radeon/evergreen_blit_kms.c +++ b/sys/dev/pci/drm/radeon/evergreen_blit_kms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evergreen_blit_kms.c,v 1.2 2015/04/08 04:03:06 jsg Exp $ */ +/* $OpenBSD: evergreen_blit_kms.c,v 1.3 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2010 Advanced Micro Devices, Inc. * @@ -34,8 +34,6 @@ #include "cayman_blit_shaders.h" #include "radeon_blit_common.h" -int evergreen_blit_init(struct radeon_device *rdev); - /* emits 17 */ static void set_render_target(struct radeon_device *rdev, int format, diff --git a/sys/dev/pci/drm/radeon/evergreen_cs.c b/sys/dev/pci/drm/radeon/evergreen_cs.c index db27b9deafe..4b154bd2106 100644 --- a/sys/dev/pci/drm/radeon/evergreen_cs.c +++ b/sys/dev/pci/drm/radeon/evergreen_cs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evergreen_cs.c,v 1.5 2015/04/06 14:32:55 jsg Exp $ */ +/* $OpenBSD: evergreen_cs.c,v 1.6 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2010 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -39,10 +39,6 @@ int r600_dma_cs_next_reloc(struct radeon_cs_parser *p, struct radeon_cs_reloc **cs_reloc); static int evergreen_cs_packet_next_reloc(struct radeon_cs_parser *p, struct radeon_cs_reloc **cs_reloc); -int evergreen_cs_parse(struct radeon_cs_parser *p); -int evergreen_dma_cs_parse(struct radeon_cs_parser *p); -int evergreen_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib); -int evergreen_dma_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib); struct evergreen_cs_track { u32 group_size; diff --git a/sys/dev/pci/drm/radeon/ni.c b/sys/dev/pci/drm/radeon/ni.c index 1948c992019..a98dd1f9db0 100644 --- a/sys/dev/pci/drm/radeon/ni.c +++ b/sys/dev/pci/drm/radeon/ni.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ni.c,v 1.9 2015/02/11 07:01:37 jsg Exp $ */ +/* $OpenBSD: ni.c,v 1.10 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2010 Advanced Micro Devices, Inc. * @@ -41,7 +41,6 @@ extern void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev); extern void evergreen_pcie_gen2_enable(struct radeon_device *rdev); extern void si_rlc_fini(struct radeon_device *rdev); extern int si_rlc_init(struct radeon_device *rdev); -void cayman_cp_int_cntl_setup(struct radeon_device *rdev, int ring, u32 cp_int_cntl); #define EVERGREEN_PFP_UCODE_SIZE 1120 #define EVERGREEN_PM4_UCODE_SIZE 1376 diff --git a/sys/dev/pci/drm/radeon/r600_blit_kms.c b/sys/dev/pci/drm/radeon/r600_blit_kms.c index 6def0629d78..4a13c14580e 100644 --- a/sys/dev/pci/drm/radeon/r600_blit_kms.c +++ b/sys/dev/pci/drm/radeon/r600_blit_kms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: r600_blit_kms.c,v 1.2 2015/04/08 04:03:06 jsg Exp $ */ +/* $OpenBSD: r600_blit_kms.c,v 1.3 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2009 Advanced Micro Devices, Inc. * Copyright 2009 Red Hat Inc. @@ -32,18 +32,6 @@ #include "r600_blit_shaders.h" #include "radeon_blit_common.h" -int r600_blit_init(struct radeon_device *rdev); -void r600_blit_fini(struct radeon_device *rdev); -int r600_blit_prepare_copy(struct radeon_device *rdev, unsigned num_gpu_pages, - struct radeon_fence **fence, struct radeon_sa_bo **vb, - struct radeon_semaphore **sem); -void r600_blit_done_copy(struct radeon_device *rdev, struct radeon_fence **fence, - struct radeon_sa_bo *vb, struct radeon_semaphore *sem); -void r600_kms_blit_copy(struct radeon_device *rdev, - u64 src_gpu_addr, u64 dst_gpu_addr, - unsigned num_gpu_pages, - struct radeon_sa_bo *vb); - /* emits 21 on rv770+, 23 on r600 */ static void set_render_target(struct radeon_device *rdev, int format, diff --git a/sys/dev/pci/drm/radeon/r600_cs.c b/sys/dev/pci/drm/radeon/r600_cs.c index dbafc402a80..8c4703222df 100644 --- a/sys/dev/pci/drm/radeon/r600_cs.c +++ b/sys/dev/pci/drm/radeon/r600_cs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: r600_cs.c,v 1.6 2015/04/06 14:32:55 jsg Exp $ */ +/* $OpenBSD: r600_cs.c,v 1.7 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -39,13 +39,6 @@ typedef int (*next_reloc_t)(struct radeon_cs_parser*, struct radeon_cs_reloc**); static next_reloc_t r600_cs_packet_next_reloc = &r600_cs_packet_next_reloc_mm; extern void r600_cs_legacy_get_tiling_conf(struct drm_device *dev, u32 *npipes, u32 *nbanks, u32 *group_size); -int r600_cs_parse(struct radeon_cs_parser *p); -int r600_cs_legacy(struct drm_device *dev, void *data, struct drm_file *filp, - unsigned family, u32 *ib, int *l); -void r600_cs_legacy_init(void); -int r600_dma_cs_next_reloc(struct radeon_cs_parser *p, - struct radeon_cs_reloc **cs_reloc); -int r600_dma_cs_parse(struct radeon_cs_parser *p); struct r600_cs_track { /* configuration we miror so that we use same code btw kms/ums */ diff --git a/sys/dev/pci/drm/radeon/radeon.h b/sys/dev/pci/drm/radeon/radeon.h index 59a1fff9a43..47fbdcff9cc 100644 --- a/sys/dev/pci/drm/radeon/radeon.h +++ b/sys/dev/pci/drm/radeon/radeon.h @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon.h,v 1.14 2015/04/12 03:54:10 jsg Exp $ */ +/* $OpenBSD: radeon.h,v 1.15 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -50,7 +50,7 @@ * situation the init path must succeed up to the memory controller * initialization point. Failure before this point are considered as * fatal error. Here is the init callchain : - * radeon_device_init perform common structure, rwlock initialization + * radeon_device_init perform common structure, mutex initialization * asic_init setup the GPU memory layout and perform all * one time initialization (failure in this * function are considered fatal) diff --git a/sys/dev/pci/drm/radeon/radeon_atombios.c b/sys/dev/pci/drm/radeon/radeon_atombios.c index 613c307abbf..fce538acbef 100644 --- a/sys/dev/pci/drm/radeon/radeon_atombios.c +++ b/sys/dev/pci/drm/radeon/radeon_atombios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_atombios.c,v 1.6 2014/04/07 06:43:11 jsg Exp $ */ +/* $OpenBSD: radeon_atombios.c,v 1.7 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2007-8 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -60,14 +60,6 @@ radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_enum, /* local */ static int radeon_atom_get_max_vddc(struct radeon_device *rdev, u8 voltage_type, u16 voltage_id, u16 *voltage); -bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, - struct drm_display_mode *mode); -uint32_t radeon_atom_get_engine_clock(struct radeon_device *rdev); -uint32_t radeon_atom_get_memory_clock(struct radeon_device *rdev); -void radeon_atom_set_engine_clock(struct radeon_device *rdev, uint32_t eng_clock); -void radeon_atom_set_memory_clock(struct radeon_device *rdev, uint32_t mem_clock); -void radeon_atombios_connected_scratch_regs(struct drm_connector *connector, - struct drm_encoder *encoder, bool connected); union atom_supported_devices { struct _ATOM_SUPPORTED_DEVICES_INFO info; diff --git a/sys/dev/pci/drm/radeon/radeon_benchmark.c b/sys/dev/pci/drm/radeon/radeon_benchmark.c index 02be19ae255..d3d9118ccd6 100644 --- a/sys/dev/pci/drm/radeon/radeon_benchmark.c +++ b/sys/dev/pci/drm/radeon/radeon_benchmark.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_benchmark.c,v 1.3 2015/04/06 07:38:49 jsg Exp $ */ +/* $OpenBSD: radeon_benchmark.c,v 1.4 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2009 Jerome Glisse. * @@ -33,8 +33,6 @@ #define RADEON_BENCHMARK_ITERATIONS 1024 #define RADEON_BENCHMARK_COMMON_MODES_N 17 -extern int ticks; - static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size, uint64_t saddr, uint64_t daddr, int flag, int n) diff --git a/sys/dev/pci/drm/radeon/radeon_clocks.c b/sys/dev/pci/drm/radeon/radeon_clocks.c index 3d8d6044e00..a8aada55c7a 100644 --- a/sys/dev/pci/drm/radeon/radeon_clocks.c +++ b/sys/dev/pci/drm/radeon/radeon_clocks.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_clocks.c,v 1.2 2014/07/03 18:58:21 kettenis Exp $ */ +/* $OpenBSD: radeon_clocks.c,v 1.3 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -36,10 +36,6 @@ #include #endif -uint32_t radeon_legacy_get_engine_clock(struct radeon_device *); -uint32_t radeon_legacy_get_memory_clock(struct radeon_device *); -void radeon_legacy_set_engine_clock(struct radeon_device *, uint32_t); - /* 10 khz */ uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev) { diff --git a/sys/dev/pci/drm/radeon/radeon_combios.c b/sys/dev/pci/drm/radeon/radeon_combios.c index 1171892b1b5..add87b71431 100644 --- a/sys/dev/pci/drm/radeon/radeon_combios.c +++ b/sys/dev/pci/drm/radeon/radeon_combios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_combios.c,v 1.7 2015/04/08 03:21:13 jsg Exp $ */ +/* $OpenBSD: radeon_combios.c,v 1.8 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2004 ATI Technologies Inc., Markham, Ontario * Copyright 2007-8 Advanced Micro Devices, Inc. @@ -51,11 +51,6 @@ extern void radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_enum, uint32_t supported_device); - -void radeon_combios_connected_scratch_regs(struct drm_connector *connector, - struct drm_encoder *encoder, - bool connected); - /* old legacy ATI BIOS routines */ /* COMBIOS table offsets */ diff --git a/sys/dev/pci/drm/radeon/radeon_connectors.c b/sys/dev/pci/drm/radeon/radeon_connectors.c index 796ad1249f2..5705874cbf0 100644 --- a/sys/dev/pci/drm/radeon/radeon_connectors.c +++ b/sys/dev/pci/drm/radeon/radeon_connectors.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_connectors.c,v 1.5 2015/04/06 09:23:19 jsg Exp $ */ +/* $OpenBSD: radeon_connectors.c,v 1.6 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2007-8 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -40,11 +40,6 @@ extern void radeon_atombios_connected_scratch_regs(struct drm_connector *connector, struct drm_encoder *encoder, bool connected); -void radeon_add_atom_connector(struct drm_device *, uint32_t, uint32_t, int, - struct radeon_i2c_bus_rec *, uint32_t, uint16_t, struct radeon_hpd *, - struct radeon_router *); -void radeon_add_legacy_connector(struct drm_device *, uint32_t, uint32_t, int, - struct radeon_i2c_bus_rec *, uint16_t, struct radeon_hpd *); void radeon_connector_hotplug(struct drm_connector *connector) { diff --git a/sys/dev/pci/drm/radeon/radeon_encoders.c b/sys/dev/pci/drm/radeon/radeon_encoders.c index 02d3d4c6a71..6d6a3b050dc 100644 --- a/sys/dev/pci/drm/radeon/radeon_encoders.c +++ b/sys/dev/pci/drm/radeon/radeon_encoders.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_encoders.c,v 1.1 2013/08/12 04:11:53 jsg Exp $ */ +/* $OpenBSD: radeon_encoders.c,v 1.2 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2007-8 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -37,8 +37,6 @@ extern void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder, struct drm_connector *drm_connector); -uint32_t radeon_get_encoder_enum(struct drm_device *, uint32_t, uint8_t); -void radeon_link_encoder_connector(struct drm_device *); static uint32_t radeon_encoder_clones(struct drm_encoder *encoder) { diff --git a/sys/dev/pci/drm/radeon/radeon_fence.c b/sys/dev/pci/drm/radeon/radeon_fence.c index c49495c1ca4..cbad412301e 100644 --- a/sys/dev/pci/drm/radeon/radeon_fence.c +++ b/sys/dev/pci/drm/radeon/radeon_fence.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_fence.c,v 1.7 2015/04/18 11:41:29 jsg Exp $ */ +/* $OpenBSD: radeon_fence.c,v 1.8 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2009 Jerome Glisse. * All Rights Reserved. @@ -36,8 +36,6 @@ #include -extern int ticks; - /* * Fences * Fences mark an event in the GPUs pipeline and are used diff --git a/sys/dev/pci/drm/radeon/radeon_gem.c b/sys/dev/pci/drm/radeon/radeon_gem.c index faba97ce27a..37ffed0dcab 100644 --- a/sys/dev/pci/drm/radeon/radeon_gem.c +++ b/sys/dev/pci/drm/radeon/radeon_gem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_gem.c,v 1.6 2015/02/11 07:01:37 jsg Exp $ */ +/* $OpenBSD: radeon_gem.c,v 1.7 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -30,12 +30,6 @@ #include #include "radeon.h" -int radeon_gem_object_init(struct drm_gem_object *); -void radeon_gem_object_free(struct drm_gem_object *); -int radeon_gem_set_domain(struct drm_gem_object *, uint32_t, uint32_t); -int radeon_gem_object_open(struct drm_gem_object *, struct drm_file *); -void radeon_gem_object_close(struct drm_gem_object *, struct drm_file *); - int radeon_gem_object_init(struct drm_gem_object *obj) { BUG(); @@ -468,7 +462,8 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data, } if (args->offset < RADEON_VA_RESERVED_SIZE) { - DRM_ERROR("offset 0x%lX is in reserved area 0x%X\n", + dev_err(&dev->pdev->dev, + "offset 0x%lX is in reserved area 0x%X\n", (unsigned long)args->offset, RADEON_VA_RESERVED_SIZE); args->operation = RADEON_VA_RESULT_ERROR; diff --git a/sys/dev/pci/drm/radeon/radeon_irq_kms.c b/sys/dev/pci/drm/radeon/radeon_irq_kms.c index 1427d3729ad..53ffc6bbf09 100644 --- a/sys/dev/pci/drm/radeon/radeon_irq_kms.c +++ b/sys/dev/pci/drm/radeon/radeon_irq_kms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_irq_kms.c,v 1.8 2015/04/06 07:38:49 jsg Exp $ */ +/* $OpenBSD: radeon_irq_kms.c,v 1.9 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -44,8 +44,7 @@ * radeon_irq_process is a macro that points to the per-asic * irq handler callback. */ -int -radeon_driver_irq_handler_kms(void *arg) +irqreturn_t radeon_driver_irq_handler_kms(void *arg) { struct drm_device *dev = arg; struct radeon_device *rdev = dev->dev_private; diff --git a/sys/dev/pci/drm/radeon/radeon_pm.c b/sys/dev/pci/drm/radeon/radeon_pm.c index ca597b764b0..94514578f66 100644 --- a/sys/dev/pci/drm/radeon/radeon_pm.c +++ b/sys/dev/pci/drm/radeon/radeon_pm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_pm.c,v 1.11 2015/04/06 07:38:49 jsg Exp $ */ +/* $OpenBSD: radeon_pm.c,v 1.12 2015/04/18 14:47:35 jsg Exp $ */ /* * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -48,8 +48,6 @@ static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish static void radeon_pm_update_profile(struct radeon_device *rdev); static void radeon_pm_set_clocks(struct radeon_device *rdev); -extern int ticks; - int radeon_pm_get_type_index(struct radeon_device *rdev, enum radeon_pm_state_type ps_type, int instance) @@ -80,13 +78,6 @@ void radeon_pm_acpi_event_handler(struct radeon_device *rdev) } } -static int -power_supply_is_system_supplied(void) -{ - /* XXX return 0 if on battery */ - return (1); -} - static void radeon_pm_update_profile(struct radeon_device *rdev) { switch (rdev->pm.profile) { diff --git a/sys/dev/pci/drm/radeon/radeon_ring.c b/sys/dev/pci/drm/radeon/radeon_ring.c index bfc7a9a704e..47e66ff0ce5 100644 --- a/sys/dev/pci/drm/radeon/radeon_ring.c +++ b/sys/dev/pci/drm/radeon/radeon_ring.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_ring.c,v 1.6 2015/02/10 06:19:36 jsg Exp $ */ +/* $OpenBSD: radeon_ring.c,v 1.7 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -33,8 +33,6 @@ #include "radeon.h" #include "atom.h" -extern int ticks; - /* * IB * IBs (Indirect Buffers) and areas of GPU accessible memory where diff --git a/sys/dev/pci/drm/radeon/rv770.c b/sys/dev/pci/drm/radeon/rv770.c index d7ce0e6078c..5af24a28e57 100644 --- a/sys/dev/pci/drm/radeon/rv770.c +++ b/sys/dev/pci/drm/radeon/rv770.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rv770.c,v 1.6 2015/04/06 14:10:59 jsg Exp $ */ +/* $OpenBSD: rv770.c,v 1.7 2015/04/18 14:47:35 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -1229,7 +1229,7 @@ static void rv770_pcie_gen2_enable(struct radeon_device *rdev) /* x2 cards have a special sequence */ if (ASIC_IS_X2(rdev)) return; - + ret = drm_pcie_get_speed_cap_mask(rdev->ddev, &mask); if (ret != 0) return; diff --git a/sys/dev/pci/drm/ttm/ttm_bo_api.h b/sys/dev/pci/drm/ttm/ttm_bo_api.h index f69e1af99d6..36b0b351a7a 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo_api.h +++ b/sys/dev/pci/drm/ttm/ttm_bo_api.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ttm_bo_api.h,v 1.3 2015/04/12 03:54:10 jsg Exp $ */ +/* $OpenBSD: ttm_bo_api.h,v 1.4 2015/04/18 14:47:35 jsg Exp $ */ /************************************************************************** * * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA @@ -138,7 +138,7 @@ struct ttm_tt; * * @bdev: Pointer to the buffer object device structure. * @type: The bo type. - * @destroy: Destruction function. If NULL, free is used. + * @destroy: Destruction function. If NULL, kfree is used. * @num_pages: Actual number of pages. * @addr_space_offset: Address space offset. * @acc_size: Accounted size for this object. @@ -473,7 +473,7 @@ size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev, * point to the shmem object backing a GEM object if TTM is used to back a * GEM user interface. * @acc_size: Accounted size for this object. - * @destroy: Destroy function. Use NULL for free(). + * @destroy: Destroy function. Use NULL for kfree(). * * This function initializes a pre-allocated struct ttm_buffer_object. * As this object may be part of a larger structure, this function, @@ -481,7 +481,7 @@ size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev, * enables driver-specific objects derived from a ttm_buffer_object. * On successful return, the object kref and list_kref are set to 1. * If a failure occurs, the function will call the @destroy function, or - * free() if @destroy is NULL. Thus, after a failure, dereferencing @bo is + * kfree() if @destroy is NULL. Thus, after a failure, dereferencing @bo is * illegal and will likely cause memory corruption. * * Returns @@ -521,7 +521,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev, * @p_bo: On successful completion *p_bo points to the created object. * * This function allocates a ttm_buffer_object, and then calls ttm_bo_init - * on that object. The destroy function is set to free(). + * on that object. The destroy function is set to kfree(). * Returns * -ENOMEM: Out of memory. * -EINVAL: Invalid placement flags. diff --git a/sys/dev/pci/drm/ttm/ttm_bo_driver.h b/sys/dev/pci/drm/ttm/ttm_bo_driver.h index 0b7b3aa31c9..fbf083a2b53 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo_driver.h +++ b/sys/dev/pci/drm/ttm/ttm_bo_driver.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ttm_bo_driver.h,v 1.4 2015/04/08 02:28:13 jsg Exp $ */ +/* $OpenBSD: ttm_bo_driver.h,v 1.5 2015/04/18 14:47:35 jsg Exp $ */ /************************************************************************** * * Copyright (c) 2006-2009 Vmware, Inc., Palo Alto, CA., USA @@ -485,7 +485,7 @@ struct ttm_bo_global { struct vm_page *dummy_read_page; struct ttm_mem_shrink shrink; struct rwlock device_list_mutex; - struct mutex lru_lock; + spinlock_t lru_lock; /** * Protected by device_list_mutex. @@ -534,9 +534,9 @@ struct ttm_bo_device { struct list_head device_list; struct ttm_bo_global *glob; struct ttm_bo_driver *driver; - struct rwlock vm_lock; + rwlock_t vm_lock; struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES]; - struct mutex fence_lock; + spinlock_t fence_lock; bus_space_tag_t iot; bus_space_tag_t memt; @@ -795,9 +795,9 @@ extern void ttm_mem_io_unlock(struct ttm_mem_type_manager *man); * to make room for a buffer already reserved. (Buffers are reserved before * they are evicted). The following algorithm prevents such deadlocks from * occurring: - * 1) Buffers are reserved with the lru mutex held. Upon successful + * 1) Buffers are reserved with the lru spinlock held. Upon successful * reservation they are removed from the lru list. This stops a reserved buffer - * from being evicted. However the lru mutex is released between the time + * from being evicted. However the lru spinlock is released between the time * a buffer is selected for eviction and the time it is reserved. * Therefore a check is made when a buffer is reserved for eviction, that it * is still the first buffer in the lru list, before it is removed from the @@ -847,7 +847,7 @@ extern int ttm_bo_reserve(struct ttm_buffer_object *bo, * * Must be called with struct ttm_bo_global::lru_lock held, * and will not remove reserved buffers from the lru lists. - * The function may release the LRU mutex if it needs to sleep. + * The function may release the LRU spinlock if it needs to sleep. * Otherwise identical to ttm_bo_reserve. * * Returns: diff --git a/sys/dev/pci/drm/ttm/ttm_lock.h b/sys/dev/pci/drm/ttm/ttm_lock.h index 52341b64aaf..60a8d2bfb55 100644 --- a/sys/dev/pci/drm/ttm/ttm_lock.h +++ b/sys/dev/pci/drm/ttm/ttm_lock.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ttm_lock.h,v 1.2 2015/04/12 03:54:10 jsg Exp $ */ +/* $OpenBSD: ttm_lock.h,v 1.3 2015/04/18 14:47:35 jsg Exp $ */ /************************************************************************** * * Copyright (c) 2007-2009 VMware, Inc., Palo Alto, CA., USA @@ -69,7 +69,7 @@ struct ttm_lock { struct ttm_base_object base; wait_queue_head_t queue; - struct mutex lock; + spinlock_t lock; int32_t rw; uint32_t flags; bool kill_takers; diff --git a/sys/dev/pci/drm/ttm/ttm_memory.h b/sys/dev/pci/drm/ttm/ttm_memory.h index 50dd163ea83..d0103a9d211 100644 --- a/sys/dev/pci/drm/ttm/ttm_memory.h +++ b/sys/dev/pci/drm/ttm/ttm_memory.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ttm_memory.h,v 1.3 2015/02/10 10:50:49 jsg Exp $ */ +/* $OpenBSD: ttm_memory.h,v 1.4 2015/04/18 14:47:35 jsg Exp $ */ /************************************************************************** * * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA @@ -75,7 +75,7 @@ struct ttm_mem_global { struct taskq *swap_queue; struct task task; bool task_queued; - struct mutex lock; + spinlock_t lock; struct ttm_mem_zone *zones[TTM_MEM_MAX_ZONES]; unsigned int num_zones; struct ttm_mem_zone *zone_kernel; diff --git a/sys/dev/pci/drm/ttm/ttm_object.c b/sys/dev/pci/drm/ttm/ttm_object.c index 376fc70fad4..bdc978fe8c2 100644 --- a/sys/dev/pci/drm/ttm/ttm_object.c +++ b/sys/dev/pci/drm/ttm/ttm_object.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttm_object.c,v 1.7 2015/04/11 05:10:13 jsg Exp $ */ +/* $OpenBSD: ttm_object.c,v 1.8 2015/04/18 14:47:35 jsg Exp $ */ /************************************************************************** * * Copyright (c) 2009 VMware, Inc., Palo Alto, CA., USA @@ -59,7 +59,7 @@ struct ttm_object_file { struct ttm_object_device *tdev; - struct rwlock lock; + rwlock_t lock; struct list_head ref_list; struct drm_open_hash ref_hash[TTM_REF_NUM]; int refcount; diff --git a/sys/dev/pci/drm/ttm/ttm_object.h b/sys/dev/pci/drm/ttm/ttm_object.h index a164850d455..2a49fe36536 100644 --- a/sys/dev/pci/drm/ttm/ttm_object.h +++ b/sys/dev/pci/drm/ttm/ttm_object.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ttm_object.h,v 1.1 2013/08/12 04:11:53 jsg Exp $ */ +/* $OpenBSD: ttm_object.h,v 1.2 2015/04/18 14:47:35 jsg Exp $ */ /************************************************************************** * * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA @@ -270,6 +270,6 @@ extern struct ttm_object_device *ttm_object_device_init extern void ttm_object_device_release(struct ttm_object_device **p_tdev); -#define ttm_base_object_free(__object, __base)\ +#define ttm_base_object_kfree(__object, __base)\ kfree_rcu(__object, __base.rhead) #endif -- cgit v1.2.3