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

Commit bfe77429 authored by Guchun Chen's avatar Guchun Chen
Browse files

drm: msm: sde: update blob property after splash is done



After early splash handoff is finished, kernel needs to
update each crtc's and plane's impacted blob property
by splash. This ensures framework can get correct resource
in the second init process.

Change-Id: Iddfa823d7ba786f3d81b96e86ad3b6e4b10a3375
Signed-off-by: default avatarGuchun Chen <guchunc@codeaurora.org>
parent 58a9174f
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -1995,6 +1995,26 @@ static void _sde_crtc_init_debugfs(struct sde_crtc *sde_crtc,
}
#endif

void sde_crtc_update_blob_property(struct drm_crtc *crtc,
				const char *key,
				int32_t value)
{
	struct sde_crtc *sde_crtc;
	char *kms_info_str = NULL;
	size_t len;

	sde_crtc = to_sde_crtc(crtc);

	kms_info_str = (char *)msm_property_get_blob(&sde_crtc->property_info,
				&sde_crtc->blob_info, &len, CRTC_PROP_INFO);
	if (!kms_info_str) {
		SDE_ERROR("get crtc property_info failed");
		return;
	}

	sde_kms_info_update_keystr(kms_info_str, key, value);
}

/* initialize crtc */
struct drm_crtc *sde_crtc_init(struct drm_device *dev,
	struct drm_plane *plane)
+9 −0
Original line number Diff line number Diff line
@@ -292,4 +292,13 @@ static inline bool sde_crtc_is_enabled(struct drm_crtc *crtc)
	return crtc ? crtc->enabled : false;
}

/**
 * sde_crtc_update_blob_property - update blob property of a given crtc
 * @crtc: Pointer to crtc
 * @key:  Pointer to key string
 * @value: Signed 32 bit integer value
 */
void sde_crtc_update_blob_property(struct drm_crtc *crtc,
				const char *key,
				int32_t value);
#endif /* _SDE_CRTC_H_ */
+11 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 * Copyright (C) 2013 Red Hat
 * Author: Rob Clark <robdclark@gmail.com>
 *
@@ -305,6 +305,16 @@ void sde_kms_info_add_keyint(struct sde_kms_info *info,
		const char *key,
		int32_t value);

/**
 * sde_kms_info_update_keystr - update the special string's value.
 * @info_str: Pointer to source blob str
 * @key:      Pointer to key string
 * @value:    Signed 32-bit integer value
 */
void sde_kms_info_update_keystr(char *info_str,
		const char *key,
		int32_t value);

/**
 * sde_kms_info_add_keystr - add string value to 'sde_kms_info'
 * @info: Pointer to sde_kms_info structure
+59 −1
Original line number Diff line number Diff line
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -41,6 +41,64 @@ void sde_kms_info_add_keyint(struct sde_kms_info *info,
	}
}

void sde_kms_info_update_keystr(char *info_str,
				const char *key,
				int32_t value)
{
	char *str, *temp, *append_str;
	uint32_t dst_len = 0, prefix_len = 0;
	char c;
	int32_t size = 0;

	if (info_str && key) {
		str = strnstr(info_str, key, strlen(info_str));
		if (str) {
			temp = str + strlen(key);
			c = *temp;
			while (c != '\n') {
				dst_len++;
				c = *(++temp);
			}
			/*
			 * If input key string to update is exactly the last
			 * string in source string, no need to allocate one
			 * memory to store the string after string key. Just
			 * replace the value of the last string.
			 *
			 * If it is not, allocate one new memory to save
			 * the string after string key+"\n". This new allocated
			 * string will be appended to the whole source string
			 * after key value is updated.
			 */
			size = strlen(str) - strlen(key) - dst_len - 1;
			if (size > 0) {
				append_str = kzalloc(size + 1, GFP_KERNEL);
				if (!append_str) {
					SDE_ERROR("failed to alloc memory\n");
					return;
				}
				memcpy(append_str,
					str + strlen(key) + dst_len + 1, size);
			}

			prefix_len = strlen(info_str) - strlen(str);
			/* Update string with new value for the string key. */
			snprintf(info_str + prefix_len,
				SDE_KMS_INFO_MAX_SIZE - prefix_len,
				"%s%d\n", key, value);

			/* Append the string save aboved. */
			if (size > 0 && append_str) {
				size = prefix_len + strlen(key) + dst_len + 1;
				snprintf(info_str + size,
					SDE_KMS_INFO_MAX_SIZE - size,
					"%s", append_str);
				kfree(append_str);
			}
		}
	}
}

void sde_kms_info_add_keystr(struct sde_kms_info *info,
		const char *key,
		const char *value)
+18 −0
Original line number Diff line number Diff line
@@ -2732,6 +2732,24 @@ end:
	return rc;
}

void sde_plane_update_blob_property(struct drm_plane *plane,
				const char *key,
				int32_t value)
{
	char *kms_info_str = NULL;
	struct sde_plane *sde_plane = to_sde_plane(plane);
	size_t len;

	kms_info_str = (char *)msm_property_get_blob(&sde_plane->property_info,
				&sde_plane->blob_info, &len, 0);
	if (!kms_info_str) {
		SDE_ERROR("get plane property_info failed\n");
		return;
	}

	sde_kms_info_update_keystr(kms_info_str, key, value);
}

/* initialize plane */
struct drm_plane *sde_plane_init(struct drm_device *dev,
		uint32_t pipe, bool primary_plane,
Loading