Skip to content

Commit a1a9d90

Browse files
committed
drm/i915: Extract link_nv12_planes()
Pull the code linking the UV and Y planes together into a sensible function instead of having the code plastered inside the higher level loop. v2: Rebase due to intel_display changes Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250212164330.16891-8-ville.syrjala@linux.intel.com
1 parent 6a01df2 commit a1a9d90

1 file changed

Lines changed: 49 additions & 37 deletions

File tree

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

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4405,6 +4405,54 @@ static bool check_single_encoder_cloning(struct intel_atomic_state *state,
44054405
return true;
44064406
}
44074407

4408+
static void link_nv12_planes(struct intel_crtc_state *crtc_state,
4409+
struct intel_plane_state *plane_state,
4410+
struct intel_plane_state *linked_state)
4411+
{
4412+
struct intel_display *display = to_intel_display(plane_state);
4413+
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
4414+
struct intel_plane *linked = to_intel_plane(linked_state->uapi.plane);
4415+
4416+
drm_dbg_kms(display->drm, "UV plane [PLANE:%d:%s] using Y plane [PLANE:%d:%s]\n",
4417+
plane->base.base.id, plane->base.name,
4418+
linked->base.base.id, linked->base.name);
4419+
4420+
plane_state->planar_linked_plane = linked;
4421+
4422+
linked_state->is_y_plane = true;
4423+
linked_state->planar_linked_plane = plane;
4424+
4425+
crtc_state->enabled_planes |= BIT(linked->id);
4426+
crtc_state->active_planes |= BIT(linked->id);
4427+
crtc_state->update_planes |= BIT(linked->id);
4428+
4429+
crtc_state->data_rate[linked->id] = crtc_state->data_rate_y[plane->id];
4430+
crtc_state->rel_data_rate[linked->id] = crtc_state->rel_data_rate_y[plane->id];
4431+
4432+
/* Copy parameters to Y plane */
4433+
linked_state->ctl = plane_state->ctl | PLANE_CTL_YUV420_Y_PLANE;
4434+
linked_state->color_ctl = plane_state->color_ctl;
4435+
linked_state->view = plane_state->view;
4436+
linked_state->decrypt = plane_state->decrypt;
4437+
4438+
intel_plane_copy_hw_state(linked_state, plane_state);
4439+
linked_state->uapi.src = plane_state->uapi.src;
4440+
linked_state->uapi.dst = plane_state->uapi.dst;
4441+
4442+
if (icl_is_hdr_plane(display, plane->id)) {
4443+
if (linked->id == PLANE_7)
4444+
plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_7_ICL;
4445+
else if (linked->id == PLANE_6)
4446+
plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_6_ICL;
4447+
else if (linked->id == PLANE_5)
4448+
plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_5_RKL;
4449+
else if (linked->id == PLANE_4)
4450+
plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_4_RKL;
4451+
else
4452+
MISSING_CASE(linked->id);
4453+
}
4454+
}
4455+
44084456
static void unlink_nv12_plane(struct intel_crtc_state *crtc_state,
44094457
struct intel_plane_state *plane_state)
44104458
{
@@ -4485,43 +4533,7 @@ static int icl_check_nv12_planes(struct intel_atomic_state *state,
44854533
return -EINVAL;
44864534
}
44874535

4488-
plane_state->planar_linked_plane = linked;
4489-
4490-
linked_state->is_y_plane = true;
4491-
linked_state->planar_linked_plane = plane;
4492-
crtc_state->enabled_planes |= BIT(linked->id);
4493-
crtc_state->active_planes |= BIT(linked->id);
4494-
crtc_state->update_planes |= BIT(linked->id);
4495-
crtc_state->data_rate[linked->id] =
4496-
crtc_state->data_rate_y[plane->id];
4497-
crtc_state->rel_data_rate[linked->id] =
4498-
crtc_state->rel_data_rate_y[plane->id];
4499-
drm_dbg_kms(&dev_priv->drm, "UV plane [PLANE:%d:%s] using [PLANE:%d:%s] as Y plane\n",
4500-
plane->base.base.id, plane->base.name,
4501-
linked->base.base.id, linked->base.name);
4502-
4503-
/* Copy parameters to Y plane */
4504-
linked_state->ctl = plane_state->ctl | PLANE_CTL_YUV420_Y_PLANE;
4505-
linked_state->color_ctl = plane_state->color_ctl;
4506-
linked_state->view = plane_state->view;
4507-
linked_state->decrypt = plane_state->decrypt;
4508-
4509-
intel_plane_copy_hw_state(linked_state, plane_state);
4510-
linked_state->uapi.src = plane_state->uapi.src;
4511-
linked_state->uapi.dst = plane_state->uapi.dst;
4512-
4513-
if (icl_is_hdr_plane(display, plane->id)) {
4514-
if (linked->id == PLANE_7)
4515-
plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_7_ICL;
4516-
else if (linked->id == PLANE_6)
4517-
plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_6_ICL;
4518-
else if (linked->id == PLANE_5)
4519-
plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_5_RKL;
4520-
else if (linked->id == PLANE_4)
4521-
plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_4_RKL;
4522-
else
4523-
MISSING_CASE(linked->id);
4524-
}
4536+
link_nv12_planes(crtc_state, plane_state, linked_state);
45254537
}
45264538

45274539
return 0;

0 commit comments

Comments
 (0)