Commit 12e32f55 authored by Laurent Pinchart's avatar Laurent Pinchart
Browse files

drm: rcar-du: Add writeback support for R-Car Gen3



Implement writeback support for R-Car Gen3 by exposing writeback
connectors. Behind the scene the calls are forwarded to the VSP
backend.

Using writeback connectors will allow implemented writeback support for
R-Car Gen2 with a consistent API if desired.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
parent d46a4e93
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -36,3 +36,7 @@ config DRM_RCAR_VSP
	depends on VIDEO_RENESAS_VSP1=y || (VIDEO_RENESAS_VSP1 && DRM_RCAR_DU=m)
	help
	  Enable support to expose the R-Car VSP Compositor as KMS planes.

config DRM_RCAR_WRITEBACK
	bool
	default y if ARM64
+2 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ rcar-du-drm-y := rcar_du_crtc.o \
		 rcar_du_encoder.o \
		 rcar_du_group.o \
		 rcar_du_kms.o \
		 rcar_du_plane.o
		 rcar_du_plane.o \

rcar-du-drm-$(CONFIG_DRM_RCAR_LVDS)	+= rcar_du_of.o \
					   rcar_du_of_lvds_r8a7790.dtb.o \
@@ -13,6 +13,7 @@ rcar-du-drm-$(CONFIG_DRM_RCAR_LVDS) += rcar_du_of.o \
					   rcar_du_of_lvds_r8a7795.dtb.o \
					   rcar_du_of_lvds_r8a7796.dtb.o
rcar-du-drm-$(CONFIG_DRM_RCAR_VSP)	+= rcar_du_vsp.o
rcar-du-drm-$(CONFIG_DRM_RCAR_WRITEBACK) += rcar_du_writeback.o

obj-$(CONFIG_DRM_RCAR_DU)		+= rcar-du-drm.o
obj-$(CONFIG_DRM_RCAR_DW_HDMI)		+= rcar_dw_hdmi.o
+6 −1
Original line number Diff line number Diff line
@@ -648,8 +648,13 @@ static int rcar_du_crtc_atomic_check(struct drm_crtc *crtc,
	rstate->outputs = 0;

	drm_for_each_encoder_mask(encoder, crtc->dev, state->encoder_mask) {
		struct rcar_du_encoder *renc = to_rcar_encoder(encoder);
		struct rcar_du_encoder *renc;

		/* Skip the writeback encoder. */
		if (encoder->encoder_type == DRM_MODE_ENCODER_VIRTUAL)
			continue;

		renc = to_rcar_encoder(encoder);
		rstate->outputs |= BIT(renc->output);
	}

+6 −1
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include <linux/wait.h>

#include <drm/drm_crtc.h>
#include <drm/drm_writeback.h>

#include <media/vsp1.h>

@@ -39,6 +40,7 @@ struct rcar_du_vsp;
 * @group: CRTC group this CRTC belongs to
 * @vsp: VSP feeding video to this CRTC
 * @vsp_pipe: index of the VSP pipeline feeding video to this CRTC
 * @writeback: the writeback connector
 */
struct rcar_du_crtc {
	struct drm_crtc crtc;
@@ -65,9 +67,12 @@ struct rcar_du_crtc {

	const char *const *sources;
	unsigned int sources_count;

	struct drm_writeback_connector writeback;
};

#define to_rcar_crtc(c)		container_of(c, struct rcar_du_crtc, crtc)
#define wb_to_rcar_crtc(c)	container_of(c, struct rcar_du_crtc, writeback)

/**
 * struct rcar_du_crtc_state - Driver-specific CRTC state
+12 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include "rcar_du_kms.h"
#include "rcar_du_regs.h"
#include "rcar_du_vsp.h"
#include "rcar_du_writeback.h"

/* -----------------------------------------------------------------------------
 * Format helpers
@@ -664,6 +665,17 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
		encoder->possible_clones = (1 << num_encoders) - 1;
	}

	/* Create the writeback connectors. */
	if (rcdu->info->gen >= 3) {
		for (i = 0; i < rcdu->num_crtcs; ++i) {
			struct rcar_du_crtc *rcrtc = &rcdu->crtcs[i];

			ret = rcar_du_writeback_init(rcdu, rcrtc);
			if (ret < 0)
				return ret;
		}
	}

	/*
	 * Initialize the default DPAD0 source to the index of the first DU
	 * channel that can be connected to DPAD0. The exact value doesn't
Loading