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

Commit 78a04ed7 authored by Clarence Ip's avatar Clarence Ip Committed by Narendra Muppalla
Browse files

drm/msm/sde: additional event logging for fences



Add event logs for plane input fences to facilitate debugging.

Change-Id: I47d4c98ccd14847b3aaf675414e5809a424b6a9d
Signed-off-by: default avatarClarence Ip <cip@codeaurora.org>
parent c47a0691
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -35,6 +35,22 @@ int sde_sync_wait(void *fence, long timeout_ms)
	return sync_fence_wait(fence, timeout_ms);
}

uint32_t sde_sync_get_name_prefix(void *fence)
{
	char *name;
	uint32_t i, prefix;

	if (!fence)
		return 0x0;

	name = ((struct sync_fence *)fence)->name;
	prefix = 0x0;
	for (i = 0; i < sizeof(uint32_t) && name[i]; ++i)
		prefix = (prefix << CHAR_BIT) | name[i];

	return prefix;
}

#if IS_ENABLED(CONFIG_SW_SYNC)
/**
 * _sde_fence_create_fd - create fence object and return an fd for it
@@ -197,10 +213,6 @@ void sde_fence_signal(struct sde_fence *fence, bool is_error)
	else
		SDE_ERROR("detected extra signal attempt!\n");

	MSM_EVTMSG(fence->dev,
			SDE_FENCE_TIMELINE_NAME(fence),
			fence->done_count,
			is_error);
	/*
	 * Always advance 'done' counter,
	 * but only advance timeline if !error
@@ -216,6 +228,11 @@ void sde_fence_signal(struct sde_fence *fence, bool is_error)
		else
			sw_sync_timeline_inc(fence->timeline, (int)val);
	}
	MSM_EVTMSG(fence->dev,
			SDE_FENCE_TIMELINE_NAME(fence),
			fence->done_count,
			((struct sw_sync_timeline *)
				fence->timeline)->value);
	mutex_unlock(&fence->fence_lock);
}
#endif
+18 −0
Original line number Diff line number Diff line
@@ -17,6 +17,10 @@
#include <linux/errno.h>
#include <linux/mutex.h>

#ifndef CHAR_BIT
#define CHAR_BIT 8 /* define this if limits.h not available */
#endif

#ifdef CONFIG_SYNC
/**
 * sde_sync_get - Query sync fence object from a file handle
@@ -48,6 +52,15 @@ void sde_sync_put(void *fence);
 * Return: Zero on success, or -ETIME on timeout
 */
int sde_sync_wait(void *fence, long timeout_ms);

/**
 * sde_sync_get_name_prefix - get integer representation of fence name prefix
 * @fence: Pointer to opaque fence structure
 *
 * Return: 32-bit integer containing first 4 characters of fence name,
 *         big-endian notation
 */
uint32_t sde_sync_get_name_prefix(void *fence);
#else
static inline void *sde_sync_get(uint64_t fd)
{
@@ -62,6 +75,11 @@ static inline int sde_sync_wait(void *fence, long timeout_ms)
{
	return 0;
}

static inline uint32_t sde_sync_get_name_prefix(void *fence)
{
	return 0x0;
}
#endif

/**
+12 −3
Original line number Diff line number Diff line
@@ -501,6 +501,7 @@ int sde_plane_wait_input_fence(struct drm_plane *plane, uint32_t wait_ms)
{
	struct sde_plane *psde;
	struct sde_plane_state *pstate;
	uint32_t prefix;
	void *input_fence;
	int ret = -EINVAL;

@@ -514,18 +515,26 @@ int sde_plane_wait_input_fence(struct drm_plane *plane, uint32_t wait_ms)
		input_fence = pstate->input_fence;

		if (input_fence) {
			prefix = sde_sync_get_name_prefix(input_fence);
			ret = sde_sync_wait(input_fence, wait_ms);

			MSM_EVT(plane->dev,
				plane->base.id,
				(uint64_t)-ret << (sizeof(uint32_t) * CHAR_BIT)
				| prefix);

			switch (ret) {
			case 0:
				SDE_DEBUG_PLANE(psde, "signaled\n");
				break;
			case -ETIME:
				SDE_ERROR_PLANE(psde, "timeout, %ums\n",
						wait_ms);
				SDE_ERROR_PLANE(psde, "%ums timeout on %08X\n",
						wait_ms, prefix);
				psde->is_error = true;
				break;
			default:
				SDE_ERROR_PLANE(psde, "error, %d\n", ret);
				SDE_ERROR_PLANE(psde, "error %d on %08X\n",
						ret, prefix);
				psde->is_error = true;
				break;
			}