aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2012-02-09 10:56:43 -0500
committerDave Airlie <airlied@redhat.com>2012-02-13 07:01:33 -0500
commitbb1bd2f43ee15386a1c3f96cbcbb9302a9994443 (patch)
tree0ac02905936728ea596a768c3b8c97b406e789fd /drivers/gpu/drm/vmwgfx
parent6b82ef50d8617f3fcd51dda9d89d973fe3bc65b8 (diff)
vmwgfx: Make it possible to get fence from execbuf
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.h3
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c15
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c10
3 files changed, 18 insertions, 10 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index 93505ce0ed10..14c2f49b21ea 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -534,7 +534,8 @@ extern int vmw_execbuf_process(struct drm_file *file_priv,
534 uint32_t command_size, 534 uint32_t command_size,
535 uint64_t throttle_us, 535 uint64_t throttle_us,
536 struct drm_vmw_fence_rep __user 536 struct drm_vmw_fence_rep __user
537 *user_fence_rep); 537 *user_fence_rep,
538 struct vmw_fence_obj **out_fence);
538 539
539extern void 540extern void
540vmw_execbuf_release_pinned_bo(struct vmw_private *dev_priv, 541vmw_execbuf_release_pinned_bo(struct vmw_private *dev_priv,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 40932fbdac0f..4acced44a623 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -1109,10 +1109,11 @@ int vmw_execbuf_process(struct drm_file *file_priv,
1109 void *kernel_commands, 1109 void *kernel_commands,
1110 uint32_t command_size, 1110 uint32_t command_size,
1111 uint64_t throttle_us, 1111 uint64_t throttle_us,
1112 struct drm_vmw_fence_rep __user *user_fence_rep) 1112 struct drm_vmw_fence_rep __user *user_fence_rep,
1113 struct vmw_fence_obj **out_fence)
1113{ 1114{
1114 struct vmw_sw_context *sw_context = &dev_priv->ctx; 1115 struct vmw_sw_context *sw_context = &dev_priv->ctx;
1115 struct vmw_fence_obj *fence; 1116 struct vmw_fence_obj *fence = NULL;
1116 uint32_t handle; 1117 uint32_t handle;
1117 void *cmd; 1118 void *cmd;
1118 int ret; 1119 int ret;
@@ -1208,8 +1209,13 @@ int vmw_execbuf_process(struct drm_file *file_priv,
1208 vmw_execbuf_copy_fence_user(dev_priv, vmw_fpriv(file_priv), ret, 1209 vmw_execbuf_copy_fence_user(dev_priv, vmw_fpriv(file_priv), ret,
1209 user_fence_rep, fence, handle); 1210 user_fence_rep, fence, handle);
1210 1211
1211 if (likely(fence != NULL)) 1212 /* Don't unreference when handing fence out */
1213 if (unlikely(out_fence != NULL)) {
1214 *out_fence = fence;
1215 fence = NULL;
1216 } else if (likely(fence != NULL)) {
1212 vmw_fence_obj_unreference(&fence); 1217 vmw_fence_obj_unreference(&fence);
1218 }
1213 1219
1214 mutex_unlock(&dev_priv->cmdbuf_mutex); 1220 mutex_unlock(&dev_priv->cmdbuf_mutex);
1215 return 0; 1221 return 0;
@@ -1362,7 +1368,8 @@ int vmw_execbuf_ioctl(struct drm_device *dev, void *data,
1362 ret = vmw_execbuf_process(file_priv, dev_priv, 1368 ret = vmw_execbuf_process(file_priv, dev_priv,
1363 (void __user *)(unsigned long)arg->commands, 1369 (void __user *)(unsigned long)arg->commands,
1364 NULL, arg->command_size, arg->throttle_us, 1370 NULL, arg->command_size, arg->throttle_us,
1365 (void __user *)(unsigned long)arg->fence_rep); 1371 (void __user *)(unsigned long)arg->fence_rep,
1372 NULL);
1366 1373
1367 if (unlikely(ret != 0)) 1374 if (unlikely(ret != 0))
1368 goto out_unlock; 1375 goto out_unlock;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index b66ef0e3cde1..12619c33953b 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -547,7 +547,7 @@ static int do_surface_dirty_sou(struct vmw_private *dev_priv,
547 fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num; 547 fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num;
548 cmd->header.size = cpu_to_le32(fifo_size - sizeof(cmd->header)); 548 cmd->header.size = cpu_to_le32(fifo_size - sizeof(cmd->header));
549 ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd, 549 ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd,
550 fifo_size, 0, NULL); 550 fifo_size, 0, NULL, NULL);
551 551
552 if (unlikely(ret != 0)) 552 if (unlikely(ret != 0))
553 break; 553 break;
@@ -809,7 +809,7 @@ static int do_dmabuf_define_gmrfb(struct drm_file *file_priv,
809 cmd->body.ptr.offset = 0; 809 cmd->body.ptr.offset = 0;
810 810
811 ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd, 811 ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd,
812 fifo_size, 0, NULL); 812 fifo_size, 0, NULL, NULL);
813 813
814 kfree(cmd); 814 kfree(cmd);
815 815
@@ -896,7 +896,7 @@ static int do_dmabuf_dirty_sou(struct drm_file *file_priv,
896 896
897 fifo_size = sizeof(*blits) * hit_num; 897 fifo_size = sizeof(*blits) * hit_num;
898 ret = vmw_execbuf_process(file_priv, dev_priv, NULL, blits, 898 ret = vmw_execbuf_process(file_priv, dev_priv, NULL, blits,
899 fifo_size, 0, NULL); 899 fifo_size, 0, NULL, NULL);
900 900
901 if (unlikely(ret != 0)) 901 if (unlikely(ret != 0))
902 break; 902 break;
@@ -1296,7 +1296,7 @@ int vmw_kms_present(struct vmw_private *dev_priv,
1296 fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num; 1296 fifo_size = sizeof(*cmd) + sizeof(SVGASignedRect) * num;
1297 cmd->header.size = cpu_to_le32(fifo_size - sizeof(cmd->header)); 1297 cmd->header.size = cpu_to_le32(fifo_size - sizeof(cmd->header));
1298 ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd, 1298 ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd,
1299 fifo_size, 0, NULL); 1299 fifo_size, 0, NULL, NULL);
1300 1300
1301 if (unlikely(ret != 0)) 1301 if (unlikely(ret != 0))
1302 break; 1302 break;
@@ -1409,7 +1409,7 @@ int vmw_kms_readback(struct vmw_private *dev_priv,
1409 fifo_size = sizeof(*cmd) + sizeof(*blits) * blits_pos; 1409 fifo_size = sizeof(*cmd) + sizeof(*blits) * blits_pos;
1410 1410
1411 ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd, fifo_size, 1411 ret = vmw_execbuf_process(file_priv, dev_priv, NULL, cmd, fifo_size,
1412 0, user_fence_rep); 1412 0, user_fence_rep, NULL);
1413 1413
1414 kfree(cmd); 1414 kfree(cmd);
1415 1415