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

Commit 4e713799 authored by Steve Cohen's avatar Steve Cohen
Browse files

drm/msm/sde: check dynamic metadata header and adjust payload



Validate the VSIF type code in the dynamic metadata payload and
adjust the payload data programmed in the memory pool to align
with the Infoframe SDP v1.3 VSIF packet type. Also reduce the
size of the static array used for caching payloads.

Change-Id: I33a7ace913c9903aeb02677722973edb2fc2739c
Signed-off-by: default avatarSteve Cohen <cohens@codeaurora.org>
parent 28dc3885
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include "sde_rm.h"

#define BL_NODE_NAME_SIZE 32
#define HDR10_PLUS_VSIF_TYPE_CODE      0x81

/* Autorefresh will occur after FRAME_CNT frames. Large values are unlikely */
#define AUTOREFRESH_MAX_FRAME_CNT 6
@@ -1151,6 +1152,14 @@ static int _sde_connector_set_ext_hdr_info(
		goto end;
	}

	/* verify 1st header byte, programmed in DP Infoframe SDP header */
	if (payload_size < 1 || (payload[0] != HDR10_PLUS_VSIF_TYPE_CODE)) {
		SDE_ERROR_CONN(c_conn, "invalid payload detected, size: %d\n",
				payload_size);
		rc = -EINVAL;
		goto end;
	}

	c_state->dyn_hdr_meta.dynamic_hdr_update = true;

skip_dhdr:
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
#include "sde_fence.h"

#define SDE_CONNECTOR_NAME_SIZE	16
#define SDE_CONNECTOR_DHDR_MEMPOOL_MAX_SIZE	SZ_2K
#define SDE_CONNECTOR_DHDR_MEMPOOL_MAX_SIZE	SZ_32

struct sde_connector;
struct sde_connector_state;
+13 −19
Original line number Diff line number Diff line
@@ -467,9 +467,9 @@ static void sde_hw_program_cwb_ppb_ctrl(struct sde_hw_mdp *mdp,
static void sde_hw_set_hdr_plus_metadata(struct sde_hw_mdp *mdp,
		u8 *payload, u32 len, u32 stream_id)
{
	u32 num_dwords, rem, i, tmp;
	u32 *payload_32;
	u32 offset = 0, byte_idx = 0;
	u32 i;
	size_t length = len - 1;
	u32 offset = 0, data = 0, byte_idx = 0;
	const u32 dword_size = sizeof(u32);

	if (!payload || !len) {
@@ -480,25 +480,19 @@ static void sde_hw_set_hdr_plus_metadata(struct sde_hw_mdp *mdp,
	if (stream_id)
		offset = DP_DHDR_MEM_POOL_1_DATA - DP_DHDR_MEM_POOL_0_DATA;

	num_dwords = len / dword_size;
	rem = len % dword_size;

	SDE_REG_WRITE(&mdp->hw, DP_DHDR_MEM_POOL_0_NUM_BYTES + offset, len);

	for (i = 0; i < num_dwords; i++) {
		payload_32 = (u32 *) &payload[byte_idx];
		SDE_REG_WRITE(&mdp->hw, DP_DHDR_MEM_POOL_0_DATA + offset,
				*payload_32);
		byte_idx += dword_size;
	/* payload[0] is set in VSCEXT header byte 1, skip programming here */
	SDE_REG_WRITE(&mdp->hw, DP_DHDR_MEM_POOL_0_NUM_BYTES + offset, length);
	for (i = 1; i < len; i++) {
		if (byte_idx && !(byte_idx % dword_size)) {
			SDE_REG_WRITE(&mdp->hw, DP_DHDR_MEM_POOL_0_DATA +
				offset, data);
			data = 0;
		}

	if (rem) {
		tmp = payload[byte_idx++];
		for (i = 1; i < rem; i++)
			tmp |= payload[byte_idx++] << (8 * i);

		SDE_REG_WRITE(&mdp->hw, DP_DHDR_MEM_POOL_0_DATA + offset, tmp);
		data |= payload[i] << (8 * (byte_idx++ % dword_size));
	}

	SDE_REG_WRITE(&mdp->hw, DP_DHDR_MEM_POOL_0_DATA + offset, data);
}

static void _setup_mdp_ops(struct sde_hw_mdp_ops *ops,