drivers/gpu/drm/i915/display/intel_modeset_verify.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_modeset_verify.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/i915/display/intel_modeset_verify.c
Extension
.c
Size
7852 bytes
Lines
257
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 (!encoder->base.crtc) {
			bool active;

			active = encoder->get_hw_state(encoder, &pipe);
			INTEL_DISPLAY_STATE_WARN(display, active,
						 "encoder detached but still enabled on pipe %c.\n",
						 pipe_name(pipe));
		}
	}
}

static void
verify_crtc_state(struct intel_atomic_state *state,
		  struct intel_crtc *crtc)
{
	struct intel_display *display = to_intel_display(state);
	const struct intel_crtc_state *sw_crtc_state =
		intel_atomic_get_new_crtc_state(state, crtc);
	struct intel_crtc_state *hw_crtc_state;
	struct intel_crtc *primary_crtc;
	struct intel_encoder *encoder;

	hw_crtc_state = intel_crtc_state_alloc(crtc);
	if (!hw_crtc_state)
		return;

	drm_dbg_kms(display->drm, "[CRTC:%d:%s]\n", crtc->base.base.id,
		    crtc->base.name);

	hw_crtc_state->hw.enable = sw_crtc_state->hw.enable;

	intel_crtc_get_pipe_config(hw_crtc_state);

	/* we keep both pipes enabled on 830 */
	if (display->platform.i830 && hw_crtc_state->hw.active)
		hw_crtc_state->hw.active = sw_crtc_state->hw.active;

	INTEL_DISPLAY_STATE_WARN(display,
				 sw_crtc_state->hw.active != hw_crtc_state->hw.active,
				 "crtc active state doesn't match with hw state (expected %i, found %i)\n",
				 sw_crtc_state->hw.active, hw_crtc_state->hw.active);

	INTEL_DISPLAY_STATE_WARN(display, crtc->active != sw_crtc_state->hw.active,
				 "transitional active state does not match atomic hw state (expected %i, found %i)\n",
				 sw_crtc_state->hw.active, crtc->active);

	primary_crtc = intel_primary_crtc(sw_crtc_state);

	for_each_encoder_on_crtc(display->drm, &primary_crtc->base, encoder) {
		enum pipe pipe;
		bool active;

		active = encoder->get_hw_state(encoder, &pipe);
		INTEL_DISPLAY_STATE_WARN(display, active != sw_crtc_state->hw.active,
					 "[ENCODER:%i] active %i with crtc active %i\n",
					 encoder->base.base.id, active,
					 sw_crtc_state->hw.active);

		INTEL_DISPLAY_STATE_WARN(display, active && primary_crtc->pipe != pipe,
					 "Encoder connected to wrong pipe %c\n",
					 pipe_name(pipe));

		if (active)
			intel_encoder_get_config(encoder, hw_crtc_state);
	}

	if (!sw_crtc_state->hw.active)
		goto destroy_state;

	intel_pipe_config_sanity_check(hw_crtc_state);

	if (!intel_pipe_config_compare(sw_crtc_state,
				       hw_crtc_state, false)) {
		INTEL_DISPLAY_STATE_WARN(display, 1, "pipe state doesn't match!\n");
		intel_crtc_state_dump(hw_crtc_state, NULL, "hw state");
		intel_crtc_state_dump(sw_crtc_state, NULL, "sw state");
	}

destroy_state:
	intel_crtc_destroy_state(&crtc->base, &hw_crtc_state->uapi);
}

void intel_modeset_verify_crtc(struct intel_atomic_state *state,
			       struct intel_crtc *crtc)
{
	const struct intel_crtc_state *new_crtc_state =
		intel_atomic_get_new_crtc_state(state, crtc);

	if (!intel_crtc_needs_modeset(new_crtc_state) &&
	    !intel_crtc_needs_fastset(new_crtc_state))

Annotation

Implementation Notes