Commit 778be378 authored by Ville Syrjälä's avatar Ville Syrjälä
Browse files

drm/i915: Move icl+ nv12 plane register mangling into skl_universal_plane.c



Try to keep all the low level skl+ universal plane register
details inside skl_universal_plane.c instead of having them
sprinkled all over the place.

v2: Rebase due to intel_display changes

Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250212164330.16891-10-ville.syrjala@linux.intel.com
parent c324dbd2
Loading
Loading
Loading
Loading
+6 −24
Original line number Diff line number Diff line
@@ -123,7 +123,6 @@
#include "intel_wm.h"
#include "skl_scaler.h"
#include "skl_universal_plane.h"
#include "skl_universal_plane_regs.h"
#include "skl_watermark.h"
#include "vlv_dpio_phy_regs.h"
#include "vlv_dsi.h"
@@ -4430,33 +4429,16 @@ static void link_nv12_planes(struct intel_crtc_state *crtc_state,
	crtc_state->rel_data_rate[y_plane->id] = crtc_state->rel_data_rate_y[uv_plane->id];

	/* Copy parameters to Y plane */
	y_plane_state->ctl = uv_plane_state->ctl | PLANE_CTL_YUV420_Y_PLANE;
	y_plane_state->color_ctl = uv_plane_state->color_ctl;
	y_plane_state->view = uv_plane_state->view;
	y_plane_state->decrypt = uv_plane_state->decrypt;

	intel_plane_copy_hw_state(y_plane_state, uv_plane_state);
	y_plane_state->uapi.src = uv_plane_state->uapi.src;
	y_plane_state->uapi.dst = uv_plane_state->uapi.dst;

	if (icl_is_hdr_plane(display, uv_plane->id)) {
		switch (y_plane->id) {
		case PLANE_7:
			uv_plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_7_ICL;
			break;
		case PLANE_6:
			uv_plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_6_ICL;
			break;
		case PLANE_5:
			uv_plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_5_RKL;
			break;
		case PLANE_4:
			uv_plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_4_RKL;
			break;
		default:
			MISSING_CASE(y_plane->id);
		}
	}
	y_plane_state->ctl = uv_plane_state->ctl;
	y_plane_state->color_ctl = uv_plane_state->color_ctl;
	y_plane_state->view = uv_plane_state->view;
	y_plane_state->decrypt = uv_plane_state->decrypt;

	icl_link_nv12_planes(uv_plane_state, y_plane_state);
}

static void unlink_nv12_plane(struct intel_crtc_state *crtc_state,
+32 −0
Original line number Diff line number Diff line
@@ -2327,6 +2327,38 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state,
	return 0;
}

void icl_link_nv12_planes(struct intel_plane_state *uv_plane_state,
			  struct intel_plane_state *y_plane_state)
{
	struct intel_display *display = to_intel_display(uv_plane_state);
	struct intel_plane *uv_plane = to_intel_plane(uv_plane_state->uapi.plane);
	struct intel_plane *y_plane = to_intel_plane(y_plane_state->uapi.plane);

	drm_WARN_ON(display->drm, icl_is_nv12_y_plane(display, uv_plane->id));
	drm_WARN_ON(display->drm, !icl_is_nv12_y_plane(display, y_plane->id));

	y_plane_state->ctl |= PLANE_CTL_YUV420_Y_PLANE;

	if (icl_is_hdr_plane(display, uv_plane->id)) {
		switch (y_plane->id) {
		case PLANE_7:
			uv_plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_7_ICL;
			break;
		case PLANE_6:
			uv_plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_6_ICL;
			break;
		case PLANE_5:
			uv_plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_5_RKL;
			break;
		case PLANE_4:
			uv_plane_state->cus_ctl |= PLANE_CUS_Y_PLANE_4_RKL;
			break;
		default:
			MISSING_CASE(y_plane->id);
		}
	}
}

static enum intel_fbc_id skl_fbc_id_for_pipe(enum pipe pipe)
{
	return pipe - PIPE_A + INTEL_FBC_A;
+3 −0
Original line number Diff line number Diff line
@@ -32,6 +32,9 @@ int skl_format_to_fourcc(int format, bool rgb_order, bool alpha);
int skl_calc_main_surface_offset(const struct intel_plane_state *plane_state,
				 int *x, int *y, u32 *offset);

void icl_link_nv12_planes(struct intel_plane_state *uv_plane_state,
			  struct intel_plane_state *y_plane_state);

bool icl_is_nv12_y_plane(struct intel_display *display,
			 enum plane_id plane_id);
u8 icl_hdr_plane_mask(void);