diff options
author | Rob Clark <robdclark@gmail.com> | 2013-09-01 13:25:09 -0400 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2013-09-10 13:56:58 -0400 |
commit | bf6811f304795e7697985449ee870b29a8cbc6c7 (patch) | |
tree | 23e844ef2eb4887d6d8f939fc056ffa54b1cbcd7 /drivers/gpu/drm/msm/msm_gpu.c | |
parent | 86a7e1224a68511d3a1ae0b7e11581b9d37723ae (diff) | |
download | lwn-bf6811f304795e7697985449ee870b29a8cbc6c7.tar.gz lwn-bf6811f304795e7697985449ee870b29a8cbc6c7.zip |
drm/msm: handle read vs write fences
The userspace API already had everything needed to handle read vs write
synchronization. This patch actually bothers to hook it up properly, so
that we don't need to (for example) stall on userspace read access to a
buffer that gpu is also still reading.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_gpu.c')
-rw-r--r-- | drivers/gpu/drm/msm/msm_gpu.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index e1e1ec9321ff..cb9cdffdc41f 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -265,7 +265,8 @@ static void retire_worker(struct work_struct *work) obj = list_first_entry(&gpu->active_list, struct msm_gem_object, mm_list); - if (obj->fence <= fence) { + if ((obj->read_fence <= fence) && + (obj->write_fence <= fence)) { /* move to inactive: */ msm_gem_move_to_inactive(&obj->base); msm_gem_put_iova(&obj->base, gpu->id); @@ -321,7 +322,11 @@ int msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit, submit->gpu->id, &iova); } - msm_gem_move_to_active(&msm_obj->base, gpu, submit->fence); + if (submit->bos[i].flags & MSM_SUBMIT_BO_READ) + msm_gem_move_to_active(&msm_obj->base, gpu, false, submit->fence); + + if (submit->bos[i].flags & MSM_SUBMIT_BO_WRITE) + msm_gem_move_to_active(&msm_obj->base, gpu, true, submit->fence); } hangcheck_timer_reset(gpu); mutex_unlock(&dev->struct_mutex); |