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

Commit 2076cb5e authored by Mayank Chopra's avatar Mayank Chopra
Browse files

msm: mdss: Check extra mmb allocated to a pipe



If set call to a pipe changes smp configuration such that
calculated no. of  mmb blocks are less than allocated mmb
blocks, fail this set call. This ensures pipe disconnection
and smp configuration is possible in next commit cycle.
Also, check that no extra mmb is left allocated to any plane
when pipe's format changes. If so, fail the set call to let
correct smp configuration happen in next commit cycle.

Change-Id: Iec2b8cb18088587655cf0c68dc81e3ac7b819cbc
Signed-off-by: default avatarMayank Chopra <makchopra@codeaurora.org>
parent baf64b5d
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -611,12 +611,6 @@ static int mdss_mdp_overlay_pipe_setup(struct msm_fb_data_type *mfd,
		!mdp5_data->mdata->has_wfd_blk)
		mdss_mdp_smp_release(pipe);

	/*
	 * Clear previous SMP reservations and reserve according to the
	 * latest configuration
	 */
	mdss_mdp_smp_unreserve(pipe);

	ret = mdss_mdp_smp_reserve(pipe);
	if (ret) {
		pr_debug("mdss_mdp_smp_reserve failed. ret=%d\n", ret);
+32 −2
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ static DEFINE_MUTEX(mdss_mdp_sspp_lock);
static DEFINE_MUTEX(mdss_mdp_smp_lock);

static int mdss_mdp_pipe_free(struct mdss_mdp_pipe *pipe);
static int mdss_mdp_smp_mmb_set(int client_id, unsigned long *smp);
static void mdss_mdp_smp_mmb_free(unsigned long *smp, bool write);
static struct mdss_mdp_pipe *mdss_mdp_pipe_search_by_client_id(
	struct mdss_data_type *mdata, int client_id);

@@ -58,8 +60,27 @@ static u32 mdss_mdp_smp_mmb_reserve(struct mdss_mdp_pipe_smp_map *smp_map,
	else
		n -= fixed_cnt;

	/* reserve more blocks if needed, but can't free mmb at this point */
	for (i = bitmap_weight(smp_map->allocated, SMP_MB_CNT); i < n; i++) {
	i = bitmap_weight(smp_map->allocated, SMP_MB_CNT);

	/*
	 * SMP programming is not double buffered. Fail the request,
	 * that calls for change in smp configuration (addition/removal
	 * of smp blocks), so that fallback solution happens.
	 */
	if (i != 0 && n != i) {
		pr_debug("Can't change mmb config, num_blks: %d alloc: %d\n",
			n, i);
		return 0;
	}

	/*
	 * Clear previous SMP reservations and reserve according to the
	 * latest configuration
	 */
	mdss_mdp_smp_mmb_free(smp_map->reserved, false);

	/* Reserve mmb blocks*/
	for (; i < n; i++) {
		if (bitmap_full(mdata->mmb_alloc_map, SMP_MB_CNT))
			break;

@@ -280,6 +301,15 @@ int mdss_mdp_smp_reserve(struct mdss_mdp_pipe *pipe)
		wb_mixer = 1;

	mutex_lock(&mdss_mdp_smp_lock);
	for (i = (MAX_PLANES - 1); i >= ps.num_planes; i--) {
		if (bitmap_weight(pipe->smp_map[i].allocated, SMP_MB_CNT)) {
			pr_debug("Extra mmb identified for pnum=%d plane=%d\n",
				pipe->num, i);
			mutex_unlock(&mdss_mdp_smp_lock);
			return -EAGAIN;
		}
	}

	for (i = 0; i < ps.num_planes; i++) {
		if (rot_mode || wb_mixer) {
			num_blks = 1;
+0 −6
Original line number Diff line number Diff line
@@ -224,12 +224,6 @@ static int __mdss_mdp_rotator_to_pipe(struct mdss_mdp_rotator_session *rot,
	pipe->params_changed++;
	rot->params_changed = 0;

	/*
	 * Clear previous SMP reservations and reserve according
	 * to the latest configuration
	 */
	mdss_mdp_smp_unreserve(pipe);

	ret = mdss_mdp_smp_reserve(pipe);
	if (ret) {
		pr_err("unable to mdss_mdp_smp_reserve rot data\n");