2020-06-11 13:52:56

by Maxime Ripard

[permalink] [raw]
Subject: [PATCH v4 0/9] drm/vc4: Turn the TXP into a CRTC

Hi,

This is another part of the rpi4 HDMI series that got promoted to a
series of its own to try to reduce the main one.

This rework is needed since the bcm2711 used in the rpi4 has a more
complex routing in the HVS that doesn't allow to use a fairly simple
mapping like what was used before.

Since that mapping affects both the pixelvalves and the TXP, turning the
TXP into a CRTC just like pixelvalves are allows to deal with the
mapping in the CRTC states, which turns out to be pretty convenient.

Let me know what you think,
Maxime

Changes from v3:
- Stripped the patches out of the main HDMI series
- Change the bind order of the HVS to avoid a compatible check
- Added Eric's tags
- Rebased on top of drm-misc-next

Maxime Ripard (9):
drm/vc4: Reorder the bind order of the devices
drm/vc4: crtc: Move HVS setup code to the HVS driver
drm/vc4: crtc: Make state functions public
drm/vc4: crtc: Split CRTC data in two
drm/vc4: crtc: Only access the PixelValve registers if we have to
drm/vc4: crtc: Move the CRTC initialisation to a separate function
drm/vc4: crtc: Move the txp_armed function to the TXP
drm/vc4: txp: Turn the TXP into a CRTC of its own
drm/vc4: crtc: Remove the feed_txp tests

drivers/gpu/drm/vc4/vc4_crtc.c | 427 ++++++----------------------------
drivers/gpu/drm/vc4/vc4_drv.c | 2 +-
drivers/gpu/drm/vc4/vc4_drv.h | 38 ++-
drivers/gpu/drm/vc4/vc4_hvs.c | 291 +++++++++++++++++++++++-
drivers/gpu/drm/vc4/vc4_txp.c | 109 ++++++++-
5 files changed, 522 insertions(+), 345 deletions(-)

base-commit: ebd11f706c9d9756edad5b5f3f3310d77d77f60c
--
git-series 0.9.1


2020-06-11 18:49:31

by Maxime Ripard

[permalink] [raw]
Subject: [PATCH v4 4/9] drm/vc4: crtc: Split CRTC data in two

The vc4_crtc_data structure is currently storing data related to both the
general CRTC information needed by the rest of the vc4 driver (like HVS
output and available FIFOs) and some related to the pixelvalve attached to
that CRTC. Let's split this into two structures so that we can reuse the
CRTC part into the TXP later on.

Reviewed-by: Eric Anholt <[email protected]>
Signed-off-by: Maxime Ripard <[email protected]>
---
drivers/gpu/drm/vc4/vc4_crtc.c | 29 ++++++++++++++++++-----------
drivers/gpu/drm/vc4/vc4_drv.h | 19 +++++++++++++++++++
2 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 6e71bc13e339..6f1a1062db8f 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -780,8 +780,10 @@ static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
.get_scanout_position = vc4_crtc_get_scanout_position,
};

