All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mateusz Kwiatkowski <kfyatek@gmail.com>
To: Lukas Satin <luke.satin@gmail.com>, Maxime Ripard <maxime@cerno.tech>
Cc: "Jani Nikula" <jani.nikula@linux.intel.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Tvrtko Ursulin" <tvrtko.ursulin@linux.intel.com>,
	"Ben Skeggs" <bskeggs@redhat.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Samuel Holland" <samuel@sholland.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Emma Anholt" <emma@anholt.net>,
	"Karol Herbst" <kherbst@redhat.com>,
	"Daniel Vetter" <daniel@ffwll.ch>, "Chen-Yu Tsai" <wens@csie.org>,
	"Lyude Paul" <lyude@redhat.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@linux.ie>,
	"Dom Cobley" <dom@raspberrypi.com>,
	nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Phil Elwell" <phil@raspberrypi.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	linux-sunxi@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [Nouveau] [PATCH v7 22/23] drm/vc4: vec: Add support for more analog TV standards
Date: Tue, 8 Nov 2022 23:16:23 +0100	[thread overview]
Message-ID: <137895ef-b2c4-6e10-e245-125745b882bc@gmail.com> (raw)
In-Reply-To: <CAEFVmOKn4Won90xyX2Efh2esZ94npoy0BuTQ7n-in+KapfBb=w@mail.gmail.com>

Hi Lukas, Maxime and everyone,

W dniu 8.11.2022 o 14:17, Lukas Satin pisze:
> They are important for retrogaming and connecting TV out to CRT TV or using
> emulator.
>
> I have PS1 that is using PAL-60 for example.
>
> Can you add 240p and 288p non-interlaced modes for NTSC and PAL, please?

To add progressive mode support, at least for the VC4/VEC device that's used
on the Raspberry Pi, all that's necessary is a patch like:

--- a/drivers/gpu/drm/vc4/vc4_vec.c
+++ b/drivers/gpu/drm/vc4/vc4_vec.c
@@ -623,7 +623,9 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder,
 	VEC_WRITE(VEC_CLMP0_START, 0xac);
 	VEC_WRITE(VEC_CLMP0_END, 0xec);
 	VEC_WRITE(VEC_CONFIG2,
-		  VEC_CONFIG2_UV_DIG_DIS | VEC_CONFIG2_RGB_DIG_DIS);
+		  VEC_CONFIG2_UV_DIG_DIS |
+		  VEC_CONFIG2_RGB_DIG_DIS |
+		  ((adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) ? 0 : VEC_CONFIG2_PROG_SCAN));
 	VEC_WRITE(VEC_CONFIG3, VEC_CONFIG3_HORIZ_LEN_STD);
 	VEC_WRITE(VEC_DAC_CONFIG, vec->variant->dac_config);
 

and then you can just add custom modes, for example within Xorg:

xrandr --newmode 720x240 13.5 720 736 800 858 240 243 246 262
xrandr --newmode 720x288 13.5 720 740 804 864 288 290 293 312

Note that the pixel aspect ratio will be all over the place - unfortunately this
is necessary at the driver level, because VC4's VEC does not support pixel
clocks other than 13.5 MHz. However, you can fix it by running something like
"xrandr --scale-from 320x240" or "xrandr --scale-from 384x288". Other (non-X)
applications would need to be adapted to similarly configure DRM scaling.

I'm not sure if Maxime wants to introduce any more code like the patch above to
facilitate progressive scan support, though (@Maxime: feel free to grab the code
from above or anything else from https://github.com/raspberrypi/linux/pull/4406
if you do, however!). We talked recently that the priority is to finally merge
existing functionality first, see this message:
https://lore.kernel.org/dri-devel/20221027115822.5vd3fqlcpy4gfq5v@houat/

I'm willing to post a couple of follow-up patches to improve things like
support for progressive modes or exotic TV norms (such as PAL-M-50 or PAL-N-60)
within the VC4 driver once this patchset lands - but I agree with Maxime's point
to focus on merging existing functionality first.

> Lukas

Best regards,
Mateusz Kwiatkowski

