drivers/gpu/drm/drm_plane_helper.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_plane_helper.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/drm_plane_helper.c
Extension
.c
Size
8561 bytes
Lines
282
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: exported/initcall integration point
Status
integration 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 (connector->encoder && connector->encoder->crtc == crtc) {
			if (connector_list != NULL && count < num_connectors)
				*(connector_list++) = connector;

			count++;
		}
	}
	drm_connector_list_iter_end(&conn_iter);

	return count;
}

static int drm_plane_helper_check_update(struct drm_plane *plane,
					 struct drm_crtc *crtc,
					 struct drm_framebuffer *fb,
					 struct drm_rect *src,
					 struct drm_rect *dst,
					 unsigned int rotation,
					 int min_scale,
					 int max_scale,
					 bool can_position,
					 bool can_update_disabled,
					 bool *visible)
{
	struct drm_plane_state plane_state = {
		.plane = plane,
		.crtc = crtc,
		.fb = fb,
		.src_x = src->x1,
		.src_y = src->y1,
		.src_w = drm_rect_width(src),
		.src_h = drm_rect_height(src),
		.crtc_x = dst->x1,
		.crtc_y = dst->y1,
		.crtc_w = drm_rect_width(dst),
		.crtc_h = drm_rect_height(dst),
		.rotation = rotation,
	};
	struct drm_crtc_state crtc_state = {
		.crtc = crtc,
		.enable = crtc->enabled,
		.mode = crtc->mode,
	};
	int ret;

	ret = drm_atomic_helper_check_plane_state(&plane_state, &crtc_state,
						  min_scale, max_scale,
						  can_position,
						  can_update_disabled);
	if (ret)
		return ret;

	*src = plane_state.src;
	*dst = plane_state.dst;
	*visible = plane_state.visible;

	return 0;
}

/**
 * drm_plane_helper_update_primary - Helper for updating primary planes
 * @plane: plane to update
 * @crtc: the plane's new CRTC
 * @fb: the plane's new framebuffer
 * @crtc_x: x coordinate within CRTC
 * @crtc_y: y coordinate within CRTC
 * @crtc_w: width coordinate within CRTC
 * @crtc_h: height coordinate within CRTC
 * @src_x: x coordinate within source
 * @src_y: y coordinate within source
 * @src_w: width coordinate within source
 * @src_h: height coordinate within source
 * @ctx: modeset locking context
 *
 * This helper validates the given parameters and updates the primary plane.
 *
 * This function is only useful for non-atomic modesetting. Don't use
 * it in new drivers.
 *
 * Returns:
 * Zero on success, or an errno code otherwise.
 */
int drm_plane_helper_update_primary(struct drm_plane *plane, struct drm_crtc *crtc,
				    struct drm_framebuffer *fb,
				    int crtc_x, int crtc_y,
				    unsigned int crtc_w, unsigned int crtc_h,
				    uint32_t src_x, uint32_t src_y,
				    uint32_t src_w, uint32_t src_h,
				    struct drm_modeset_acquire_ctx *ctx)
{

Annotation

Implementation Notes