drivers/gpu/drm/i915/display/intel_panel.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_panel.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/intel_panel.c- Extension
.c- Size
- 18008 bytes
- Lines
- 604
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/pwm.hdrm/drm_edid.hdrm/drm_print.hintel_backlight.hintel_connector.hintel_display_core.hintel_display_driver.hintel_display_types.hintel_drrs.hintel_panel.hintel_quirks.hintel_vrr.h
Detected Declarations
function Copyrightfunction intel_panel_preferred_fixed_modefunction is_best_fixed_modefunction intel_panel_fixed_modefunction list_for_each_entryfunction is_alt_drrs_modefunction is_alt_fixed_modefunction intel_panel_downclock_modefunction intel_panel_highest_modefunction intel_panel_get_modesfunction list_for_each_entryfunction has_drrs_modesfunction list_for_each_entryfunction list_for_each_entry_continuefunction intel_panel_drrs_typefunction intel_panel_compute_configfunction intel_panel_add_edid_alt_fixed_modesfunction list_for_each_entry_safefunction intel_panel_add_edid_preferred_modefunction intel_panel_destroy_probed_modesfunction list_for_each_entry_safefunction intel_panel_add_edid_fixed_modesfunction intel_panel_add_fixed_modefunction intel_panel_add_vbt_lfp_fixed_modefunction intel_panel_add_vbt_sdvo_fixed_modefunction intel_panel_add_encoder_fixed_modefunction intel_panel_detectfunction intel_panel_mode_validfunction intel_panel_init_allocfunction intel_panel_initfunction intel_panel_finifunction list_for_each_entry_safefunction intel_modeset_readout_hw_statefunction intel_panel_registerfunction intel_panel_unregisterfunction intel_panel_preparefunction intel_panel_unprepare
Annotated Snippet
if (mode) {
drm_mode_probed_add(&connector->base, mode);
num_modes++;
}
}
return num_modes;
}
static bool has_drrs_modes(struct intel_connector *connector)
{
const struct drm_display_mode *mode1;
list_for_each_entry(mode1, &connector->panel.fixed_modes, head) {
const struct drm_display_mode *mode2 = mode1;
list_for_each_entry_continue(mode2, &connector->panel.fixed_modes, head) {
if (is_alt_drrs_mode(mode1, mode2))
return true;
}
}
return false;
}
enum drrs_type intel_panel_drrs_type(struct intel_connector *connector)
{
return connector->panel.vbt.drrs_type;
}
int intel_panel_compute_config(struct intel_connector *connector,
struct drm_display_mode *adjusted_mode)
{
const struct drm_display_mode *fixed_mode =
intel_panel_fixed_mode(connector, adjusted_mode);
int vrefresh, fixed_mode_vrefresh;
bool is_vrr;
if (!fixed_mode)
return 0;
vrefresh = drm_mode_vrefresh(adjusted_mode);
fixed_mode_vrefresh = drm_mode_vrefresh(fixed_mode);
/*
* Assume that we shouldn't muck about with the
* timings if they don't land in the VRR range.
*/
is_vrr = intel_vrr_is_in_range(connector, vrefresh) &&
intel_vrr_is_in_range(connector, fixed_mode_vrefresh);
if (!is_vrr) {
/*
* We don't want to lie too much to the user about the refresh
* rate they're going to get. But we have to allow a bit of latitude
* for Xorg since it likes to automagically cook up modes with slightly
* off refresh rates.
*/
if (abs(vrefresh - fixed_mode_vrefresh) > 1) {
drm_dbg_kms(connector->base.dev,
"[CONNECTOR:%d:%s] Requested mode vrefresh (%d Hz) does not match fixed mode vrefresh (%d Hz)\n",
connector->base.base.id, connector->base.name,
vrefresh, fixed_mode_vrefresh);
return -EINVAL;
}
}
drm_mode_copy(adjusted_mode, fixed_mode);
if (is_vrr && fixed_mode_vrefresh != vrefresh)
adjusted_mode->vtotal =
DIV_ROUND_CLOSEST(adjusted_mode->clock * 1000,
adjusted_mode->htotal * vrefresh);
drm_mode_set_crtcinfo(adjusted_mode, 0);
return 0;
}
static void intel_panel_add_edid_alt_fixed_modes(struct intel_connector *connector)
{
struct intel_display *display = to_intel_display(connector);
const struct drm_display_mode *preferred_mode =
intel_panel_preferred_fixed_mode(connector);
struct drm_display_mode *mode, *next;
list_for_each_entry_safe(mode, next, &connector->base.probed_modes, head) {
if (!is_alt_fixed_mode(mode, preferred_mode))
continue;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/pwm.h`, `drm/drm_edid.h`, `drm/drm_print.h`, `intel_backlight.h`, `intel_connector.h`, `intel_display_core.h`, `intel_display_driver.h`.
- Detected declarations: `function Copyright`, `function intel_panel_preferred_fixed_mode`, `function is_best_fixed_mode`, `function intel_panel_fixed_mode`, `function list_for_each_entry`, `function is_alt_drrs_mode`, `function is_alt_fixed_mode`, `function intel_panel_downclock_mode`, `function intel_panel_highest_mode`, `function intel_panel_get_modes`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.