drm: Add support for tiny LCD displays
Subsystems (3)
v2 cover drm: Add support for tiny LCD displays
This is an attempt at providing a DRM version of drivers/staging/fbtft.
The tinydrm library provides a very simplified view of DRM in particular for tiny displays that has onboard video memory and is connected through a slow bus like SPI/I2C.
Only core patches this time.
Noralf.
Changes since version 1:
- Add tinydrm.rst
- Set tdev->fbdev_cma=NULL on unregister (lastclose is called after that).
- Remove some DRM_DEBUG*()
- Write-combined memory has uncached reads, so speed up by copying/buffering one pixel line before conversion.
Noralf Trønnes (2):
drm: Add DRM support for tiny LCD displays
drm/tinydrm: Add helper functions
Documentation/gpu/index.rst | 1 + Documentation/gpu/tinydrm.rst | 30 ++ drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/tinydrm/Kconfig | 8 + drivers/gpu/drm/tinydrm/Makefile | 1 + drivers/gpu/drm/tinydrm/core/Makefile | 3 + drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 377 ++++++++++++++++++++ drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 462 +++++++++++++++++++++++++ drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c | 234 +++++++++++++ include/drm/tinydrm/tinydrm-helpers.h | 100 ++++++ include/drm/tinydrm/tinydrm.h | 115 ++++++ 12 files changed, 1334 insertions(+) create mode 100644 Documentation/gpu/tinydrm.rst create mode 100644 drivers/gpu/drm/tinydrm/Kconfig create mode 100644 drivers/gpu/drm/tinydrm/Makefile create mode 100644 drivers/gpu/drm/tinydrm/core/Makefile create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-core.c create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c create mode 100644 include/drm/tinydrm/tinydrm-helpers.h create mode 100644 include/drm/tinydrm/tinydrm.h
--
2.10.2
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/2 drm: Add DRM support for tiny LCD displays
tinydrm provides helpers for very simple displays that can use CMA backed framebuffers and need flushing on changes.
---
Changes since version 1:
- Add tinydrm.rst
- Set tdev->fbdev_cma=NULL on unregister (lastclose is called after that).
- Remove some DRM_DEBUG*()
Documentation/gpu/index.rst | 1 + Documentation/gpu/tinydrm.rst | 21 ++ drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/tinydrm/Kconfig | 8 + drivers/gpu/drm/tinydrm/Makefile | 1 + drivers/gpu/drm/tinydrm/core/Makefile | 3 + drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 377 ++++++++++++++++++++++++++++ drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c | 234 +++++++++++++++++ include/drm/tinydrm/tinydrm.h | 115 +++++++++ 10 files changed, 763 insertions(+) create mode 100644 Documentation/gpu/tinydrm.rst create mode 100644 drivers/gpu/drm/tinydrm/Kconfig create mode 100644 drivers/gpu/drm/tinydrm/Makefile create mode 100644 drivers/gpu/drm/tinydrm/core/Makefile create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-core.c create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c create mode 100644 include/drm/tinydrm/tinydrm.h
Documentation/gpu/index.rst +1 -0
@@ -11,6 +11,7 @@ Linux GPU Driver Developer's Guide drm-kms-helpers drm-uapi i915 + tinydrm vga-switcheroo vgaarbiter
Documentation/gpu/tinydrm.rst new file +21 -0
@@ -0,0 +1,21 @@ +========================== +drm/tinydrm Driver library +========================== + +.. kernel-doc:: drivers/gpu/drm/tinydrm/core/tinydrm-core.c + :doc: overview + +Core functionality +================== + +.. kernel-doc:: drivers/gpu/drm/tinydrm/core/tinydrm-core.c + :doc: core + +.. kernel-doc:: include/drm/tinydrm/tinydrm.h + :internal: + +.. kernel-doc:: drivers/gpu/drm/tinydrm/core/tinydrm-core.c + :export: + +.. kernel-doc:: drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c + :export:
drivers/gpu/drm/Kconfig +2 -0
@@ -263,6 +263,8 @@ source "drivers/gpu/drm/mxsfb/Kconfig" source "drivers/gpu/drm/meson/Kconfig" +source "drivers/gpu/drm/tinydrm/Kconfig" + # Keep legacy drivers last menuconfig DRM_LEGACY
drivers/gpu/drm/Makefile +1 -0
@@ -94,3 +94,4 @@ obj-$(CONFIG_DRM_ARCPGU)+= arc/ obj-y += hisilicon/ obj-$(CONFIG_DRM_ZTE) += zte/ obj-$(CONFIG_DRM_MXSFB) += mxsfb/ +obj-$(CONFIG_DRM_TINYDRM) += tinydrm/
drivers/gpu/drm/tinydrm/Kconfig new file +8 -0
@@ -0,0 +1,8 @@ +menuconfig DRM_TINYDRM + tristate "Support for simple displays" + depends on DRM + select DRM_KMS_HELPER + select DRM_KMS_CMA_HELPER + help + Choose this option if you have a tinydrm supported display. + If M is selected the module will be called tinydrm.
drivers/gpu/drm/tinydrm/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_DRM_TINYDRM) += core/
drivers/gpu/drm/tinydrm/core/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +tinydrm-y := tinydrm-core.o tinydrm-pipe.o + +obj-$(CONFIG_DRM_TINYDRM) += tinydrm.o
drivers/gpu/drm/tinydrm/core/tinydrm-core.c new file +377 -0
377 lines not on this page · raw message
drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c new file +234 -0
234 lines not on this page · raw message
include/drm/tinydrm/tinydrm.h new file +115 -0
115 lines not on this page · raw message
--
2.10.2
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 2/2 drm/tinydrm: Add helper functions
In reply to Noralf TrønnesAdd common functionality needed by many tinydrm drivers.
---
Changes since version 1:
- Remove some DRM_DEBUG*()
- Write-combined memory has uncached reads, so speed up by copying/buffering one pixel line before conversion.
Documentation/gpu/tinydrm.rst | 9 + drivers/gpu/drm/tinydrm/core/Makefile | 2 +- drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 462 +++++++++++++++++++++++++ include/drm/tinydrm/tinydrm-helpers.h | 100 ++++++ 4 files changed, 572 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c create mode 100644 include/drm/tinydrm/tinydrm-helpers.h
Documentation/gpu/tinydrm.rst +9 -0
@@ -19,3 +19,12 @@ Core functionality .. kernel-doc:: drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c :export: + +Additional helpers +================== + +.. kernel-doc:: include/drm/tinydrm/tinydrm-helpers.h + :internal: + +.. kernel-doc:: drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c + :export:
drivers/gpu/drm/tinydrm/core/Makefile +1 -1
@@ -1,3 +1,3 @@ -tinydrm-y := tinydrm-core.o tinydrm-pipe.o +tinydrm-y := tinydrm-core.o tinydrm-pipe.o tinydrm-helpers.o obj-$(CONFIG_DRM_TINYDRM) += tinydrm.o
drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c new file +462 -0
462 lines not on this page · raw message
include/drm/tinydrm/tinydrm-helpers.h new file +100 -0
100 lines not on this page · raw message
--
2.10.2
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Noralf,
Quoted 9 lines · Noralf Trønnes
This is an attempt at providing a DRM version of
drivers/staging/fbtft.The tinydrm library provides a very simplified view of DRM in particular for tiny displays that has onboard video memory and is connected through a slow bus like SPI/I2C.
Only core patches this time.
Quoted 6 lines
Noralf.
Changes since version 1:
- Addtinydrm.rst
- Set tdev->fbdev_cma=NULL on unregister (lastclose is called after that).
Hm, this sounds like a buglet in the drm framework ... how do we call lastclose when the driver is disappearing? I do see a drm_lastclose call at the beginning of drm_dev_unregister (which we might want to remove for KMS drivers, it doesn't make much sense imo), but that shouldn't result in troubles.
Quoted 3 lines
- Remove some DRM_DEBUG*()
- Write-combined memory has uncached reads, so speed up by copying/buffering one pixel line before conversion.
Hm, why are you using write-combining memory? Or is that needed so that you can (if available) use hw spi engines?
Either way, I think this all looks good, pls submit a pull request to Dave with these two patches as soon as latest drm-misc has landed (I'll send a pull request for that later today).
Another one: Do you want to maintain tinydrm as part of the drm-misc group, i.e. want commit rights there? That would also help a bit with pushing all your great drm refactoring patches through the machinery ...
Cheers, Daniel
Quoted 36 lines
Noralf Trønnes (2):
drm: Add DRM support for tiny LCD displays
drm/tinydrm: Add helper functionsDocumentation/gpu/index.rst | 1 + Documentation/gpu/tinydrm.rst | 30 ++ drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/tinydrm/Kconfig | 8 + drivers/gpu/drm/tinydrm/Makefile | 1 + drivers/gpu/drm/tinydrm/core/Makefile | 3 + drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 377 ++++++++++++++++++++ drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 462 +++++++++++++++++++++++++ drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c | 234 +++++++++++++ include/drm/tinydrm/tinydrm-helpers.h | 100 ++++++ include/drm/tinydrm/tinydrm.h | 115 ++++++ 12 files changed, 1334 insertions(+) create mode 100644 Documentation/gpu/tinydrm.rst create mode 100644 drivers/gpu/drm/tinydrm/Kconfig create mode 100644 drivers/gpu/drm/tinydrm/Makefile create mode 100644 drivers/gpu/drm/tinydrm/core/Makefile create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-core.c create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c create mode 100644 include/drm/tinydrm/tinydrm-helpers.h create mode 100644 include/drm/tinydrm/tinydrm.h--
2.10.2_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Den 30.01.2017 09.44, skrev Daniel Vetter:
Quoted 15 lines
Hi Noralf,
Quoted 12 lines · Noralf Trønnes
This is an attempt at providing a DRM version of
drivers/staging/fbtft.The tinydrm library provides a very simplified view of DRM in particular for tiny displays that has onboard video memory and is connected through a slow bus like SPI/I2C.
Only core patches this time.
Noralf.
Quoted 8 lines
Quoted 3 lines
Changes since version 1:
- Addtinydrm.rst
- Set tdev->fbdev_cma=NULL on unregister (lastclose is called after that).Hm, this sounds like a buglet in the drm framework ... how do we call lastclose when the driver is disappearing? I do see a
drm_lastclosecall at the beginning ofdrm_dev_unregister(which we might want to remove for KMS drivers, it doesn't make much sense imo), but that shouldn't result in troubles.
Ah, I see, I'm tearing down fbdev before unregistering drm. That should be reversed.
static void tinydrm_unregister(struct tinydrm_device *tdev)
{
drm_crtc_force_disable_all(tdev->drm);
if (tdev->fbdev_cma) {
drm_fbdev_cma_fini(tdev->fbdev_cma);
tdev->fbdev_cma = NULL;
}
drm_dev_unregister(tdev->drm);
}Quoted 5 lines
Quoted 3 lines
- Remove some DRM_DEBUG*()
- Write-combined memory has uncached reads, so speed up by copying/buffering one pixel line before conversion.Hm, why are you using write-combining memory? Or is that needed so that you can (if available) use hw spi engines?
That comes with using the CMA helper:drm_fbdev_cma_create_with_funcs() -> drm_gem_cma_create() -> dma_alloc_wc()
Here's a comment I have added in the code for why I set the DMA mask on the SPI device and why it will work:
/*
* Even though it's not the SPI device that does DMA (the master does),
* the dma mask is necessary for the dma_alloc_wc() in
* drm_gem_cma_create(). The dma_addr returned will be a physical
* adddress which might be different from the bus address, but this is
* not a problem since the address will not be used.
* The virtual address is used in the transfer and the SPI core
* re-maps it on the SPI master device using the DMA streaming API
* (spi_map_buf()).
*/
Quoted 3 lines
Either way, I think this all looks good, pls submit a pull request to Dave with these two patches as soon as latest drm-misc has landed (I'll send a pull request for that later today).
I'm confused, I thought you wanted the core patches through drm-misc and the rest as a pull request to Dave.
This is what you said:
Looks all pretty. A bunch of ideas below, but all optional. For
merging I
think simplest to first get the core patches in through drm-misc,
and then
you can submit a pull request to Dave for tinydrm+backends (just
needs an
ack for the dt parts from dt maintainers), including MAINTAINERS entry. Ack from my side.
Quoted 3 lines
Another one: Do you want to maintain tinydrm as part of the drm-misc group, i.e. want commit rights there? That would also help a bit with pushing all your great drm refactoring patches through the machinery ...
My goal is to port staging/fbtft to drm. Whether or not I will do work in drm core (refactoring) besides the tinydrm drivers when that is accomplished, I don't know. Working on drm as a hobbyist is very difficult (for me at least) because it is very complex, it changes all the time and on top of that it has a high volume mailinglist. It takes effort to keep up.
So I will probably end up doing only tinydrm maintanence. As for how that is best done, I don't know. Once I have covered a 3-4 controller types, a new driver is just a copy of a similar one with a different register initialization. This means that it's easy to review patches. They will all look the same, more or less.
So for me it's ofc best if I can review the patches and then commit them myself. As for my own patches, if I need that tit for tat reviewing to get them in, it will be difficult for me to review other drivers because I have no idea how a GPU operates, and to keep up with drm best pratices will be next to impossible for me.
If the Device Tree guys allows me to add fbtft support to tinydrm, then there won't be much activity once the fbtft drivers have been ported over. The uncertainty stems from the fact that the fbtft drivers are written as controller drivers, but they contain panel specific things like register setup and how to do rotation.
So compatible = "fb_ili9341", supports a controller with a specific panel, but it can support other panels through the 'init' DT property which encodes register values and delays (which is a no-no).
Noralf.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 73 lines · Noralf Trønnes
Den 30.01.2017 09.44, skrev Daniel Vetter:
Quoted 15 lines
Hi Noralf,
Quoted 12 lines · Noralf Trønnes
This is an attempt at providing a DRM version of
drivers/staging/fbtft.The tinydrm library provides a very simplified view of DRM in particular for tiny displays that has onboard video memory and is connected through a slow bus like SPI/I2C.
Only core patches this time.
Noralf.
Quoted 8 lines
Quoted 3 lines
Changes since version 1:
- Addtinydrm.rst
- Set tdev->fbdev_cma=NULL on unregister (lastclose is called after that).Hm, this sounds like a buglet in the drm framework ... how do we call lastclose when the driver is disappearing? I do see a
drm_lastclosecall at the beginning ofdrm_dev_unregister(which we might want to remove for KMS drivers, it doesn't make much sense imo), but that shouldn't result in troubles.Ah, I see, I'm tearing down fbdev before unregistering drm. That should be reversed.
static void
tinydrm_unregister(struct tinydrm_device *tdev){ drm_crtc_force_disable_all(tdev->drm); if (tdev->fbdev_cma) { drm_fbdev_cma_fini(tdev->fbdev_cma); tdev->fbdev_cma = NULL; } drm_dev_unregister(tdev->drm); }Quoted 5 lines
Quoted 3 lines
- Remove some DRM_DEBUG*()
- Write-combined memory has uncached reads, so speed up by copying/buffering one pixel line before conversion.Hm, why are you using write-combining memory? Or is that needed so that you can (if available) use hw spi engines?
That comes with using the CMA helper:
drm_fbdev_cma_create_with_funcs()->drm_gem_cma_create()->dma_alloc_wc()Here's a comment I have added in the code for why I set the DMA mask on the SPI device and why it will work:
/*
* Even though it's not the SPI device that does DMA (the master does),
* the dma mask is necessary for thedma_alloc_wc()in
*drm_gem_cma_create(). Thedma_addrreturned will be a physical
* adddress which might be different from the bus address, but this is
* not a problem since the address will not be used.
* The virtual address is used in the transfer and the SPI core
* re-maps it on the SPI master device using the DMA streaming API
* (spi_map_buf()).
*/Quoted 3 lines
Either way, I think this all looks good, pls submit a pull request to Dave with these two patches as soon as latest drm-misc has landed (I'll send a pull request for that later today).
I'm confused, I thought you wanted the core patches through drm-misc and the rest as a pull request to Dave.
This is what you said:
Quoted 8 lines
Looks all pretty. A bunch of ideas below, but all optional. For merging
I
think simplest to first get the core patches in through drm-misc, and
then
you can submit a pull request to Dave for tinydrm+backends (just needs
an
ack for the dt parts from dt maintainers), includingMAINTAINERSentry. Ack from my side.
Ah, I thought we already have all the prep patches you need merged into drm-misc. Still the same plan.
Quoted 11 lines
Quoted 3 lines
Another one: Do you want to maintain tinydrm as part of the drm-misc group, i.e. want commit rights there? That would also help a bit with pushing all your great drm refactoring patches through the machinery ...
My goal is to port staging/fbtft to drm. Whether or not I will do work in drm core (refactoring) besides the tinydrm drivers when that is accomplished, I don't know. Working on drm as a hobbyist is very difficult (for me at least) because it is very complex, it changes all the time and on top of that it has a high volume mailinglist. It takes effort to keep up.
Quoted 10 lines
So I will probably end up doing only tinydrm maintanence. As for how that is best done, I don't know. Once I have covered a 3-4 controller types, a new driver is just a copy of a similar one with a different register initialization. This means that it's easy to review patches. They will all look the same, more or less.
So for me it's ofc best if I can review the patches and then commit them myself. As for my own patches, if I need that tit for tat reviewing to get them in, it will be difficult for me to review other drivers because I have no idea how a GPU operates, and to keep up with drm best pratices will be next to impossible for me.
I think you're slightly understating your knowledge about the display side of drm here a bit :-) We're (for now) also only talking about getting small display drivers into drm-misc.
Quoted 8 lines
If the Device Tree guys allows me to add fbtft support to tinydrm, then there won't be much activity once the fbtft drivers have been ported over. The uncertainty stems from the fact that the fbtft drivers are written as controller drivers, but they contain panel specific things like register setup and how to do rotation.
So compatible = "fb_ili9341", supports a controller with a specific panel, but it can support other panels through the 'init' DT property which encodes register values and delays (which is a no-no).
I guess getting minimal cross-review going on with panel drivers would still be great. I'm also trying to get Thierry's drm_panel tree into drm-misc, but that hasn't really happened. There's also the nice thing with once you have a group, it's much easier to load-balance with someone else when you're not around ...
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Den 30.01.2017 19.06, skrev Daniel Vetter:
Quoted 20 lines · Noralf Trønnes
Quoted 19 lines
Den 30.01.2017 09.44, skrev Daniel Vetter:
Quoted 18 lines
Hi Noralf,
Quoted 15 lines · Noralf Trønnes
This is an attempt at providing a DRM version of
drivers/staging/fbtft.The tinydrm library provides a very simplified view of DRM in particular for tiny displays that has onboard video memory and is connected through a slow bus like SPI/I2C.
Only core patches this time.
Noralf.
Changes since version 1:
- Addtinydrm.rst
- Set tdev->fbdev_cma=NULL on unregister (lastclose is called after that).
<snip>
Quoted 16 lines
Quoted 8 lines
Quoted 3 lines
Either way, I think this all looks good, pls submit a pull request to Dave with these two patches as soon as latest drm-misc has landed (I'll send a pull request for that later today).
I'm confused, I thought you wanted the core patches through drm-misc and the rest as a pull request to Dave.
This is what you said:
Quoted 8 lines
Looks all pretty. A bunch of ideas below, but all optional. For merging
I
think simplest to first get the core patches in through drm-misc, and
then
you can submit a pull request to Dave for tinydrm+backends (just needs
an
ack for the dt parts from dt maintainers), includingMAINTAINERSentry. Ack from my side.
Quoted 2 lines
Ah, I thought we already have all the prep patches you need merged into drm-misc. Still the same plan.
Oh, sorry, I mixed up core drm with core tinydrm.
Yes, the core drm patches are in. I'll send a pull request for tinydrm when I get an ack from the DT maintainer.
It all makes sense now :-)
Noralf.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel