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

Commit f55e65bb authored by Jeykumar Sankaran's avatar Jeykumar Sankaran
Browse files

drm/msm/sde: add 10 bit support for virtual pipes



This change adds 10 bit RGB format support for virtual pipes
when smart DMA is enabled.

Change-Id: I4922ab220476a03c4e880881133ac0256d745372
Signed-off-by: default avatarJeykumar Sankaran <jsanka@codeaurora.org>
parent 7574ff02
Loading
Loading
Loading
Loading
+11 −42
Original line number Original line Diff line number Diff line
@@ -528,37 +528,6 @@ static struct sde_prop_type reg_dma_prop[REG_DMA_PROP_MAX] = {
 * static API list
 * static API list
 *************************************************************/
 *************************************************************/


/**
 * _sde_copy_formats   - copy formats from src_list to dst_list
 * @dst_list:          pointer to destination list where to copy formats
 * @dst_list_size:     size of destination list
 * @dst_list_pos:      starting position on the list where to copy formats
 * @src_list:          pointer to source list where to copy formats from
 * @src_list_size:     size of source list
 * Return: number of elements populated
 */
static uint32_t _sde_copy_formats(
		struct sde_format_extended *dst_list,
		uint32_t dst_list_size,
		uint32_t dst_list_pos,
		const struct sde_format_extended *src_list,
		uint32_t src_list_size)
{
	uint32_t cur_pos, i;

	if (!dst_list || !src_list || (dst_list_pos >= (dst_list_size - 1)))
		return 0;

	for (i = 0, cur_pos = dst_list_pos;
		(cur_pos < (dst_list_size - 1)) && (i < src_list_size)
		&& src_list[i].fourcc_format; ++i, ++cur_pos)
		dst_list[cur_pos] = src_list[i];

	dst_list[cur_pos].fourcc_format = 0;

	return i;
}

static int _parse_dt_u32_handler(struct device_node *np,
static int _parse_dt_u32_handler(struct device_node *np,
	char *prop_name, u32 *offsets, int len, bool mandatory)
	char *prop_name, u32 *offsets, int len, bool mandatory)
{
{
@@ -2439,7 +2408,7 @@ static int sde_hardware_format_caps(struct sde_mdss_cfg *sde_cfg,
			rc = -ENOMEM;
			rc = -ENOMEM;
			goto end;
			goto end;
		}
		}
		index = _sde_copy_formats(sde_cfg->cursor_formats,
		index = sde_copy_formats(sde_cfg->cursor_formats,
			cursor_list_size, 0, cursor_formats,
			cursor_list_size, 0, cursor_formats,
			ARRAY_SIZE(cursor_formats));
			ARRAY_SIZE(cursor_formats));
	}
	}
