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

Commit ce985f7e authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge c27837e4 on remote branch

Change-Id: Ibca4403f13143e4bf46d377066190fbe77a34872
parents f2ac2931 c27837e4
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -13,7 +13,10 @@ display_headers_out = [
display_kernel_headers_verbose = "--verbose "
genrule {
    name: "qti_generate_display_kernel_headers",
    tools: ["headers_install.sh"],
    tools: [
        "headers_install.sh",
        "unifdef"
    ],
    tool_files: [
        "display_kernel_headers.py",
    ],
@@ -23,6 +26,7 @@ genrule {
         "--header_arch arm64 " +
         "--gen_dir $(genDir) " +
         "--display_include_uapi $(locations include/uapi/*/**/*.h) " +
         "--unifdef $(location unifdef) " +
         "--headers_install $(location headers_install.sh)",
    out: display_headers_out,
}
+12 −5
Original line number Diff line number Diff line
@@ -18,31 +18,33 @@ import re
import subprocess
import sys

def run_headers_install(verbose, gen_dir, headers_install, prefix, h):
def run_headers_install(verbose, gen_dir, headers_install, unifdef, prefix, h):
    if not h.startswith(prefix):
        print('error: expected prefix [%s] on header [%s]' % (prefix, h))
        return False

    out_h = os.path.join(gen_dir, h[len(prefix):])
    (out_h_dirname, out_h_basename) = os.path.split(out_h)
    env = os.environ.copy()
    env["LOC_UNIFDEF"] = unifdef
    cmd = ["sh", headers_install, h, out_h]

    if verbose:
        print('run_headers_install: cmd is %s' % cmd)

    result = subprocess.call(cmd)
    result = subprocess.call(cmd, env=env)

    if result != 0:
        print('error: run_headers_install: cmd %s failed %d' % (cmd, result))
        return False
    return True

def gen_display_headers(verbose, gen_dir, headers_install, display_include_uapi):
def gen_display_headers(verbose, gen_dir, headers_install, unifdef, display_include_uapi):
    error_count = 0
    for h in display_include_uapi:
        display_uapi_include_prefix = os.path.join(h.split('/include/uapi')[0], 'include', 'uapi') + os.sep
        if not run_headers_install(
                verbose, gen_dir, headers_install,
                verbose, gen_dir, headers_install, unifdef,
                display_uapi_include_prefix, h): error_count += 1
    return error_count

@@ -68,6 +70,10 @@ def main():
    parser.add_argument(
            '--headers_install', required=True,
            help='The headers_install tool to process input headers.')
    parser.add_argument(
              '--unifdef',
              required=True,
              help='The unifdef tool used by headers_install.')

    args = parser.parse_args()

@@ -76,9 +82,10 @@ def main():
        print('gen_dir [%s]' % args.gen_dir)
        print('display_include_uapi [%s]' % args.display_include_uapi)
        print('headers_install [%s]' % args.headers_install)
        print('unifdef [%s]' % args.unifdef)

    return gen_display_headers(args.verbose, args.gen_dir,
            args.headers_install, args.display_include_uapi)
            args.headers_install, args.unifdef, args.display_include_uapi)

if __name__ == '__main__':
    sys.exit(main())
+27 −66
Original line number Diff line number Diff line
@@ -2709,55 +2709,6 @@ static int dp_display_validate_pixel_clock(struct dp_display_mode dp_mode,
	return 0;
}

static int dp_display_validate_mixers(struct msm_drm_private *priv,
		struct drm_display_mode *mode,
		const struct msm_resource_caps_info *avail_res)
{
	int rc;
	u32 num_lm = 0;

	rc = msm_get_mixer_count(priv, mode, avail_res, &num_lm);
	if (rc) {
		DP_ERR("error getting mixer count. rc:%d\n", rc);
		return rc;
	}

	if (num_lm > avail_res->num_lm) {
		DP_DEBUG("num lm:%d > available lm:%d\n", num_lm,
				avail_res->num_lm);
		return -EPERM;
	}

	return 0;
}

static int dp_display_validate_dscs(struct msm_drm_private *priv,
		struct dp_panel *dp_panel, struct drm_display_mode *mode,
		struct dp_display_mode *dp_mode,
		const struct msm_resource_caps_info *avail_res)
{
	int rc;
	u32 num_dsc = 0;
	bool dsc_capable = dp_mode->capabilities & DP_PANEL_CAPS_DSC;

	if (!dp_panel->dsc_en || !dsc_capable)
		return 0;

	rc = msm_get_dsc_count(priv, mode->hdisplay, &num_dsc);
	if (rc) {
		DP_ERR("error getting dsc count. rc:%d\n", rc);
		return rc;
	}

	if (num_dsc > avail_res->num_dsc) {
		DP_DEBUG("num dsc:%d > available dsc:%d\n", num_dsc,
				avail_res->num_dsc);
		return -EPERM;
	}

	return 0;
}

static int dp_display_validate_topology(struct dp_display_private *dp,
		struct dp_panel *dp_panel, struct drm_display_mode *mode,
		struct dp_display_mode *dp_mode,
@@ -2765,9 +2716,10 @@ static int dp_display_validate_topology(struct dp_display_private *dp,
{
	int rc;
	struct msm_drm_private *priv = dp->priv;
	const u32 dual_lm = 2, quad_lm = 4;
	const u32 dual = 2, quad = 4;
	u32 num_lm = 0, num_dsc = 0, num_3dmux = 0;
	bool dsc_capable = dp_mode->capabilities & DP_PANEL_CAPS_DSC;
	u32 fps = dp_mode->timing.refresh_rate;

	rc = msm_get_mixer_count(priv, mode, avail_res, &num_lm);
	if (rc) {
@@ -2775,24 +2727,42 @@ static int dp_display_validate_topology(struct dp_display_private *dp,
		return rc;
	}

	num_3dmux = avail_res->num_3dmux;

	/* Merge using DSC, if enabled */
	if (dp_panel->dsc_en && dsc_capable) {
		rc = msm_get_dsc_count(priv, mode->hdisplay, &num_dsc);
		if (rc) {
			DP_ERR("error getting dsc count. rc:%d\n", rc);
			return rc;
		}

		/* Only DSCMERGE is supported on DP */
		num_lm  = max(num_lm, num_dsc);
		num_dsc = max(num_lm, num_dsc);
	} else {
		num_3dmux = avail_res->num_3dmux;
	}

	/* filter out unsupported DP topologies */
	if ((num_lm == dual_lm && (!num_3dmux && !num_dsc)) ||
			(num_lm == quad_lm && (num_dsc != 4))) {
		DP_DEBUG("invalid topology lm:%d dsc:%d 3dmux:%d intf:1\n",
				num_lm, num_dsc, num_3dmux);
	if (num_lm > avail_res->num_lm) {
		DP_DEBUG("mode %sx%d is invalid, not enough lm %d %d\n",
				mode->name, fps, num_lm, num_lm, avail_res->num_lm);
		return -EPERM;
	} else if (num_dsc > avail_res->num_dsc) {
		DP_DEBUG("mode %sx%d is invalid, not enough dsc %d %d\n",
				mode->name, fps, num_dsc, avail_res->num_dsc);
		return -EPERM;
	} else if (!num_dsc && (num_lm == dual && !num_3dmux)) {
		DP_DEBUG("mode %sx%d is invalid, not enough 3dmux %d %d\n",
				mode->name, fps, num_3dmux, avail_res->num_3dmux);
		return -EPERM;
	} else if (num_lm == quad && num_dsc != quad)  {
		DP_DEBUG("mode %sx%d is invalid, unsupported DP topology lm:%d dsc:%d\n",
				mode->name, fps, num_lm, num_dsc);
		return -EPERM;
	}

	DP_DEBUG("mode %sx%d is valid, supported DP topology lm:%d dsc:%d 3dmux:%d\n",
				mode->name, fps, num_lm, num_dsc, num_3dmux);

	return 0;
}

@@ -2905,15 +2875,6 @@ static enum drm_mode_status dp_display_validate_mode(
	if (rc)
		goto end;

	rc = dp_display_validate_mixers(dp->priv, mode, avail_res);
	if (rc)
		goto end;

	rc = dp_display_validate_dscs(dp->priv, panel, mode, &dp_mode,
			avail_res);
	if (rc)
		goto end;

	rc = dp_display_validate_topology(dp, dp_panel, mode,
			&dp_mode, avail_res);
	if (rc)
+41 −1
Original line number Diff line number Diff line
@@ -1959,6 +1959,41 @@ static int sde_cp_crtc_set_pu_features(struct drm_crtc *crtc, bool *need_flush)
	return 0;
}

static void _sde_clear_ltm_merge_mode(struct sde_crtc *sde_crtc)
{
	u32 num_mixers = 0, i = 0;
	struct sde_hw_ctl *ctl = NULL;
	struct sde_hw_dspp *hw_dspp = NULL;
	unsigned long irq_flags;

	num_mixers = sde_crtc->num_mixers;
	if (!num_mixers) {
		DRM_ERROR("no mixers for this crtc\n");
		return;
	}

	spin_lock_irqsave(&sde_crtc->ltm_lock, irq_flags);
	if (!sde_crtc->ltm_merge_clear_pending) {
		spin_unlock_irqrestore(&sde_crtc->ltm_lock, irq_flags);
		return;
	}

	sde_cp_dspp_flush_helper(sde_crtc, SDE_CP_CRTC_DSPP_LTM_HIST_CTL);
	for (i = 0; i < num_mixers; i++) {
		hw_dspp = sde_crtc->mixers[i].hw_dspp;
		ctl = sde_crtc->mixers[i].hw_ctl;
		if (!hw_dspp || !ctl || i >= DSPP_MAX)
			continue;
		if (hw_dspp->ops.clear_ltm_merge_mode)
			hw_dspp->ops.clear_ltm_merge_mode(hw_dspp);
		if (ctl->ops.update_bitmask_dspp)
			ctl->ops.update_bitmask_dspp(ctl, hw_dspp->idx, 1);
	}

	sde_crtc->ltm_merge_clear_pending = false;
	spin_unlock_irqrestore(&sde_crtc->ltm_lock, irq_flags);
}

void sde_cp_crtc_apply_properties(struct drm_crtc *crtc)
{
	struct sde_crtc *sde_crtc = NULL;
@@ -1988,6 +2023,7 @@ void sde_cp_crtc_apply_properties(struct drm_crtc *crtc)
	}

	mutex_lock(&sde_crtc->crtc_cp_lock);
	_sde_clear_ltm_merge_mode(sde_crtc);

	if (list_empty(&sde_crtc->dirty_list) &&
			list_empty(&sde_crtc->ad_dirty) &&
@@ -2307,6 +2343,7 @@ void sde_cp_crtc_destroy_properties(struct drm_crtc *crtc)
	}
	sde_crtc->ltm_buffer_cnt = 0;
	sde_crtc->ltm_hist_en = false;
	sde_crtc->ltm_merge_clear_pending = false;
	sde_crtc->hist_irq_idx = -1;

	mutex_destroy(&sde_crtc->crtc_cp_lock);
@@ -2352,6 +2389,7 @@ void sde_cp_crtc_suspend(struct drm_crtc *crtc)

	spin_lock_irqsave(&sde_crtc->ltm_lock, irq_flags);
	sde_crtc->ltm_hist_en = false;
	sde_crtc->ltm_merge_clear_pending = false;
	spin_unlock_irqrestore(&sde_crtc->ltm_lock, irq_flags);

	if (ad_suspend)
@@ -2402,6 +2440,7 @@ void sde_cp_crtc_clear(struct drm_crtc *crtc)
	}
	sde_crtc->ltm_buffer_cnt = 0;
	sde_crtc->ltm_hist_en = false;
	sde_crtc->ltm_merge_clear_pending = false;
	sde_crtc->hist_irq_idx = -1;
	INIT_LIST_HEAD(&sde_crtc->ltm_buf_free);
	INIT_LIST_HEAD(&sde_crtc->ltm_buf_busy);
@@ -3791,6 +3830,7 @@ static void _sde_cp_crtc_disable_ltm_hist(struct sde_crtc *sde_crtc,

	spin_lock_irqsave(&sde_crtc->ltm_lock, irq_flags);
	sde_crtc->ltm_hist_en = false;
	sde_crtc->ltm_merge_clear_pending = true;
	INIT_LIST_HEAD(&sde_crtc->ltm_buf_free);
	INIT_LIST_HEAD(&sde_crtc->ltm_buf_busy);
	for (i = 0; i < sde_crtc->ltm_buffer_cnt; i++)
@@ -3862,7 +3902,7 @@ static void sde_cp_ltm_hist_interrupt_cb(void *arg, int irq_idx)
			hw_dspp->ops.setup_ltm_hist_ctrl(hw_dspp, NULL, false,
				0);
		}

		sde_crtc->ltm_merge_clear_pending = true;
		spin_unlock_irqrestore(&sde_crtc->ltm_lock, irq_flags);
		DRM_DEBUG_DRIVER("LTM histogram is disabled\n");
		return;
+3 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
 */

#define pr_fmt(fmt)	"[drm:%s:%d] " fmt, __func__, __LINE__
@@ -2571,6 +2571,8 @@ static int sde_connector_populate_mode_info(struct drm_connector *conn,
			continue;
		}

		sde_kms_info_add_keyint(info, "has_cwb_crop", sde_kms->catalog->has_cwb_crop);

		sde_kms_info_add_keyint(info, "mdp_transfer_time_us",
			mode_info.mdp_transfer_time_us);

Loading