Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1586722 > unrolled thread
| Started by | Chen-Yu Tsai <wens@csie.org> |
|---|---|
| First post | 2017-02-23 09:20 +0100 |
| Last post | 2017-02-23 19:30 +0100 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 00/11] drm/sun4i: Various fixes and cleanups part 2 Chen-Yu Tsai <wens@csie.org> - 2017-02-23 09:20 +0100
[PATCH 11/11] drm/sun4i: Add backend and tcon pointers to sun4i_crtc Chen-Yu Tsai <wens@csie.org> - 2017-02-23 09:20 +0100
Re: [PATCH 11/11] drm/sun4i: Add backend and tcon pointers to sun4i_crtc Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-02-23 19:50 +0100
[PATCH 02/11] drm/sun4i: Set drm_crtc.port to the underlying TCON's output port node Chen-Yu Tsai <wens@csie.org> - 2017-02-23 09:20 +0100
Re: [PATCH 02/11] drm/sun4i: Set drm_crtc.port to the underlying TCON's output port node Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-02-23 19:30 +0100
| From | Chen-Yu Tsai <wens@csie.org> |
|---|---|
| Date | 2017-02-23 09:20 +0100 |
| Subject | [PATCH 00/11] drm/sun4i: Various fixes and cleanups part 2 |
| Message-ID | <tdWN3-731-3@gated-at.bofh.it> |
Hi Maxime,
This is the second bunch of fixes for the sun4i drm driver. This is part
of the cleanup I am doing towards making the driver support multiple
display pipelines.
This part mainly aims to get detection of crtcs working with of_graph,
and moving data structure pointers around for a more layered and
connected approach of associating the various components:
---------- ---------
|---------- |---------
SW: || | included || |
|| layers | ----------> || crtcs |
-| | in -| |
---------- ---------
| \_______________ |
| \ |
v maps to v v
------------ ---------
|------------ |---------
HW: || | feeds || |
|| backends | --------> || tcons |
-| | -| |
------------ ---------
This will make it easier to support multiple display pipelines, as
we only have to deal with indexes at bind time.
Patch 1 makes the table of RGB-to-YUV conversion coefficients constant.
Patch 2 sets the crtc's output port so drm_of_find_possible_crtcs can
work.
Patch 3 adds an empty end of list element to the list of layers returned
from sun4i_layers_init.
Patch 4 moves the list of layers from the main sun4i_drv structure into
the crtc.
Patch 5 initializes the crtc within the tcon's bind function. The crtc
has to be initialized before any encoders downstream of the tcon, so
drm_of_find_possible_crtcs() used within encoder bind functions work.
Previously crtcs were initialized after all hardware components were
bound.
Patch 6 drops the pointer to the primary layer/plane from sun4i_drv.
This pointer was only used for initializing the crtc later on.
Patch 7 drops the hardcoded .possible_crtcs values for the layers.
Instead we iterate through the list of layers and set the value
for overlay layers with the value derived from the crtc that was
just initialized.
Patch 8 makes the tv encoder driver use drm_of_find_possible_crtcs
instead of a hardcoded value.
Patch 9 adds a argument to pass the tcon pointer when initializing
the RGB encoder.
Patch 10 adds a pointer to the underlying backend to sun4i_layer.
Patch 11 adds pointers to the underlying backend and tcon to
sun4i_crtc.
Please have a look. Notably, I do not have hardware to test patch 8,
though I do not expect any problems.
Still to come is the actual work of supporting many display pipelines.
Regards
ChenYu
Chen-Yu Tsai (11):
drm/sun4i: Make sunxi_rgb2yuv_coef constant
drm/sun4i: Set drm_crtc.port to the underlying TCON's output port node
drm/sun4i: Add end of list element for sun4i_layers_init's returned
list
drm/sun4i: Move layers from sun4i_drv to sun4i_crtc
drm/sun4i: Initialize crtc from tcon bind function
drm/sun4i: Drop primary layer pointer from sun4i_drv
drm/sun4i: Drop hardcoded .possible_crtcs values from layers
drm/sun4i: tv: Switch to drm_of_find_possible_crtcs
drm/sun4i: rgb: Pass tcon pointer when initializing RGB encoder
drm/sun4i: Add backend pointer to sun4i_layer
drm/sun4i: Add backend and tcon pointers to sun4i_crtc
drivers/gpu/drm/sun4i/Makefile | 4 +--
drivers/gpu/drm/sun4i/sun4i_backend.c | 2 +-
drivers/gpu/drm/sun4i/sun4i_crtc.c | 57 +++++++++++++++++++++++++++++------
drivers/gpu/drm/sun4i/sun4i_crtc.h | 4 ++-
drivers/gpu/drm/sun4i/sun4i_drv.c | 17 -----------
drivers/gpu/drm/sun4i/sun4i_drv.h | 4 ---
drivers/gpu/drm/sun4i/sun4i_layer.c | 16 ++++------
drivers/gpu/drm/sun4i/sun4i_layer.h | 1 +
drivers/gpu/drm/sun4i/sun4i_rgb.c | 30 +++++++-----------
drivers/gpu/drm/sun4i/sun4i_rgb.h | 2 +-
drivers/gpu/drm/sun4i/sun4i_tcon.c | 12 ++++++--
drivers/gpu/drm/sun4i/sun4i_tcon.h | 3 ++
drivers/gpu/drm/sun4i/sun4i_tv.c | 8 ++++-
13 files changed, 91 insertions(+), 69 deletions(-)
--
2.11.0
[toc] | [next] | [standalone]
| From | Chen-Yu Tsai <wens@csie.org> |
|---|---|
| Date | 2017-02-23 09:20 +0100 |
| Subject | [PATCH 11/11] drm/sun4i: Add backend and tcon pointers to sun4i_crtc |
| Message-ID | <tdWN4-731-37@gated-at.bofh.it> |
| In reply to | #1586722 |
sun4i_crtc controls the backend and tcon hardware blocks of the display
pipeline. Instead of doing so through the master drm structure, leave
pointers to the corresponding backend and tcon in itself.
Also drop the drm_device pointer, since it is no longer needed.
The next step forward would be to pass the pointers in through
sun4i_crtc_init as parameters. This would make it easier to support
multiple display pipelines layer on.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
drivers/gpu/drm/sun4i/sun4i_crtc.c | 12 +++++-------
drivers/gpu/drm/sun4i/sun4i_crtc.h | 3 ++-
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c
index 4a30932643c3..018239870a0b 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c
@@ -52,12 +52,11 @@ static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc,
struct drm_crtc_state *old_state)
{
struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
- struct sun4i_drv *drv = scrtc->drv;
struct drm_pending_vblank_event *event = crtc->state->event;
DRM_DEBUG_DRIVER("Committing plane changes\n");
- sun4i_backend_commit(drv->backend);
+ sun4i_backend_commit(scrtc->backend);
if (event) {
crtc->state->event = NULL;
@@ -74,11 +73,10 @@ static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc,
static void sun4i_crtc_disable(struct drm_crtc *crtc)
{
struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
- struct sun4i_drv *drv = scrtc->drv;
DRM_DEBUG_DRIVER("Disabling the CRTC\n");
- sun4i_tcon_disable(drv->tcon);
+ sun4i_tcon_disable(scrtc->tcon);
if (crtc->state->event && !crtc->state->active) {
spin_lock_irq(&crtc->dev->event_lock);
@@ -92,11 +90,10 @@ static void sun4i_crtc_disable(struct drm_crtc *crtc)
static void sun4i_crtc_enable(struct drm_crtc *crtc)
{
struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc);
- struct sun4i_drv *drv = scrtc->drv;
DRM_DEBUG_DRIVER("Enabling the CRTC\n");
- sun4i_tcon_enable(drv->tcon);
+ sun4i_tcon_enable(scrtc->tcon);
}
static const struct drm_crtc_helper_funcs sun4i_crtc_helper_funcs = {
@@ -125,7 +122,8 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm)
scrtc = devm_kzalloc(drm->dev, sizeof(*scrtc), GFP_KERNEL);
if (!scrtc)
return ERR_PTR(-ENOMEM);
- scrtc->drv = drv;
+ scrtc->backend = drv->backend;
+ scrtc->tcon = drv->tcon;
/* Create our layers */
scrtc->layers = sun4i_layers_init(drm);
diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.h b/drivers/gpu/drm/sun4i/sun4i_crtc.h
index 0a888f73c983..cd0e633cce3a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_crtc.h
+++ b/drivers/gpu/drm/sun4i/sun4i_crtc.h
@@ -17,7 +17,8 @@ struct sun4i_crtc {
struct drm_crtc crtc;
struct drm_pending_vblank_event *event;
- struct sun4i_drv *drv;
+ struct sun4i_backend *backend;
+ struct sun4i_tcon *tcon;
struct sun4i_layer **layers;
};
--
2.11.0
[toc] | [prev] | [next] | [standalone]
| From | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| Date | 2017-02-23 19:50 +0100 |
| Subject | Re: [PATCH 11/11] drm/sun4i: Add backend and tcon pointers to sun4i_crtc |
| Message-ID | <te6CJ-54T-1@gated-at.bofh.it> |
| In reply to | #1586726 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, Feb 23, 2017 at 04:05:43PM +0800, Chen-Yu Tsai wrote: > sun4i_crtc controls the backend and tcon hardware blocks of the display > pipeline. Instead of doing so through the master drm structure, leave > pointers to the corresponding backend and tcon in itself. > > Also drop the drm_device pointer, since it is no longer needed. > > The next step forward would be to pass the pointers in through > sun4i_crtc_init as parameters. This would make it easier to support > multiple display pipelines layer on. > > Signed-off-by: Chen-Yu Tsai <wens@csie.org> Applied all the previous patches, and this one Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
[toc] | [prev] | [next] | [standalone]
| From | Chen-Yu Tsai <wens@csie.org> |
|---|---|
| Date | 2017-02-23 09:20 +0100 |
| Subject | [PATCH 02/11] drm/sun4i: Set drm_crtc.port to the underlying TCON's output port node |
| Message-ID | <tdWN5-731-43@gated-at.bofh.it> |
| In reply to | #1586722 |
The way drm_of_find_possible_crtcs is it tries to match the remote-endpoint of the given node's various endpoints to all the crtc's .port field. Thus we need to set drm_crtc.port to the output port node of the underlying TCON. Signed-off-by: Chen-Yu Tsai <wens@csie.org> --- drivers/gpu/drm/sun4i/sun4i_crtc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_crtc.c b/drivers/gpu/drm/sun4i/sun4i_crtc.c index 4e2e89c3104f..de6f7da69746 100644 --- a/drivers/gpu/drm/sun4i/sun4i_crtc.c +++ b/drivers/gpu/drm/sun4i/sun4i_crtc.c @@ -19,6 +19,7 @@ #include <linux/clk-provider.h> #include <linux/ioport.h> #include <linux/of_address.h> +#include <linux/of_graph.h> #include <linux/of_irq.h> #include <linux/regmap.h> @@ -136,5 +137,9 @@ struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm) drm_crtc_helper_add(&scrtc->crtc, &sun4i_crtc_helper_funcs); + /* Set crtc.port to output port node of the tcon */ + scrtc->crtc.port = of_graph_get_port_by_id(drv->tcon->dev->of_node, + 1); + return scrtc; } -- 2.11.0
[toc] | [prev] | [next] | [standalone]
| From | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| Date | 2017-02-23 19:30 +0100 |
| Subject | Re: [PATCH 02/11] drm/sun4i: Set drm_crtc.port to the underlying TCON's output port node |
| Message-ID | <te6jo-4Yu-9@gated-at.bofh.it> |
| In reply to | #1586727 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, Feb 23, 2017 at 04:05:34PM +0800, Chen-Yu Tsai wrote: > The way drm_of_find_possible_crtcs is it tries to match the Aren't you missing "works" here ^ > remote-endpoint of the given node's various endpoints to all the > crtc's .port field. Thus we need to set drm_crtc.port to the output > port node of the underlying TCON. > > Signed-off-by: Chen-Yu Tsai <wens@csie.org> Added it, and applied. Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web