@@ -2480,34 +2449,34 @@ static int sde_hardware_format_caps(struct sde_mdss_cfg *sde_cfg,
		goto end;
		goto end;
	}
	}


	index = _sde_copy_formats(sde_cfg->dma_formats, dma_list_size,
	index = sde_copy_formats(sde_cfg->dma_formats, dma_list_size,
		0, plane_formats, ARRAY_SIZE(plane_formats));
		0, plane_formats, ARRAY_SIZE(plane_formats));
	index += _sde_copy_formats(sde_cfg->dma_formats, dma_list_size,
	index += sde_copy_formats(sde_cfg->dma_formats, dma_list_size,
		index, rgb_10bit_formats,
		index, rgb_10bit_formats,
		ARRAY_SIZE(rgb_10bit_formats));
		ARRAY_SIZE(rgb_10bit_formats));


	index = _sde_copy_formats(sde_cfg->vig_formats, vig_list_size,
	index = sde_copy_formats(sde_cfg->vig_formats, vig_list_size,
		0, plane_formats_yuv, ARRAY_SIZE(plane_formats_yuv));
		0, plane_formats_yuv, ARRAY_SIZE(plane_formats_yuv));
	index += _sde_copy_formats(sde_cfg->vig_formats, vig_list_size,
	index += sde_copy_formats(sde_cfg->vig_formats, vig_list_size,
		index, rgb_10bit_formats,
		index, rgb_10bit_formats,
		ARRAY_SIZE(rgb_10bit_formats));
		ARRAY_SIZE(rgb_10bit_formats));
	index += _sde_copy_formats(sde_cfg->vig_formats, vig_list_size,
	index += sde_copy_formats(sde_cfg->vig_formats, vig_list_size,
		index, p010_formats, ARRAY_SIZE(p010_formats));
		index, p010_formats, ARRAY_SIZE(p010_formats));
	if (IS_SDE_MAJOR_MINOR_SAME((hw_rev), SDE_HW_VER_400))
	if (IS_SDE_MAJOR_MINOR_SAME((hw_rev), SDE_HW_VER_400))
		index += _sde_copy_formats(sde_cfg->vig_formats,
		index += sde_copy_formats(sde_cfg->vig_formats,
			vig_list_size, index, p010_ubwc_formats,
			vig_list_size, index, p010_ubwc_formats,
			ARRAY_SIZE(p010_ubwc_formats));
			ARRAY_SIZE(p010_ubwc_formats));


	index += _sde_copy_formats(sde_cfg->vig_formats, vig_list_size,
	index += sde_copy_formats(sde_cfg->vig_formats, vig_list_size,
		index, tp10_ubwc_formats,
		index, tp10_ubwc_formats,
		ARRAY_SIZE(tp10_ubwc_formats));
		ARRAY_SIZE(tp10_ubwc_formats));


	index = _sde_copy_formats(sde_cfg->wb_formats, wb2_list_size,
	index = sde_copy_formats(sde_cfg->wb_formats, wb2_list_size,
		0, wb2_formats, ARRAY_SIZE(wb2_formats));
		0, wb2_formats, ARRAY_SIZE(wb2_formats));
	index += _sde_copy_formats(sde_cfg->wb_formats, wb2_list_size,
	index += sde_copy_formats(sde_cfg->wb_formats, wb2_list_size,
		index, rgb_10bit_formats,
		index, rgb_10bit_formats,
		ARRAY_SIZE(rgb_10bit_formats));
		ARRAY_SIZE(rgb_10bit_formats));
	index += _sde_copy_formats(sde_cfg->wb_formats, wb2_list_size,
	index += sde_copy_formats(sde_cfg->wb_formats, wb2_list_size,
		index, tp10_ubwc_formats,
		index, tp10_ubwc_formats,
		ARRAY_SIZE(tp10_ubwc_formats));
		ARRAY_SIZE(tp10_ubwc_formats));
end:
end:
+30 −0
Original line number Original line Diff line number Diff line
@@ -91,3 +91,33 @@ void sde_hw_csc_setup(struct sde_hw_blk_reg_map *c,
	SDE_REG_WRITE(c, csc_reg_off + 0x40, data->csc_post_bv[2]);
	SDE_REG_WRITE(c, csc_reg_off + 0x40, data->csc_post_bv[2]);
}
}


/**
 * _sde_copy_formats   - copy formats from src_list to dst_list
 * @dst_list:          pointer to destination list where to copy formats
 * @dst_list_size:     size of destination list
 * @dst_list_pos:      starting position on the list where to copy formats
 * @src_list:          pointer to source list where to copy formats from
 * @src_list_size:     size of source list
 * Return: number of elements populated
 */
uint32_t sde_copy_formats(
		struct sde_format_extended *dst_list,
		uint32_t dst_list_size,
		uint32_t dst_list_pos,
		const struct sde_format_extended *src_list,
		uint32_t src_list_size)
{
	uint32_t cur_pos, i;

	if (!dst_list || !src_list || (dst_list_pos >= (dst_list_size - 1)))
		return 0;

	for (i = 0, cur_pos = dst_list_pos;
		(cur_pos < (dst_list_size - 1)) && (i < src_list_size)
		&& src_list[i].fourcc_format; ++i, ++cur_pos)
		dst_list[cur_pos] = src_list[i];

	dst_list[cur_pos].fourcc_format = 0;

	return i;
}
+9 −1
Original line number Original line Diff line number Diff line
@@ -17,6 +17,8 @@
#include <linux/slab.h>
#include <linux/slab.h>
#include "sde_hw_mdss.h"
#include "sde_hw_mdss.h"


struct sde_format_extended;

/*
/*
 * This is the common struct maintained by each sub block
 * This is the common struct maintained by each sub block
 * for mapping the register offsets in this block to the
 * for mapping the register offsets in this block to the
@@ -59,5 +61,11 @@ void sde_hw_csc_setup(struct sde_hw_blk_reg_map *c,
		u32 csc_reg_off,
		u32 csc_reg_off,
		struct sde_csc_cfg *data, bool csc10);
		struct sde_csc_cfg *data, bool csc10);


#endif /* _SDE_HW_UTIL_H */
uint32_t sde_copy_formats(
		struct sde_format_extended *dst_list,
		uint32_t dst_list_size,
		uint32_t dst_list_pos,
		const struct sde_format_extended *src_list,
		uint32_t src_list_size);


