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

Commit e7aaa400 authored by Sultan Alsawaf's avatar Sultan Alsawaf Committed by Razziell
Browse files

msm: mdss: Speed up mdss_mdp_get_format_params for UBWC formats



In mdss_mdp_get_format_params, a very large array (mdss_mdp_format_map)
is scanned for a requested format first, and then when the format is
not found in the large array, a small array (mdss_mdp_format_ubwc_map)
is scanned for the requested format. This results in significant
overhead from needlessly scanning the large array for UBWC formats.

To fix this, scan the much-smaller mdss_mdp_format_ubwc_map array first
to search for a requested format.

Signed-off-by: default avatarSultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: default avatarZile995 <stefan.zivkovic995@gmail.com>
parent 77560ffa
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -158,8 +158,8 @@ struct mdss_mdp_format_params *mdss_mdp_get_format_params(u32 format)
	int i;
	bool fmt_found = false;

	for (i = 0; i < ARRAY_SIZE(mdss_mdp_format_map); i++) {
		fmt = &mdss_mdp_format_map[i];
	for (i = 0; i < ARRAY_SIZE(mdss_mdp_format_ubwc_map); i++) {
		fmt = &mdss_mdp_format_ubwc_map[i].mdp_format;
		if (format == fmt->format) {
			fmt_found = true;
			break;
@@ -167,8 +167,8 @@ struct mdss_mdp_format_params *mdss_mdp_get_format_params(u32 format)
	}

	if (!fmt_found) {
		for (i = 0; i < ARRAY_SIZE(mdss_mdp_format_ubwc_map); i++) {
			fmt = &mdss_mdp_format_ubwc_map[i].mdp_format;
		for (i = 0; i < ARRAY_SIZE(mdss_mdp_format_map); i++) {
			fmt = &mdss_mdp_format_map[i];
			if (format == fmt->format)
				break;
		}