drivers/gpu/drm/renesas/rz-du/rzg2l_du_vsp.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/renesas/rz-du/rzg2l_du_vsp.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/renesas/rz-du/rzg2l_du_vsp.c
Extension
.c
Size
9660 bytes
Lines
372
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

switch (fourcc) {
		case DRM_FORMAT_ARGB1555:
			fourcc = DRM_FORMAT_XRGB1555;
			break;

		case DRM_FORMAT_ARGB4444:
			fourcc = DRM_FORMAT_XRGB4444;
			break;

		case DRM_FORMAT_ARGB8888:
			fourcc = DRM_FORMAT_XRGB8888;
			break;
		}
	}

	format = rzg2l_du_format_info(fourcc);
	cfg.pixelformat = format->v4l2;

	cfg.premult = state->state.pixel_blend_mode == DRM_MODE_BLEND_PREMULTI;

	vsp1_du_atomic_update(plane->vsp->vsp, crtc->vsp_pipe,
			      plane->index, &cfg);
}

static int __rzg2l_du_vsp_plane_atomic_check(struct drm_plane *plane,
					     struct drm_plane_state *state,
					     const struct rzg2l_du_format_info **format)
{
	struct drm_crtc_state *crtc_state;
	int ret;

	if (!state->crtc) {
		/*
		 * The visible field is not reset by the DRM core but only
		 * updated by drm_atomic_helper_check_plane_state, set it
		 * manually.
		 */
		state->visible = false;
		*format = NULL;
		return 0;
	}

	crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
	if (IS_ERR(crtc_state))
		return PTR_ERR(crtc_state);

	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
						  DRM_PLANE_NO_SCALING,
						  DRM_PLANE_NO_SCALING,
						  true, true);
	if (ret < 0)
		return ret;

	if (!state->visible) {
		*format = NULL;
		return 0;
	}

	*format = rzg2l_du_format_info(state->fb->format->format);

	return 0;
}

static int rzg2l_du_vsp_plane_atomic_check(struct drm_plane *plane,
					   struct drm_atomic_commit *state)
{
	struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
										 plane);
	struct rzg2l_du_vsp_plane_state *rstate = to_rzg2l_vsp_plane_state(new_plane_state);

	return __rzg2l_du_vsp_plane_atomic_check(plane, new_plane_state, &rstate->format);
}

static void rzg2l_du_vsp_plane_atomic_update(struct drm_plane *plane,
					     struct drm_atomic_commit *state)
{
	struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state, plane);
	struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state, plane);
	struct rzg2l_du_vsp_plane *rplane = to_rzg2l_vsp_plane(plane);
	struct rzg2l_du_crtc *crtc = to_rzg2l_crtc(old_state->crtc);

	if (new_state->visible)
		rzg2l_du_vsp_plane_setup(rplane);
	else if (old_state->crtc)
		vsp1_du_atomic_update(rplane->vsp->vsp, crtc->vsp_pipe,
				      rplane->index, NULL);
}

static const struct drm_plane_helper_funcs rzg2l_du_vsp_plane_helper_funcs = {
	.atomic_check = rzg2l_du_vsp_plane_atomic_check,

Annotation

Implementation Notes