> On Mon, Nov 7, 2022 at 3:19 PM Maxime Ripard <maxime@cerno.tech> wrote:
>
>     From: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
>
>     Add support for the following composite output modes (all of them are
>     somewhat more obscure than the previously defined ones):
>
>     - NTSC_443 - NTSC-style signal with the chroma subcarrier shifted to
>       4.43361875 MHz (the PAL subcarrier frequency). Never used for
>       broadcasting, but sometimes used as a hack to play NTSC content in PAL
>       regions (e.g. on VCRs).
>     - PAL_N - PAL with alternative chroma subcarrier frequency,
>       3.58205625 MHz. Used as a broadcast standard in Argentina, Paraguay
>       and Uruguay to fit 576i50 with colour in 6 MHz channel raster.
>     - PAL60 - 480i60 signal with PAL-style color at normal European PAL
>       frequency. Another non-standard, non-broadcast mode, used in similar
>       contexts as NTSC_443. Some displays support one but not the other.
>     - SECAM - French frequency-modulated analog color standard; also have
>       been broadcast in Eastern Europe and various parts of Africa and Asia.
>       Uses the same 576i50 timings as PAL.
>
>     Also added some comments explaining color subcarrier frequency
>     registers.
>
>     Acked-by: Noralf Trønnes <noralf@tronnes.org>
>     Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
>     Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>
>     ---
>     Changes in v6:
>     - Support PAL60 again
>     ---
>      drivers/gpu/drm/vc4/vc4_vec.c | 111 ++++++++++++++++++++++++++++++++++++++++--
>      1 file changed, 107 insertions(+), 4 deletions(-)
>
>     diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c
>     index a828fc6fb776..d23dbad3cbf6 100644
>     --- a/drivers/gpu/drm/vc4/vc4_vec.c
>     +++ b/drivers/gpu/drm/vc4/vc4_vec.c
>     @@ -46,6 +46,7 @@
>      #define VEC_CONFIG0_YDEL(x)            ((x) << 26)
>      #define VEC_CONFIG0_CDEL_MASK          GENMASK(25, 24)
>      #define VEC_CONFIG0_CDEL(x)            ((x) << 24)
>     +#define VEC_CONFIG0_SECAM_STD          BIT(21)
>      #define VEC_CONFIG0_PBPR_FIL           BIT(18)
>      #define VEC_CONFIG0_CHROMA_GAIN_MASK   GENMASK(17, 16)
>      #define VEC_CONFIG0_CHROMA_GAIN_UNITY  (0 << 16)
>     @@ -76,6 +77,27 @@
>      #define VEC_SOFT_RESET                 0x10c
>      #define VEC_CLMP0_START                        0x144
>      #define VEC_CLMP0_END                  0x148
>     +
>     +/*
>     + * These set the color subcarrier frequency
>     + * if VEC_CONFIG1_CUSTOM_FREQ is enabled.
>     + *
>     + * VEC_FREQ1_0 contains the most significant 16-bit half-word,
>     + * VEC_FREQ3_2 contains the least significant 16-bit half-word.
>     + * 0x80000000 seems to be equivalent to the pixel clock
>     + * (which itself is the VEC clock divided by 8).
>     + *
>     + * Reference values (with the default pixel clock of 13.5 MHz):
>     + *
>     + * NTSC  (3579545.[45] Hz)     - 0x21F07C1F
>     + * PAL   (4433618.75 Hz)       - 0x2A098ACB
>     + * PAL-M (3575611.[888111] Hz) - 0x21E6EFE3
>     + * PAL-N (3582056.25 Hz)       - 0x21F69446
>     + *
>     + * NOTE: For SECAM, it is used as the Dr center frequency,
>     + * regardless of whether VEC_CONFIG1_CUSTOM_FREQ is enabled or not;
>     + * that is specified as 4406250 Hz, which corresponds to 0x29C71C72.
>     + */
>      #define VEC_FREQ3_2                    0x180
>      #define VEC_FREQ1_0                    0x184
>
>     @@ -118,6 +140,14 @@
>
>      #define VEC_INTERRUPT_CONTROL          0x190
>      #define VEC_INTERRUPT_STATUS           0x194
>     +
>     +/*
>     + * Db center frequency for SECAM; the clock for this is the same as for
>     + * VEC_FREQ3_2/VEC_FREQ1_0, which is used for Dr center frequency.
>     + *
>     + * This is specified as 4250000 Hz, which corresponds to 0x284BDA13.
>     + * That is also the default value, so no need to set it explicitly.
>     + */
>      #define VEC_FCW_SECAM_B                        0x198
>      #define VEC_SECAM_GAIN_VAL             0x19c
>
>     @@ -197,10 +227,15 @@ enum vc4_vec_tv_mode_id {
>             VC4_VEC_TV_MODE_NTSC_J,
>             VC4_VEC_TV_MODE_PAL,
>             VC4_VEC_TV_MODE_PAL_M,
>     +       VC4_VEC_TV_MODE_NTSC_443,
>     +       VC4_VEC_TV_MODE_PAL_60,
>     +       VC4_VEC_TV_MODE_PAL_N,
>     +       VC4_VEC_TV_MODE_SECAM,
>      };
>
>      struct vc4_vec_tv_mode {
>             unsigned int mode;
>     +       u16 expected_htotal;
>             u32 config0;
>             u32 config1;
>             u32 custom_freq;
>     @@ -236,35 +271,68 @@ static const struct debugfs_reg32 vec_regs[] = {
>      static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = {
>             {
>                     .mode = DRM_MODE_TV_MODE_NTSC,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_NTSC_443,
>     +               .expected_htotal = 858,
>     +               .config0 = VEC_CONFIG0_NTSC_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ,
>     +               .custom_freq = 0x2a098acb,
>     +       },
>             {
>                     .mode = DRM_MODE_TV_MODE_NTSC_J,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_NTSC_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>             {
>                     .mode = DRM_MODE_TV_MODE_PAL,
>     +               .expected_htotal = 864,
>                     .config0 = VEC_CONFIG0_PAL_BDGHI_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               /* PAL-60 */
>     +               .mode = DRM_MODE_TV_MODE_PAL,
>     +               .expected_htotal = 858,
>     +               .config0 = VEC_CONFIG0_PAL_M_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ,
>     +               .custom_freq = 0x2a098acb,
>     +       },
>             {
>                     .mode = DRM_MODE_TV_MODE_PAL_M,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_PAL_M_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_PAL_N,
>     +               .expected_htotal = 864,
>     +               .config0 = VEC_CONFIG0_PAL_N_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>     +       },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_SECAM,
>     +               .expected_htotal = 864,
>     +               .config0 = VEC_CONFIG0_SECAM_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>     +               .custom_freq = 0x29c71c72,
>     +       },
>      };
>
>      static inline const struct vc4_vec_tv_mode *
>     -vc4_vec_tv_mode_lookup(unsigned int mode)
>     +vc4_vec_tv_mode_lookup(unsigned int mode, u16 htotal)
>      {
>             unsigned int i;
>
>             for (i = 0; i < ARRAY_SIZE(vc4_vec_tv_modes); i++) {
>                     const struct vc4_vec_tv_mode *tv_mode = &vc4_vec_tv_modes[i];
>
>     -               if (tv_mode->mode == mode)
>     +               if (tv_mode->mode == mode &&
>     +                   tv_mode->expected_htotal == htotal)
>                             return tv_mode;
>             }
>
>     @@ -273,9 +341,13 @@ vc4_vec_tv_mode_lookup(unsigned int mode)
>
>      static const struct drm_prop_enum_list legacy_tv_mode_names[] = {
>             { VC4_VEC_TV_MODE_NTSC, "NTSC", },
>     +       { VC4_VEC_TV_MODE_NTSC_443, "NTSC-443", },
>             { VC4_VEC_TV_MODE_NTSC_J, "NTSC-J", },
>             { VC4_VEC_TV_MODE_PAL, "PAL", },
>     +       { VC4_VEC_TV_MODE_PAL_60, "PAL-60", },
>             { VC4_VEC_TV_MODE_PAL_M, "PAL-M", },
>     +       { VC4_VEC_TV_MODE_PAL_N, "PAL-N", },
>     +       { VC4_VEC_TV_MODE_SECAM, "SECAM", },
>      };
>
>      static enum drm_connector_status
>     @@ -306,11 +378,16 @@ vc4_vec_connector_set_property(struct drm_connector *connector,
>                     state->tv.mode = DRM_MODE_TV_MODE_NTSC;
>                     break;
>
>     +       case VC4_VEC_TV_MODE_NTSC_443:
>     +               state->tv.mode = DRM_MODE_TV_MODE_NTSC_443;
>     +               break;
>     +
>             case VC4_VEC_TV_MODE_NTSC_J:
>                     state->tv.mode = DRM_MODE_TV_MODE_NTSC_J;
>                     break;
>
>             case VC4_VEC_TV_MODE_PAL:
>     +       case VC4_VEC_TV_MODE_PAL_60:
>                     state->tv.mode = DRM_MODE_TV_MODE_PAL;
>                     break;
>
>     @@ -318,6 +395,14 @@ vc4_vec_connector_set_property(struct drm_connector *connector,
>                     state->tv.mode = DRM_MODE_TV_MODE_PAL_M;
>                     break;
>
>     +       case VC4_VEC_TV_MODE_PAL_N:
>     +               state->tv.mode = DRM_MODE_TV_MODE_PAL_N;
>     +               break;
>     +
>     +       case VC4_VEC_TV_MODE_SECAM:
>     +               state->tv.mode = DRM_MODE_TV_MODE_SECAM;
>     +               break;
>     +
>             default:
>                     return -EINVAL;
>             }
>     @@ -341,6 +426,10 @@ vc4_vec_connector_get_property(struct drm_connector *connector,
>                     *val = VC4_VEC_TV_MODE_NTSC;
>                     break;
>
>     +       case DRM_MODE_TV_MODE_NTSC_443:
>     +               *val = VC4_VEC_TV_MODE_NTSC_443;
>     +               break;
>     +
>             case DRM_MODE_TV_MODE_NTSC_J:
>                     *val = VC4_VEC_TV_MODE_NTSC_J;
>                     break;
>     @@ -353,6 +442,14 @@ vc4_vec_connector_get_property(struct drm_connector *connector,
>                     *val = VC4_VEC_TV_MODE_PAL_M;
>                     break;
>
>     +       case DRM_MODE_TV_MODE_PAL_N:
>     +               *val = VC4_VEC_TV_MODE_PAL_N;
>     +               break;
>     +
>     +       case DRM_MODE_TV_MODE_SECAM:
>     +               *val = VC4_VEC_TV_MODE_SECAM;
>     +               break;
>     +
>             default:
>                     return -EINVAL;
>             }
>     @@ -448,13 +545,16 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder,
>             struct drm_connector *connector = &vec->connector;
>             struct drm_connector_state *conn_state =
>                     drm_atomic_get_new_connector_state(state, connector);
>     +       struct drm_display_mode *adjusted_mode =
>     +               &encoder->crtc->state->adjusted_mode;
>             const struct vc4_vec_tv_mode *tv_mode;
>             int idx, ret;
>
>             if (!drm_dev_enter(drm, &idx))
>                     return;
>
>     -       tv_mode = vc4_vec_tv_mode_lookup(conn_state->tv.mode);
>     +       tv_mode = vc4_vec_tv_mode_lookup(conn_state->tv.mode,
>     +                                        adjusted_mode->htotal);
>             if (!tv_mode)
>                     goto err_dev_exit;
>
>     @@ -648,9 +748,12 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data)
>
>             ret = drm_mode_create_tv_properties(drm,
>                                                 BIT(DRM_MODE_TV_MODE_NTSC) |
>     +                                           BIT(DRM_MODE_TV_MODE_NTSC_443) |
>                                                 BIT(DRM_MODE_TV_MODE_NTSC_J) |
>                                                 BIT(DRM_MODE_TV_MODE_PAL) |
>     -                                           BIT(DRM_MODE_TV_MODE_PAL_M));
>     +                                           BIT(DRM_MODE_TV_MODE_PAL_M) |
>     +                                           BIT(DRM_MODE_TV_MODE_PAL_N) |
>     +                                           BIT(DRM_MODE_TV_MODE_SECAM));
>             if (ret)
>                     return ret;
>
>
>     -- 
>     b4 0.11.0-dev-99e3a 
>


WARNING: multiple messages have this Message-ID (diff)
From: Mateusz Kwiatkowski <kfyatek@gmail.com>
To: Lukas Satin <luke.satin@gmail.com>, Maxime Ripard <maxime@cerno.tech>
Cc: "David Airlie" <airlied@linux.ie>,
	nouveau@lists.freedesktop.org,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	dri-devel@lists.freedesktop.org,
	"Phil Elwell" <phil@raspberrypi.com>,
	"Emma Anholt" <emma@anholt.net>,
	"Samuel Holland" <samuel@sholland.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Ben Skeggs" <bskeggs@redhat.com>,
	linux-sunxi@lists.linux.dev, "Daniel Vetter" <daniel@ffwll.ch>,
	intel-gfx@lists.freedesktop.org,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	linux-arm-kernel@lists.infradead.org,
	"Tvrtko Ursulin" <tvrtko.ursulin@linux.intel.com>,
	"Dom Cobley" <dom@raspberrypi.com>,
	linux-kernel@vger.kernel.org,
	"Noralf Trønnes" <noralf@tronnes.org>
Subject: Re: [Nouveau] [PATCH v7 22/23] drm/vc4: vec: Add support for more analog TV standards
Date: Tue, 8 Nov 2022 23:16:23 +0100	[thread overview]
Message-ID: <137895ef-b2c4-6e10-e245-125745b882bc@gmail.com> (raw)
In-Reply-To: <CAEFVmOKn4Won90xyX2Efh2esZ94npoy0BuTQ7n-in+KapfBb=w@mail.gmail.com>

Hi Lukas, Maxime and everyone,

W dniu 8.11.2022 o 14:17, Lukas Satin pisze:
> They are important for retrogaming and connecting TV out to CRT TV or using
> emulator.
>
> I have PS1 that is using PAL-60 for example.
>
> Can you add 240p and 288p non-interlaced modes for NTSC and PAL, please?

To add progressive mode support, at least for the VC4/VEC device that's used
on the Raspberry Pi, all that's necessary is a patch like:

--- a/drivers/gpu/drm/vc4/vc4_vec.c
+++ b/drivers/gpu/drm/vc4/vc4_vec.c
@@ -623,7 +623,9 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder,
 	VEC_WRITE(VEC_CLMP0_START, 0xac);
 	VEC_WRITE(VEC_CLMP0_END, 0xec);
 	VEC_WRITE(VEC_CONFIG2,
-		  VEC_CONFIG2_UV_DIG_DIS | VEC_CONFIG2_RGB_DIG_DIS);
+		  VEC_CONFIG2_UV_DIG_DIS |
+		  VEC_CONFIG2_RGB_DIG_DIS |
+		  ((adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) ? 0 : VEC_CONFIG2_PROG_SCAN));
 	VEC_WRITE(VEC_CONFIG3, VEC_CONFIG3_HORIZ_LEN_STD);
 	VEC_WRITE(VEC_DAC_CONFIG, vec->variant->dac_config);
 

and then you can just add custom modes, for example within Xorg:

xrandr --newmode 720x240 13.5 720 736 800 858 240 243 246 262
xrandr --newmode 720x288 13.5 720 740 804 864 288 290 293 312

Note that the pixel aspect ratio will be all over the place - unfortunately this
is necessary at the driver level, because VC4's VEC does not support pixel
clocks other than 13.5 MHz. However, you can fix it by running something like
"xrandr --scale-from 320x240" or "xrandr --scale-from 384x288". Other (non-X)
applications would need to be adapted to similarly configure DRM scaling.

I'm not sure if Maxime wants to introduce any more code like the patch above to
facilitate progressive scan support, though (@Maxime: feel free to grab the code
from above or anything else from https://github.com/raspberrypi/linux/pull/4406
if you do, however!). We talked recently that the priority is to finally merge
existing functionality first, see this message:
https://lore.kernel.org/dri-devel/20221027115822.5vd3fqlcpy4gfq5v@houat/

I'm willing to post a couple of follow-up patches to improve things like
support for progressive modes or exotic TV norms (such as PAL-M-50 or PAL-N-60)
within the VC4 driver once this patchset lands - but I agree with Maxime's point
to focus on merging existing functionality first.

> Lukas

Best regards,
Mateusz Kwiatkowski

> On Mon, Nov 7, 2022 at 3:19 PM Maxime Ripard <maxime@cerno.tech> wrote:
>
>     From: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
>
>     Add support for the following composite output modes (all of them are
>     somewhat more obscure than the previously defined ones):
>
>     - NTSC_443 - NTSC-style signal with the chroma subcarrier shifted to
>       4.43361875 MHz (the PAL subcarrier frequency). Never used for
>       broadcasting, but sometimes used as a hack to play NTSC content in PAL
>       regions (e.g. on VCRs).
>     - PAL_N - PAL with alternative chroma subcarrier frequency,
>       3.58205625 MHz. Used as a broadcast standard in Argentina, Paraguay
>       and Uruguay to fit 576i50 with colour in 6 MHz channel raster.
>     - PAL60 - 480i60 signal with PAL-style color at normal European PAL
>       frequency. Another non-standard, non-broadcast mode, used in similar
>       contexts as NTSC_443. Some displays support one but not the other.
>     - SECAM - French frequency-modulated analog color standard; also have
>       been broadcast in Eastern Europe and various parts of Africa and Asia.
>       Uses the same 576i50 timings as PAL.
>
>     Also added some comments explaining color subcarrier frequency
>     registers.
>
>     Acked-by: Noralf Trønnes <noralf@tronnes.org>
>     Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
>     Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>
>     ---
>     Changes in v6:
>     - Support PAL60 again
>     ---
>      drivers/gpu/drm/vc4/vc4_vec.c | 111 ++++++++++++++++++++++++++++++++++++++++--
>      1 file changed, 107 insertions(+), 4 deletions(-)
>
>     diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c
>     index a828fc6fb776..d23dbad3cbf6 100644
>     --- a/drivers/gpu/drm/vc4/vc4_vec.c
>     +++ b/drivers/gpu/drm/vc4/vc4_vec.c
>     @@ -46,6 +46,7 @@
>      #define VEC_CONFIG0_YDEL(x)            ((x) << 26)
>      #define VEC_CONFIG0_CDEL_MASK          GENMASK(25, 24)
>      #define VEC_CONFIG0_CDEL(x)            ((x) << 24)
>     +#define VEC_CONFIG0_SECAM_STD          BIT(21)
>      #define VEC_CONFIG0_PBPR_FIL           BIT(18)
>      #define VEC_CONFIG0_CHROMA_GAIN_MASK   GENMASK(17, 16)
>      #define VEC_CONFIG0_CHROMA_GAIN_UNITY  (0 << 16)
>     @@ -76,6 +77,27 @@
>      #define VEC_SOFT_RESET                 0x10c
>      #define VEC_CLMP0_START                        0x144
>      #define VEC_CLMP0_END                  0x148
>     +
>     +/*
>     + * These set the color subcarrier frequency
>     + * if VEC_CONFIG1_CUSTOM_FREQ is enabled.
>     + *
>     + * VEC_FREQ1_0 contains the most significant 16-bit half-word,
>     + * VEC_FREQ3_2 contains the least significant 16-bit half-word.
>     + * 0x80000000 seems to be equivalent to the pixel clock
>     + * (which itself is the VEC clock divided by 8).
>     + *
>     + * Reference values (with the default pixel clock of 13.5 MHz):
>     + *
>     + * NTSC  (3579545.[45] Hz)     - 0x21F07C1F
>     + * PAL   (4433618.75 Hz)       - 0x2A098ACB
>     + * PAL-M (3575611.[888111] Hz) - 0x21E6EFE3
>     + * PAL-N (3582056.25 Hz)       - 0x21F69446
>     + *
>     + * NOTE: For SECAM, it is used as the Dr center frequency,
>     + * regardless of whether VEC_CONFIG1_CUSTOM_FREQ is enabled or not;
>     + * that is specified as 4406250 Hz, which corresponds to 0x29C71C72.
>     + */
>      #define VEC_FREQ3_2                    0x180
>      #define VEC_FREQ1_0                    0x184
>
>     @@ -118,6 +140,14 @@
>
>      #define VEC_INTERRUPT_CONTROL          0x190
>      #define VEC_INTERRUPT_STATUS           0x194
>     +
>     +/*
>     + * Db center frequency for SECAM; the clock for this is the same as for
>     + * VEC_FREQ3_2/VEC_FREQ1_0, which is used for Dr center frequency.
>     + *
>     + * This is specified as 4250000 Hz, which corresponds to 0x284BDA13.
>     + * That is also the default value, so no need to set it explicitly.
>     + */
>      #define VEC_FCW_SECAM_B                        0x198
>      #define VEC_SECAM_GAIN_VAL             0x19c
>
>     @@ -197,10 +227,15 @@ enum vc4_vec_tv_mode_id {
>             VC4_VEC_TV_MODE_NTSC_J,
>             VC4_VEC_TV_MODE_PAL,
>             VC4_VEC_TV_MODE_PAL_M,
>     +       VC4_VEC_TV_MODE_NTSC_443,
>     +       VC4_VEC_TV_MODE_PAL_60,
>     +       VC4_VEC_TV_MODE_PAL_N,
>     +       VC4_VEC_TV_MODE_SECAM,
>      };
>
>      struct vc4_vec_tv_mode {
>             unsigned int mode;
>     +       u16 expected_htotal;
>             u32 config0;
>             u32 config1;
>             u32 custom_freq;
>     @@ -236,35 +271,68 @@ static const struct debugfs_reg32 vec_regs[] = {
>      static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = {
>             {
>                     .mode = DRM_MODE_TV_MODE_NTSC,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_NTSC_443,
>     +               .expected_htotal = 858,
>     +               .config0 = VEC_CONFIG0_NTSC_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ,
>     +               .custom_freq = 0x2a098acb,
>     +       },
>             {
>                     .mode = DRM_MODE_TV_MODE_NTSC_J,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_NTSC_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>             {
>                     .mode = DRM_MODE_TV_MODE_PAL,
>     +               .expected_htotal = 864,
>                     .config0 = VEC_CONFIG0_PAL_BDGHI_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               /* PAL-60 */
>     +               .mode = DRM_MODE_TV_MODE_PAL,
>     +               .expected_htotal = 858,
>     +               .config0 = VEC_CONFIG0_PAL_M_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ,
>     +               .custom_freq = 0x2a098acb,
>     +       },
>             {
>                     .mode = DRM_MODE_TV_MODE_PAL_M,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_PAL_M_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_PAL_N,
>     +               .expected_htotal = 864,
>     +               .config0 = VEC_CONFIG0_PAL_N_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>     +       },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_SECAM,
>     +               .expected_htotal = 864,
>     +               .config0 = VEC_CONFIG0_SECAM_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>     +               .custom_freq = 0x29c71c72,
>     +       },
>      };
>
>      static inline const struct vc4_vec_tv_mode *
>     -vc4_vec_tv_mode_lookup(unsigned int mode)
>     +vc4_vec_tv_mode_lookup(unsigned int mode, u16 htotal)
>      {
>             unsigned int i;
>
>             for (i = 0; i < ARRAY_SIZE(vc4_vec_tv_modes); i++) {
>                     const struct vc4_vec_tv_mode *tv_mode = &vc4_vec_tv_modes[i];
>
>     -               if (tv_mode->mode == mode)
>     +               if (tv_mode->mode == mode &&
>     +                   tv_mode->expected_htotal == htotal)
>                             return tv_mode;
>             }
>
>     @@ -273,9 +341,13 @@ vc4_vec_tv_mode_lookup(unsigned int mode)
>
>      static const struct drm_prop_enum_list legacy_tv_mode_names[] = {
>             { VC4_VEC_TV_MODE_NTSC, "NTSC", },
>     +       { VC4_VEC_TV_MODE_NTSC_443, "NTSC-443", },
>             { VC4_VEC_TV_MODE_NTSC_J, "NTSC-J", },
>             { VC4_VEC_TV_MODE_PAL, "PAL", },
>     +       { VC4_VEC_TV_MODE_PAL_60, "PAL-60", },
>             { VC4_VEC_TV_MODE_PAL_M, "PAL-M", },
>     +       { VC4_VEC_TV_MODE_PAL_N, "PAL-N", },
>     +       { VC4_VEC_TV_MODE_SECAM, "SECAM", },
>      };
>
>      static enum drm_connector_status
>     @@ -306,11 +378,16 @@ vc4_vec_connector_set_property(struct drm_connector *connector,
>                     state->tv.mode = DRM_MODE_TV_MODE_NTSC;
>                     break;
>
>     +       case VC4_VEC_TV_MODE_NTSC_443:
>     +               state->tv.mode = DRM_MODE_TV_MODE_NTSC_443;
>     +               break;
>     +
>             case VC4_VEC_TV_MODE_NTSC_J:
>                     state->tv.mode = DRM_MODE_TV_MODE_NTSC_J;
>                     break;
>
>             case VC4_VEC_TV_MODE_PAL:
>     +       case VC4_VEC_TV_MODE_PAL_60:
>                     state->tv.mode = DRM_MODE_TV_MODE_PAL;
>                     break;
>
>     @@ -318,6 +395,14 @@ vc4_vec_connector_set_property(struct drm_connector *connector,
>                     state->tv.mode = DRM_MODE_TV_MODE_PAL_M;
>                     break;
>
>     +       case VC4_VEC_TV_MODE_PAL_N:
>     +               state->tv.mode = DRM_MODE_TV_MODE_PAL_N;
>     +               break;
>     +
>     +       case VC4_VEC_TV_MODE_SECAM:
>     +               state->tv.mode = DRM_MODE_TV_MODE_SECAM;
>     +               break;
>     +
>             default:
>                     return -EINVAL;
>             }
>     @@ -341,6 +426,10 @@ vc4_vec_connector_get_property(struct drm_connector *connector,
>                     *val = VC4_VEC_TV_MODE_NTSC;
>                     break;
>
>     +       case DRM_MODE_TV_MODE_NTSC_443:
>     +               *val = VC4_VEC_TV_MODE_NTSC_443;
>     +               break;
>     +
>             case DRM_MODE_TV_MODE_NTSC_J:
>                     *val = VC4_VEC_TV_MODE_NTSC_J;
>                     break;
>     @@ -353,6 +442,14 @@ vc4_vec_connector_get_property(struct drm_connector *connector,
>                     *val = VC4_VEC_TV_MODE_PAL_M;
>                     break;
>
>     +       case DRM_MODE_TV_MODE_PAL_N:
>     +               *val = VC4_VEC_TV_MODE_PAL_N;
>     +               break;
>     +
>     +       case DRM_MODE_TV_MODE_SECAM:
>     +               *val = VC4_VEC_TV_MODE_SECAM;
>     +               break;
>     +
>             default:
>                     return -EINVAL;
>             }
>     @@ -448,13 +545,16 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder,
>             struct drm_connector *connector = &vec->connector;
>             struct drm_connector_state *conn_state =
>                     drm_atomic_get_new_connector_state(state, connector);
>     +       struct drm_display_mode *adjusted_mode =
>     +               &encoder->crtc->state->adjusted_mode;
>             const struct vc4_vec_tv_mode *tv_mode;
>             int idx, ret;
>
>             if (!drm_dev_enter(drm, &idx))
>                     return;
>
>     -       tv_mode = vc4_vec_tv_mode_lookup(conn_state->tv.mode);
>     +       tv_mode = vc4_vec_tv_mode_lookup(conn_state->tv.mode,
>     +                                        adjusted_mode->htotal);
>             if (!tv_mode)
>                     goto err_dev_exit;
>
>     @@ -648,9 +748,12 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data)
>
>             ret = drm_mode_create_tv_properties(drm,
>                                                 BIT(DRM_MODE_TV_MODE_NTSC) |
>     +                                           BIT(DRM_MODE_TV_MODE_NTSC_443) |
>                                                 BIT(DRM_MODE_TV_MODE_NTSC_J) |
>                                                 BIT(DRM_MODE_TV_MODE_PAL) |
>     -                                           BIT(DRM_MODE_TV_MODE_PAL_M));
>     +                                           BIT(DRM_MODE_TV_MODE_PAL_M) |
>     +                                           BIT(DRM_MODE_TV_MODE_PAL_N) |
>     +                                           BIT(DRM_MODE_TV_MODE_SECAM));
>             if (ret)
>                     return ret;
>
>
>     -- 
>     b4 0.11.0-dev-99e3a 
>


WARNING: multiple messages have this Message-ID (diff)
From: Mateusz Kwiatkowski <kfyatek@gmail.com>
To: Lukas Satin <luke.satin@gmail.com>, Maxime Ripard <maxime@cerno.tech>
Cc: "Karol Herbst" <kherbst@redhat.com>,
	"David Airlie" <airlied@linux.ie>,
	nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	"Phil Elwell" <phil@raspberrypi.com>,
	"Emma Anholt" <emma@anholt.net>,
	"Samuel Holland" <samuel@sholland.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Ben Skeggs" <bskeggs@redhat.com>,
	linux-sunxi@lists.linux.dev, intel-gfx@lists.freedesktop.org,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	linux-arm-kernel@lists.infradead.org,
	"Tvrtko Ursulin" <tvrtko.ursulin@linux.intel.com>,
	"Dom Cobley" <dom@raspberrypi.com>,
	linux-kernel@vger.kernel.org,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>
Subject: Re: [Nouveau] [PATCH v7 22/23] drm/vc4: vec: Add support for more analog TV standards
Date: Tue, 8 Nov 2022 23:16:23 +0100	[thread overview]
Message-ID: <137895ef-b2c4-6e10-e245-125745b882bc@gmail.com> (raw)
In-Reply-To: <CAEFVmOKn4Won90xyX2Efh2esZ94npoy0BuTQ7n-in+KapfBb=w@mail.gmail.com>

Hi Lukas, Maxime and everyone,

W dniu 8.11.2022 o 14:17, Lukas Satin pisze:
> They are important for retrogaming and connecting TV out to CRT TV or using
> emulator.
>
> I have PS1 that is using PAL-60 for example.
>
> Can you add 240p and 288p non-interlaced modes for NTSC and PAL, please?

To add progressive mode support, at least for the VC4/VEC device that's used
on the Raspberry Pi, all that's necessary is a patch like:

--- a/drivers/gpu/drm/vc4/vc4_vec.c
+++ b/drivers/gpu/drm/vc4/vc4_vec.c
@@ -623,7 +623,9 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder,
 	VEC_WRITE(VEC_CLMP0_START, 0xac);
 	VEC_WRITE(VEC_CLMP0_END, 0xec);
 	VEC_WRITE(VEC_CONFIG2,
-		  VEC_CONFIG2_UV_DIG_DIS | VEC_CONFIG2_RGB_DIG_DIS);
+		  VEC_CONFIG2_UV_DIG_DIS |
+		  VEC_CONFIG2_RGB_DIG_DIS |
+		  ((adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) ? 0 : VEC_CONFIG2_PROG_SCAN));
 	VEC_WRITE(VEC_CONFIG3, VEC_CONFIG3_HORIZ_LEN_STD);
 	VEC_WRITE(VEC_DAC_CONFIG, vec->variant->dac_config);
 

and then you can just add custom modes, for example within Xorg:

xrandr --newmode 720x240 13.5 720 736 800 858 240 243 246 262
xrandr --newmode 720x288 13.5 720 740 804 864 288 290 293 312

Note that the pixel aspect ratio will be all over the place - unfortunately this
is necessary at the driver level, because VC4's VEC does not support pixel
clocks other than 13.5 MHz. However, you can fix it by running something like
"xrandr --scale-from 320x240" or "xrandr --scale-from 384x288". Other (non-X)
applications would need to be adapted to similarly configure DRM scaling.

I'm not sure if Maxime wants to introduce any more code like the patch above to
facilitate progressive scan support, though (@Maxime: feel free to grab the code
from above or anything else from https://github.com/raspberrypi/linux/pull/4406
if you do, however!). We talked recently that the priority is to finally merge
existing functionality first, see this message:
https://lore.kernel.org/dri-devel/20221027115822.5vd3fqlcpy4gfq5v@houat/

I'm willing to post a couple of follow-up patches to improve things like
support for progressive modes or exotic TV norms (such as PAL-M-50 or PAL-N-60)
within the VC4 driver once this patchset lands - but I agree with Maxime's point
to focus on merging existing functionality first.

> Lukas

Best regards,
Mateusz Kwiatkowski

> On Mon, Nov 7, 2022 at 3:19 PM Maxime Ripard <maxime@cerno.tech> wrote:
>
>     From: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
>
>     Add support for the following composite output modes (all of them are
>     somewhat more obscure than the previously defined ones):
>
>     - NTSC_443 - NTSC-style signal with the chroma subcarrier shifted to
>       4.43361875 MHz (the PAL subcarrier frequency). Never used for
>       broadcasting, but sometimes used as a hack to play NTSC content in PAL
>       regions (e.g. on VCRs).
>     - PAL_N - PAL with alternative chroma subcarrier frequency,
>       3.58205625 MHz. Used as a broadcast standard in Argentina, Paraguay
>       and Uruguay to fit 576i50 with colour in 6 MHz channel raster.
>     - PAL60 - 480i60 signal with PAL-style color at normal European PAL
>       frequency. Another non-standard, non-broadcast mode, used in similar
>       contexts as NTSC_443. Some displays support one but not the other.
>     - SECAM - French frequency-modulated analog color standard; also have
>       been broadcast in Eastern Europe and various parts of Africa and Asia.
>       Uses the same 576i50 timings as PAL.
>
>     Also added some comments explaining color subcarrier frequency
>     registers.
>
>     Acked-by: Noralf Trønnes <noralf@tronnes.org>
>     Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
>     Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>
>     ---
>     Changes in v6:
>     - Support PAL60 again
>     ---
>      drivers/gpu/drm/vc4/vc4_vec.c | 111 ++++++++++++++++++++++++++++++++++++++++--
>      1 file changed, 107 insertions(+), 4 deletions(-)
>
>     diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c
>     index a828fc6fb776..d23dbad3cbf6 100644
>     --- a/drivers/gpu/drm/vc4/vc4_vec.c
>     +++ b/drivers/gpu/drm/vc4/vc4_vec.c
>     @@ -46,6 +46,7 @@
>      #define VEC_CONFIG0_YDEL(x)            ((x) << 26)
>      #define VEC_CONFIG0_CDEL_MASK          GENMASK(25, 24)
>      #define VEC_CONFIG0_CDEL(x)            ((x) << 24)
>     +#define VEC_CONFIG0_SECAM_STD          BIT(21)
>      #define VEC_CONFIG0_PBPR_FIL           BIT(18)
>      #define VEC_CONFIG0_CHROMA_GAIN_MASK   GENMASK(17, 16)
>      #define VEC_CONFIG0_CHROMA_GAIN_UNITY  (0 << 16)
>     @@ -76,6 +77,27 @@
>      #define VEC_SOFT_RESET                 0x10c
>      #define VEC_CLMP0_START                        0x144
>      #define VEC_CLMP0_END                  0x148
>     +
>     +/*
>     + * These set the color subcarrier frequency
>     + * if VEC_CONFIG1_CUSTOM_FREQ is enabled.
>     + *
>     + * VEC_FREQ1_0 contains the most significant 16-bit half-word,
>     + * VEC_FREQ3_2 contains the least significant 16-bit half-word.
>     + * 0x80000000 seems to be equivalent to the pixel clock
>     + * (which itself is the VEC clock divided by 8).
>     + *
>     + * Reference values (with the default pixel clock of 13.5 MHz):
>     + *
>     + * NTSC  (3579545.[45] Hz)     - 0x21F07C1F
>     + * PAL   (4433618.75 Hz)       - 0x2A098ACB
>     + * PAL-M (3575611.[888111] Hz) - 0x21E6EFE3
>     + * PAL-N (3582056.25 Hz)       - 0x21F69446
>     + *
>     + * NOTE: For SECAM, it is used as the Dr center frequency,
>     + * regardless of whether VEC_CONFIG1_CUSTOM_FREQ is enabled or not;
>     + * that is specified as 4406250 Hz, which corresponds to 0x29C71C72.
>     + */
>      #define VEC_FREQ3_2                    0x180
>      #define VEC_FREQ1_0                    0x184
>
>     @@ -118,6 +140,14 @@
>
>      #define VEC_INTERRUPT_CONTROL          0x190
>      #define VEC_INTERRUPT_STATUS           0x194
>     +
>     +/*
>     + * Db center frequency for SECAM; the clock for this is the same as for
>     + * VEC_FREQ3_2/VEC_FREQ1_0, which is used for Dr center frequency.
>     + *
>     + * This is specified as 4250000 Hz, which corresponds to 0x284BDA13.
>     + * That is also the default value, so no need to set it explicitly.
>     + */
>      #define VEC_FCW_SECAM_B                        0x198
>      #define VEC_SECAM_GAIN_VAL             0x19c
>
>     @@ -197,10 +227,15 @@ enum vc4_vec_tv_mode_id {
>             VC4_VEC_TV_MODE_NTSC_J,
>             VC4_VEC_TV_MODE_PAL,
>             VC4_VEC_TV_MODE_PAL_M,
>     +       VC4_VEC_TV_MODE_NTSC_443,
>     +       VC4_VEC_TV_MODE_PAL_60,
>     +       VC4_VEC_TV_MODE_PAL_N,
>     +       VC4_VEC_TV_MODE_SECAM,
>      };
>
>      struct vc4_vec_tv_mode {
>             unsigned int mode;
>     +       u16 expected_htotal;
>             u32 config0;
>             u32 config1;
>             u32 custom_freq;
>     @@ -236,35 +271,68 @@ static const struct debugfs_reg32 vec_regs[] = {
>      static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = {
>             {
>                     .mode = DRM_MODE_TV_MODE_NTSC,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_NTSC_443,
>     +               .expected_htotal = 858,
>     +               .config0 = VEC_CONFIG0_NTSC_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ,
>     +               .custom_freq = 0x2a098acb,
>     +       },
>             {
>                     .mode = DRM_MODE_TV_MODE_NTSC_J,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_NTSC_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>             {
>                     .mode = DRM_MODE_TV_MODE_PAL,
>     +               .expected_htotal = 864,
>                     .config0 = VEC_CONFIG0_PAL_BDGHI_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               /* PAL-60 */
>     +               .mode = DRM_MODE_TV_MODE_PAL,
>     +               .expected_htotal = 858,
>     +               .config0 = VEC_CONFIG0_PAL_M_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ,
>     +               .custom_freq = 0x2a098acb,
>     +       },
>             {
>                     .mode = DRM_MODE_TV_MODE_PAL_M,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_PAL_M_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_PAL_N,
>     +               .expected_htotal = 864,
>     +               .config0 = VEC_CONFIG0_PAL_N_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>     +       },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_SECAM,
>     +               .expected_htotal = 864,
>     +               .config0 = VEC_CONFIG0_SECAM_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>     +               .custom_freq = 0x29c71c72,
>     +       },
>      };
>
>      static inline const struct vc4_vec_tv_mode *
>     -vc4_vec_tv_mode_lookup(unsigned int mode)
>     +vc4_vec_tv_mode_lookup(unsigned int mode, u16 htotal)
>      {
>             unsigned int i;
>
>             for (i = 0; i < ARRAY_SIZE(vc4_vec_tv_modes); i++) {
>                     const struct vc4_vec_tv_mode *tv_mode = &vc4_vec_tv_modes[i];
>
>     -               if (tv_mode->mode == mode)
>     +               if (tv_mode->mode == mode &&
>     +                   tv_mode->expected_htotal == htotal)
>                             return tv_mode;
>             }
>
>     @@ -273,9 +341,13 @@ vc4_vec_tv_mode_lookup(unsigned int mode)
>
>      static const struct drm_prop_enum_list legacy_tv_mode_names[] = {
>             { VC4_VEC_TV_MODE_NTSC, "NTSC", },
>     +       { VC4_VEC_TV_MODE_NTSC_443, "NTSC-443", },
>             { VC4_VEC_TV_MODE_NTSC_J, "NTSC-J", },
>             { VC4_VEC_TV_MODE_PAL, "PAL", },
>     +       { VC4_VEC_TV_MODE_PAL_60, "PAL-60", },
>             { VC4_VEC_TV_MODE_PAL_M, "PAL-M", },
>     +       { VC4_VEC_TV_MODE_PAL_N, "PAL-N", },
>     +       { VC4_VEC_TV_MODE_SECAM, "SECAM", },
>      };
>
>      static enum drm_connector_status
>     @@ -306,11 +378,16 @@ vc4_vec_connector_set_property(struct drm_connector *connector,
>                     state->tv.mode = DRM_MODE_TV_MODE_NTSC;
>                     break;
>
>     +       case VC4_VEC_TV_MODE_NTSC_443:
>     +               state->tv.mode = DRM_MODE_TV_MODE_NTSC_443;
>     +               break;
>     +
>             case VC4_VEC_TV_MODE_NTSC_J:
>                     state->tv.mode = DRM_MODE_TV_MODE_NTSC_J;
>                     break;
>
>             case VC4_VEC_TV_MODE_PAL:
>     +       case VC4_VEC_TV_MODE_PAL_60:
>                     state->tv.mode = DRM_MODE_TV_MODE_PAL;
>                     break;
>
>     @@ -318,6 +395,14 @@ vc4_vec_connector_set_property(struct drm_connector *connector,
>                     state->tv.mode = DRM_MODE_TV_MODE_PAL_M;
>                     break;
>
>     +       case VC4_VEC_TV_MODE_PAL_N:
>     +               state->tv.mode = DRM_MODE_TV_MODE_PAL_N;
>     +               break;
>     +
>     +       case VC4_VEC_TV_MODE_SECAM:
>     +               state->tv.mode = DRM_MODE_TV_MODE_SECAM;
>     +               break;
>     +
>             default:
>                     return -EINVAL;
>             }
>     @@ -341,6 +426,10 @@ vc4_vec_connector_get_property(struct drm_connector *connector,
>                     *val = VC4_VEC_TV_MODE_NTSC;
>                     break;
>
>     +       case DRM_MODE_TV_MODE_NTSC_443:
>     +               *val = VC4_VEC_TV_MODE_NTSC_443;
>     +               break;
>     +
>             case DRM_MODE_TV_MODE_NTSC_J:
>                     *val = VC4_VEC_TV_MODE_NTSC_J;
>                     break;
>     @@ -353,6 +442,14 @@ vc4_vec_connector_get_property(struct drm_connector *connector,
>                     *val = VC4_VEC_TV_MODE_PAL_M;
>                     break;
>
>     +       case DRM_MODE_TV_MODE_PAL_N:
>     +               *val = VC4_VEC_TV_MODE_PAL_N;
>     +               break;
>     +
>     +       case DRM_MODE_TV_MODE_SECAM:
>     +               *val = VC4_VEC_TV_MODE_SECAM;
>     +               break;
>     +
>             default:
>                     return -EINVAL;
>             }
>     @@ -448,13 +545,16 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder,
>             struct drm_connector *connector = &vec->connector;
>             struct drm_connector_state *conn_state =
>                     drm_atomic_get_new_connector_state(state, connector);
>     +       struct drm_display_mode *adjusted_mode =
>     +               &encoder->crtc->state->adjusted_mode;
>             const struct vc4_vec_tv_mode *tv_mode;
>             int idx, ret;
>
>             if (!drm_dev_enter(drm, &idx))
>                     return;
>
>     -       tv_mode = vc4_vec_tv_mode_lookup(conn_state->tv.mode);
>     +       tv_mode = vc4_vec_tv_mode_lookup(conn_state->tv.mode,
>     +                                        adjusted_mode->htotal);
>             if (!tv_mode)
>                     goto err_dev_exit;
>
>     @@ -648,9 +748,12 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data)
>
>             ret = drm_mode_create_tv_properties(drm,
>                                                 BIT(DRM_MODE_TV_MODE_NTSC) |
>     +                                           BIT(DRM_MODE_TV_MODE_NTSC_443) |
>                                                 BIT(DRM_MODE_TV_MODE_NTSC_J) |
>                                                 BIT(DRM_MODE_TV_MODE_PAL) |
>     -                                           BIT(DRM_MODE_TV_MODE_PAL_M));
>     +                                           BIT(DRM_MODE_TV_MODE_PAL_M) |
>     +                                           BIT(DRM_MODE_TV_MODE_PAL_N) |
>     +                                           BIT(DRM_MODE_TV_MODE_SECAM));
>             if (ret)
>                     return ret;
>
>
>     -- 
>     b4 0.11.0-dev-99e3a 
>


WARNING: multiple messages have this Message-ID (diff)
From: Mateusz Kwiatkowski <kfyatek@gmail.com>
To: Lukas Satin <luke.satin@gmail.com>, Maxime Ripard <maxime@cerno.tech>
Cc: "Karol Herbst" <kherbst@redhat.com>,
	"David Airlie" <airlied@linux.ie>,
	nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	"Phil Elwell" <phil@raspberrypi.com>,
	"Emma Anholt" <emma@anholt.net>,
	"Samuel Holland" <samuel@sholland.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Ben Skeggs" <bskeggs@redhat.com>,
	linux-sunxi@lists.linux.dev, "Daniel Vetter" <daniel@ffwll.ch>,
	intel-gfx@lists.freedesktop.org,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	linux-arm-kernel@lists.infradead.org,
	"Dom Cobley" <dom@raspberrypi.com>,
	linux-kernel@vger.kernel.org,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>
Subject: Re: [Intel-gfx] [Nouveau] [PATCH v7 22/23] drm/vc4: vec: Add support for more analog TV standards
Date: Tue, 8 Nov 2022 23:16:23 +0100	[thread overview]
Message-ID: <137895ef-b2c4-6e10-e245-125745b882bc@gmail.com> (raw)
In-Reply-To: <CAEFVmOKn4Won90xyX2Efh2esZ94npoy0BuTQ7n-in+KapfBb=w@mail.gmail.com>

Hi Lukas, Maxime and everyone,

W dniu 8.11.2022 o 14:17, Lukas Satin pisze:
> They are important for retrogaming and connecting TV out to CRT TV or using
> emulator.
>
> I have PS1 that is using PAL-60 for example.
>
> Can you add 240p and 288p non-interlaced modes for NTSC and PAL, please?

To add progressive mode support, at least for the VC4/VEC device that's used
on the Raspberry Pi, all that's necessary is a patch like:

--- a/drivers/gpu/drm/vc4/vc4_vec.c
+++ b/drivers/gpu/drm/vc4/vc4_vec.c
@@ -623,7 +623,9 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder,
 	VEC_WRITE(VEC_CLMP0_START, 0xac);
 	VEC_WRITE(VEC_CLMP0_END, 0xec);
 	VEC_WRITE(VEC_CONFIG2,
-		  VEC_CONFIG2_UV_DIG_DIS | VEC_CONFIG2_RGB_DIG_DIS);
+		  VEC_CONFIG2_UV_DIG_DIS |
+		  VEC_CONFIG2_RGB_DIG_DIS |
+		  ((adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) ? 0 : VEC_CONFIG2_PROG_SCAN));
 	VEC_WRITE(VEC_CONFIG3, VEC_CONFIG3_HORIZ_LEN_STD);
 	VEC_WRITE(VEC_DAC_CONFIG, vec->variant->dac_config);
 

and then you can just add custom modes, for example within Xorg:

xrandr --newmode 720x240 13.5 720 736 800 858 240 243 246 262
xrandr --newmode 720x288 13.5 720 740 804 864 288 290 293 312

Note that the pixel aspect ratio will be all over the place - unfortunately this
is necessary at the driver level, because VC4's VEC does not support pixel
clocks other than 13.5 MHz. However, you can fix it by running something like
"xrandr --scale-from 320x240" or "xrandr --scale-from 384x288". Other (non-X)
applications would need to be adapted to similarly configure DRM scaling.

I'm not sure if Maxime wants to introduce any more code like the patch above to
facilitate progressive scan support, though (@Maxime: feel free to grab the code
from above or anything else from https://github.com/raspberrypi/linux/pull/4406
if you do, however!). We talked recently that the priority is to finally merge
existing functionality first, see this message:
https://lore.kernel.org/dri-devel/20221027115822.5vd3fqlcpy4gfq5v@houat/

I'm willing to post a couple of follow-up patches to improve things like
support for progressive modes or exotic TV norms (such as PAL-M-50 or PAL-N-60)
within the VC4 driver once this patchset lands - but I agree with Maxime's point
to focus on merging existing functionality first.

> Lukas

Best regards,
Mateusz Kwiatkowski

> On Mon, Nov 7, 2022 at 3:19 PM Maxime Ripard <maxime@cerno.tech> wrote:
>
>     From: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
>
>     Add support for the following composite output modes (all of them are
>     somewhat more obscure than the previously defined ones):
>
>     - NTSC_443 - NTSC-style signal with the chroma subcarrier shifted to
>       4.43361875 MHz (the PAL subcarrier frequency). Never used for
>       broadcasting, but sometimes used as a hack to play NTSC content in PAL
>       regions (e.g. on VCRs).
>     - PAL_N - PAL with alternative chroma subcarrier frequency,
>       3.58205625 MHz. Used as a broadcast standard in Argentina, Paraguay
>       and Uruguay to fit 576i50 with colour in 6 MHz channel raster.
>     - PAL60 - 480i60 signal with PAL-style color at normal European PAL
>       frequency. Another non-standard, non-broadcast mode, used in similar
>       contexts as NTSC_443. Some displays support one but not the other.
>     - SECAM - French frequency-modulated analog color standard; also have
>       been broadcast in Eastern Europe and various parts of Africa and Asia.
>       Uses the same 576i50 timings as PAL.
>
>     Also added some comments explaining color subcarrier frequency
>     registers.
>
>     Acked-by: Noralf Trønnes <noralf@tronnes.org>
>     Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
>     Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>
>     ---
>     Changes in v6:
>     - Support PAL60 again
>     ---
>      drivers/gpu/drm/vc4/vc4_vec.c | 111 ++++++++++++++++++++++++++++++++++++++++--
>      1 file changed, 107 insertions(+), 4 deletions(-)
>
>     diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c
>     index a828fc6fb776..d23dbad3cbf6 100644
>     --- a/drivers/gpu/drm/vc4/vc4_vec.c
>     +++ b/drivers/gpu/drm/vc4/vc4_vec.c
>     @@ -46,6 +46,7 @@
>      #define VEC_CONFIG0_YDEL(x)            ((x) << 26)
>      #define VEC_CONFIG0_CDEL_MASK          GENMASK(25, 24)
>      #define VEC_CONFIG0_CDEL(x)            ((x) << 24)
>     +#define VEC_CONFIG0_SECAM_STD          BIT(21)
>      #define VEC_CONFIG0_PBPR_FIL           BIT(18)
>      #define VEC_CONFIG0_CHROMA_GAIN_MASK   GENMASK(17, 16)
>      #define VEC_CONFIG0_CHROMA_GAIN_UNITY  (0 << 16)
>     @@ -76,6 +77,27 @@
>      #define VEC_SOFT_RESET                 0x10c
>      #define VEC_CLMP0_START                        0x144
>      #define VEC_CLMP0_END                  0x148
>     +
>     +/*
>     + * These set the color subcarrier frequency
>     + * if VEC_CONFIG1_CUSTOM_FREQ is enabled.
>     + *
>     + * VEC_FREQ1_0 contains the most significant 16-bit half-word,
>     + * VEC_FREQ3_2 contains the least significant 16-bit half-word.
>     + * 0x80000000 seems to be equivalent to the pixel clock
>     + * (which itself is the VEC clock divided by 8).
>     + *
>     + * Reference values (with the default pixel clock of 13.5 MHz):
>     + *
>     + * NTSC  (3579545.[45] Hz)     - 0x21F07C1F
>     + * PAL   (4433618.75 Hz)       - 0x2A098ACB
>     + * PAL-M (3575611.[888111] Hz) - 0x21E6EFE3
>     + * PAL-N (3582056.25 Hz)       - 0x21F69446
>     + *
>     + * NOTE: For SECAM, it is used as the Dr center frequency,
>     + * regardless of whether VEC_CONFIG1_CUSTOM_FREQ is enabled or not;
>     + * that is specified as 4406250 Hz, which corresponds to 0x29C71C72.
>     + */
>      #define VEC_FREQ3_2                    0x180
>      #define VEC_FREQ1_0                    0x184
>
>     @@ -118,6 +140,14 @@
>
>      #define VEC_INTERRUPT_CONTROL          0x190
>      #define VEC_INTERRUPT_STATUS           0x194
>     +
>     +/*
>     + * Db center frequency for SECAM; the clock for this is the same as for
>     + * VEC_FREQ3_2/VEC_FREQ1_0, which is used for Dr center frequency.
>     + *
>     + * This is specified as 4250000 Hz, which corresponds to 0x284BDA13.
>     + * That is also the default value, so no need to set it explicitly.
>     + */
>      #define VEC_FCW_SECAM_B                        0x198
>      #define VEC_SECAM_GAIN_VAL             0x19c
>
>     @@ -197,10 +227,15 @@ enum vc4_vec_tv_mode_id {
>             VC4_VEC_TV_MODE_NTSC_J,
>             VC4_VEC_TV_MODE_PAL,
>             VC4_VEC_TV_MODE_PAL_M,
>     +       VC4_VEC_TV_MODE_NTSC_443,
>     +       VC4_VEC_TV_MODE_PAL_60,
>     +       VC4_VEC_TV_MODE_PAL_N,
>     +       VC4_VEC_TV_MODE_SECAM,
>      };
>
>      struct vc4_vec_tv_mode {
>             unsigned int mode;
>     +       u16 expected_htotal;
>             u32 config0;
>             u32 config1;
>             u32 custom_freq;
>     @@ -236,35 +271,68 @@ static const struct debugfs_reg32 vec_regs[] = {
>      static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = {
>             {
>                     .mode = DRM_MODE_TV_MODE_NTSC,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_NTSC_443,
>     +               .expected_htotal = 858,
>     +               .config0 = VEC_CONFIG0_NTSC_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ,
>     +               .custom_freq = 0x2a098acb,
>     +       },
>             {
>                     .mode = DRM_MODE_TV_MODE_NTSC_J,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_NTSC_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>             {
>                     .mode = DRM_MODE_TV_MODE_PAL,
>     +               .expected_htotal = 864,
>                     .config0 = VEC_CONFIG0_PAL_BDGHI_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               /* PAL-60 */
>     +               .mode = DRM_MODE_TV_MODE_PAL,
>     +               .expected_htotal = 858,
>     +               .config0 = VEC_CONFIG0_PAL_M_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ,
>     +               .custom_freq = 0x2a098acb,
>     +       },
>             {
>                     .mode = DRM_MODE_TV_MODE_PAL_M,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_PAL_M_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_PAL_N,
>     +               .expected_htotal = 864,
>     +               .config0 = VEC_CONFIG0_PAL_N_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>     +       },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_SECAM,
>     +               .expected_htotal = 864,
>     +               .config0 = VEC_CONFIG0_SECAM_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>     +               .custom_freq = 0x29c71c72,
>     +       },
>      };
>
>      static inline const struct vc4_vec_tv_mode *
>     -vc4_vec_tv_mode_lookup(unsigned int mode)
>     +vc4_vec_tv_mode_lookup(unsigned int mode, u16 htotal)
>      {
>             unsigned int i;
>
>             for (i = 0; i < ARRAY_SIZE(vc4_vec_tv_modes); i++) {
>                     const struct vc4_vec_tv_mode *tv_mode = &vc4_vec_tv_modes[i];
>
>     -               if (tv_mode->mode == mode)
>     +               if (tv_mode->mode == mode &&
>     +                   tv_mode->expected_htotal == htotal)
>                             return tv_mode;
>             }
>
>     @@ -273,9 +341,13 @@ vc4_vec_tv_mode_lookup(unsigned int mode)
>
>      static const struct drm_prop_enum_list legacy_tv_mode_names[] = {
>             { VC4_VEC_TV_MODE_NTSC, "NTSC", },
>     +       { VC4_VEC_TV_MODE_NTSC_443, "NTSC-443", },
>             { VC4_VEC_TV_MODE_NTSC_J, "NTSC-J", },
>             { VC4_VEC_TV_MODE_PAL, "PAL", },
>     +       { VC4_VEC_TV_MODE_PAL_60, "PAL-60", },
>             { VC4_VEC_TV_MODE_PAL_M, "PAL-M", },
>     +       { VC4_VEC_TV_MODE_PAL_N, "PAL-N", },
>     +       { VC4_VEC_TV_MODE_SECAM, "SECAM", },
>      };
>
>      static enum drm_connector_status
>     @@ -306,11 +378,16 @@ vc4_vec_connector_set_property(struct drm_connector *connector,
>                     state->tv.mode = DRM_MODE_TV_MODE_NTSC;
>                     break;
>
>     +       case VC4_VEC_TV_MODE_NTSC_443:
>     +               state->tv.mode = DRM_MODE_TV_MODE_NTSC_443;
>     +               break;
>     +
>             case VC4_VEC_TV_MODE_NTSC_J:
>                     state->tv.mode = DRM_MODE_TV_MODE_NTSC_J;
>                     break;
>
>             case VC4_VEC_TV_MODE_PAL:
>     +       case VC4_VEC_TV_MODE_PAL_60:
>                     state->tv.mode = DRM_MODE_TV_MODE_PAL;
>                     break;
>
>     @@ -318,6 +395,14 @@ vc4_vec_connector_set_property(struct drm_connector *connector,
>                     state->tv.mode = DRM_MODE_TV_MODE_PAL_M;
>                     break;
>
>     +       case VC4_VEC_TV_MODE_PAL_N:
>     +               state->tv.mode = DRM_MODE_TV_MODE_PAL_N;
>     +               break;
>     +
>     +       case VC4_VEC_TV_MODE_SECAM:
>     +               state->tv.mode = DRM_MODE_TV_MODE_SECAM;
>     +               break;
>     +
>             default:
>                     return -EINVAL;
>             }
>     @@ -341,6 +426,10 @@ vc4_vec_connector_get_property(struct drm_connector *connector,
>                     *val = VC4_VEC_TV_MODE_NTSC;
>                     break;
>
>     +       case DRM_MODE_TV_MODE_NTSC_443:
>     +               *val = VC4_VEC_TV_MODE_NTSC_443;
>     +               break;
>     +
>             case DRM_MODE_TV_MODE_NTSC_J:
>                     *val = VC4_VEC_TV_MODE_NTSC_J;
>                     break;
>     @@ -353,6 +442,14 @@ vc4_vec_connector_get_property(struct drm_connector *connector,
>                     *val = VC4_VEC_TV_MODE_PAL_M;
>                     break;
>
>     +       case DRM_MODE_TV_MODE_PAL_N:
>     +               *val = VC4_VEC_TV_MODE_PAL_N;
>     +               break;
>     +
>     +       case DRM_MODE_TV_MODE_SECAM:
>     +               *val = VC4_VEC_TV_MODE_SECAM;
>     +               break;
>     +
>             default:
>                     return -EINVAL;
>             }
>     @@ -448,13 +545,16 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder,
>             struct drm_connector *connector = &vec->connector;
>             struct drm_connector_state *conn_state =
>                     drm_atomic_get_new_connector_state(state, connector);
>     +       struct drm_display_mode *adjusted_mode =
>     +               &encoder->crtc->state->adjusted_mode;
>             const struct vc4_vec_tv_mode *tv_mode;
>             int idx, ret;
>
>             if (!drm_dev_enter(drm, &idx))
>                     return;
>
>     -       tv_mode = vc4_vec_tv_mode_lookup(conn_state->tv.mode);
>     +       tv_mode = vc4_vec_tv_mode_lookup(conn_state->tv.mode,
>     +                                        adjusted_mode->htotal);
>             if (!tv_mode)
>                     goto err_dev_exit;
>
>     @@ -648,9 +748,12 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data)
>
>             ret = drm_mode_create_tv_properties(drm,
>                                                 BIT(DRM_MODE_TV_MODE_NTSC) |
>     +                                           BIT(DRM_MODE_TV_MODE_NTSC_443) |
>                                                 BIT(DRM_MODE_TV_MODE_NTSC_J) |
>                                                 BIT(DRM_MODE_TV_MODE_PAL) |
>     -                                           BIT(DRM_MODE_TV_MODE_PAL_M));
>     +                                           BIT(DRM_MODE_TV_MODE_PAL_M) |
>     +                                           BIT(DRM_MODE_TV_MODE_PAL_N) |
>     +                                           BIT(DRM_MODE_TV_MODE_SECAM));
>             if (ret)
>                     return ret;
>
>
>     -- 
>     b4 0.11.0-dev-99e3a 
>


WARNING: multiple messages have this Message-ID (diff)
From: Mateusz Kwiatkowski <kfyatek@gmail.com>
To: Lukas Satin <luke.satin@gmail.com>, Maxime Ripard <maxime@cerno.tech>
Cc: "Jani Nikula" <jani.nikula@linux.intel.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Tvrtko Ursulin" <tvrtko.ursulin@linux.intel.com>,
	"Ben Skeggs" <bskeggs@redhat.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Samuel Holland" <samuel@sholland.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Emma Anholt" <emma@anholt.net>,
	"Karol Herbst" <kherbst@redhat.com>,
	"Daniel Vetter" <daniel@ffwll.ch>, "Chen-Yu Tsai" <wens@csie.org>,
	"Lyude Paul" <lyude@redhat.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@linux.ie>,
	"Dom Cobley" <dom@raspberrypi.com>,
	nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Phil Elwell" <phil@raspberrypi.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	linux-sunxi@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [Nouveau] [PATCH v7 22/23] drm/vc4: vec: Add support for more analog TV standards
Date: Tue, 8 Nov 2022 23:16:23 +0100	[thread overview]
Message-ID: <137895ef-b2c4-6e10-e245-125745b882bc@gmail.com> (raw)
In-Reply-To: <CAEFVmOKn4Won90xyX2Efh2esZ94npoy0BuTQ7n-in+KapfBb=w@mail.gmail.com>

Hi Lukas, Maxime and everyone,

W dniu 8.11.2022 o 14:17, Lukas Satin pisze:
> They are important for retrogaming and connecting TV out to CRT TV or using
> emulator.
>
> I have PS1 that is using PAL-60 for example.
>
> Can you add 240p and 288p non-interlaced modes for NTSC and PAL, please?

To add progressive mode support, at least for the VC4/VEC device that's used
on the Raspberry Pi, all that's necessary is a patch like:

--- a/drivers/gpu/drm/vc4/vc4_vec.c
+++ b/drivers/gpu/drm/vc4/vc4_vec.c
@@ -623,7 +623,9 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder,
 	VEC_WRITE(VEC_CLMP0_START, 0xac);
 	VEC_WRITE(VEC_CLMP0_END, 0xec);
 	VEC_WRITE(VEC_CONFIG2,
-		  VEC_CONFIG2_UV_DIG_DIS | VEC_CONFIG2_RGB_DIG_DIS);
+		  VEC_CONFIG2_UV_DIG_DIS |
+		  VEC_CONFIG2_RGB_DIG_DIS |
+		  ((adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) ? 0 : VEC_CONFIG2_PROG_SCAN));
 	VEC_WRITE(VEC_CONFIG3, VEC_CONFIG3_HORIZ_LEN_STD);
 	VEC_WRITE(VEC_DAC_CONFIG, vec->variant->dac_config);
 

and then you can just add custom modes, for example within Xorg:

xrandr --newmode 720x240 13.5 720 736 800 858 240 243 246 262
xrandr --newmode 720x288 13.5 720 740 804 864 288 290 293 312

Note that the pixel aspect ratio will be all over the place - unfortunately this
is necessary at the driver level, because VC4's VEC does not support pixel
clocks other than 13.5 MHz. However, you can fix it by running something like
"xrandr --scale-from 320x240" or "xrandr --scale-from 384x288". Other (non-X)
applications would need to be adapted to similarly configure DRM scaling.

I'm not sure if Maxime wants to introduce any more code like the patch above to
facilitate progressive scan support, though (@Maxime: feel free to grab the code
from above or anything else from https://github.com/raspberrypi/linux/pull/4406
if you do, however!). We talked recently that the priority is to finally merge
existing functionality first, see this message:
https://lore.kernel.org/dri-devel/20221027115822.5vd3fqlcpy4gfq5v@houat/

I'm willing to post a couple of follow-up patches to improve things like
support for progressive modes or exotic TV norms (such as PAL-M-50 or PAL-N-60)
within the VC4 driver once this patchset lands - but I agree with Maxime's point
to focus on merging existing functionality first.

> Lukas

Best regards,
Mateusz Kwiatkowski

> On Mon, Nov 7, 2022 at 3:19 PM Maxime Ripard <maxime@cerno.tech> wrote:
>
>     From: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
>
>     Add support for the following composite output modes (all of them are
>     somewhat more obscure than the previously defined ones):
>
>     - NTSC_443 - NTSC-style signal with the chroma subcarrier shifted to
>       4.43361875 MHz (the PAL subcarrier frequency). Never used for
>       broadcasting, but sometimes used as a hack to play NTSC content in PAL
>       regions (e.g. on VCRs).
>     - PAL_N - PAL with alternative chroma subcarrier frequency,
>       3.58205625 MHz. Used as a broadcast standard in Argentina, Paraguay
>       and Uruguay to fit 576i50 with colour in 6 MHz channel raster.
>     - PAL60 - 480i60 signal with PAL-style color at normal European PAL
>       frequency. Another non-standard, non-broadcast mode, used in similar
>       contexts as NTSC_443. Some displays support one but not the other.
>     - SECAM - French frequency-modulated analog color standard; also have
>       been broadcast in Eastern Europe and various parts of Africa and Asia.
>       Uses the same 576i50 timings as PAL.
>
>     Also added some comments explaining color subcarrier frequency
>     registers.
>
>     Acked-by: Noralf Trønnes <noralf@tronnes.org>
>     Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
>     Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>
>     ---
>     Changes in v6:
>     - Support PAL60 again
>     ---
>      drivers/gpu/drm/vc4/vc4_vec.c | 111 ++++++++++++++++++++++++++++++++++++++++--
>      1 file changed, 107 insertions(+), 4 deletions(-)
>
>     diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c
>     index a828fc6fb776..d23dbad3cbf6 100644
>     --- a/drivers/gpu/drm/vc4/vc4_vec.c
>     +++ b/drivers/gpu/drm/vc4/vc4_vec.c
>     @@ -46,6 +46,7 @@
>      #define VEC_CONFIG0_YDEL(x)            ((x) << 26)
>      #define VEC_CONFIG0_CDEL_MASK          GENMASK(25, 24)
>      #define VEC_CONFIG0_CDEL(x)            ((x) << 24)
>     +#define VEC_CONFIG0_SECAM_STD          BIT(21)
>      #define VEC_CONFIG0_PBPR_FIL           BIT(18)
>      #define VEC_CONFIG0_CHROMA_GAIN_MASK   GENMASK(17, 16)
>      #define VEC_CONFIG0_CHROMA_GAIN_UNITY  (0 << 16)
>     @@ -76,6 +77,27 @@
>      #define VEC_SOFT_RESET                 0x10c
>      #define VEC_CLMP0_START                        0x144
>      #define VEC_CLMP0_END                  0x148
>     +
>     +/*
>     + * These set the color subcarrier frequency
>     + * if VEC_CONFIG1_CUSTOM_FREQ is enabled.
>     + *
>     + * VEC_FREQ1_0 contains the most significant 16-bit half-word,
>     + * VEC_FREQ3_2 contains the least significant 16-bit half-word.
>     + * 0x80000000 seems to be equivalent to the pixel clock
>     + * (which itself is the VEC clock divided by 8).
>     + *
>     + * Reference values (with the default pixel clock of 13.5 MHz):
>     + *
>     + * NTSC  (3579545.[45] Hz)     - 0x21F07C1F
>     + * PAL   (4433618.75 Hz)       - 0x2A098ACB
>     + * PAL-M (3575611.[888111] Hz) - 0x21E6EFE3
>     + * PAL-N (3582056.25 Hz)       - 0x21F69446
>     + *
>     + * NOTE: For SECAM, it is used as the Dr center frequency,
>     + * regardless of whether VEC_CONFIG1_CUSTOM_FREQ is enabled or not;
>     + * that is specified as 4406250 Hz, which corresponds to 0x29C71C72.
>     + */
>      #define VEC_FREQ3_2                    0x180
>      #define VEC_FREQ1_0                    0x184
>
>     @@ -118,6 +140,14 @@
>
>      #define VEC_INTERRUPT_CONTROL          0x190
>      #define VEC_INTERRUPT_STATUS           0x194
>     +
>     +/*
>     + * Db center frequency for SECAM; the clock for this is the same as for
>     + * VEC_FREQ3_2/VEC_FREQ1_0, which is used for Dr center frequency.
>     + *
>     + * This is specified as 4250000 Hz, which corresponds to 0x284BDA13.
>     + * That is also the default value, so no need to set it explicitly.
>     + */
>      #define VEC_FCW_SECAM_B                        0x198
>      #define VEC_SECAM_GAIN_VAL             0x19c
>
>     @@ -197,10 +227,15 @@ enum vc4_vec_tv_mode_id {
>             VC4_VEC_TV_MODE_NTSC_J,
>             VC4_VEC_TV_MODE_PAL,
>             VC4_VEC_TV_MODE_PAL_M,
>     +       VC4_VEC_TV_MODE_NTSC_443,
>     +       VC4_VEC_TV_MODE_PAL_60,
>     +       VC4_VEC_TV_MODE_PAL_N,
>     +       VC4_VEC_TV_MODE_SECAM,
>      };
>
>      struct vc4_vec_tv_mode {
>             unsigned int mode;
>     +       u16 expected_htotal;
>             u32 config0;
>             u32 config1;
>             u32 custom_freq;
>     @@ -236,35 +271,68 @@ static const struct debugfs_reg32 vec_regs[] = {
>      static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = {
>             {
>                     .mode = DRM_MODE_TV_MODE_NTSC,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_NTSC_443,
>     +               .expected_htotal = 858,
>     +               .config0 = VEC_CONFIG0_NTSC_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ,
>     +               .custom_freq = 0x2a098acb,
>     +       },
>             {
>                     .mode = DRM_MODE_TV_MODE_NTSC_J,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_NTSC_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>             {
>                     .mode = DRM_MODE_TV_MODE_PAL,
>     +               .expected_htotal = 864,
>                     .config0 = VEC_CONFIG0_PAL_BDGHI_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               /* PAL-60 */
>     +               .mode = DRM_MODE_TV_MODE_PAL,
>     +               .expected_htotal = 858,
>     +               .config0 = VEC_CONFIG0_PAL_M_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ,
>     +               .custom_freq = 0x2a098acb,
>     +       },
>             {
>                     .mode = DRM_MODE_TV_MODE_PAL_M,
>     +               .expected_htotal = 858,
>                     .config0 = VEC_CONFIG0_PAL_M_STD,
>                     .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>             },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_PAL_N,
>     +               .expected_htotal = 864,
>     +               .config0 = VEC_CONFIG0_PAL_N_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>     +       },
>     +       {
>     +               .mode = DRM_MODE_TV_MODE_SECAM,
>     +               .expected_htotal = 864,
>     +               .config0 = VEC_CONFIG0_SECAM_STD,
>     +               .config1 = VEC_CONFIG1_C_CVBS_CVBS,
>     +               .custom_freq = 0x29c71c72,
>     +       },
>      };
>
>      static inline const struct vc4_vec_tv_mode *
>     -vc4_vec_tv_mode_lookup(unsigned int mode)
>     +vc4_vec_tv_mode_lookup(unsigned int mode, u16 htotal)
>      {
>             unsigned int i;
>
>             for (i = 0; i < ARRAY_SIZE(vc4_vec_tv_modes); i++) {
>                     const struct vc4_vec_tv_mode *tv_mode = &vc4_vec_tv_modes[i];
>
>     -               if (tv_mode->mode == mode)
>     +               if (tv_mode->mode == mode &&
>     +                   tv_mode->expected_htotal == htotal)
>                             return tv_mode;
>             }
>
>     @@ -273,9 +341,13 @@ vc4_vec_tv_mode_lookup(unsigned int mode)
>
>      static const struct drm_prop_enum_list legacy_tv_mode_names[] = {
>             { VC4_VEC_TV_MODE_NTSC, "NTSC", },
>     +       { VC4_VEC_TV_MODE_NTSC_443, "NTSC-443", },
>             { VC4_VEC_TV_MODE_NTSC_J, "NTSC-J", },
>             { VC4_VEC_TV_MODE_PAL, "PAL", },
>     +       { VC4_VEC_TV_MODE_PAL_60, "PAL-60", },
>             { VC4_VEC_TV_MODE_PAL_M, "PAL-M", },
>     +       { VC4_VEC_TV_MODE_PAL_N, "PAL-N", },
>     +       { VC4_VEC_TV_MODE_SECAM, "SECAM", },
>      };
>
>      static enum drm_connector_status
>     @@ -306,11 +378,16 @@ vc4_vec_connector_set_property(struct drm_connector *connector,
>                     state->tv.mode = DRM_MODE_TV_MODE_NTSC;
>                     break;
>
>     +       case VC4_VEC_TV_MODE_NTSC_443:
>     +               state->tv.mode = DRM_MODE_TV_MODE_NTSC_443;
>     +               break;
>     +
>             case VC4_VEC_TV_MODE_NTSC_J:
>                     state->tv.mode = DRM_MODE_TV_MODE_NTSC_J;
>                     break;
>
>             case VC4_VEC_TV_MODE_PAL:
>     +       case VC4_VEC_TV_MODE_PAL_60:
>                     state->tv.mode = DRM_MODE_TV_MODE_PAL;
>                     break;
>
>     @@ -318,6 +395,14 @@ vc4_vec_connector_set_property(struct drm_connector *connector,
>                     state->tv.mode = DRM_MODE_TV_MODE_PAL_M;
>                     break;
>
>     +       case VC4_VEC_TV_MODE_PAL_N:
>     +               state->tv.mode = DRM_MODE_TV_MODE_PAL_N;
>     +               break;
>     +
>     +       case VC4_VEC_TV_MODE_SECAM:
>     +               state->tv.mode = DRM_MODE_TV_MODE_SECAM;
>     +               break;
>     +
>             default:
>                     return -EINVAL;
>             }
>     @@ -341,6 +426,10 @@ vc4_vec_connector_get_property(struct drm_connector *connector,
>                     *val = VC4_VEC_TV_MODE_NTSC;
>                     break;
>
>     +       case DRM_MODE_TV_MODE_NTSC_443:
>     +               *val = VC4_VEC_TV_MODE_NTSC_443;
>     +               break;
>     +
>             case DRM_MODE_TV_MODE_NTSC_J:
>                     *val = VC4_VEC_TV_MODE_NTSC_J;
>                     break;
>     @@ -353,6 +442,14 @@ vc4_vec_connector_get_property(struct drm_connector *connector,
>                     *val = VC4_VEC_TV_MODE_PAL_M;
>                     break;
>
>     +       case DRM_MODE_TV_MODE_PAL_N:
>     +               *val = VC4_VEC_TV_MODE_PAL_N;
>     +               break;
>     +
>     +       case DRM_MODE_TV_MODE_SECAM:
>     +               *val = VC4_VEC_TV_MODE_SECAM;
>     +               break;
>     +
>             default:
>                     return -EINVAL;
>             }
>     @@ -448,13 +545,16 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder,
>             struct drm_connector *connector = &vec->connector;
>             struct drm_connector_state *conn_state =
>                     drm_atomic_get_new_connector_state(state, connector);
>     +       struct drm_display_mode *adjusted_mode =
>     +               &encoder->crtc->state->adjusted_mode;
>             const struct vc4_vec_tv_mode *tv_mode;
>             int idx, ret;
>
>             if (!drm_dev_enter(drm, &idx))
>                     return;
>
>     -       tv_mode = vc4_vec_tv_mode_lookup(conn_state->tv.mode);
>     +       tv_mode = vc4_vec_tv_mode_lookup(conn_state->tv.mode,
>     +                                        adjusted_mode->htotal);
>             if (!tv_mode)
>                     goto err_dev_exit;
>
>     @@ -648,9 +748,12 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data)
>
>             ret = drm_mode_create_tv_properties(drm,
>                                                 BIT(DRM_MODE_TV_MODE_NTSC) |
>     +                                           BIT(DRM_MODE_TV_MODE_NTSC_443) |
>                                                 BIT(DRM_MODE_TV_MODE_NTSC_J) |
>                                                 BIT(DRM_MODE_TV_MODE_PAL) |
>     -                                           BIT(DRM_MODE_TV_MODE_PAL_M));
>     +                                           BIT(DRM_MODE_TV_MODE_PAL_M) |
>     +                                           BIT(DRM_MODE_TV_MODE_PAL_N) |
>     +                                           BIT(DRM_MODE_TV_MODE_SECAM));
>             if (ret)
>                     return ret;
>
>
>     -- 
>     b4 0.11.0-dev-99e3a 
>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-11-08 22:16 UTC|newest]

Thread overview: 219+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 14:16 [PATCH v7 00/23] drm: Analog TV Improvements Maxime Ripard
2022-11-07 14:16 ` Maxime Ripard
2022-11-07 14:16 ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16 ` Maxime Ripard
2022-11-07 14:16 ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 01/23] drm/tests: Add Kunit Helpers Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 02/23] drm/connector: Rename legacy TV property Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 03/23] drm/connector: Only register TV mode property if present Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 04/23] drm/connector: Rename drm_mode_create_tv_properties Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 05/23] drm/connector: Add TV standard property Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 06/23] drm/modes: Add a function to generate analog display modes Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-08 13:28   ` Lukas Satin
2022-11-08 13:28     ` [Intel-gfx] " Lukas Satin
2022-11-08 13:28     ` Lukas Satin
2022-11-08 21:51     ` Mateusz Kwiatkowski
2022-11-08 21:51       ` Mateusz Kwiatkowski
2022-11-08 21:51       ` [Intel-gfx] " Mateusz Kwiatkowski
2022-11-08 21:51       ` Mateusz Kwiatkowski
2022-11-08 21:51       ` Mateusz Kwiatkowski
2022-11-07 14:16 ` [PATCH v7 07/23] drm/client: Add some tests for drm_connector_pick_cmdline_mode() Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 08/23] drm/modes: Move named modes parsing to a separate function Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 09/23] drm/modes: Switch to named mode descriptors Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 10/23] drm/modes: Fill drm_cmdline mode from named modes Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 11/23] drm/connector: Add pixel clock to cmdline mode Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 12/23] drm/connector: Add a function to lookup a TV mode by its name Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 13/23] drm/modes: Introduce the tv_mode property as a command-line option Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 14/23] drm/modes: Properly generate a drm_display_mode from a named mode Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 17:49   ` Noralf Trønnes
2022-11-07 17:49     ` Noralf Trønnes
2022-11-07 17:49     ` [Nouveau] " Noralf Trønnes
2022-11-07 17:49     ` [Intel-gfx] " Noralf Trønnes
2022-11-07 17:49     ` Noralf Trønnes
2022-11-08  9:40     ` Noralf Trønnes
2022-11-08  9:40       ` Noralf Trønnes
2022-11-08  9:40       ` [Intel-gfx] " Noralf Trønnes
2022-11-08  9:40       ` Noralf Trønnes
2022-11-08  9:40       ` [Nouveau] " Noralf Trønnes
2022-11-10 10:36       ` Maxime Ripard
2022-11-10 10:36         ` Maxime Ripard
2022-11-10 10:36         ` [Intel-gfx] " Maxime Ripard
2022-11-10 10:36         ` Maxime Ripard
2022-11-10 10:36         ` [Nouveau] " Maxime Ripard
2022-11-10  9:31     ` Maxime Ripard
2022-11-10  9:31       ` Maxime Ripard
2022-11-10  9:31       ` [Intel-gfx] " Maxime Ripard
2022-11-10  9:31       ` Maxime Ripard
2022-11-10  9:31       ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 15/23] drm/modes: Introduce more named modes Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 18:03   ` Noralf Trønnes
2022-11-07 18:03     ` Noralf Trønnes
2022-11-07 18:03     ` Noralf Trønnes
2022-11-07 18:03     ` [Intel-gfx] " Noralf Trønnes
2022-11-07 18:03     ` Noralf Trønnes
2022-11-08  9:38     ` Noralf Trønnes
2022-11-08  9:38       ` [Intel-gfx] " Noralf Trønnes
2022-11-08  9:38       ` Noralf Trønnes
2022-11-08  9:38       ` Noralf Trønnes
2022-11-08  9:38       ` [Nouveau] " Noralf Trønnes
2022-11-08 21:27       ` Mateusz Kwiatkowski
2022-11-08 21:27         ` Mateusz Kwiatkowski
2022-11-08 21:27         ` [Intel-gfx] " Mateusz Kwiatkowski
2022-11-08 21:27         ` Mateusz Kwiatkowski
2022-11-08 21:27         ` [Nouveau] " Mateusz Kwiatkowski
2022-11-09 11:18         ` Maxime Ripard
2022-11-09 11:18           ` Maxime Ripard
2022-11-09 11:18           ` [Intel-gfx] " Maxime Ripard
2022-11-09 11:18           ` Maxime Ripard
2022-11-09 11:18           ` [Nouveau] " Maxime Ripard
2022-11-09 14:09   ` Noralf Trønnes
2022-11-09 14:09     ` Noralf Trønnes
2022-11-09 14:09     ` [Intel-gfx] " Noralf Trønnes
2022-11-09 14:09     ` Noralf Trønnes
2022-11-09 14:09     ` [Nouveau] " Noralf Trønnes
2022-11-07 14:16 ` [PATCH v7 16/23] drm/probe-helper: Provide a TV get_modes helper Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 18:11   ` Noralf Trønnes
2022-11-07 18:11     ` Noralf Trønnes
2022-11-07 18:11     ` [Intel-gfx] " Noralf Trønnes
2022-11-07 18:11     ` Noralf Trønnes
2022-11-07 18:11     ` [Nouveau] " Noralf Trønnes
2022-11-09 15:41     ` Maxime Ripard
2022-11-09 15:41       ` Maxime Ripard
2022-11-09 15:41       ` [Intel-gfx] " Maxime Ripard
2022-11-09 15:41       ` Maxime Ripard
2022-11-09 15:41       ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 17/23] drm/atomic-helper: Add a TV properties reset helper Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 18/23] drm/atomic-helper: Add an analog TV atomic_check implementation Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 19/23] drm/vc4: vec: Use TV Reset implementation Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 20/23] drm/vc4: vec: Check for VEC output constraints Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 21/23] drm/vc4: vec: Convert to the new TV mode property Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 22/23] drm/vc4: vec: Add support for more analog TV standards Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-08 13:17   ` [Nouveau] " Lukas Satin
2022-11-08 13:17     ` [Intel-gfx] " Lukas Satin
2022-11-08 13:17     ` Lukas Satin
2022-11-08 22:16     ` Mateusz Kwiatkowski [this message]
2022-11-08 22:16       ` Mateusz Kwiatkowski
2022-11-08 22:16       ` [Intel-gfx] " Mateusz Kwiatkowski
2022-11-08 22:16       ` Mateusz Kwiatkowski
2022-11-08 22:16       ` Mateusz Kwiatkowski
2022-11-09  1:15   ` Mateusz Kwiatkowski
2022-11-09  1:15     ` Mateusz Kwiatkowski
2022-11-09  1:15     ` [Intel-gfx] " Mateusz Kwiatkowski
2022-11-09  1:15     ` Mateusz Kwiatkowski
2022-11-09  1:15     ` [Nouveau] " Mateusz Kwiatkowski
2022-11-09 16:55     ` Lukas Satin
2022-11-09 16:55       ` [Intel-gfx] " Lukas Satin
2022-11-09 16:55       ` Lukas Satin
2022-11-10 10:39       ` Maxime Ripard
2022-11-10 10:39         ` Maxime Ripard
2022-11-10 10:39         ` Maxime Ripard
2022-11-10 10:39         ` [Intel-gfx] " Maxime Ripard
2022-11-10 10:39         ` Maxime Ripard
2022-11-10 10:57     ` Maxime Ripard
2022-11-10 10:57       ` [Intel-gfx] " Maxime Ripard
2022-11-10 10:57       ` Maxime Ripard
2022-11-10 10:57       ` Maxime Ripard
2022-11-10 10:57       ` [Nouveau] " Maxime Ripard
2022-11-07 14:16 ` [PATCH v7 23/23] drm/sun4i: tv: Convert to the new TV mode property Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Intel-gfx] " Maxime Ripard
2022-11-07 14:16   ` Maxime Ripard
2022-11-07 14:16   ` [Nouveau] " Maxime Ripard
2022-11-07 18:57 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm: Analog TV Improvements (rev7) Patchwork
2022-11-08 13:20 ` [Nouveau] [PATCH v7 00/23] drm: Analog TV Improvements Lukas Satin
2022-11-08 13:20   ` [Intel-gfx] " Lukas Satin
2022-11-08 13:20   ` Lukas Satin
2022-11-08 13:42   ` Geert Uytterhoeven
2022-11-08 13:42     ` Geert Uytterhoeven
2022-11-08 13:42     ` Geert Uytterhoeven
2022-11-08 13:42     ` Geert Uytterhoeven
2022-11-08 13:42     ` [Intel-gfx] " Geert Uytterhoeven
2022-11-08 22:27 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm: Analog TV Improvements (rev8) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=137895ef-b2c4-6e10-e245-125745b882bc@gmail.com \
    --to=kfyatek@gmail.com \
    --cc=airlied@linux.ie \
    --cc=bskeggs@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dom@raspberrypi.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emma@anholt.net \
    --cc=geert@linux-m68k.org \
    --cc=hdegoede@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kfyatek+publicgit@gmail.com \
    --cc=kherbst@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=luke.satin@gmail.com \
    --cc=lyude@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime@cerno.tech \
    --cc=mripard@kernel.org \
    --cc=noralf@tronnes.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=phil@raspberrypi.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=samuel@sholland.org \
    --cc=tvrtko.ursulin@linux.intel.com \
    --cc=tzimmermann@suse.de \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.