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

Commit fdf36d71 authored by Jayaprakash Madisetty's avatar Jayaprakash Madisetty
Browse files

disp: msm: use vzalloc for large allocations



Large allocations using kzalloc can lead to timeouts. This updates
the allocation calls accordingly to use vzalloc to remove
requirements on contiguous memory.

Change-Id: Ica54483787509ed0e9283289fc9d523e8cde9238
Signed-off-by: default avatarNilaan Gunabalachandran <quic_ngunabal@quicinc.com>
Signed-off-by: default avatarJayaprakash Madisetty <quic_jmadiset@quicinc.com>
parent a67699f4
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
 */

@@ -4476,7 +4477,7 @@ void sde_cp_crtc_enable(struct drm_crtc *drm_crtc)
	if (!num_mixers)
		return;
	mutex_lock(&crtc->crtc_cp_lock);
	info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL);
	info = vzalloc(sizeof(struct sde_kms_info));
	if (info) {
		for (i = 0; i < ARRAY_SIZE(dspp_cap_update_func); i++)
			dspp_cap_update_func[i](crtc, info);
@@ -4485,7 +4486,7 @@ void sde_cp_crtc_enable(struct drm_crtc *drm_crtc)
			info->data, SDE_KMS_INFO_DATALEN(info),
			CRTC_PROP_DSPP_INFO);
	}
	kfree(info);
	vfree(info);
	mutex_unlock(&crtc->crtc_cp_lock);
}

@@ -4500,12 +4501,12 @@ void sde_cp_crtc_disable(struct drm_crtc *drm_crtc)
	}
	crtc = to_sde_crtc(drm_crtc);
	mutex_lock(&crtc->crtc_cp_lock);
	info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL);
	info = vzalloc(sizeof(struct sde_kms_info));
	if (info)
		msm_property_set_blob(&crtc->property_info,
				&crtc->dspp_blob_info,
			info->data, SDE_KMS_INFO_DATALEN(info),
			CRTC_PROP_DSPP_INFO);
	mutex_unlock(&crtc->crtc_cp_lock);
	kfree(info);
	vfree(info);
}
+3 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
 */

@@ -2633,7 +2634,7 @@ int sde_connector_set_blob_data(struct drm_connector *conn,
		return -EINVAL;
	}

	info = kzalloc(sizeof(*info), GFP_KERNEL);
	info = vzalloc(sizeof(*info));
	if (!info)
		return -ENOMEM;

@@ -2691,7 +2692,7 @@ int sde_connector_set_blob_data(struct drm_connector *conn,
			SDE_KMS_INFO_DATALEN(info),
			prop_id);
exit:
	kfree(info);
	vfree(info);

	return rc;
}
+2 −2
Original line number Diff line number Diff line
@@ -5415,7 +5415,7 @@ static void sde_crtc_install_properties(struct drm_crtc *crtc,
		return;
	}

	info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL);
	info = vzalloc(sizeof(struct sde_kms_info));
	if (!info) {
		SDE_ERROR("failed to allocate info memory\n");
		return;
@@ -5499,7 +5499,7 @@ static void sde_crtc_install_properties(struct drm_crtc *crtc,
			info->data, SDE_KMS_INFO_DATALEN(info),
			CRTC_PROP_INFO);

	kfree(info);
	vfree(info);
}

