drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
Extension
.c
Size
66788 bytes
Lines
1784
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (total_swath_bytes > detile_buf_size_in_bytes) {
			req128_l = true;
			swath_bytes_l = full_swath_bytes_packed_l / 2;
		}
	} else {
		req128_l = true;
		req128_c = false;
		swath_bytes_l = full_swath_bytes_packed_l/2;
		swath_bytes_c = full_swath_bytes_packed_c;

		total_swath_bytes = 2 * swath_bytes_l + 2 * swath_bytes_c;

		if (total_swath_bytes > detile_buf_size_in_bytes) {
			req128_c = true;
			swath_bytes_c = full_swath_bytes_packed_c/2;
		}
	}

	if (rq_param->yuv420)
		total_swath_bytes = 2 * swath_bytes_l + 2 * swath_bytes_c;
	else
		total_swath_bytes = 2 * swath_bytes_l;

	rq_param->misc.rq_l.stored_swath_bytes = swath_bytes_l;
	rq_param->misc.rq_c.stored_swath_bytes = swath_bytes_c;

	if (surf_linear) {
		log2_swath_height_l = 0;
		log2_swath_height_c = 0;
	} else {
		unsigned int swath_height_l;
		unsigned int swath_height_c;

		if (!surf_vert) {
			swath_height_l = rq_param->misc.rq_l.blk256_height;
			swath_height_c = rq_param->misc.rq_c.blk256_height;
		} else {
			swath_height_l = rq_param->misc.rq_l.blk256_width;
			swath_height_c = rq_param->misc.rq_c.blk256_width;
		}

		if (swath_height_l > 0)
			log2_swath_height_l = dml_log2(swath_height_l);

		if (req128_l && log2_swath_height_l > 0)
			log2_swath_height_l -= 1;

		if (swath_height_c > 0)
			log2_swath_height_c = dml_log2(swath_height_c);

		if (req128_c && log2_swath_height_c > 0)
			log2_swath_height_c -= 1;
	}

	rq_param->dlg.rq_l.swath_height = 1 << log2_swath_height_l;
	rq_param->dlg.rq_c.swath_height = 1 << log2_swath_height_c;

	dml_print("DML_DLG: %s: req128_l = %0d\n", __func__, req128_l);
	dml_print("DML_DLG: %s: req128_c = %0d\n", __func__, req128_c);
	dml_print("DML_DLG: %s: full_swath_bytes_packed_l = %0d\n",
		__func__,
		full_swath_bytes_packed_l);
	dml_print("DML_DLG: %s: full_swath_bytes_packed_c = %0d\n",
		__func__,
		full_swath_bytes_packed_c);
}

static void get_meta_and_pte_attr(struct display_mode_lib *mode_lib,
	display_data_rq_dlg_params_st *rq_dlg_param,
	display_data_rq_misc_params_st *rq_misc_param,
	display_data_rq_sizing_params_st *rq_sizing_param,
	unsigned int vp_width,
	unsigned int vp_height,
	unsigned int data_pitch,
	unsigned int meta_pitch,
	unsigned int source_format,
	unsigned int tiling,
	unsigned int macro_tile_size,
	unsigned int source_scan,
	unsigned int hostvm_enable,
	unsigned int is_chroma,
	unsigned int surface_height)
{
	bool surf_linear = (tiling == dm_sw_linear);
	bool surf_vert = (source_scan == dm_vert);

	unsigned int bytes_per_element = 0;
	unsigned int bytes_per_element_y = 0;
	unsigned int bytes_per_element_c = 0;

Annotation

Implementation Notes