Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 Red Hat |
| 3 | * Author: Rob Clark <robdclark@gmail.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 as published by |
| 7 | * the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along with |
| 15 | * this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #include "msm_drv.h" |
| 19 | #include "msm_gpu.h" |
| 20 | #include "msm_gem.h" |
| 21 | |
| 22 | /* |
| 23 | * Cmdstream submission: |
| 24 | */ |
| 25 | |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 26 | /* make sure these don't conflict w/ MSM_SUBMIT_BO_x */ |
Rob Clark | 340faef | 2016-03-14 13:56:37 -0400 | [diff] [blame] | 27 | #define BO_VALID 0x8000 /* is current addr in cmdstream correct/valid? */ |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 28 | #define BO_LOCKED 0x4000 |
| 29 | #define BO_PINNED 0x2000 |
| 30 | |
| 31 | static inline void __user *to_user_ptr(u64 address) |
| 32 | { |
| 33 | return (void __user *)(uintptr_t)address; |
| 34 | } |
| 35 | |
| 36 | static struct msm_gem_submit *submit_create(struct drm_device *dev, |
| 37 | struct msm_gpu *gpu, int nr) |
| 38 | { |
| 39 | struct msm_gem_submit *submit; |
| 40 | int sz = sizeof(*submit) + (nr * sizeof(submit->bos[0])); |
| 41 | |
| 42 | submit = kmalloc(sz, GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY); |
Rob Clark | 6860b56 | 2016-05-03 09:49:40 -0400 | [diff] [blame^] | 43 | if (!submit) |
| 44 | return NULL; |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 45 | |
Rob Clark | 6860b56 | 2016-05-03 09:49:40 -0400 | [diff] [blame^] | 46 | submit->dev = dev; |
| 47 | submit->gpu = gpu; |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 48 | |
Rob Clark | 6860b56 | 2016-05-03 09:49:40 -0400 | [diff] [blame^] | 49 | /* initially, until copy_from_user() and bo lookup succeeds: */ |
| 50 | submit->nr_bos = 0; |
| 51 | submit->nr_cmds = 0; |
| 52 | |
| 53 | INIT_LIST_HEAD(&submit->bo_list); |
| 54 | ww_acquire_init(&submit->ticket, &reservation_ww_class); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 55 | |
| 56 | return submit; |
| 57 | } |
| 58 | |
| 59 | static int submit_lookup_objects(struct msm_gem_submit *submit, |
| 60 | struct drm_msm_gem_submit *args, struct drm_file *file) |
| 61 | { |
| 62 | unsigned i; |
| 63 | int ret = 0; |
| 64 | |
| 65 | spin_lock(&file->table_lock); |
| 66 | |
| 67 | for (i = 0; i < args->nr_bos; i++) { |
| 68 | struct drm_msm_gem_submit_bo submit_bo; |
| 69 | struct drm_gem_object *obj; |
| 70 | struct msm_gem_object *msm_obj; |
| 71 | void __user *userptr = |
| 72 | to_user_ptr(args->bos + (i * sizeof(submit_bo))); |
| 73 | |
| 74 | ret = copy_from_user(&submit_bo, userptr, sizeof(submit_bo)); |
| 75 | if (ret) { |
| 76 | ret = -EFAULT; |
| 77 | goto out_unlock; |
| 78 | } |
| 79 | |
Rob Clark | 93ddb0d | 2014-03-03 09:42:33 -0500 | [diff] [blame] | 80 | if (submit_bo.flags & ~MSM_SUBMIT_BO_FLAGS) { |
Rob Clark | 1987253 | 2013-09-06 15:36:40 -0400 | [diff] [blame] | 81 | DRM_ERROR("invalid flags: %x\n", submit_bo.flags); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 82 | ret = -EINVAL; |
| 83 | goto out_unlock; |
| 84 | } |
| 85 | |
| 86 | submit->bos[i].flags = submit_bo.flags; |
| 87 | /* in validate_objects() we figure out if this is true: */ |
| 88 | submit->bos[i].iova = submit_bo.presumed; |
| 89 | |
| 90 | /* normally use drm_gem_object_lookup(), but for bulk lookup |
| 91 | * all under single table_lock just hit object_idr directly: |
| 92 | */ |
| 93 | obj = idr_find(&file->object_idr, submit_bo.handle); |
| 94 | if (!obj) { |
Rob Clark | 1987253 | 2013-09-06 15:36:40 -0400 | [diff] [blame] | 95 | DRM_ERROR("invalid handle %u at index %u\n", submit_bo.handle, i); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 96 | ret = -EINVAL; |
| 97 | goto out_unlock; |
| 98 | } |
| 99 | |
| 100 | msm_obj = to_msm_bo(obj); |
| 101 | |
| 102 | if (!list_empty(&msm_obj->submit_entry)) { |
Rob Clark | 1987253 | 2013-09-06 15:36:40 -0400 | [diff] [blame] | 103 | DRM_ERROR("handle %u at index %u already on submit list\n", |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 104 | submit_bo.handle, i); |
| 105 | ret = -EINVAL; |
| 106 | goto out_unlock; |
| 107 | } |
| 108 | |
| 109 | drm_gem_object_reference(obj); |
| 110 | |
| 111 | submit->bos[i].obj = msm_obj; |
| 112 | |
| 113 | list_add_tail(&msm_obj->submit_entry, &submit->bo_list); |
| 114 | } |
| 115 | |
| 116 | out_unlock: |
| 117 | submit->nr_bos = i; |
| 118 | spin_unlock(&file->table_lock); |
| 119 | |
| 120 | return ret; |
| 121 | } |
| 122 | |
| 123 | static void submit_unlock_unpin_bo(struct msm_gem_submit *submit, int i) |
| 124 | { |
| 125 | struct msm_gem_object *msm_obj = submit->bos[i].obj; |
| 126 | |
| 127 | if (submit->bos[i].flags & BO_PINNED) |
| 128 | msm_gem_put_iova(&msm_obj->base, submit->gpu->id); |
| 129 | |
| 130 | if (submit->bos[i].flags & BO_LOCKED) |
| 131 | ww_mutex_unlock(&msm_obj->resv->lock); |
| 132 | |
| 133 | if (!(submit->bos[i].flags & BO_VALID)) |
| 134 | submit->bos[i].iova = 0; |
| 135 | |
| 136 | submit->bos[i].flags &= ~(BO_LOCKED | BO_PINNED); |
| 137 | } |
| 138 | |
| 139 | /* This is where we make sure all the bo's are reserved and pin'd: */ |
Rob Clark | 340faef | 2016-03-14 13:56:37 -0400 | [diff] [blame] | 140 | static int submit_lock_objects(struct msm_gem_submit *submit) |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 141 | { |
| 142 | int contended, slow_locked = -1, i, ret = 0; |
| 143 | |
| 144 | retry: |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 145 | for (i = 0; i < submit->nr_bos; i++) { |
| 146 | struct msm_gem_object *msm_obj = submit->bos[i].obj; |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 147 | |
| 148 | if (slow_locked == i) |
| 149 | slow_locked = -1; |
| 150 | |
| 151 | contended = i; |
| 152 | |
| 153 | if (!(submit->bos[i].flags & BO_LOCKED)) { |
| 154 | ret = ww_mutex_lock_interruptible(&msm_obj->resv->lock, |
| 155 | &submit->ticket); |
| 156 | if (ret) |
| 157 | goto fail; |
| 158 | submit->bos[i].flags |= BO_LOCKED; |
| 159 | } |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | ww_acquire_done(&submit->ticket); |
| 163 | |
| 164 | return 0; |
| 165 | |
| 166 | fail: |
| 167 | for (; i >= 0; i--) |
| 168 | submit_unlock_unpin_bo(submit, i); |
| 169 | |
| 170 | if (slow_locked > 0) |
| 171 | submit_unlock_unpin_bo(submit, slow_locked); |
| 172 | |
| 173 | if (ret == -EDEADLK) { |
| 174 | struct msm_gem_object *msm_obj = submit->bos[contended].obj; |
| 175 | /* we lost out in a seqno race, lock and retry.. */ |
| 176 | ret = ww_mutex_lock_slow_interruptible(&msm_obj->resv->lock, |
| 177 | &submit->ticket); |
| 178 | if (!ret) { |
| 179 | submit->bos[contended].flags |= BO_LOCKED; |
| 180 | slow_locked = contended; |
| 181 | goto retry; |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | return ret; |
| 186 | } |
| 187 | |
Rob Clark | b6295f9 | 2016-03-15 18:26:28 -0400 | [diff] [blame] | 188 | static int submit_fence_sync(struct msm_gem_submit *submit) |
| 189 | { |
| 190 | int i, ret = 0; |
| 191 | |
| 192 | for (i = 0; i < submit->nr_bos; i++) { |
| 193 | struct msm_gem_object *msm_obj = submit->bos[i].obj; |
| 194 | bool write = submit->bos[i].flags & MSM_SUBMIT_BO_WRITE; |
| 195 | |
| 196 | ret = msm_gem_sync_object(&msm_obj->base, submit->gpu->fctx, write); |
| 197 | if (ret) |
| 198 | break; |
| 199 | } |
| 200 | |
| 201 | return ret; |
| 202 | } |
| 203 | |
Rob Clark | 340faef | 2016-03-14 13:56:37 -0400 | [diff] [blame] | 204 | static int submit_pin_objects(struct msm_gem_submit *submit) |
| 205 | { |
| 206 | int i, ret = 0; |
| 207 | |
| 208 | submit->valid = true; |
| 209 | |
| 210 | for (i = 0; i < submit->nr_bos; i++) { |
| 211 | struct msm_gem_object *msm_obj = submit->bos[i].obj; |
| 212 | uint32_t iova; |
| 213 | |
| 214 | /* if locking succeeded, pin bo: */ |
| 215 | ret = msm_gem_get_iova_locked(&msm_obj->base, |
| 216 | submit->gpu->id, &iova); |
| 217 | |
| 218 | if (ret) |
| 219 | break; |
| 220 | |
| 221 | submit->bos[i].flags |= BO_PINNED; |
| 222 | |
| 223 | if (iova == submit->bos[i].iova) { |
| 224 | submit->bos[i].flags |= BO_VALID; |
| 225 | } else { |
| 226 | submit->bos[i].iova = iova; |
| 227 | /* iova changed, so address in cmdstream is not valid: */ |
| 228 | submit->bos[i].flags &= ~BO_VALID; |
| 229 | submit->valid = false; |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | return ret; |
| 234 | } |
| 235 | |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 236 | static int submit_bo(struct msm_gem_submit *submit, uint32_t idx, |
| 237 | struct msm_gem_object **obj, uint32_t *iova, bool *valid) |
| 238 | { |
| 239 | if (idx >= submit->nr_bos) { |
Rob Clark | 1987253 | 2013-09-06 15:36:40 -0400 | [diff] [blame] | 240 | DRM_ERROR("invalid buffer index: %u (out of %u)\n", |
| 241 | idx, submit->nr_bos); |
| 242 | return -EINVAL; |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | if (obj) |
| 246 | *obj = submit->bos[idx].obj; |
| 247 | if (iova) |
| 248 | *iova = submit->bos[idx].iova; |
| 249 | if (valid) |
| 250 | *valid = !!(submit->bos[idx].flags & BO_VALID); |
| 251 | |
| 252 | return 0; |
| 253 | } |
| 254 | |
| 255 | /* process the reloc's and patch up the cmdstream as needed: */ |
| 256 | static int submit_reloc(struct msm_gem_submit *submit, struct msm_gem_object *obj, |
| 257 | uint32_t offset, uint32_t nr_relocs, uint64_t relocs) |
| 258 | { |
| 259 | uint32_t i, last_offset = 0; |
| 260 | uint32_t *ptr; |
| 261 | int ret; |
| 262 | |
| 263 | if (offset % 4) { |
Rob Clark | 1987253 | 2013-09-06 15:36:40 -0400 | [diff] [blame] | 264 | DRM_ERROR("non-aligned cmdstream buffer: %u\n", offset); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 265 | return -EINVAL; |
| 266 | } |
| 267 | |
| 268 | /* For now, just map the entire thing. Eventually we probably |
| 269 | * to do it page-by-page, w/ kmap() if not vmap()d.. |
| 270 | */ |
Rob Clark | c2703b1 | 2014-02-06 19:19:20 -0500 | [diff] [blame] | 271 | ptr = msm_gem_vaddr_locked(&obj->base); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 272 | |
| 273 | if (IS_ERR(ptr)) { |
| 274 | ret = PTR_ERR(ptr); |
| 275 | DBG("failed to map: %d", ret); |
| 276 | return ret; |
| 277 | } |
| 278 | |
| 279 | for (i = 0; i < nr_relocs; i++) { |
| 280 | struct drm_msm_gem_submit_reloc submit_reloc; |
| 281 | void __user *userptr = |
| 282 | to_user_ptr(relocs + (i * sizeof(submit_reloc))); |
| 283 | uint32_t iova, off; |
| 284 | bool valid; |
| 285 | |
| 286 | ret = copy_from_user(&submit_reloc, userptr, sizeof(submit_reloc)); |
| 287 | if (ret) |
| 288 | return -EFAULT; |
| 289 | |
| 290 | if (submit_reloc.submit_offset % 4) { |
Rob Clark | 1987253 | 2013-09-06 15:36:40 -0400 | [diff] [blame] | 291 | DRM_ERROR("non-aligned reloc offset: %u\n", |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 292 | submit_reloc.submit_offset); |
| 293 | return -EINVAL; |
| 294 | } |
| 295 | |
| 296 | /* offset in dwords: */ |
| 297 | off = submit_reloc.submit_offset / 4; |
| 298 | |
| 299 | if ((off >= (obj->base.size / 4)) || |
| 300 | (off < last_offset)) { |
Rob Clark | 1987253 | 2013-09-06 15:36:40 -0400 | [diff] [blame] | 301 | DRM_ERROR("invalid offset %u at reloc %u\n", off, i); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 302 | return -EINVAL; |
| 303 | } |
| 304 | |
| 305 | ret = submit_bo(submit, submit_reloc.reloc_idx, NULL, &iova, &valid); |
| 306 | if (ret) |
| 307 | return ret; |
| 308 | |
| 309 | if (valid) |
| 310 | continue; |
| 311 | |
| 312 | iova += submit_reloc.reloc_offset; |
| 313 | |
| 314 | if (submit_reloc.shift < 0) |
| 315 | iova >>= -submit_reloc.shift; |
| 316 | else |
| 317 | iova <<= submit_reloc.shift; |
| 318 | |
| 319 | ptr[off] = iova | submit_reloc.or; |
| 320 | |
| 321 | last_offset = off; |
| 322 | } |
| 323 | |
| 324 | return 0; |
| 325 | } |
| 326 | |
| 327 | static void submit_cleanup(struct msm_gem_submit *submit, bool fail) |
| 328 | { |
| 329 | unsigned i; |
| 330 | |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 331 | for (i = 0; i < submit->nr_bos; i++) { |
| 332 | struct msm_gem_object *msm_obj = submit->bos[i].obj; |
| 333 | submit_unlock_unpin_bo(submit, i); |
| 334 | list_del_init(&msm_obj->submit_entry); |
| 335 | drm_gem_object_unreference(&msm_obj->base); |
| 336 | } |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 337 | |
| 338 | ww_acquire_fini(&submit->ticket); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 339 | } |
| 340 | |
| 341 | int msm_ioctl_gem_submit(struct drm_device *dev, void *data, |
| 342 | struct drm_file *file) |
| 343 | { |
| 344 | struct msm_drm_private *priv = dev->dev_private; |
| 345 | struct drm_msm_gem_submit *args = data; |
| 346 | struct msm_file_private *ctx = file->driver_priv; |
| 347 | struct msm_gem_submit *submit; |
Rob Clark | c01a958 | 2016-02-03 13:12:31 -0500 | [diff] [blame] | 348 | struct msm_gpu *gpu = priv->gpu; |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 349 | unsigned i; |
| 350 | int ret; |
| 351 | |
Rob Clark | c01a958 | 2016-02-03 13:12:31 -0500 | [diff] [blame] | 352 | if (!gpu) |
| 353 | return -ENXIO; |
| 354 | |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 355 | /* for now, we just have 3d pipe.. eventually this would need to |
| 356 | * be more clever to dispatch to appropriate gpu module: |
| 357 | */ |
| 358 | if (args->pipe != MSM_PIPE_3D0) |
| 359 | return -EINVAL; |
| 360 | |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 361 | if (args->nr_cmds > MAX_CMDS) |
| 362 | return -EINVAL; |
| 363 | |
| 364 | submit = submit_create(dev, gpu, args->nr_bos); |
Rob Clark | 687f084 | 2016-02-03 13:24:35 -0500 | [diff] [blame] | 365 | if (!submit) |
| 366 | return -ENOMEM; |
| 367 | |
| 368 | mutex_lock(&dev->struct_mutex); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 369 | |
| 370 | ret = submit_lookup_objects(submit, args, file); |
| 371 | if (ret) |
| 372 | goto out; |
| 373 | |
Rob Clark | 340faef | 2016-03-14 13:56:37 -0400 | [diff] [blame] | 374 | ret = submit_lock_objects(submit); |
| 375 | if (ret) |
| 376 | goto out; |
| 377 | |
Rob Clark | b6295f9 | 2016-03-15 18:26:28 -0400 | [diff] [blame] | 378 | ret = submit_fence_sync(submit); |
| 379 | if (ret) |
| 380 | goto out; |
| 381 | |
Rob Clark | 340faef | 2016-03-14 13:56:37 -0400 | [diff] [blame] | 382 | ret = submit_pin_objects(submit); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 383 | if (ret) |
| 384 | goto out; |
| 385 | |
| 386 | for (i = 0; i < args->nr_cmds; i++) { |
| 387 | struct drm_msm_gem_submit_cmd submit_cmd; |
| 388 | void __user *userptr = |
| 389 | to_user_ptr(args->cmds + (i * sizeof(submit_cmd))); |
| 390 | struct msm_gem_object *msm_obj; |
| 391 | uint32_t iova; |
| 392 | |
| 393 | ret = copy_from_user(&submit_cmd, userptr, sizeof(submit_cmd)); |
| 394 | if (ret) { |
| 395 | ret = -EFAULT; |
| 396 | goto out; |
| 397 | } |
| 398 | |
Rob Clark | 93ddb0d | 2014-03-03 09:42:33 -0500 | [diff] [blame] | 399 | /* validate input from userspace: */ |
| 400 | switch (submit_cmd.type) { |
| 401 | case MSM_SUBMIT_CMD_BUF: |
| 402 | case MSM_SUBMIT_CMD_IB_TARGET_BUF: |
| 403 | case MSM_SUBMIT_CMD_CTX_RESTORE_BUF: |
| 404 | break; |
| 405 | default: |
| 406 | DRM_ERROR("invalid type: %08x\n", submit_cmd.type); |
| 407 | ret = -EINVAL; |
| 408 | goto out; |
| 409 | } |
| 410 | |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 411 | ret = submit_bo(submit, submit_cmd.submit_idx, |
| 412 | &msm_obj, &iova, NULL); |
| 413 | if (ret) |
| 414 | goto out; |
| 415 | |
| 416 | if (submit_cmd.size % 4) { |
Rob Clark | 1987253 | 2013-09-06 15:36:40 -0400 | [diff] [blame] | 417 | DRM_ERROR("non-aligned cmdstream buffer size: %u\n", |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 418 | submit_cmd.size); |
| 419 | ret = -EINVAL; |
| 420 | goto out; |
| 421 | } |
| 422 | |
Rob Clark | 1987253 | 2013-09-06 15:36:40 -0400 | [diff] [blame] | 423 | if ((submit_cmd.size + submit_cmd.submit_offset) >= |
| 424 | msm_obj->base.size) { |
| 425 | DRM_ERROR("invalid cmdstream size: %u\n", submit_cmd.size); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 426 | ret = -EINVAL; |
| 427 | goto out; |
| 428 | } |
| 429 | |
| 430 | submit->cmd[i].type = submit_cmd.type; |
| 431 | submit->cmd[i].size = submit_cmd.size / 4; |
| 432 | submit->cmd[i].iova = iova + submit_cmd.submit_offset; |
Rob Clark | a7d3c95 | 2014-05-30 14:47:38 -0400 | [diff] [blame] | 433 | submit->cmd[i].idx = submit_cmd.submit_idx; |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 434 | |
| 435 | if (submit->valid) |
| 436 | continue; |
| 437 | |
| 438 | ret = submit_reloc(submit, msm_obj, submit_cmd.submit_offset, |
| 439 | submit_cmd.nr_relocs, submit_cmd.relocs); |
| 440 | if (ret) |
| 441 | goto out; |
| 442 | } |
| 443 | |
| 444 | submit->nr_cmds = i; |
| 445 | |
| 446 | ret = msm_gpu_submit(gpu, submit, ctx); |
| 447 | |
Rob Clark | b6295f9 | 2016-03-15 18:26:28 -0400 | [diff] [blame] | 448 | args->fence = submit->fence->seqno; |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 449 | |
| 450 | out: |
Rob Clark | 687f084 | 2016-02-03 13:24:35 -0500 | [diff] [blame] | 451 | submit_cleanup(submit, !!ret); |
Rob Clark | c2703b1 | 2014-02-06 19:19:20 -0500 | [diff] [blame] | 452 | mutex_unlock(&dev->struct_mutex); |
Rob Clark | 7198e6b | 2013-07-19 12:59:32 -0400 | [diff] [blame] | 453 | return ret; |
| 454 | } |