Skip to content

Why is the interlaced mode disabled in the DPI? #2668

Closed

Description

@mortaca

Hello, I am the main developer of the RGB-Pi project to connect the Raspberry with CRT TVs through the DPI port, users would love to be able to use interlaced modes but I see that in the firmware this mode is disabled, why? How could I enable it again please? Thank in advance.

I found this on the firmware: fe683ca#diff-6c2809c90758efe822c708a4b8728e00

drm/vc4: Disallow interlaced modes on DPI.
Wealready don't expose such modes to userspace, but make
sure userspace can't sneak some interlaced mode in.
Signed-off-by: Mario Kleiner mario.kleiner.de@gmail.com
Signed-off-by: Eric Anholt eric@anholt.net

Activity

  1. javiertoti commented on Aug 30, 2018

    @javiertoti

    Interesting topic for retrogamers, please help this man.

  2. marcushg85 commented on Aug 30, 2018

    @marcushg85

    I also think it is a really interesting function it should be available, thanks

  3. xjauna commented on Aug 30, 2018

    @xjauna

    Interlaced mode is very interesting for retro devices.

  4. pelwell commented on Aug 30, 2018

    @pelwell
    Contributor

    "Me too"/upvote posts like this don't help - they just generate email spam for the devs. The thumbs-up feature is better because it generates less clutter and no notifications, but we still get to see the interest.

    The commit you reference is in the open source ARM-based "vc4" V3D driver. Is this what you are using (you don't say)? If so, the correct place to report this question/issue is in the author's repo. If not, this commit is a red herring.

  5. mortaca commented on Aug 30, 2018

    @mortaca
    Author

    I'm not really using the vc4 driver but the post is in general to deal with the theme of the mode interlaced by the GPIO, when launching an interlaced hdmi_timing like this:

    hdmi_timings 512 1 25 46 17 480 1 1 3 23 0 0 0 60 1 9600000 1
    

    I find this image, in the picture it is not appreciated but two displaced images instead of superimposed and by HDMI converter these timings are functional.
    image

    If the use of a modified driver like vc4 or another can be the solution I would greatly appreciate a recommendation of where to continue investigating.

  6. 6by9 commented on Aug 30, 2018

    @6by9
    Contributor

    AFAIK The DPI peripheral doesn't have the capabilities to produce an interlaced frame, unlike the VEC (composite video) and HDMI. It would need to output the relevant set of long and short sync periods to identify the fields, and I can find no reference to that in the documentation.

    It's just possible that some of the pixel valve setup intended for the VEC may have a useful effect on the DPI interface too, because AIUI you effectively are wanting PAL or NTSC interlacing on DPI.
    Whether there is the resource or motivation to experiment is a totally different question.

  7. mortaca commented on Aug 30, 2018

    @mortaca
    Author

    The resources or motivation can be obtained in different ways, there is no problem in making a contribution for the hours of research employed.

    The best thing would be to achieve this through software but I can experiment with the use of dedicated hardware for this purpose if necessary, the next steps I can follow are to analyze with oscilloscope the synchronism signal emitted by a hdmi to vga converter and compare it with the same hdmi_timing through the DPI, so we can know exactly what we need. Any idea is very grateful.

  8. 6by9 commented on Aug 30, 2018

    @6by9
    Contributor

    Well we have no interlaced hardware to connect to the DPI interface, nor video analyser (AFAIK). We may even struggle to find a display with a composite or SCART input!

    There is one obvious setup parameter that may tickle things into life but which is fixed for DPI displays. It wouldn't be difficult to stuff that into a config.txt entry, or extend the new dpi_timings parameter, to allow it to be set to NTSC or PAL instead. Whether it will do anything useful I have no idea.

    (For others at Pi Towers, PIXELVALVE_MODE_xxx. I can't find pixelvalve docs, but does it seem sane to try switching from VIDEO to VEC_NTSC/VEC_PAL?)

  9. popcornmix commented on Aug 31, 2018

    @popcornmix
    Collaborator

    PIXELVALVE_VC bit 4 is called INT_MODE:

    0 LCD / progressive mode
    1 Interlaced mode
    

    But I don't believe anyone has ever tried to drive a DPI display in interlaced mode so the chances of this magically doing something useful are low.

  10. 6by9 commented on Aug 31, 2018

    @6by9
    Contributor

    INT_MODE is already controllable by the interlaced flag in hdmi_timings/dpi_timings (the 15th field of the 17 by the looks of it). It appears that @mortaca has already set that in his test hdmi_timings.

    I was more curious over the mode member of PIXELVALVE_PERIPH_SETUP_T.
    DPI fixes it at PIXELVALVE_MODE_VIDEO, but the VEC middleware will set it to PIXELVALVE_MODE_VEC_PAL or PIXELVALVE_MODE_VEC_NTSC.
    Whether that kicks the pixelvalve into producing the weird long and short sync pulses during the vsync to denote field order I don't know - I can't actually see any code that handles those values for the mode in the pixelvalve driver, so perhaps it is real magic!

  11. mortaca commented on Aug 31, 2018

    @mortaca
    Author

    First of all, thank you very much for the interest shown in this topic, it is really something that many users will thank.

    I have done some tests waiting for an HDMI to VGA adapter to compare, I have looked at the CSYNC synchronous signal in my circuit which is nothing more than the mix of HSYNC and VSYNC and I have compared between a progressive hdmi_timing with the interlaced option disabled and the aforementioned timing with the option activated and interlaced resolution values and they are exactly the same signal.

    240p timing by DPI:
    image
    image

    480i timing by DPI:
    image
    image

    EDITED: Ok I have done new tests, I have obtained a hdmi to vga converter and I have made a vga to scart cable mixing the H and V sync, for the configuration of the Pi I used the hdmi_mode=1 and hdmi_group=8 to start with a 240p mode , it has worked and this is the synchronization signal, exactly the same as for the DPI port.
    image

    Then I changed to hdmi_mode=6 which is 480i and the change in the image is significant, it has also worked well and the synchronization signal are this.
    image

    image

    I tried using the hdmi_timings but these do not work with the hdmi_group=2 hdmi_mode=87

    Conclusion, Here we can see the two heights in the synchronism signal that define when it is an even or odd field in the signal that does not exist through the DPI port.

  12. 6by9 commented on Sep 2, 2018

    @6by9
    Contributor

    Conclusion, Here we can see the two heights in the synchronism signal that define when it is an even or odd field in the signal that does not exist through the DPI port.

    And they can't exist directly from the DPI interface as it is pure binary digital logic and can't create that the third voltage level. That was the reason I had already said I didn't believe that the DPI interface was capable of doing it.
    I had been reading http://martin.hinner.info/vga/pal.html and others which give detail of the difference in sync pulses on the first couple of lines of each field to identify the fields. That may be possible as it remains as pure digital logic levels, but depends on how the hardware interfaces to the rest of the system.

  13. mortaca commented on Sep 2, 2018

    @mortaca
    Author

    True but the DPI port has two pins that can be used for this purpose, the 0(PCLK) u and the 1(DE)

    image

    Then it would be necessary to add this new level to the sync signal through a little electronic but nothing problematic.

  14. 6by9 commented on Sep 2, 2018

    @6by9
    Contributor

    This is all cast in hardware, so no real options to add new magical features without respinning the silicon (not going to happen and not backwards compatible).

    PCK and DE have dedicated functions for driving LCD panels so I very much doubt they have any other modes of operation within the DPI peripheral.

  15. mortaca commented on Sep 3, 2018

    @mortaca
    Author

    Ok, it would be necessary to use a compute module to have an extra pin to do this but I think that all this is not necessary, reviewing the documentation that you have previously contributed, the sync signal that looks a bit different from what I could check with the oscilloscope.

    The first difference is that they speak of sync+luma, in addition to the sync it carries the brightness signal, but we in the Pi have the pure H and V sync so the waves that appear in the document we do not have them.

    The second most important difference is that the differentiation of even and odd fields I do not see that it is done with a third logical level, it is all in only two high and low levels with the vertical signal acting in XOR mode, I am currently simply mixing the two signals with two resistors in paralallel so this would be equivalent to a logical OR gate, maybe here is the solution!

    This would be the signal generated by my circuit currently VS the signal resulting from using a logical XOR gate:
    image

    With this we could obtain that inversion in the signal that we see in the documentation that contributed :D If you see it right I start to create the circuit to check it.

  16. 10 remaining items

  17. 6by9 commented on Sep 24, 2018

    @6by9
    Contributor

    Take it back, the vc4 driver does have some setup for interlaced at https://github.com/raspberrypi/linux/blob/rpi-4.14.y/drivers/gpu/drm/vc4/vc4_crtc.c#L414, but ONLY for PAL/HDMI, not NTSC field ordering.

    You have access to all those register values via the config.txt line, therefore it should be possible to achieve the same setup.
    @sigmaris How have you setup the mode with KMS? If I can replicate that then I can derive the same settings from the firmware.

  18. sigmaris commented on Sep 24, 2018

    @sigmaris
    Contributor

    @6by9 Currently a custom kernel is needed; using the kernel, modules and DT overlays built from this branch "interlace-hack-vc4-dpidac" with CONFIG_DRM_RPI_DPIDAC enabled, and adding dtoverlay=vc4-kms-v3d and dtoverlay=vc4-vga666 to config.txt, and adding video=VGA-1:640x480i to cmdline.txt should be sufficient to get an interlaced signal output from a VGA666 adapter via DPI. That branch is a bit behind the current rpi-4.14.y kernel, but the 3 patches could be updated to the current kernel fairly easily if needed.

    @mortaca Sorry, it's not just a single driver, and I don't think a binary kernel module I compiled would work with other kernels. You can try compiling the patched kernel from the above branch, though.

    For background info - Because DPI has so far only been used to drive fixed-resolution LCD panels with the open-source driver, there isn't an easy way to use it with a range of displays supporting several different video modes, like would be connected via VGA666, Pi2SCART, etc adapters. There was some discussion of this here: anholt#36 and I tried a few different approaches. Eventually, I added a DRM bridge driver based on dumb-vga-dac.c, which is needed to set the bus format and video modes on the VGA connector, and a devicetree overlay to activate the driver.

    Amongst other things the DT overlay contains display timings which are loaded by the driver to define video modes; the example modes there are a 640x480 progressive VGA mode for VGA-capable displays, and a 320x240 progressive mode and 640x480 interlaced mode for 15kHz displays. These can and should be changed (e.g. by an additional DT overlay) to the appropriate modes for the connected display - modes can't be autodetected due to the lack of DDC / EDID data. The mode used at boot can be force selected by an argument like video=VGA-1:640x480i on the kernel command line.

  19. cedricp commented on Oct 11, 2018

    @cedricp

    Hi,
    I just want to thank you all guys ! I'm struggling for a long time now to connect my RPi3 to an old LCD from my car. I tested a custom VGA565 DPI (don't need deep color depth) but I only succeeded to display 320x240p. No way to get 480i signal.
    Finally, after reading this thread, I've got it working 👍
    I used a HDMI to VGA converter, I mixed the HV sync signals with a custom XNOR gate to the green input line (this monitor is sync-on-green).
    I just had to configure the hdmi mode to 480i (mode 7, group 1) and voila :)
    Not sure the field ordering is right, but I can't see any problem on the screen.

    The XNOR gate is built with 4 NAND and a transistor to invert an input (I did it with salvaged components).

    img_20181011_210037

    The XNOR gate is made like this :

    image

    I used a 74LS00 (4 NAND gates) to do a XOR operation and I invert an input to finally build a XNOR.

  20. added
    Close within 30 days
    on Oct 29, 2018
  21. pelwell commented on Oct 29, 2018

    @pelwell
    Contributor

    Please close this issue if it has been resolved.

  22. JamesH65 commented on Jul 30, 2019

    @JamesH65
    Contributor

    Closing due to lack of activity. Please request to be reopened if you feel this issue is still relevant.

  23. mortaca commented on Jun 11, 2020

    @mortaca
    Author

    Please close this issue if it has been resolved.

    Why is solved? On the new VC6 driver or V3D the interlaced modes continue disabled on the DPI, please reopen again the issue.

  24. milika commented on Jun 18, 2021

    @milika

    Please reactivate interlaced modes!!

  25. 6by9 commented on Jun 21, 2021

    @6by9
    Contributor

    Please reactivate interlaced modes!!

    Do you have hardware that shows that it works? There's no point in enabling something that is broken.

    The kernel driver will take the lead here. If someone can provide a configuration that shows it working, then I may be persuaded to look at the firmware again.

    Interlacing has too many parameters to make it trivial to enable. Is it odd or even field first? What field delay is in use? How do the porch timings differ between fields? These vary between PAL and NTSC. HDMI follows PAL, but there's no guarantee which way something connected via DPI would go.
    #4241 is fixing up the pixel valve configuration to support NTSC as previously it was only supporting the PAL/HDMI "odd field first" config.

    The simplest option to test is probably a VGA666 feeding an interlaced video mode to a VGA monitor. 1024x768i @ 43Hz is a DMT standard mode so has a chance to be supported by the monitor. CEA modes are unlikely to be. It'll largely be down to your specific sink device.

  26. milika commented on Jun 21, 2021

    @milika

    Please reactivate interlaced modes!!

    Do you have hardware that shows that it works? There's no point in enabling something that is broken.

    The kernel driver will take the lead here. If someone can provide a configuration that shows it working, then I may be persuaded to look at the firmware again.

    Interlacing has too many parameters to make it trivial to enable. Is it odd or even field first? What field delay is in use? How do the porch timings differ between fields? These vary between PAL and NTSC. HDMI follows PAL, but there's no guarantee which way something connected via DPI would go.
    #4241 is fixing up the pixel valve configuration to support NTSC as previously it was only supporting the PAL/HDMI "odd field first" config.

    The simplest option to test is probably a VGA666 feeding an interlaced video mode to a VGA monitor. 1024x768i @ 43Hz is a DMT standard mode so has a chance to be supported by the monitor. CEA modes are unlikely to be. It'll largely be down to your specific sink device.

    What would be the tool i can use on rpi 3b/4 with my vga666? I have a bunch of crts, from 30khz pc monitors to 15khz tvs.
    Tool should be similar capabilities as your hdmi timings option?
    Thanks

  27. 6by9 commented on Jun 24, 2021

    @6by9
    Contributor

    What would be the tool i can use on rpi 3b/4 with my vga666? I have a bunch of crts, from 30khz pc monitors to 15khz tvs.
    Tool should be similar capabilities as your hdmi timings option?

    You'll need to build a custom kernel first to allow selection of interlaced modes. Just removing the conditional at https://github.com/raspberrypi/linux/blob/rpi-5.10.y/drivers/gpu/drm/vc4/vc4_dpi.c#L209 and rebuilding the kernel (see https://www.raspberrypi.org/documentation/linux/kernel/building.md). Whether there are other restrictions I don't know.

    In theory xrandr, assuming you're running X.

    If you boot only to a console then it's harder. I'll talk with those involved as to whether it is sensible to extend the kernel command line parsing to allow a complete mode to be defined. Currently it's only possible to select modes computed via the CVT timing formula, or which are found via the EDID or some other definition for the connector.

  28. setiawanj commented on Aug 8, 2021

    @setiawanj

    @6by9 Currently a custom kernel is needed; using the kernel, modules and DT overlays built from this branch "interlace-hack-vc4-dpidac" with CONFIG_DRM_RPI_DPIDAC enabled, and adding dtoverlay=vc4-kms-v3d and dtoverlay=vc4-vga666 to config.txt, and adding video=VGA-1:640x480i to cmdline.txt should be sufficient to get an interlaced signal output from a VGA666 adapter via DPI. That branch is a bit behind the current rpi-4.14.y kernel, but the 3 patches could be updated to the current kernel fairly easily if needed.

    @sigmaris I've given this a try on my Pi 4B, on top of the latest kernel, but it doesn't seem to work. No VGA connector appears. Do you know if this should work on Pi 4?

  29. sigmaris commented on Aug 8, 2021

    @sigmaris
    Contributor

    @sigmaris I've given this a try on my Pi 4B, on top of the latest kernel, but it doesn't seem to work. No VGA connector appears. Do you know if this should work on Pi 4?

    I don't have a Pi 4 to try it myself, but in principle the approach should work on a Pi 4 using "full" KMS. There's a blog post by someone who's updated the code for the DRM bridge driver to recent kernels and made it into an out-of-tree module, and mentions using it with the Pi 4: http://mydedibox.fr/rpi4-custom-modes-on-a-crt-tv-the-holy-grail/

  30. rtomasa commented on Nov 18, 2021

    @rtomasa

    Please reactivate interlaced modes!!

    Do you have hardware that shows that it works? There's no point in enabling something that is broken.

    The kernel driver will take the lead here. If someone can provide a configuration that shows it working, then I may be persuaded to look at the firmware again.

    Interlacing has too many parameters to make it trivial to enable. Is it odd or even field first? What field delay is in use? How do the porch timings differ between fields? These vary between PAL and NTSC. HDMI follows PAL, but there's no guarantee which way something connected via DPI would go. #4241 is fixing up the pixel valve configuration to support NTSC as previously it was only supporting the PAL/HDMI "odd field first" config.

    The simplest option to test is probably a VGA666 feeding an interlaced video mode to a VGA monitor. 1024x768i @ 43Hz is a DMT standard mode so has a chance to be supported by the monitor. CEA modes are unlikely to be. It'll largely be down to your specific sink device.

    Here the proof that interlaced works perfectly fine via DPI in KMS mode in Rasberry Pi 4 when removing the 2 lines that prevents interlaced from vc4_dpi.c: https://twitter.com/rtomasal/status/1461303096144011265?s=20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Close within 30 days

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions