-
Notifications
You must be signed in to change notification settings - Fork 27
tinydrm progress reports #2
Comments
(fyi i have subscribed to this thread - ready to test anything) |
It took a while, but the first patchset is away: drm: Add support for tiny LCD displays Based on the review it seems that I still have some way to go, so no need for testing yet. Need to get the API stable first. |
thx for the update! |
How do i setup tinydrm? (Yes im new.) |
[RFC v2 0/8] drm: Add support for tiny LCD displays The feedback is focusing on the parts of tinydrm that will go into the core drm helpers. So I will concentrate on getting those parts accepted before I do a new tinydrm patchset. Hopefully the fbdev deferred io part will land in 4.7. Patches can also be picked from here: https://github.com/notro/linux/commits/tinydrm-rfc2 (based on rpi-4.5.y)
See wiki. |
@notro do you have any recommendations on where to look for a jump start on interfacing a TFT with the Parallel RGB of an imx6. we're looking to add a custom display to our linux device...seems like we could use a lot of the elements of FBTFT but you're messages suggest abandoning that as the maintainer is not accepting any more drivers. |
@beardedbadger This thread is for tinydrm announcements, so I have move your question here: notro/fbtft#391 |
This is just a note to say that the project is still alive. I needed a break after working on it for 6 months straight. After a 4 month break, I'm now back working on it. Currently I'm looking at the possibility to write userspace drm drivers: https://github.com/notro/udrm-kernel This is the userspace driver I use for testing: https://github.com/notro/utinydrm When I started with fbtft, I tried to make it as easy as possible for others to write drivers, even if they hadn't done any kernel coding before. But it turned out that not many actually did write drivers, so I made the drivers as flexible as possible using module parameters. This way the drivers could be used with many displays, without having to build a new kernel. So the reason I'm detouring on userspace drivers, is because I want as many people as possible to be able to write drivers for these displays. It would have been really cool to see a drm userspace driver for this: https://learn.adafruit.com/1500-neopixel-led-curtain-with-raspberry-pi-fadecandy/overview |
What's in the Device Tree policy prevents init sequences? Also, how much slower would the userspace driver be for SPI displays? Currently 320x240 SPIs are barely usable as it is, anything that requires X will be unworkable if it gets any slower. Would there be some way to write the userspace drivers in a way that they're easy to shove into the kernel if one wanted to build a custom kernel with them? |
The current consensus among kernel maintainers is that device tree "describes the hardware" and any configuration parameters (especially anything linux-specific) are rejected. To get a sense of the bigger picture, here are some slides from the recent Linux Plumbers Conference about this.
Personally, I would much rather write kernel drivers so that I don't have to maintain a userspace driver on my own. In fact, if you don't mind ccing me when you submit patches for the mainline kernel, I would like to get familiar with the simple drm helpers so that I can submit drivers for the displays that I am interested in. |
X is one of the things that should perform better with a drm driver.
So if I didn't mess up anything with this test, there's quite some improvements to be made compared to fbtft. But full screen updates is the difficult metric, and it's not just used for video playback, because with drm it's possible to do rendering on the gpu and then scanout the resulting buffer on a spi display (PRIME). I would guess that this requires a full scanout every time, because that's what the app expects when it does buffer/page flipping.
Not if I end up doing only userspace drivers, but that's to early to tell right now. |
If we end up doing only userspace drivers, then I will add a repo to collect those drivers. What do you see as a downside with having the drivers in userspace? The first driver to use the simple drm helper has just landed, but it doesn't use the framebuffer dirty callback: https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/mxsfb |
The main downside is that the userspace drivers will have to be packaged or manually installed on whatever system/OS you are using. So, if I am to use this in the ev3dev OS that I maintain, it is one more package for me to maintain and one more upstream project that I have to follow. Whereas, if the drivers are in the kernel, there is no extra work for me. Also, it is just a minor thing, but with a kernel driver, you can use the display in early boot, for things like a boot splash. Thanks for the link. |
as a thought for the custom initialization details: could we set up a 'generic' 320x240 & 320x480 SPI kernel driver and then have a userspace tool send the init commands over an IOCTL or similar? id say at this point, 3 or 4 display chipsets dominate the 'small display' market (ili9341, hx8357d, ili9328 etc) so you can set them up with basic generic init and then load the special init commands for gamma correction, rotation, and bias voltage later. |
@ladyada It's a possibility to have all but the init sequence in-kernel, but performance doesn't seem to be an argument. |
There are Raspberry Pi HAT displays with an onboard eeprom containing a Device Tree fragment. If we end up with userspace drivers, it shouldn't be a problem with backwards compatibility: If we do kernel drivers, then maybe we're allowed to add fbtft legacy support to the drivers, I don't know. |
I think yes. What I hear from kernel maintainers is that if there is something already in the mainline device tree, then the kernel supports it indefinitely, even if the device tree is "wrong". So, if the new drm drivers can use the same device tree bindings as fbtft, this will be the only way that fbtft can be removed from staging. |
The userspace driver approach wasn't such a good idea: [RFC 0/6] drm: Add support for userspace drivers
It wasn't a waste of time though, because it made me rework the emulation code (byte swapping RGB565) in tinydrm (16-bit SPI not supported on Pi which is little endian) which made the code easier to read. Edit: |
[PATCH 0/9] drm: Add support for tiny LCD displays The review went well, only minor things left to do. I have now understood why I get a speed up if I make a copy of the pixel line before swapping the bytes: So now i get 27 fps on a 320x240 display @48MHz. Edit: This is nonsense, fbtft doesn't read from the tx buffer, but tinydrm performs better than fbtft... |
@notro Good to hear. Thanks for all your efforts! I'd like to try out tinydrm on the BeagleBone. Are there particular LCDs that would be good to test? In the past with fbtft, I've used Adafruit 1.8" [PID 358], Adafruit 2.2" [PID 1480] and Adafruit 2.8" [PID 2090] |
I have few LCDs too and i could try them on rpi2. plz do let me know if i could be a help. currently i have 1.8" ST7735 (spi), 2.4" ili9341(spi), 3.5" ili9481 (8 bit bus) fbtft was a good excuse for me to learn abt FB drivers. (https://github.com/amitesh-singh/ldd/blob/master/tfts/tftframework/4dtft.c) |
The patchset will only apply cleanly on linux-next, there's been several changes to drm header files and other changes since 4.10 that tinydrm relies on. I'm too late for 4.11 so tinydrm will be available in 4.12. The patchset only supports rpi-display and Adafruit PiTFT 2.8" since they both have a MI0283QT display panel. And I'm reminded that I will probably not add support for 8080 parallel bus in tinydrm. At least not initially. The reason is that driving the bus through the gpio subsystem is very slow. Some boards like Pi and BBB (I believe) has hw support for parallel bus, but there's no Linux subsystem for a parallel databus. I actually don't know how widespread the use of parallel bus connected displays are. It can't compete with SPI on performance (with DMA), so why bother? |
I can't find the notes, but IIRC 3 of the Adafruit displays use(d) the same init sequence: 1601, 2090 and one more. So 2090 will probably work with mi0283qt. Continuing on the parallel bus support: |
[PATCH v4 0/7] drm: Add support for tiny LCD displays The only thing missing now is a DT maintainer ack. |
Congrats on getting accepted for Kernel 4.11! |
Hooray! Great news @PTS93. Well done @notro! |
Yes, tinydrm has crashed into Linus' tree. It's been a difficult task to condense the complexity of drm into something simple that the maintainers would accept. Daniel Vetter (drm maintainer) has been very helpful in guiding me along the way. So now there's a foundation for fbtft type drivers. I have a fatigue illness that keeps getting worse each year. It's now at a point where I can't spearhead this work anymore. This means that we need someone else to step up and do the actual work of converting and preparing drivers for submission. I have converted the fbtft module to tinydrm so the fbtft drivers do work, but that will never be accepted by maintainers. One driver should be picked and submitted for review to find out if backwards Device Tree compatibility will be accepted. Thanks for the encouragements along the way. It's been times that I thought of quitting, but I wanted to get it done for the maker community. |
@notro thanks very much to all of your efforts! |
Thanks @notro! |
Thanks @notro for your great efforts! Thanks a lot! |
For the Raspberry Pi crowd I've built a 4.9 kernel for easy testing on a stable kernel and a 4.10 kernel with headers for low entry development: https://github.com/notro/tinydrm/wiki/board:-Raspberry-Pi |
There's a new tinydrm driver for some small e-ink panels (avail in 4.14): https://cgit.freedesktop.org/drm/drm-misc/tree/drivers/gpu/drm/tinydrm/repaper.c tinydrm has been backported to 4.9 for the Raspberry Pi: raspberrypi/linux#2119 |
wow that repaper driver is really simple, looks awesome. nice work @notro :) |
@notro, tested your repaper driver on a 2.7" Papirus display. |
I have considered it, but it isn't the kernel job to do stuff like this. If userspace (lib, apps) already had support for drm monochrome/greyscale, I would have used that instead, but I see no point in adding it when 'no one' will add support for such formats. So I took the best supported format XRGB8888 and did a simple brightness conversion (plymouth, boot splash, only support xrgb8888). The downside is that userspace needs to know that the display is monochrome for good result. For bash to look good, you can change the colors it uses. |
New tinydrm driver for LEGO MINDSTORMS EV3 LCD in 4.14: https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/tinydrm/st7586.c I'm trying to make tinydrm more useful on all platforms by moving away from buffers allocated with dma_alloc_wc() to using vmalloc() instead: https://lists.freedesktop.org/archives/dri-devel/2017-October/154048.html I'm also working on supporting USB devices: https://lists.freedesktop.org/archives/dri-devel/2017-September/152115.html |
@notro thanks for the update and all your efforts on fbtft and tinydrm! |
Two new tindyrm drivers by @dlech for 4.16:
|
@anholt has just ported hx8357d.c to tinydrm (DT binding). Another great think is that he's done some work to offload rendering to the vc4 driver: anholt/linux#10 |
yay! |
tinydrm as a concept will be gone in Linux 5.4. 2 years ago I got an idea to turn a Raspberry Pi Zero into a $5 USB to HDMI/SDTV/DSI/DPI/DBI adapter. I have spent the time since to clean up tinydrm and do core prep work and now I've finally started on the driver. If all goes well, it will be a generic USB display driver. This means that it will be possible for anyone to make a USB display without having to write a kernel driver. I'll post here when I got some code to show. |
sounds neat! i just wrote a tinydrm display driver for a new high resolution mini st7789 display cause none of the existing drivers would support it. luckily it looks like |
I have finally something to show for wrt. the idea to turn a Raspberry Pi Zero into a $5 USB to HDMI/SDTV/DSI/DPI/DBI adapter. I did end up with a generic 'Multifunction USB Device' that can support multiple functions like display, gpio, adc, etc. [RFC 0/9] Regmap over USB for Multifunction USB Device (gpio, display, ...) If this doesn't work out, then I'll fall back to a pure display driver. lz4 compression does help for the display driver.
If I disable compression I'm getting 5 fps for a 1.5MB framebuffer (7800 kB/s):
This is slower than I hoped for. I've discovered that reading is almost 3 times faster than writing. The zero gadget (loop testing) confirms my findings:
I have tried Pi1 and Pi4 as host (2 different controllers) and Pi Zero and Beaglebone Black as device, getting the same result. |
The USB display driver is now included in Linux 5.13: https://github.com/notro/gud/wiki With this driver I'm winding down my involvement into Linux display drivers and move more into maintainance mode. It's been an interesting and rewarding ride starting in 2012 with a Raspberry Pi and an Adafruit 2.2" display which resulted in fbtft and 5 years later I was doing refactoring work in the Linux DRM subsystem. You never know what the future holds in store for you :) Thanks for all encouragement along the way. |
tinydrm is an attempt at making a drm version of fbtft.
I will post progress reports in this thread as the tinydrm work moves forward.
If you want to be notified, click the Subscribe button to the right.
One change from fbtft is that we now write drivers for displays, not controllers. The main reason for this is that we're not allowed to have the binary init sequence in the Device Tree and it's impossible to cover all the possible controller configurations with individual properties.
The controller specific code is put in a module of it's own and contains the necessary code to update the display memory.
This is an example of how a display driver might look like: ada-mipifb.c
This is how a controller module might look like (many controllers are mipi compliant): mipi-dbi.c
But this could change depending on the feedback from the drm maintainers.
I haven't posted anything on the drm mailinglist yet, just a very short discussion.
The text was updated successfully, but these errors were encountered: