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

Commit 1a9ad527 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "disp: msm: use vzalloc for large allocations"

parents 1d5f7b89 687ad854
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.
 */

@@ -3968,7 +3969,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);
@@ -3977,7 +3978,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);
}

@@ -3992,12 +3993,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) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#define pr_fmt(fmt)	"[drm:%s:%d] " fmt, __func__, __LINE__
@@ -2367,7 +2368,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;

@@ -2425,7 +2426,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;
}
+3 −3
Original line number Diff line number Diff line
@@ -5066,7 +5066,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;
@@ -5318,7 +5318,7 @@ static void sde_crtc_install_properties(struct drm_crtc *crtc,
	msm_property_set_blob(&sde_crtc->property_info, &sde_crtc->blob_info,
			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 −2
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014-2020 The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (C) 2013 Red Hat
 * Author: Rob Clark <robdclark@gmail.com>
 *
@@ -3609,7 +3610,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
			"prefill_time", 0x0, 0, ~0, 0,
			PLANE_PROP_PREFILL_TIME);

	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;
@@ -3720,7 +3721,7 @@ static void _sde_plane_install_properties(struct drm_plane *plane,
			info->data, SDE_KMS_INFO_DATALEN(info),
			PLANE_PROP_INFO);

	kfree(info);
	vfree(info);

	if (psde->features & BIT(SDE_SSPP_MEMCOLOR)) {
		snprintf(feature_name, sizeof(feature_name), "%s%d",
+26 −11
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2009-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#define pr_fmt(fmt)	"[drm:%s:%d] " fmt, __func__, __LINE__
@@ -198,6 +199,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
@@ -221,6 +223,7 @@ static 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;
@@ -3251,7 +3254,6 @@ static void _sde_dbg_dump_sde_dbg_bus(struct sde_dbg_sde_debug_bus *bus)
	u32 *dump_addr = NULL;
	u32 status = 0;
	struct sde_debug_bus_entry *head;
	phys_addr_t phys = 0;
	int list_size;
	int i;
	u32 offset;
@@ -3289,8 +3291,7 @@ static void _sde_dbg_dump_sde_dbg_bus(struct sde_dbg_sde_debug_bus *bus)

	if (in_mem) {
		if (!(*dump_mem))
			*dump_mem = dma_alloc_coherent(sde_dbg_base.dev,
				list_size, &phys, GFP_KERNEL);
			*dump_mem =  vzalloc(list_size);

		if (*dump_mem) {
			dump_addr = *dump_mem;
@@ -3400,7 +3401,6 @@ static void _sde_dbg_dump_vbif_dbg_bus(struct sde_dbg_vbif_debug_bus *bus)
	u32 value, d0, d1;
	unsigned long reg, reg1, reg2;
	struct vbif_debug_bus_entry *head;
	phys_addr_t phys = 0;
	int i, list_size = 0;
	void __iomem *mem_base = NULL;
	struct vbif_debug_bus_entry *dbg_bus;
@@ -3450,8 +3450,7 @@ static void _sde_dbg_dump_vbif_dbg_bus(struct sde_dbg_vbif_debug_bus *bus)

	if (in_mem) {
		if (!(*dump_mem))
			*dump_mem = dma_alloc_coherent(sde_dbg_base.dev,
				list_size, &phys, GFP_KERNEL);
			*dump_mem =  vzalloc(list_size);

		if (*dump_mem) {
			dump_addr = *dump_mem;
@@ -3542,13 +3541,18 @@ static void _sde_dump_array(struct sde_dbg_reg_base *blk_arr[],
	int i;
	u32 reg_dump_size;
	struct sde_dbg_base *dbg_base = &sde_dbg_base;
	phys_addr_t phys = 0;

	mutex_lock(&sde_dbg_base.mutex);

	reg_dump_size =  _sde_dbg_get_reg_dump_size();
	dbg_base->reg_dump_addr = dma_alloc_coherent(sde_dbg_base.dev,
			reg_dump_size, &phys, 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",
				reg_dump_size);

	if (dump_all)
		sde_evtlog_dump_all(sde_dbg_base.evtlog);
@@ -4051,7 +4055,7 @@ static ssize_t sde_recovery_regdump_read(struct file *file, char __user *ubuf,
	mutex_lock(&sde_dbg_base.mutex);
	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;
@@ -4781,13 +4785,23 @@ 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_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);
}

/**
 * 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;
@@ -4796,6 +4810,7 @@ void sde_dbg_destroy(void)
	sde_reglog_destroy(sde_dbg_base.reglog);
	sde_dbg_base.reglog = NULL;
	sde_dbg_reg_base_destroy();
	sde_dbg_buses_destroy();
	mutex_destroy(&sde_dbg_base.mutex);
}

Loading