summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2008-03-30 15:14:45 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2008-03-30 15:14:45 +0200
commit1f4ba62567d32fdd32786273326e1aab17d5d412 (patch)
tree761e1021ca71af286fa9e9c8d0cd527e7b93d797
parentb8567bafff58cfb9d77145088fd5b8ad2e5cde6b (diff)
[i915] Report buffer state _after_ fence submission to user-space.
This fixes a problem where the wrong bo->fence_type was reported, and also saves some memory space. [bo core] export the drm_bo_fill_rep_arg function.
-rw-r--r--linux-core/drm_bo.c5
-rw-r--r--linux-core/drm_objects.h2
-rw-r--r--linux-core/i915_execbuf.c10
3 files changed, 11 insertions, 6 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index a94bd8a1..144935d6 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -1163,8 +1163,8 @@ static int drm_bo_wait_unfenced(struct drm_buffer_object *bo, int no_wait,
* Bo locked.
*/
-static void drm_bo_fill_rep_arg(struct drm_buffer_object *bo,
- struct drm_bo_info_rep *rep)
+void drm_bo_fill_rep_arg(struct drm_buffer_object *bo,
+ struct drm_bo_info_rep *rep)
{
if (!rep)
return;
@@ -1195,6 +1195,7 @@ static void drm_bo_fill_rep_arg(struct drm_buffer_object *bo,
DRM_BO_REP_BUSY);
}
}
+EXPORT_SYMBOL(drm_bo_fill_rep_arg);
/*
* Wait for buffer idle and register that we've mapped the buffer.
diff --git a/linux-core/drm_objects.h b/linux-core/drm_objects.h
index 69e3f67f..1f5d6ee2 100644
--- a/linux-core/drm_objects.h
+++ b/linux-core/drm_objects.h
@@ -746,6 +746,8 @@ extern int drm_bo_pfn_prot(struct drm_buffer_object *bo,
unsigned long dst_offset,
unsigned long *pfn,
pgprot_t *prot);
+extern void drm_bo_fill_rep_arg(struct drm_buffer_object *bo,
+ struct drm_bo_info_rep *rep);
/*
diff --git a/linux-core/i915_execbuf.c b/linux-core/i915_execbuf.c
index ae4a6121..729ee0c3 100644
--- a/linux-core/i915_execbuf.c
+++ b/linux-core/i915_execbuf.c
@@ -64,7 +64,6 @@ struct i915_relocatee_info {
struct drm_i915_validate_buffer {
struct drm_buffer_object *buffer;
- struct drm_bo_info_rep rep;
int presumed_offset_correct;
void __user *data;
int ret;
@@ -686,7 +685,7 @@ int i915_validate_buffer_list(struct drm_file *file_priv,
req->bo_req.flags,
req->bo_req.mask, req->bo_req.hint,
req->bo_req.fence_class, 0,
- &item->rep, &item->buffer);
+ NULL, &item->buffer);
if (ret) {
DRM_ERROR("error on handle validate %d\n", ret);
goto out_err;
@@ -725,6 +724,7 @@ static int i915_handle_copyback(struct drm_device *dev,
int err = ret;
int i;
struct drm_i915_op_arg arg;
+ struct drm_buffer_object *bo;
if (ret)
drm_putback_buffer_objects(dev);
@@ -733,7 +733,10 @@ static int i915_handle_copyback(struct drm_device *dev,
for (i = 0; i < num_buffers; ++i) {
arg.handled = 1;
arg.d.rep.ret = buffers->ret;
- arg.d.rep.bo_info = buffers->rep;
+ bo = buffers->buffer;
+ mutex_lock(&bo->mutex);
+ drm_bo_fill_rep_arg(bo, &arg.d.rep.bo_info);
+ mutex_unlock(&bo->mutex);
if (__copy_to_user(buffers->data, &arg, sizeof(arg)))
err = -EFAULT;
buffers++;
@@ -780,7 +783,6 @@ void i915_fence_or_sync(struct drm_file *file_priv,
fence_arg->handle = ~0;
fence_arg->error = ret;
}
-
drm_putback_buffer_objects(dev);
if (fence_p)
*fence_p = NULL;