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

Commit b6c049ce authored by Alan Kwong's avatar Alan Kwong
Browse files

msm: sde: add query for max line width supported by rotator



Maximum line width is used by client to determine the maximum
input image width for rotator. Add query support for maximum
line width supported by rotator. The value of maximum line
width can be overridden in device tree.

CRs-Fixed: 2009714
Change-Id: I8d1a04560f108ddc5b4726646333339500ba80b6
Signed-off-by: default avatarAlan Kwong <akwong@codeaurora.org>
parent cdb2f282
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ Optional properties
- qcom,mdss-rot-mode:		This is integer value indicates operation mode
				of the rotator device
- qcom,mdss-sbuf-headroom:	This integer value indicates stream buffer headroom in lines.
- qcom,mdss-rot-linewidth:	This integer value indicates rotator line width supported in pixels.
- cache-slice-names:		A set of names that identify the usecase names of a client that uses
				cache slice. These strings are used to look up the cache slice
				entries by name.
+9 −0
Original line number Diff line number Diff line
@@ -459,6 +459,7 @@ struct sde_rot_mgr {
			bool input);
	int (*ops_hw_get_downscale_caps)(struct sde_rot_mgr *mgr, char *caps,
			int len);
	int (*ops_hw_get_maxlinewidth)(struct sde_rot_mgr *mgr);

	void *hw_data;
};
@@ -490,6 +491,14 @@ static inline int sde_rotator_get_downscale_caps(struct sde_rot_mgr *mgr,
	return 0;
}

static inline int sde_rotator_get_maxlinewidth(struct sde_rot_mgr *mgr)
{
	if (mgr && mgr->ops_hw_get_maxlinewidth)
		return mgr->ops_hw_get_maxlinewidth(mgr);

	return 2048;
}

static inline int __compare_session_item_rect(
	struct sde_rotation_buf_info *s_rect,
	struct sde_rect *i_rect, uint32_t i_fmt, bool src)
+29 −0
Original line number Diff line number Diff line
@@ -1314,6 +1314,35 @@ int sde_rotator_inline_get_downscale_caps(struct platform_device *pdev,
}
EXPORT_SYMBOL(sde_rotator_inline_get_downscale_caps);

/*
 * sde_rotator_inline_get_maxlinewidth - get maximum line width of rotator
 * @pdev: Pointer to platform device
 * return: maximum line width
 */
int sde_rotator_inline_get_maxlinewidth(struct platform_device *pdev)
{
	struct sde_rotator_device *rot_dev;
	int maxlinewidth;

	if (!pdev) {
		SDEROT_ERR("invalid platform device\n");
		return -EINVAL;
	}

	rot_dev = (struct sde_rotator_device *)platform_get_drvdata(pdev);
	if (!rot_dev || !rot_dev->mgr) {
		SDEROT_ERR("invalid rotator device\n");
		return -EINVAL;
	}

	sde_rot_mgr_lock(rot_dev->mgr);
	maxlinewidth = sde_rotator_get_maxlinewidth(rot_dev->mgr);
	sde_rot_mgr_unlock(rot_dev->mgr);

	return maxlinewidth;
}
EXPORT_SYMBOL(sde_rotator_inline_get_maxlinewidth);

/*
 * sde_rotator_inline_get_pixfmt_caps - get pixel format capability
 * @pdev: Pointer to platform device
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ int sde_rotator_inline_get_dst_pixfmt(struct platform_device *pdev,
		u32 src_pixfmt, u32 *dst_pixfmt);
int sde_rotator_inline_get_downscale_caps(struct platform_device *pdev,
		char *downscale_caps, int len);
int sde_rotator_inline_get_maxlinewidth(struct platform_device *pdev);
int sde_rotator_inline_get_pixfmt_caps(struct platform_device *pdev,
		bool input, u32 *pixfmt, int len);
int sde_rotator_inline_commit(void *handle, struct sde_rotator_inline_cmd *cmd,
+45 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@
#define DEFAULT_UBWC_MALSIZE	1
#define DEFAULT_UBWC_SWIZZLE	1

#define DEFAULT_MAXLINEWIDTH	4096

/* Macro for constructing the REGDMA command */
#define SDE_REGDMA_WRITE(p, off, data) \
	do { \
@@ -2457,11 +2459,24 @@ static int sde_hw_rotator_validate_entry(struct sde_rot_mgr *mgr,
		struct sde_rot_entry *entry)
{
	struct sde_rot_data_type *mdata = sde_rot_get_mdata();
	struct sde_hw_rotator *hw_data;
	int ret = 0;
	u16 src_w, src_h, dst_w, dst_h;
	struct sde_rotation_item *item = &entry->item;
	struct sde_mdp_format_params *fmt;

	if (!mgr || !entry || !mgr->hw_data) {
		SDEROT_ERR("invalid parameters\n");
		return -EINVAL;
	}

	hw_data = mgr->hw_data;

	if (hw_data->maxlinewidth < item->src_rect.w) {
		SDEROT_ERR("invalid src width %u\n", item->src_rect.w);
		return -EINVAL;
	}

	src_w = item->src_rect.w;
	src_h = item->src_rect.h;

@@ -2755,6 +2770,25 @@ static int sde_hw_rotator_get_downscale_caps(struct sde_rot_mgr *mgr,
	return rc;
}

/*
 * sde_hw_rotator_get_maxlinewidth - get maximum line width supported
 * @mgr: Pointer to rotator manager
 * return: maximum line width supported by hardware
 */
static int sde_hw_rotator_get_maxlinewidth(struct sde_rot_mgr *mgr)
{
	struct sde_hw_rotator *rot;

	if (!mgr || !mgr->hw_data) {
		SDEROT_ERR("null parameters\n");
		return -EINVAL;
	}

	rot = mgr->hw_data;

	return rot->maxlinewidth;
}

/*
 * sde_hw_rotator_parse_dt - parse r3 specific device tree settings
 * @hw_data: Pointer to rotator hw
@@ -2824,6 +2858,16 @@ static int sde_hw_rotator_parse_dt(struct sde_hw_rotator *hw_data,
		hw_data->sbuf_headroom = data;
	}

	ret = of_property_read_u32(dev->dev.of_node,
			"qcom,mdss-rot-linewidth", &data);
	if (ret) {
		ret = 0;
		hw_data->maxlinewidth = DEFAULT_MAXLINEWIDTH;
	} else {
		SDEROT_DBG("set mdss-rot-linewidth to %d\n", data);
		hw_data->maxlinewidth = data;
	}

	return ret;
}

@@ -2871,6 +2915,7 @@ int sde_rotator_r3_init(struct sde_rot_mgr *mgr)
	mgr->ops_hw_pre_pmevent = sde_hw_rotator_pre_pmevent;
	mgr->ops_hw_post_pmevent = sde_hw_rotator_post_pmevent;
	mgr->ops_hw_get_downscale_caps = sde_hw_rotator_get_downscale_caps;
	mgr->ops_hw_get_maxlinewidth = sde_hw_rotator_get_maxlinewidth;

	ret = sde_hw_rotator_parse_dt(mgr->hw_data, mgr->pdev);
	if (ret)
Loading