#endif /* _SDE_HW_UTIL_H */
+47 −4
Original line number Original line Diff line number Diff line
@@ -3027,6 +3027,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
		{SDE_DRM_DEINTERLACE, "deinterlace"}
		{SDE_DRM_DEINTERLACE, "deinterlace"}
	};
	};
	const struct sde_format_extended *format_list;
	const struct sde_format_extended *format_list;
	struct sde_format_extended *virt_format_list = NULL;
	struct sde_kms_info *info;
	struct sde_kms_info *info;
	struct sde_plane *psde = to_sde_plane(plane);
	struct sde_plane *psde = to_sde_plane(plane);
	int zpos_max = 255;
	int zpos_max = 255;
@@ -3165,9 +3166,28 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
	format_list = psde->pipe_sblk->format_list;
	format_list = psde->pipe_sblk->format_list;


	if (master_plane_id) {
	if (master_plane_id) {
		int index, array_size;

		array_size = ARRAY_SIZE(plane_formats)
					+ ARRAY_SIZE(rgb_10bit_formats);
		virt_format_list = kcalloc(array_size,
				sizeof(struct sde_format_extended), GFP_KERNEL);
		if (!virt_format_list) {
			SDE_ERROR(
			"failed to allocate virtual pipe format list\n");
			return;
		}

		index = sde_copy_formats(virt_format_list, array_size,
				0, plane_formats, ARRAY_SIZE(plane_formats));
		sde_copy_formats(virt_format_list, array_size,
				index, rgb_10bit_formats,
				ARRAY_SIZE(rgb_10bit_formats));

		format_list = virt_format_list;

		sde_kms_info_add_keyint(info, "primary_smart_plane_id",
		sde_kms_info_add_keyint(info, "primary_smart_plane_id",
						master_plane_id);
						master_plane_id);
		format_list = plane_formats;
	}
	}


	if (format_list) {
	if (format_list) {
@@ -3197,6 +3217,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
			info->data, info->len, PLANE_PROP_INFO);
			info->data, info->len, PLANE_PROP_INFO);


	kfree(info);
	kfree(info);
	kfree(virt_format_list);


	if (psde->features & BIT(SDE_SSPP_MEMCOLOR)) {
	if (psde->features & BIT(SDE_SSPP_MEMCOLOR)) {
		snprintf(feature_name, sizeof(feature_name), "%s%d",
		snprintf(feature_name, sizeof(feature_name), "%s%d",
@@ -3914,6 +3935,7 @@ struct drm_plane *sde_plane_init(struct drm_device *dev,
{
{
	struct drm_plane *plane = NULL;
	struct drm_plane *plane = NULL;
	const struct sde_format_extended *format_list;
	const struct sde_format_extended *format_list;
	struct sde_format_extended *virt_format_list = NULL;
	struct sde_plane *psde;
	struct sde_plane *psde;
	struct msm_drm_private *priv;
	struct msm_drm_private *priv;
	struct sde_kms *kms;
	struct sde_kms *kms;
@@ -3988,8 +4010,28 @@ struct drm_plane *sde_plane_init(struct drm_device *dev,


	format_list = psde->pipe_sblk->format_list;
	format_list = psde->pipe_sblk->format_list;


	if (master_plane_id)
	if (master_plane_id) {
		format_list = plane_formats;
		int index, array_size;

		array_size = ARRAY_SIZE(plane_formats)
					+ ARRAY_SIZE(rgb_10bit_formats);
		virt_format_list = kcalloc(array_size,
					sizeof(struct sde_format_extended),
					GFP_KERNEL);
		if (!virt_format_list) {
			SDE_ERROR(
			"failed to allocate virtual pipe format list\n");
			goto clean_sspp;
		}

		index = sde_copy_formats(virt_format_list, array_size,
				0, plane_formats, ARRAY_SIZE(plane_formats));
		sde_copy_formats(virt_format_list, array_size,
				index, rgb_10bit_formats,
				ARRAY_SIZE(rgb_10bit_formats));

		format_list = virt_format_list;
	}


	psde->nformats = sde_populate_formats(format_list,
	psde->nformats = sde_populate_formats(format_list,
				psde->formats,
				psde->formats,
@@ -4040,5 +4082,6 @@ struct drm_plane *sde_plane_init(struct drm_device *dev,
clean_plane:
clean_plane:
	kfree(psde);
	kfree(psde);
exit:
exit:
	kfree(virt_format_list);
	return ERR_PTR(ret);
	return ERR_PTR(ret);
}
}