diff options
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 49 | ||||
-rw-r--r-- | include/drm/drm_os_linux.h | 2 |
3 files changed, 41 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 95391191316a..e440f70e477a 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -803,6 +803,7 @@ void i915_gem_cleanup_ringbuffer(struct drm_device *dev); | |||
803 | int i915_gem_do_init(struct drm_device *dev, unsigned long start, | 803 | int i915_gem_do_init(struct drm_device *dev, unsigned long start, |
804 | unsigned long end); | 804 | unsigned long end); |
805 | int i915_gem_idle(struct drm_device *dev); | 805 | int i915_gem_idle(struct drm_device *dev); |
806 | int i915_lp_ring_sync(struct drm_device *dev); | ||
806 | int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); | 807 | int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); |
807 | int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, | 808 | int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, |
808 | int write); | 809 | int write); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index abfc27b0c2ea..7d1e9adf0f4c 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1820,12 +1820,8 @@ i915_gem_retire_work_handler(struct work_struct *work) | |||
1820 | mutex_unlock(&dev->struct_mutex); | 1820 | mutex_unlock(&dev->struct_mutex); |
1821 | } | 1821 | } |
1822 | 1822 | ||
1823 | /** | ||
1824 | * Waits for a sequence number to be signaled, and cleans up the | ||
1825 | * request and object lists appropriately for that event. | ||
1826 | */ | ||
1827 | static int | 1823 | static int |
1828 | i915_wait_request(struct drm_device *dev, uint32_t seqno) | 1824 | i915_do_wait_request(struct drm_device *dev, uint32_t seqno, int interruptible) |
1829 | { | 1825 | { |
1830 | drm_i915_private_t *dev_priv = dev->dev_private; | 1826 | drm_i915_private_t *dev_priv = dev->dev_private; |
1831 | u32 ier; | 1827 | u32 ier; |
@@ -1852,10 +1848,15 @@ i915_wait_request(struct drm_device *dev, uint32_t seqno) | |||
1852 | 1848 | ||
1853 | dev_priv->mm.waiting_gem_seqno = seqno; | 1849 | dev_priv->mm.waiting_gem_seqno = seqno; |
1854 | i915_user_irq_get(dev); | 1850 | i915_user_irq_get(dev); |
1855 | ret = wait_event_interruptible(dev_priv->irq_queue, | 1851 | if (interruptible) |
1856 | i915_seqno_passed(i915_get_gem_seqno(dev), | 1852 | ret = wait_event_interruptible(dev_priv->irq_queue, |
1857 | seqno) || | 1853 | i915_seqno_passed(i915_get_gem_seqno(dev), seqno) || |
1858 | atomic_read(&dev_priv->mm.wedged)); | 1854 | atomic_read(&dev_priv->mm.wedged)); |
1855 | else | ||
1856 | wait_event(dev_priv->irq_queue, | ||
1857 | i915_seqno_passed(i915_get_gem_seqno(dev), seqno) || | ||
1858 | atomic_read(&dev_priv->mm.wedged)); | ||
1859 | |||
1859 | i915_user_irq_put(dev); | 1860 | i915_user_irq_put(dev); |
1860 | dev_priv->mm.waiting_gem_seqno = 0; | 1861 | dev_priv->mm.waiting_gem_seqno = 0; |
1861 | 1862 | ||
@@ -1879,6 +1880,34 @@ i915_wait_request(struct drm_device *dev, uint32_t seqno) | |||
1879 | return ret; | 1880 | return ret; |
1880 | } | 1881 | } |
1881 | 1882 | ||
1883 | /** | ||
1884 | * Waits for a sequence number to be signaled, and cleans up the | ||
1885 | * request and object lists appropriately for that event. | ||
1886 | */ | ||
1887 | static int | ||
1888 | i915_wait_request(struct drm_device *dev, uint32_t seqno) | ||
1889 | { | ||
1890 | return i915_do_wait_request(dev, seqno, 1); | ||
1891 | } | ||
1892 | |||
1893 | /** | ||
1894 | * Waits for the ring to finish up to the latest request. Usefull for waiting | ||
1895 | * for flip events, e.g for the overlay support. */ | ||
1896 | int i915_lp_ring_sync(struct drm_device *dev) | ||
1897 | { | ||
1898 | uint32_t seqno; | ||
1899 | int ret; | ||
1900 | |||
1901 | seqno = i915_add_request(dev, NULL, 0); | ||
1902 | |||
1903 | if (seqno == 0) | ||
1904 | return -ENOMEM; | ||
1905 | |||
1906 | ret = i915_do_wait_request(dev, seqno, 0); | ||
1907 | BUG_ON(ret == -ERESTARTSYS); | ||
1908 | return ret; | ||
1909 | } | ||
1910 | |||
1882 | static void | 1911 | static void |
1883 | i915_gem_flush(struct drm_device *dev, | 1912 | i915_gem_flush(struct drm_device *dev, |
1884 | uint32_t invalidate_domains, | 1913 | uint32_t invalidate_domains, |
@@ -1947,7 +1976,7 @@ i915_gem_flush(struct drm_device *dev, | |||
1947 | #endif | 1976 | #endif |
1948 | BEGIN_LP_RING(2); | 1977 | BEGIN_LP_RING(2); |
1949 | OUT_RING(cmd); | 1978 | OUT_RING(cmd); |
1950 | OUT_RING(0); /* noop */ | 1979 | OUT_RING(MI_NOOP); |
1951 | ADVANCE_LP_RING(); | 1980 | ADVANCE_LP_RING(); |
1952 | } | 1981 | } |
1953 | } | 1982 | } |
diff --git a/include/drm/drm_os_linux.h b/include/drm/drm_os_linux.h index 26641e95e0a4..393369147a2d 100644 --- a/include/drm/drm_os_linux.h +++ b/include/drm/drm_os_linux.h | |||
@@ -123,5 +123,5 @@ do { \ | |||
123 | remove_wait_queue(&(queue), &entry); \ | 123 | remove_wait_queue(&(queue), &entry); \ |
124 | } while (0) | 124 | } while (0) |
125 | 125 | ||
126 | #define DRM_WAKEUP( queue ) wake_up_interruptible( queue ) | 126 | #define DRM_WAKEUP( queue ) wake_up( queue ) |
127 | #define DRM_INIT_WAITQUEUE( queue ) init_waitqueue_head( queue ) | 127 | #define DRM_INIT_WAITQUEUE( queue ) init_waitqueue_head( queue ) |