static int _sde_crtc_get_output_fence(struct drm_crtc *crtc,
+3 −3
Original line number Diff line number Diff line
@@ -3665,7 +3665,7 @@ static void _sde_plane_setup_capabilities_blob(struct sde_plane *psde,
	sde_kms_info_add_keyint(info, "pipe_idx", pipe_id);

	index = (master_plane_id == 0) ? 0 : 1;
	if (catalog->has_demura &&
	if (catalog->has_demura && psde->pipe < SSPP_MAX &&
	    catalog->demura_supported[psde->pipe][index] != ~0x0)
		sde_kms_info_add_keyint(info, "demura_block", index);

@@ -3755,7 +3755,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
	psde->catalog = catalog;
	is_master = !psde->is_virtual;

	info = kzalloc(sizeof(struct sde_kms_info), GFP_KERNEL);
	info = vzalloc(sizeof(struct sde_kms_info));
	if (!info) {
		SDE_ERROR("failed to allocate info memory\n");
		return;
@@ -3834,7 +3834,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
			ARRAY_SIZE(e_fb_translation_mode), 0,
			PLANE_PROP_FB_TRANSLATION_MODE);

	kfree(info);
	vfree(info);
}

static inline void _sde_plane_set_csc_v1(struct sde_plane *psde,
+23 −6
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2009-2021, The Linux Foundation. All rights reserved.
 */

@@ -228,6 +229,7 @@ struct sde_dbg_regbuf {
 * struct sde_dbg_base - global sde debug base structure
 * @evtlog: event log instance
 * @reglog: reg log instance
 * @reg_dump_base: base address of register dump region
 * @reg_base_list: list of register dumping regions
 * @dev: device pointer
 * @mutex: mutex to serialize access to serialze dumps, debugfs access
@@ -253,6 +255,7 @@ struct sde_dbg_base {
	struct sde_dbg_evtlog *evtlog;
	struct sde_dbg_reglog *reglog;
	struct list_head reg_base_list;
	void *reg_dump_base;
	void *reg_dump_addr;
	struct device *dev;
	struct mutex mutex;
@@ -992,7 +995,7 @@ static void _sde_dbg_dump_sde_dbg_bus(struct sde_dbg_sde_debug_bus *bus)

	in_mem = (bus->cmn.enable_mask & SDE_DBG_DUMP_IN_MEM);
	if (in_mem && (!(*dump_mem))) {
		*dump_mem = devm_kzalloc(sde_dbg_base.dev, list_size, GFP_KERNEL);
		*dump_mem = vzalloc(list_size);
		bus->cmn.content_size = list_size / sizeof(u32);
	}

@@ -1040,7 +1043,7 @@ static void _sde_dbg_dump_dsi_dbg_bus(struct sde_dbg_sde_debug_bus *bus)
	mutex_lock(&sde_dbg_dsi_mutex);
	in_mem = (bus->cmn.enable_mask & SDE_DBG_DUMP_IN_MEM);
	if (in_mem && (!(*dump_mem))) {
		*dump_mem = devm_kzalloc(sde_dbg_base.dev, list_size, GFP_KERNEL);
		*dump_mem = vzalloc(list_size);
		bus->cmn.content_size = list_size / sizeof(u32);
	}

@@ -1086,8 +1089,10 @@ static void _sde_dump_array(struct sde_dbg_reg_base *blk_arr[],
	mutex_lock(&sde_dbg_base.mutex);

	reg_dump_size =  _sde_dbg_get_reg_dump_size();
	dbg_base->reg_dump_addr = devm_kzalloc(sde_dbg_base.dev,
			reg_dump_size, GFP_KERNEL);
	if (!dbg_base->reg_dump_base)
		dbg_base->reg_dump_base = vzalloc(reg_dump_size);

	dbg_base->reg_dump_addr =  dbg_base->reg_dump_base;

	if (!dbg_base->reg_dump_addr)
		pr_err("Failed to allocate memory for reg_dump_addr size:%d\n",
@@ -1627,7 +1632,7 @@ static ssize_t sde_recovery_regdump_read(struct file *file, char __user *ubuf,

	if (!rbuf->dump_done && !rbuf->cur_blk) {
		if (!rbuf->buf)
			rbuf->buf = kzalloc(DUMP_BUF_SIZE, GFP_KERNEL);
			rbuf->buf = vzalloc(DUMP_BUF_SIZE);
		if (!rbuf->buf) {
			len =  -ENOMEM;
			goto err;
@@ -2402,6 +2407,7 @@ static void sde_dbg_reg_base_destroy(void)
		list_del(&blk_base->reg_base_head);
		kfree(blk_base);
	}
	vfree(dbg_base->reg_dump_base);
}

static void sde_dbg_dsi_ctrl_destroy(void)
@@ -2416,12 +2422,22 @@ static void sde_dbg_dsi_ctrl_destroy(void)
	mutex_unlock(&sde_dbg_dsi_mutex);
}

static void sde_dbg_buses_destroy(void)
{
	struct sde_dbg_base *dbg_base = &sde_dbg_base;

	vfree(dbg_base->dbgbus_sde.cmn.dumped_content);
	vfree(dbg_base->dbgbus_vbif_rt.cmn.dumped_content);
	vfree(dbg_base->dbgbus_dsi.cmn.dumped_content);
	vfree(dbg_base->dbgbus_lutdma.cmn.dumped_content);
}

/**
 * sde_dbg_destroy - destroy sde debug facilities
 */
void sde_dbg_destroy(void)
{
	kfree(sde_dbg_base.regbuf.buf);
	vfree(sde_dbg_base.regbuf.buf);
	memset(&sde_dbg_base.regbuf, 0, sizeof(sde_dbg_base.regbuf));
	_sde_dbg_debugfs_destroy();
	sde_dbg_base_evtlog = NULL;
@@ -2431,6 +2447,7 @@ void sde_dbg_destroy(void)
	sde_dbg_base.reglog = NULL;
	sde_dbg_reg_base_destroy();
	sde_dbg_dsi_ctrl_destroy();
	sde_dbg_buses_destroy();
	mutex_destroy(&sde_dbg_base.mutex);
}

Loading