-static const struct vc4_crtc_data bcm2835_pv0_data = {
- .hvs_channel = 0,
+static const struct vc4_pv_data bcm2835_pv0_data = {
+ .base = {
+ .hvs_channel = 0,
+ },
.debugfs_name = "crtc0_regs",
.encoder_types = {
[PV_CONTROL_CLK_SELECT_DSI] = VC4_ENCODER_TYPE_DSI0,
@@ -789,8 +791,10 @@ static const struct vc4_crtc_data bcm2835_pv0_data = {
},
};

-static const struct vc4_crtc_data bcm2835_pv1_data = {
- .hvs_channel = 2,
+static const struct vc4_pv_data bcm2835_pv1_data = {
+ .base = {
+ .hvs_channel = 2,
+ },
.debugfs_name = "crtc1_regs",
.encoder_types = {
[PV_CONTROL_CLK_SELECT_DSI] = VC4_ENCODER_TYPE_DSI1,
@@ -798,8 +802,10 @@ static const struct vc4_crtc_data bcm2835_pv1_data = {
},
};

-static const struct vc4_crtc_data bcm2835_pv2_data = {
- .hvs_channel = 1,
+static const struct vc4_pv_data bcm2835_pv2_data = {
+ .base = {
+ .hvs_channel = 1,
+ },
.debugfs_name = "crtc2_regs",
.encoder_types = {
[PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_HDMI,
@@ -818,8 +824,9 @@ static void vc4_set_crtc_possible_masks(struct drm_device *drm,
struct drm_crtc *crtc)
{
struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
- const struct vc4_crtc_data *crtc_data = vc4_crtc->data;
- const enum vc4_encoder_type *encoder_types = crtc_data->encoder_types;
+ const struct vc4_crtc_data *crtc_data = vc4_crtc_to_vc4_crtc_data(vc4_crtc);
+ const struct vc4_pv_data *pv_data = vc4_crtc_to_vc4_pv_data(vc4_crtc);
+ const enum vc4_encoder_type *encoder_types = pv_data->encoder_types;
struct drm_encoder *encoder;

drm_for_each_encoder(encoder, drm) {
@@ -834,7 +841,7 @@ static void vc4_set_crtc_possible_masks(struct drm_device *drm,
}

vc4_encoder = to_vc4_encoder(encoder);
- for (i = 0; i < ARRAY_SIZE(crtc_data->encoder_types); i++) {
+ for (i = 0; i < ARRAY_SIZE(pv_data->encoder_types); i++) {
if (vc4_encoder->type == encoder_types[i]) {
vc4_encoder->clock_select = i;
encoder->possible_crtcs |= drm_crtc_mask(crtc);
@@ -864,7 +871,7 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
{
struct platform_device *pdev = to_platform_device(dev);
struct drm_device *drm = dev_get_drvdata(master);
- const struct vc4_crtc_data *pv_data;
+ const struct vc4_pv_data *pv_data;
struct vc4_crtc *vc4_crtc;
struct drm_crtc *crtc;
struct drm_plane *primary_plane, *destroy_plane, *temp;
@@ -878,7 +885,7 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
pv_data = of_device_get_match_data(dev);
if (!pv_data)
return -ENODEV;
- vc4_crtc->data = pv_data;
+ vc4_crtc->data = &pv_data->base;
vc4_crtc->pdev = pdev;

vc4_crtc->regs = vc4_ioremap_regs(pdev, 0);
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index c4873ae84231..6587bc09b2cd 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -443,9 +443,14 @@ to_vc4_encoder(struct drm_encoder *encoder)
struct vc4_crtc_data {
/* Which channel of the HVS this pixelvalve sources from. */
int hvs_channel;
+};
+
+struct vc4_pv_data {
+ struct vc4_crtc_data base;

enum vc4_encoder_type encoder_types[4];
const char *debugfs_name;
+
};

struct vc4_crtc {
@@ -477,6 +482,20 @@ to_vc4_crtc(struct drm_crtc *crtc)
return (struct vc4_crtc *)crtc;
}

+static inline const struct vc4_crtc_data *
+vc4_crtc_to_vc4_crtc_data(const struct vc4_crtc *crtc)
+{
+ return crtc->data;
+}
+
+static inline const struct vc4_pv_data *
+vc4_crtc_to_vc4_pv_data(const struct vc4_crtc *crtc)
+{
+ const struct vc4_crtc_data *data = vc4_crtc_to_vc4_crtc_data(crtc);
+
+ return container_of(data, struct vc4_pv_data, base);
+}
+
struct vc4_crtc_state {
struct drm_crtc_state base;
/* Dlist area for this CRTC configuration. */
--
git-series 0.9.1

2020-06-30 08:26:59

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH v4 0/9] drm/vc4: Turn the TXP into a CRTC

Hi Eric,

On Thu, Jun 11, 2020 at 03:36:45PM +0200, Maxime Ripard wrote:
> Hi,
>
> This is another part of the rpi4 HDMI series that got promoted to a
> series of its own to try to reduce the main one.
>
> This rework is needed since the bcm2711 used in the rpi4 has a more
> complex routing in the HVS that doesn't allow to use a fairly simple
> mapping like what was used before.
>
> Since that mapping affects both the pixelvalves and the TXP, turning the
> TXP into a CRTC just like pixelvalves are allows to deal with the
> mapping in the CRTC states, which turns out to be pretty convenient.
>
> Let me know what you think,
> Maxime
>
> Changes from v3:
> - Stripped the patches out of the main HDMI series
> - Change the bind order of the HVS to avoid a compatible check
> - Added Eric's tags
> - Rebased on top of drm-misc-next
>
> Maxime Ripard (9):
> drm/vc4: Reorder the bind order of the devices
> drm/vc4: crtc: Move HVS setup code to the HVS driver

Could you review those two patches? You haven't reviewed them yet and
it's holding back the rest of the patches.

Thanks!
Maxime


Attachments:
(No filename) (1.12 kB)
signature.asc (235.00 B)
Download all attachments

2020-07-07 00:53:04

by Eric Anholt

[permalink] [raw]
Subject: Re: [PATCH v4 0/9] drm/vc4: Turn the TXP into a CRTC

On Tue, Jun 30, 2020 at 1:25 AM Maxime Ripard <[email protected]> wrote:
>
> Hi Eric,
>
> On Thu, Jun 11, 2020 at 03:36:45PM +0200, Maxime Ripard wrote:
> > Hi,
> >
> > This is another part of the rpi4 HDMI series that got promoted to a
> > series of its own to try to reduce the main one.
> >
> > This rework is needed since the bcm2711 used in the rpi4 has a more
> > complex routing in the HVS that doesn't allow to use a fairly simple
> > mapping like what was used before.
> >
> > Since that mapping affects both the pixelvalves and the TXP, turning the
> > TXP into a CRTC just like pixelvalves are allows to deal with the
> > mapping in the CRTC states, which turns out to be pretty convenient.
> >
> > Let me know what you think,
> > Maxime
> >
> > Changes from v3:
> > - Stripped the patches out of the main HDMI series
> > - Change the bind order of the HVS to avoid a compatible check
> > - Added Eric's tags
> > - Rebased on top of drm-misc-next
> >
> > Maxime Ripard (9):
> > drm/vc4: Reorder the bind order of the devices
> > drm/vc4: crtc: Move HVS setup code to the HVS driver
>
> Could you review those two patches? You haven't reviewed them yet and
> it's holding back the rest of the patches.

LKML email workflow is the worst, the patches never came through to me
so I didn't see them until you linked me the patchwork. Patch 2,
commit message should say "We'll need the HVS to be bound before the
TXP", but other than that, r-b.

2020-07-07 08:58:35

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH v4 0/9] drm/vc4: Turn the TXP into a CRTC

On Mon, Jul 06, 2020 at 05:51:29PM -0700, Eric Anholt wrote:
> On Tue, Jun 30, 2020 at 1:25 AM Maxime Ripard <[email protected]> wrote:
> >
> > Hi Eric,
> >
> > On Thu, Jun 11, 2020 at 03:36:45PM +0200, Maxime Ripard wrote:
> > > Hi,
> > >
> > > This is another part of the rpi4 HDMI series that got promoted to a
> > > series of its own to try to reduce the main one.
> > >
> > > This rework is needed since the bcm2711 used in the rpi4 has a more
> > > complex routing in the HVS that doesn't allow to use a fairly simple
> > > mapping like what was used before.
> > >
> > > Since that mapping affects both the pixelvalves and the TXP, turning the
> > > TXP into a CRTC just like pixelvalves are allows to deal with the
> > > mapping in the CRTC states, which turns out to be pretty convenient.
> > >
> > > Let me know what you think,
> > > Maxime
> > >
> > > Changes from v3:
> > > - Stripped the patches out of the main HDMI series
> > > - Change the bind order of the HVS to avoid a compatible check
> > > - Added Eric's tags
> > > - Rebased on top of drm-misc-next
> > >
> > > Maxime Ripard (9):
> > > drm/vc4: Reorder the bind order of the devices
> > > drm/vc4: crtc: Move HVS setup code to the HVS driver
> >
> > Could you review those two patches? You haven't reviewed them yet and
> > it's holding back the rest of the patches.
>
> LKML email workflow is the worst, the patches never came through to me
> so I didn't see them until you linked me the patchwork. Patch 2,
> commit message should say "We'll need the HVS to be bound before the
> TXP", but other than that, r-b.

I've fixed the commit message and applied, thanks (and sorry for the troubles).

Maxime


Attachments:
(No filename) (1.69 kB)
signature.asc (235.00 B)
Download all attachments