drivers/gpu/drm/amd/pm/amdgpu_dpm_internal.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/pm/amdgpu_dpm_internal.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/pm/amdgpu_dpm_internal.c
Extension
.c
Size
3351 bytes
Lines
96
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

list_for_each_entry(crtc, &ddev->mode_config.crtc_list, head) {
			amdgpu_crtc = to_amdgpu_crtc(crtc);

			/* The array should only contain active displays. */
			if (!amdgpu_crtc->enabled)
				continue;

			conn = to_amdgpu_connector(amdgpu_crtc->connector);
			display_cfg = &adev->pm.pm_display_cfg.displays[num_crtcs++];

			if (amdgpu_crtc->hw_mode.clock) {
				vrefresh = drm_mode_vrefresh(&amdgpu_crtc->hw_mode);

				vblank_in_pixels =
					amdgpu_crtc->hw_mode.crtc_htotal *
					(amdgpu_crtc->hw_mode.crtc_vblank_end -
					amdgpu_crtc->hw_mode.crtc_vdisplay +
					(amdgpu_crtc->v_border * 2));

				vblank_time_us =
					vblank_in_pixels * 1000 / amdgpu_crtc->hw_mode.clock;

				/* The legacy (non-DC) code has issues with mclk switching
				 * with refresh rates over 120 Hz. Disable mclk switching.
				 */
				if (vrefresh > 120)
					vblank_time_us = 0;

				/* Find minimum vblank time. */
				if (vblank_time_us < cfg->min_vblank_time)
					cfg->min_vblank_time = vblank_time_us;

				/* Find vertical refresh rate of first active display. */
				if (!cfg->vrefresh)
					cfg->vrefresh = vrefresh;
			}

			if (amdgpu_crtc->crtc_id < cfg->crtc_index) {
				/* Find first active CRTC and its line time. */
				cfg->crtc_index = amdgpu_crtc->crtc_id;
				cfg->line_time_in_us = amdgpu_crtc->line_time;
			}

			display_cfg->controller_id = amdgpu_crtc->crtc_id;
			display_cfg->pixel_clock = conn->pixelclock_for_modeset;
		}
	}

	cfg->display_clk = adev->clock.default_dispclk;
	cfg->num_display = num_crtcs;
}

Annotation

Implementation Notes