Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f699c5ad authored by Kasin Li's avatar Kasin Li Committed by Gerrit - the friendly Code Review server
Browse files

drm/msm: Rename r/w_fence in GEM to _timestamp



It seems timestamp is better than fence in GEM object.
And in future the user generated timestamp will store here.

Change-Id: I0dba02c94c82658a80bf20bb5667329634cfa245
Signed-off-by: default avatarYajun Li <yajunl@codeaurora.org>
Signed-off-by: default avatarKasin Li <donglil@codeaurora.org>
parent c8616d27
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -552,9 +552,9 @@ void msm_gem_move_to_active(struct drm_gem_object *obj,

	msm_obj->gpu = gpu;
	if (write)
		msm_obj->write_fence = fence;
		msm_obj->write_timestamp = fence;
	else
		msm_obj->read_fence = fence;
		msm_obj->read_timestamp = fence;
	list_del_init(&msm_obj->mm_list);
	list_add_tail(&msm_obj->mm_list, &gpu->active_list);
}
@@ -568,8 +568,8 @@ void msm_gem_move_to_inactive(struct drm_gem_object *obj)
	WARN_ON(!mutex_is_locked(&dev->struct_mutex));

	msm_obj->gpu = NULL;
	msm_obj->read_fence = 0;
	msm_obj->write_fence = 0;
	msm_obj->read_timestamp = 0;
	msm_obj->write_timestamp = 0;
	list_del_init(&msm_obj->mm_list);
	list_add_tail(&msm_obj->mm_list, &priv->inactive_list);
}
@@ -610,7 +610,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m)
	WARN_ON(!mutex_is_locked(&dev->struct_mutex));
	seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %zu\n",
			msm_obj->flags, is_active(msm_obj) ? 'A' : 'I',
			msm_obj->read_fence, msm_obj->write_fence,
			msm_obj->read_timestamp, msm_obj->write_timestamp,
			obj->name, obj->refcount.refcount.counter,
			off, msm_obj->vaddr, obj->size);
}
+7 −3
Original line number Diff line number Diff line
@@ -34,6 +34,11 @@ struct msm_gem_object {
	struct msm_gem_buf *buf;
	uint32_t flags;


	/* global timestamp */
	uint32_t read_timestamp;
	uint32_t write_timestamp;

	/* And object is either:
	 *  inactive - on priv->inactive_list
	 *  active   - on one one of the gpu's active_list..  well, at
@@ -44,7 +49,6 @@ struct msm_gem_object {
	 */
	struct list_head mm_list;
	struct msm_gpu *gpu;     /* non-null if active */
	uint32_t read_fence, write_fence;

	/* Transiently in the process of submit ioctl, objects associated
	 * with the submit are on submit->bo_list.. this only lasts for
@@ -85,9 +89,9 @@ static inline uint32_t msm_gem_fence(struct msm_gem_object *msm_obj,

	mutex_lock(&dev->struct_mutex);
	if (op & MSM_PREP_READ)
		fence = msm_obj->write_fence;
		fence = msm_obj->write_timestamp;
	if (op & MSM_PREP_WRITE)
		fence = max(fence, msm_obj->read_fence);
		fence = max(fence, msm_obj->read_timestamp);
	mutex_unlock(&dev->struct_mutex);

	return fence;
+10 −2
Original line number Diff line number Diff line
@@ -452,11 +452,19 @@ static void retire_submits(struct msm_gpu *gpu, uint32_t fence)
	}
}

static inline uint32_t get_retired_timestamp(struct msm_gpu *gpu)
{
	/* For global timestamp, the last retired timestamp
	 * is the fence of recently completed GPU commands. */
	return gpu->funcs->last_fence(gpu);
}

static void retire_worker(struct work_struct *work)
{
	struct msm_gpu *gpu = container_of(work, struct msm_gpu, retire_work);
	struct drm_device *dev = gpu->dev;
	uint32_t fence = gpu->funcs->last_fence(gpu);
	uint32_t retired_timestamp = get_retired_timestamp(gpu);

	msm_update_fence(gpu->dev, fence);

@@ -470,8 +478,8 @@ static void retire_worker(struct work_struct *work)
		obj = list_first_entry(&gpu->active_list,
				struct msm_gem_object, mm_list);

		if ((obj->read_fence <= fence) &&
				(obj->write_fence <= fence)) {
		if ((obj->read_timestamp <= retired_timestamp) &&
				(obj->write_timestamp <= retired_timestamp)) {
			/* move to inactive: */
			msm_gem_move_to_inactive(&obj->base);
			msm_gem_put_iova(&obj->base, gpu->id);