diff options
| author | Dave Airlie <airlied@redhat.com> | 2013-11-21 03:46:26 -0500 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2013-11-21 03:46:26 -0500 |
| commit | 28adb3026d01da3f6acded3cec817e1a3ba37f44 (patch) | |
| tree | 26df1bf50f9ccf6fd282f3b22d103cb3b30ecaa3 | |
| parent | cf969677945e6e19810d616873617320da002e32 (diff) | |
| parent | c486d4f894d7c7d0e4148426360aa354384f6dc8 (diff) | |
Merge branch 'vmwgfx-fixes-3.13' of git://people.freedesktop.org/~thomash/linux into drm-fixes
Below is a fix for a false lockep warning,
and the vmwgfx prime implementation.
* 'vmwgfx-fixes-3.13' of git://people.freedesktop.org/~thomash/linux:
drm/vmwgfx: Make vmwgfx dma buffers prime aware
drm/vmwgfx: Make surfaces prime-aware
drm/vmwgfx: Hook up the prime ioctls
drm/ttm: Add a minimal prime implementation for ttm base objects
drm/vmwgfx: Fix false lockdep warning
drm/ttm: Allow execbuf util reserves without ticket
| -rw-r--r-- | drivers/gpu/drm/ttm/ttm_execbuf_util.c | 32 | ||||
| -rw-r--r-- | drivers/gpu/drm/ttm/ttm_object.c | 254 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/Makefile | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 14 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_prime.c | 137 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 63 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 30 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_execbuf_util.h | 3 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_object.h | 61 |
10 files changed, 533 insertions, 70 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_execbuf_util.c b/drivers/gpu/drm/ttm/ttm_execbuf_util.c index 6c911789ae5c..479e9418e3d7 100644 --- a/drivers/gpu/drm/ttm/ttm_execbuf_util.c +++ b/drivers/gpu/drm/ttm/ttm_execbuf_util.c | |||
| @@ -32,8 +32,7 @@ | |||
| 32 | #include <linux/sched.h> | 32 | #include <linux/sched.h> |
| 33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
| 34 | 34 | ||
| 35 | static void ttm_eu_backoff_reservation_locked(struct list_head *list, | 35 | static void ttm_eu_backoff_reservation_locked(struct list_head *list) |
| 36 | struct ww_acquire_ctx *ticket) | ||
| 37 | { | 36 | { |
| 38 | struct ttm_validate_buffer *entry; | 37 | struct ttm_validate_buffer *entry; |
| 39 | 38 | ||
| @@ -93,8 +92,9 @@ void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket, | |||
| 93 | entry = list_first_entry(list, struct ttm_validate_buffer, head); | 92 | entry = list_first_entry(list, struct ttm_validate_buffer, head); |
| 94 | glob = entry->bo->glob; | 93 | glob = entry->bo->glob; |
| 95 | spin_lock(&glob->lru_lock); | 94 | spin_lock(&glob->lru_lock); |
| 96 | ttm_eu_backoff_reservation_locked(list, ticket); | 95 | ttm_eu_backoff_reservation_locked(list); |
| 97 | ww_acquire_fini(ticket); | 96 | if (ticket) |
| 97 | ww_acquire_fini(ticket); | ||
| 98 | spin_unlock(&glob->lru_lock); | 98 | spin_unlock(&glob->lru_lock); |
| 99 | } | 99 | } |
| 100 | EXPORT_SYMBOL(ttm_eu_backoff_reservation); | 100 | EXPORT_SYMBOL(ttm_eu_backoff_reservation); |
| @@ -130,7 +130,8 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, | |||
| 130 | entry = list_first_entry(list, struct ttm_validate_buffer, head); | 130 | entry = list_first_entry(list, struct ttm_validate_buffer, head); |
| 131 | glob = entry->bo->glob; | 131 | glob = entry->bo->glob; |
| 132 | 132 | ||
| 133 | ww_acquire_init(ticket, &reservation_ww_class); | 133 | if (ticket) |
| 134 | ww_acquire_init(ticket, &reservation_ww_class); | ||
| 134 | retry: | 135 | retry: |
| 135 | list_for_each_entry(entry, list, head) { | 136 | list_for_each_entry(entry, list, head) { |
| 136 | struct ttm_buffer_object *bo = entry->bo; | 137 | struct ttm_buffer_object *bo = entry->bo; |
| @@ -139,16 +140,17 @@ retry: | |||
| 139 | if (entry->reserved) | 140 | if (entry->reserved) |
| 140 | continue; | 141 | continue; |
| 141 | 142 | ||
| 142 | 143 | ret = ttm_bo_reserve_nolru(bo, true, (ticket == NULL), true, | |
| 143 | ret = ttm_bo_reserve_nolru(bo, true, false, true, ticket); | 144 | ticket); |
| 144 | 145 | ||
| 145 | if (ret == -EDEADLK) { | 146 | if (ret == -EDEADLK) { |
| 146 | /* uh oh, we lost out, drop every reservation and try | 147 | /* uh oh, we lost out, drop every reservation and try |
| 147 | * to only reserve this buffer, then start over if | 148 | * to only reserve this buffer, then start over if |
| 148 | * this succeeds. | 149 | * this succeeds. |
| 149 | */ | 150 | */ |
| 151 | BUG_ON(ticket == NULL); | ||
| 150 | spin_lock(&glob->lru_lock); | 152 | spin_lock(&glob->lru_lock); |
| 151 | ttm_eu_backoff_reservation_locked(list, ticket); | 153 | ttm_eu_backoff_reservation_locked(list); |
| 152 | spin_unlock(&glob->lru_lock); | 154 | spin_unlock(&glob->lru_lock); |
| 153 | ttm_eu_list_ref_sub(list); | 155 | ttm_eu_list_ref_sub(list); |
| 154 | ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock, | 156 | ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock, |
| @@ -175,7 +177,8 @@ retry: | |||
| 175 | } | 177 | } |
| 176 | } | 178 | } |
| 177 | 179 | ||
| 178 | ww_acquire_done(ticket); | 180 | if (ticket) |
| 181 | ww_acquire_done(ticket); | ||
| 179 | spin_lock(&glob->lru_lock); | 182 | spin_lock(&glob->lru_lock); |
| 180 | ttm_eu_del_from_lru_locked(list); | 183 | ttm_eu_del_from_lru_locked(list); |
| 181 | spin_unlock(&glob->lru_lock); | 184 | spin_unlock(&glob->lru_lock); |
| @@ -184,12 +187,14 @@ retry: | |||
| 184 | 187 | ||
| 185 | err: | 188 | err: |
| 186 | spin_lock(&glob->lru_lock); | 189 | spin_lock(&glob->lru_lock); |
| 187 | ttm_eu_backoff_reservation_locked(list, ticket); | 190 | ttm_eu_backoff_reservation_locked(list); |
| 188 | spin_unlock(&glob->lru_lock); | 191 | spin_unlock(&glob->lru_lock); |
| 189 | ttm_eu_list_ref_sub(list); | 192 | ttm_eu_list_ref_sub(list); |
| 190 | err_fini: | 193 | err_fini: |
| 191 | ww_acquire_done(ticket); | 194 | if (ticket) { |
| 192 | ww_acquire_fini(ticket); | 195 | ww_acquire_done(ticket); |
| 196 | ww_acquire_fini(ticket); | ||
| 197 | } | ||
| 193 | return ret; | 198 | return ret; |
| 194 | } | 199 | } |
| 195 | EXPORT_SYMBOL(ttm_eu_reserve_buffers); | 200 | EXPORT_SYMBOL(ttm_eu_reserve_buffers); |
| @@ -224,7 +229,8 @@ void ttm_eu_fence_buffer_objects(struct ww_acquire_ctx *ticket, | |||
| 224 | } | 229 | } |
| 225 | spin_unlock(&bdev->fence_lock); | 230 | spin_unlock(&bdev->fence_lock); |
| 226 | spin_unlock(&glob->lru_lock); | 231 | spin_unlock(&glob->lru_lock); |
| 227 | ww_acquire_fini(ticket); | 232 | if (ticket) |
| 233 | ww_acquire_fini(ticket); | ||
| 228 | 234 | ||
| 229 | list_for_each_entry(entry, list, head) { | 235 | list_for_each_entry(entry, list, head) { |
| 230 | if (entry->old_sync_obj) | 236 | if (entry->old_sync_obj) |
diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/ttm/ttm_object.c index a868176c258a..6fe7b92a82d1 100644 --- a/drivers/gpu/drm/ttm/ttm_object.c +++ b/drivers/gpu/drm/ttm/ttm_object.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /************************************************************************** | 1 | /************************************************************************** |
| 2 | * | 2 | * |
| 3 | * Copyright (c) 2009 VMware, Inc., Palo Alto, CA., USA | 3 | * Copyright (c) 2009-2013 VMware, Inc., Palo Alto, CA., USA |
| 4 | * All Rights Reserved. | 4 | * All Rights Reserved. |
| 5 | * | 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| @@ -26,6 +26,12 @@ | |||
| 26 | **************************************************************************/ | 26 | **************************************************************************/ |
| 27 | /* | 27 | /* |
| 28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> | 28 | * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> |
| 29 | * | ||
| 30 | * While no substantial code is shared, the prime code is inspired by | ||
| 31 | * drm_prime.c, with | ||
| 32 | * Authors: | ||
| 33 | * Dave Airlie <airlied@redhat.com> | ||
| 34 | * Rob Clark <rob.clark@linaro.org> | ||
| 29 | */ | 35 | */ |
| 30 | /** @file ttm_ref_object.c | 36 | /** @file ttm_ref_object.c |
| 31 | * | 37 | * |
| @@ -34,6 +40,7 @@ | |||
| 34 | * and release on file close. | 40 | * and release on file close. |
| 35 | */ | 41 | */ |
| 36 | 42 | ||
| 43 | |||
| 37 | /** | 44 | /** |
| 38 | * struct ttm_object_file | 45 | * struct ttm_object_file |
| 39 | * | 46 | * |
| @@ -84,6 +91,9 @@ struct ttm_object_device { | |||
| 84 | struct drm_open_hash object_hash; | 91 | struct drm_open_hash object_hash; |
| 85 | atomic_t object_count; | 92 | atomic_t object_count; |
| 86 | struct ttm_mem_global *mem_glob; | 93 | struct ttm_mem_global *mem_glob; |
| 94 | struct dma_buf_ops ops; | ||
| 95 | void (*dmabuf_release)(struct dma_buf *dma_buf); | ||
| 96 | size_t dma_buf_size; | ||
| 87 | }; | 97 | }; |
| 88 | 98 | ||
| 89 | /** | 99 | /** |
| @@ -116,6 +126,8 @@ struct ttm_ref_object { | |||
| 116 | struct ttm_object_file *tfile; | 126 | struct ttm_object_file *tfile; |
| 117 | }; | 127 | }; |
| 118 | 128 | ||
| 129 | static void ttm_prime_dmabuf_release(struct dma_buf *dma_buf); | ||
| 130 | |||
| 119 | static inline struct ttm_object_file * | 131 | static inline struct ttm_object_file * |
| 120 | |||
