Re: [PATCH v6 08/13] drm/sun4i: add support for Allwinner DE2 mixers
On Fri, May 05, 2017 at 08:39:31PM +0800, Icenowy Zheng wrote: > >> > > + /* Set base coordinates */ > >> > > + DRM_DEBUG_DRIVER("Layer coordinates X: %d Y: %d\n", > >> > > + state->crtc_x, state->crtc_y); > >> > > + regmap_write(mixer->engine.regs, > >> > > + SUN8I_MIXER_CHAN_UI_LAYER_COORD(chan, layer), > >> > > + SUN8I_MIXER_COORD(state->crtc_x, state->crtc_y)); > >> > > >> > X and Y are fixed point numbers. You want to keep only the higher > >16 > >> > bits there. > >> > >> Do you mean "lower 16 bits"? Thus should I (x & 0x) or ((u16)x) ? > > > >Nevermind, I got confused with src_x and src_y. > > > >> P.S. The negative coordinates are broken, how should I deal with it? > >or > >> is the coordinates promised to be not negative? > > > >Adjust the buffer base address, and use a shorter line. You have such > >an example in the sun4i code. > > Are they these two lines: > ``` > paddr += (state->src_x >> 16) * bpp; > paddr += (state->src_y >> 16) * fb->pitches[0]; > ``` > > I think I copied them here, so I don't need to mind this problem any > more, right? Hmmm, yes, probably. That's pretty easy to test anyway, you just need to set up a plane with a negative base coordinate. Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com signature.asc Description: PGP signature
Re: [PATCH v6 08/13] drm/sun4i: add support for Allwinner DE2 mixers
于 2017年5月5日 GMT+08:00 下午8:36:18, Maxime Ripard 写到: >On Fri, May 05, 2017 at 12:50:51AM +0800, icen...@aosc.io wrote: >> > > +void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer, >> > > +int layer, bool enable) >> > > +{ >> > > +u32 val; >> > > +/* Currently the first UI channel is used */ >> > > +int chan = mixer->cfg->vi_num; >> > > + >> > > +DRM_DEBUG_DRIVER("Enabling layer %d in channel %d\n", layer, >chan); >> > > + >> > > +if (enable) >> > > +val = SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN; >> > > +else >> > > +val = 0; >> > > + >> > > +regmap_update_bits(mixer->engine.regs, >> > > + SUN8I_MIXER_CHAN_UI_LAYER_ATTR(chan, layer), >> > > + SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN, val); >> > > + >> > > +/* Set the alpha configuration */ >> > > +regmap_update_bits(mixer->engine.regs, >> > > + SUN8I_MIXER_CHAN_UI_LAYER_ATTR(chan, layer), >> > > + >> > > SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_MASK, >> > > + >> > > SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_DEF); >> > > +regmap_update_bits(mixer->engine.regs, >> > > + SUN8I_MIXER_CHAN_UI_LAYER_ATTR(chan, layer), >> > > + SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MASK, >> > > + SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_DEF); >> > > +} >> > >> > This one too. >> >> It's called from sun8i_layer.c, so it cannot be static. > >Fair enough. > >> > > +/* Set base coordinates */ >> > > +DRM_DEBUG_DRIVER("Layer coordinates X: %d Y: %d\n", >> > > + state->crtc_x, state->crtc_y); >> > > +regmap_write(mixer->engine.regs, >> > > + SUN8I_MIXER_CHAN_UI_LAYER_COORD(chan, layer), >> > > + SUN8I_MIXER_COORD(state->crtc_x, state->crtc_y)); >> > >> > X and Y are fixed point numbers. You want to keep only the higher >16 >> > bits there. >> >> Do you mean "lower 16 bits"? Thus should I (x & 0x) or ((u16)x) ? > >Nevermind, I got confused with src_x and src_y. > >> P.S. The negative coordinates are broken, how should I deal with it? >or >> is the coordinates promised to be not negative? > >Adjust the buffer base address, and use a shorter line. You have such >an example in the sun4i code. Are they these two lines: ``` paddr += (state->src_x >> 16) * bpp; paddr += (state->src_y >> 16) * fb->pitches[0]; ``` I think I copied them here, so I don't need to mind this problem any more, right? > >Maxime
Re: [PATCH v6 08/13] drm/sun4i: add support for Allwinner DE2 mixers
On Fri, May 05, 2017 at 12:50:51AM +0800, icen...@aosc.io wrote: > > > +void sun8i_mixer_layer_enable(struct sun8i_mixer *mixer, > > > + int layer, bool enable) > > > +{ > > > + u32 val; > > > + /* Currently the first UI channel is used */ > > > + int chan = mixer->cfg->vi_num; > > > + > > > + DRM_DEBUG_DRIVER("Enabling layer %d in channel %d\n", layer, chan); > > > + > > > + if (enable) > > > + val = SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN; > > > + else > > > + val = 0; > > > + > > > + regmap_update_bits(mixer->engine.regs, > > > +SUN8I_MIXER_CHAN_UI_LAYER_ATTR(chan, layer), > > > +SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN, val); > > > + > > > + /* Set the alpha configuration */ > > > + regmap_update_bits(mixer->engine.regs, > > > +SUN8I_MIXER_CHAN_UI_LAYER_ATTR(chan, layer), > > > +SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_MASK, > > > +SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_DEF); > > > + regmap_update_bits(mixer->engine.regs, > > > +SUN8I_MIXER_CHAN_UI_LAYER_ATTR(chan, layer), > > > +SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MASK, > > > +SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_DEF); > > > +} > > > > This one too. > > It's called from sun8i_layer.c, so it cannot be static. Fair enough. > > > + /* Set base coordinates */ > > > + DRM_DEBUG_DRIVER("Layer coordinates X: %d Y: %d\n", > > > + state->crtc_x, state->crtc_y); > > > + regmap_write(mixer->engine.regs, > > > + SUN8I_MIXER_CHAN_UI_LAYER_COORD(chan, layer), > > > + SUN8I_MIXER_COORD(state->crtc_x, state->crtc_y)); > > > > X and Y are fixed point numbers. You want to keep only the higher 16 > > bits there. > > Do you mean "lower 16 bits"? Thus should I (x & 0x) or ((u16)x) ? Nevermind, I got confused with src_x and src_y. > P.S. The negative coordinates are broken, how should I deal with it? or > is the coordinates promised to be not negative? Adjust the buffer base address, and use a shorter line. You have such an example in the sun4i code. Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com signature.asc Description: PGP signature
Re: [linux-sunxi] Re: [PATCH v6 08/13] drm/sun4i: add support for Allwinner DE2 mixers
On Fri, May 5, 2017 at 12:52 AM, wrote: > 在 2017-05-04 21:05,Maxime Ripard 写道: >> >> On Thu, May 04, 2017 at 07:48:53PM +0800, Icenowy Zheng wrote: >>> >>> Allwinner have a new "Display Engine 2.0" in their new SoCs, which comes >>> with mixers to do graphic processing and feed data to TCON, like the old >>> backends and frontends. >>> >>> Add support for the mixer on Allwinner V3s SoC; it's the simplest one. >>> >>> Currently a lot of functions are still missing -- more investigations >>> are needed to gain enough information for them. >>> >>> Signed-off-by: Icenowy Zheng >>> --- >>> Changes in v6: >>> - Rebased on wens's multi-pipeline patchset. >>> Changes in v5: >>> - Changed some code alignment. >>> - Request real 32-bit DMA (prepare for 64-bit SoCs). >>> Changes in v4: >>> - Killed some dead code according to Jernej. >>> >>> drivers/gpu/drm/sun4i/Kconfig | 10 + >>> drivers/gpu/drm/sun4i/Makefile | 3 + >>> drivers/gpu/drm/sun4i/sun8i_layer.c | 140 + >>> drivers/gpu/drm/sun4i/sun8i_layer.h | 36 >>> drivers/gpu/drm/sun4i/sun8i_mixer.c | 394 >>> >>> drivers/gpu/drm/sun4i/sun8i_mixer.h | 137 + >>> 6 files changed, 720 insertions(+) >>> create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.c >>> create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.h >>> create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.c >>> create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.h >>> [...] >>> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c >>> b/drivers/gpu/drm/sun4i/sun8i_mixer.c >>> new file mode 100644 >>> index ..e216b84d5bb2 >>> --- /dev/null >>> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c >>> @@ -0,0 +1,394 @@ [...] >>> + list_add_tail(&mixer->engine.list, &drv->engine_list); >> >> >> You didn't call INIT_LIST_HEAD on that list. > > > So didn't the sun4i_backend driver... > > I think the mixer->engine.list only means an item in the > engine_list, and the drv->engine_list is initialized in the > sun4i_drv source code. I read [1] that if the item is subsequently added to a list, you could omit the INIT_LIST_HEAD call. Makes sense, though you have to be sure you aren't doing anything else with the list element. ChenYu [1] https://isis.poly.edu/kulesh/stuff/src/klist/
Re: [PATCH v6 08/13] drm/sun4i: add support for Allwinner DE2 mixers
在 2017-05-05 00:57,icen...@aosc.io 写道: 在 2017-05-05 00:50,icen...@aosc.io 写道: 在 2017-05-04 21:05,Maxime Ripard 写道: On Thu, May 04, 2017 at 07:48:53PM +0800, Icenowy Zheng wrote: Allwinner have a new "Display Engine 2.0" in their new SoCs, which comes with mixers to do graphic processing and feed data to TCON, like the old backends and frontends. Add support for the mixer on Allwinner V3s SoC; it's the simplest one. Currently a lot of functions are still missing -- more investigations are needed to gain enough information for them. Signed-off-by: Icenowy Zheng --- Changes in v6: - Rebased on wens's multi-pipeline patchset. Changes in v5: - Changed some code alignment. - Request real 32-bit DMA (prepare for 64-bit SoCs). Changes in v4: - Killed some dead code according to Jernej. drivers/gpu/drm/sun4i/Kconfig | 10 + drivers/gpu/drm/sun4i/Makefile | 3 + drivers/gpu/drm/sun4i/sun8i_layer.c | 140 + drivers/gpu/drm/sun4i/sun8i_layer.h | 36 drivers/gpu/drm/sun4i/sun8i_mixer.c | 394 drivers/gpu/drm/sun4i/sun8i_mixer.h | 137 + 6 files changed, 720 insertions(+) create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.c create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.h create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.c create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.h diff --git a/drivers/gpu/drm/sun4i/Kconfig b/drivers/gpu/drm/sun4i/Kconfig index 5a8227f37cc4..15557484520d 100644 --- a/drivers/gpu/drm/sun4i/Kconfig +++ b/drivers/gpu/drm/sun4i/Kconfig @@ -22,3 +22,13 @@ config DRM_SUN4I_BACKEND original Allwinner Display Engine, which has a backend to do some alpha blending and feed graphics to TCON. If M is selected the module will be called sun4i-backend. + +config DRM_SUN4I_SUN8I_MIXER DRM_SUN8I_MIXER? + tristate "Support for Allwinner Display Engine 2.0 Mixer" + depends on DRM_SUN4I + default MACH_SUN8I + help + Choose this option if you have an Allwinner SoC with the + Allwinner Display Engine 2.0, which has a mixer to do some + graphics mixture and feed graphics to TCON, If M is + selected the module will be called sun8i-mixer. diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile index a08df56759e3..a876c6b3027c 100644 --- a/drivers/gpu/drm/sun4i/Makefile +++ b/drivers/gpu/drm/sun4i/Makefile @@ -8,7 +8,10 @@ sun4i-tcon-y += sun4i_crtc.o sun4i-backend-y += sun4i_backend.o sun4i_layer.o +sun8i-mixer-y += sun8i_mixer.o sun8i_layer.o + obj-$(CONFIG_DRM_SUN4I)+= sun4i-drm.o sun4i-tcon.o obj-$(CONFIG_DRM_SUN4I_BACKEND)+= sun4i-backend.o +obj-$(CONFIG_DRM_SUN4I_SUN8I_MIXER)+= sun8i-mixer.o obj-$(CONFIG_DRM_SUN4I)+= sun6i_drc.o obj-$(CONFIG_DRM_SUN4I)+= sun4i_tv.o diff --git a/drivers/gpu/drm/sun4i/sun8i_layer.c b/drivers/gpu/drm/sun4i/sun8i_layer.c new file mode 100644 index ..48f33d8e013b --- /dev/null +++ b/drivers/gpu/drm/sun4i/sun8i_layer.c @@ -0,0 +1,140 @@ +/* + * Copyright (C) Icenowy Zheng + * + * Based on sun4i_layer.h, which is: + * Copyright (C) 2015 Free Electrons + * Copyright (C) 2015 NextThing Co + * + * Maxime Ripard + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + */ + +#include +#include +#include + +#include "sun8i_layer.h" +#include "sun8i_mixer.h" + +struct sun8i_plane_desc { + enum drm_plane_type type; + const uint32_t *formats; + uint32_tnformats; +}; + +static int sun8i_mixer_layer_atomic_check(struct drm_plane *plane, + struct drm_plane_state *state) +{ + return 0; +} This isn't needed. +static void sun8i_mixer_layer_atomic_disable(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct sun8i_layer *layer = plane_to_sun8i_layer(plane); + struct sun8i_mixer *mixer = layer->mixer; + + sun8i_mixer_layer_enable(mixer, layer->id, false); +} + +static void sun8i_mixer_layer_atomic_update(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct sun8i_layer *layer = plane_to_sun8i_layer(plane); + struct sun8i_mixer *mixer = layer->mixer; + + sun8i_mixer_update_layer_coord(mixer, layer->id, plane); + sun8i_mixer_update_layer_formats(mixer, layer->id, plane); + sun8i_mixer_update_layer_buffer(mixer, layer->id, plane); + sun8i_mixer_layer_enable(mixer, layer->id, true); +} + +static struct drm_plane_helper_funcs sun8i_mixer_layer_helper_funcs = { + .atomic_c
Re: [PATCH v6 08/13] drm/sun4i: add support for Allwinner DE2 mixers
在 2017-05-05 00:50,icen...@aosc.io 写道: 在 2017-05-04 21:05,Maxime Ripard 写道: On Thu, May 04, 2017 at 07:48:53PM +0800, Icenowy Zheng wrote: Allwinner have a new "Display Engine 2.0" in their new SoCs, which comes with mixers to do graphic processing and feed data to TCON, like the old backends and frontends. Add support for the mixer on Allwinner V3s SoC; it's the simplest one. Currently a lot of functions are still missing -- more investigations are needed to gain enough information for them. Signed-off-by: Icenowy Zheng --- Changes in v6: - Rebased on wens's multi-pipeline patchset. Changes in v5: - Changed some code alignment. - Request real 32-bit DMA (prepare for 64-bit SoCs). Changes in v4: - Killed some dead code according to Jernej. drivers/gpu/drm/sun4i/Kconfig | 10 + drivers/gpu/drm/sun4i/Makefile | 3 + drivers/gpu/drm/sun4i/sun8i_layer.c | 140 + drivers/gpu/drm/sun4i/sun8i_layer.h | 36 drivers/gpu/drm/sun4i/sun8i_mixer.c | 394 drivers/gpu/drm/sun4i/sun8i_mixer.h | 137 + 6 files changed, 720 insertions(+) create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.c create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.h create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.c create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.h diff --git a/drivers/gpu/drm/sun4i/Kconfig b/drivers/gpu/drm/sun4i/Kconfig index 5a8227f37cc4..15557484520d 100644 --- a/drivers/gpu/drm/sun4i/Kconfig +++ b/drivers/gpu/drm/sun4i/Kconfig @@ -22,3 +22,13 @@ config DRM_SUN4I_BACKEND original Allwinner Display Engine, which has a backend to do some alpha blending and feed graphics to TCON. If M is selected the module will be called sun4i-backend. + +config DRM_SUN4I_SUN8I_MIXER DRM_SUN8I_MIXER? + tristate "Support for Allwinner Display Engine 2.0 Mixer" + depends on DRM_SUN4I + default MACH_SUN8I + help + Choose this option if you have an Allwinner SoC with the + Allwinner Display Engine 2.0, which has a mixer to do some + graphics mixture and feed graphics to TCON, If M is + selected the module will be called sun8i-mixer. diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile index a08df56759e3..a876c6b3027c 100644 --- a/drivers/gpu/drm/sun4i/Makefile +++ b/drivers/gpu/drm/sun4i/Makefile @@ -8,7 +8,10 @@ sun4i-tcon-y += sun4i_crtc.o sun4i-backend-y += sun4i_backend.o sun4i_layer.o +sun8i-mixer-y += sun8i_mixer.o sun8i_layer.o + obj-$(CONFIG_DRM_SUN4I)+= sun4i-drm.o sun4i-tcon.o obj-$(CONFIG_DRM_SUN4I_BACKEND)+= sun4i-backend.o +obj-$(CONFIG_DRM_SUN4I_SUN8I_MIXER)+= sun8i-mixer.o obj-$(CONFIG_DRM_SUN4I)+= sun6i_drc.o obj-$(CONFIG_DRM_SUN4I)+= sun4i_tv.o diff --git a/drivers/gpu/drm/sun4i/sun8i_layer.c b/drivers/gpu/drm/sun4i/sun8i_layer.c new file mode 100644 index ..48f33d8e013b --- /dev/null +++ b/drivers/gpu/drm/sun4i/sun8i_layer.c @@ -0,0 +1,140 @@ +/* + * Copyright (C) Icenowy Zheng + * + * Based on sun4i_layer.h, which is: + * Copyright (C) 2015 Free Electrons + * Copyright (C) 2015 NextThing Co + * + * Maxime Ripard + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + */ + +#include +#include +#include + +#include "sun8i_layer.h" +#include "sun8i_mixer.h" + +struct sun8i_plane_desc { + enum drm_plane_type type; + const uint32_t *formats; + uint32_tnformats; +}; + +static int sun8i_mixer_layer_atomic_check(struct drm_plane *plane, + struct drm_plane_state *state) +{ + return 0; +} This isn't needed. +static void sun8i_mixer_layer_atomic_disable(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct sun8i_layer *layer = plane_to_sun8i_layer(plane); + struct sun8i_mixer *mixer = layer->mixer; + + sun8i_mixer_layer_enable(mixer, layer->id, false); +} + +static void sun8i_mixer_layer_atomic_update(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct sun8i_layer *layer = plane_to_sun8i_layer(plane); + struct sun8i_mixer *mixer = layer->mixer; + + sun8i_mixer_update_layer_coord(mixer, layer->id, plane); + sun8i_mixer_update_layer_formats(mixer, layer->id, plane); + sun8i_mixer_update_layer_buffer(mixer, layer->id, plane); + sun8i_mixer_layer_enable(mixer, layer->id, true); +} + +static struct drm_plane_helper_funcs sun8i_mixer_layer_helper_funcs = { + .atomic_check = sun8i_mixer_layer_atomic_check, +
Re: [PATCH v6 08/13] drm/sun4i: add support for Allwinner DE2 mixers
在 2017-05-04 21:05,Maxime Ripard 写道: On Thu, May 04, 2017 at 07:48:53PM +0800, Icenowy Zheng wrote: Allwinner have a new "Display Engine 2.0" in their new SoCs, which comes with mixers to do graphic processing and feed data to TCON, like the old backends and frontends. Add support for the mixer on Allwinner V3s SoC; it's the simplest one. Currently a lot of functions are still missing -- more investigations are needed to gain enough information for them. Signed-off-by: Icenowy Zheng --- Changes in v6: - Rebased on wens's multi-pipeline patchset. Changes in v5: - Changed some code alignment. - Request real 32-bit DMA (prepare for 64-bit SoCs). Changes in v4: - Killed some dead code according to Jernej. drivers/gpu/drm/sun4i/Kconfig | 10 + drivers/gpu/drm/sun4i/Makefile | 3 + drivers/gpu/drm/sun4i/sun8i_layer.c | 140 + drivers/gpu/drm/sun4i/sun8i_layer.h | 36 drivers/gpu/drm/sun4i/sun8i_mixer.c | 394 drivers/gpu/drm/sun4i/sun8i_mixer.h | 137 + 6 files changed, 720 insertions(+) create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.c create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.h create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.c create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.h diff --git a/drivers/gpu/drm/sun4i/Kconfig b/drivers/gpu/drm/sun4i/Kconfig index 5a8227f37cc4..15557484520d 100644 --- a/drivers/gpu/drm/sun4i/Kconfig +++ b/drivers/gpu/drm/sun4i/Kconfig @@ -22,3 +22,13 @@ config DRM_SUN4I_BACKEND original Allwinner Display Engine, which has a backend to do some alpha blending and feed graphics to TCON. If M is selected the module will be called sun4i-backend. + +config DRM_SUN4I_SUN8I_MIXER DRM_SUN8I_MIXER? + tristate "Support for Allwinner Display Engine 2.0 Mixer" + depends on DRM_SUN4I + default MACH_SUN8I + help + Choose this option if you have an Allwinner SoC with the + Allwinner Display Engine 2.0, which has a mixer to do some + graphics mixture and feed graphics to TCON, If M is + selected the module will be called sun8i-mixer. diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile index a08df56759e3..a876c6b3027c 100644 --- a/drivers/gpu/drm/sun4i/Makefile +++ b/drivers/gpu/drm/sun4i/Makefile @@ -8,7 +8,10 @@ sun4i-tcon-y += sun4i_crtc.o sun4i-backend-y += sun4i_backend.o sun4i_layer.o +sun8i-mixer-y += sun8i_mixer.o sun8i_layer.o + obj-$(CONFIG_DRM_SUN4I)+= sun4i-drm.o sun4i-tcon.o obj-$(CONFIG_DRM_SUN4I_BACKEND)+= sun4i-backend.o +obj-$(CONFIG_DRM_SUN4I_SUN8I_MIXER)+= sun8i-mixer.o obj-$(CONFIG_DRM_SUN4I)+= sun6i_drc.o obj-$(CONFIG_DRM_SUN4I)+= sun4i_tv.o diff --git a/drivers/gpu/drm/sun4i/sun8i_layer.c b/drivers/gpu/drm/sun4i/sun8i_layer.c new file mode 100644 index ..48f33d8e013b --- /dev/null +++ b/drivers/gpu/drm/sun4i/sun8i_layer.c @@ -0,0 +1,140 @@ +/* + * Copyright (C) Icenowy Zheng + * + * Based on sun4i_layer.h, which is: + * Copyright (C) 2015 Free Electrons + * Copyright (C) 2015 NextThing Co + * + * Maxime Ripard + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + */ + +#include +#include +#include + +#include "sun8i_layer.h" +#include "sun8i_mixer.h" + +struct sun8i_plane_desc { + enum drm_plane_type type; + const uint32_t *formats; + uint32_tnformats; +}; + +static int sun8i_mixer_layer_atomic_check(struct drm_plane *plane, + struct drm_plane_state *state) +{ + return 0; +} This isn't needed. +static void sun8i_mixer_layer_atomic_disable(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct sun8i_layer *layer = plane_to_sun8i_layer(plane); + struct sun8i_mixer *mixer = layer->mixer; + + sun8i_mixer_layer_enable(mixer, layer->id, false); +} + +static void sun8i_mixer_layer_atomic_update(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct sun8i_layer *layer = plane_to_sun8i_layer(plane); + struct sun8i_mixer *mixer = layer->mixer; + + sun8i_mixer_update_layer_coord(mixer, layer->id, plane); + sun8i_mixer_update_layer_formats(mixer, layer->id, plane); + sun8i_mixer_update_layer_buffer(mixer, layer->id, plane); + sun8i_mixer_layer_enable(mixer, layer->id, true); +} + +static struct drm_plane_helper_funcs sun8i_mixer_layer_helper_funcs = { + .atomic_check = sun8i_mixer_layer_atomic_check, + .atomic_disable = sun8i_mixer_layer_at
Re: [PATCH v6 08/13] drm/sun4i: add support for Allwinner DE2 mixers
在 2017-05-04 21:05,Maxime Ripard 写道: On Thu, May 04, 2017 at 07:48:53PM +0800, Icenowy Zheng wrote: Allwinner have a new "Display Engine 2.0" in their new SoCs, which comes with mixers to do graphic processing and feed data to TCON, like the old backends and frontends. Add support for the mixer on Allwinner V3s SoC; it's the simplest one. Currently a lot of functions are still missing -- more investigations are needed to gain enough information for them. Signed-off-by: Icenowy Zheng --- Changes in v6: - Rebased on wens's multi-pipeline patchset. Changes in v5: - Changed some code alignment. - Request real 32-bit DMA (prepare for 64-bit SoCs). Changes in v4: - Killed some dead code according to Jernej. drivers/gpu/drm/sun4i/Kconfig | 10 + drivers/gpu/drm/sun4i/Makefile | 3 + drivers/gpu/drm/sun4i/sun8i_layer.c | 140 + drivers/gpu/drm/sun4i/sun8i_layer.h | 36 drivers/gpu/drm/sun4i/sun8i_mixer.c | 394 drivers/gpu/drm/sun4i/sun8i_mixer.h | 137 + 6 files changed, 720 insertions(+) create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.c create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.h create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.c create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.h diff --git a/drivers/gpu/drm/sun4i/Kconfig b/drivers/gpu/drm/sun4i/Kconfig index 5a8227f37cc4..15557484520d 100644 --- a/drivers/gpu/drm/sun4i/Kconfig +++ b/drivers/gpu/drm/sun4i/Kconfig @@ -22,3 +22,13 @@ config DRM_SUN4I_BACKEND original Allwinner Display Engine, which has a backend to do some alpha blending and feed graphics to TCON. If M is selected the module will be called sun4i-backend. + +config DRM_SUN4I_SUN8I_MIXER DRM_SUN8I_MIXER? + tristate "Support for Allwinner Display Engine 2.0 Mixer" + depends on DRM_SUN4I + default MACH_SUN8I + help + Choose this option if you have an Allwinner SoC with the + Allwinner Display Engine 2.0, which has a mixer to do some + graphics mixture and feed graphics to TCON, If M is + selected the module will be called sun8i-mixer. diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile index a08df56759e3..a876c6b3027c 100644 --- a/drivers/gpu/drm/sun4i/Makefile +++ b/drivers/gpu/drm/sun4i/Makefile @@ -8,7 +8,10 @@ sun4i-tcon-y += sun4i_crtc.o sun4i-backend-y += sun4i_backend.o sun4i_layer.o +sun8i-mixer-y += sun8i_mixer.o sun8i_layer.o + obj-$(CONFIG_DRM_SUN4I)+= sun4i-drm.o sun4i-tcon.o obj-$(CONFIG_DRM_SUN4I_BACKEND)+= sun4i-backend.o +obj-$(CONFIG_DRM_SUN4I_SUN8I_MIXER)+= sun8i-mixer.o obj-$(CONFIG_DRM_SUN4I)+= sun6i_drc.o obj-$(CONFIG_DRM_SUN4I)+= sun4i_tv.o diff --git a/drivers/gpu/drm/sun4i/sun8i_layer.c b/drivers/gpu/drm/sun4i/sun8i_layer.c new file mode 100644 index ..48f33d8e013b --- /dev/null +++ b/drivers/gpu/drm/sun4i/sun8i_layer.c @@ -0,0 +1,140 @@ +/* + * Copyright (C) Icenowy Zheng + * + * Based on sun4i_layer.h, which is: + * Copyright (C) 2015 Free Electrons + * Copyright (C) 2015 NextThing Co + * + * Maxime Ripard + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + */ + +#include +#include +#include + +#include "sun8i_layer.h" +#include "sun8i_mixer.h" + +struct sun8i_plane_desc { + enum drm_plane_type type; + const uint32_t *formats; + uint32_tnformats; +}; + +static int sun8i_mixer_layer_atomic_check(struct drm_plane *plane, + struct drm_plane_state *state) +{ + return 0; +} This isn't needed. +static void sun8i_mixer_layer_atomic_disable(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct sun8i_layer *layer = plane_to_sun8i_layer(plane); + struct sun8i_mixer *mixer = layer->mixer; + + sun8i_mixer_layer_enable(mixer, layer->id, false); +} + +static void sun8i_mixer_layer_atomic_update(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct sun8i_layer *layer = plane_to_sun8i_layer(plane); + struct sun8i_mixer *mixer = layer->mixer; + + sun8i_mixer_update_layer_coord(mixer, layer->id, plane); + sun8i_mixer_update_layer_formats(mixer, layer->id, plane); + sun8i_mixer_update_layer_buffer(mixer, layer->id, plane); + sun8i_mixer_layer_enable(mixer, layer->id, true); +} + +static struct drm_plane_helper_funcs sun8i_mixer_layer_helper_funcs = { + .atomic_check = sun8i_mixer_layer_atomic_check, + .atomic_disable = sun8i_mixer_layer_at
Re: [PATCH v6 08/13] drm/sun4i: add support for Allwinner DE2 mixers
On Thu, May 04, 2017 at 07:48:53PM +0800, Icenowy Zheng wrote: > Allwinner have a new "Display Engine 2.0" in their new SoCs, which comes > with mixers to do graphic processing and feed data to TCON, like the old > backends and frontends. > > Add support for the mixer on Allwinner V3s SoC; it's the simplest one. > > Currently a lot of functions are still missing -- more investigations > are needed to gain enough information for them. > > Signed-off-by: Icenowy Zheng > --- > Changes in v6: > - Rebased on wens's multi-pipeline patchset. > Changes in v5: > - Changed some code alignment. > - Request real 32-bit DMA (prepare for 64-bit SoCs). > Changes in v4: > - Killed some dead code according to Jernej. > > drivers/gpu/drm/sun4i/Kconfig | 10 + > drivers/gpu/drm/sun4i/Makefile | 3 + > drivers/gpu/drm/sun4i/sun8i_layer.c | 140 + > drivers/gpu/drm/sun4i/sun8i_layer.h | 36 > drivers/gpu/drm/sun4i/sun8i_mixer.c | 394 > > drivers/gpu/drm/sun4i/sun8i_mixer.h | 137 + > 6 files changed, 720 insertions(+) > create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.c > create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.h > create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.c > create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.h > > diff --git a/drivers/gpu/drm/sun4i/Kconfig b/drivers/gpu/drm/sun4i/Kconfig > index 5a8227f37cc4..15557484520d 100644 > --- a/drivers/gpu/drm/sun4i/Kconfig > +++ b/drivers/gpu/drm/sun4i/Kconfig > @@ -22,3 +22,13 @@ config DRM_SUN4I_BACKEND > original Allwinner Display Engine, which has a backend to > do some alpha blending and feed graphics to TCON. If M is > selected the module will be called sun4i-backend. > + > +config DRM_SUN4I_SUN8I_MIXER DRM_SUN8I_MIXER? > + tristate "Support for Allwinner Display Engine 2.0 Mixer" > + depends on DRM_SUN4I > + default MACH_SUN8I > + help > + Choose this option if you have an Allwinner SoC with the > + Allwinner Display Engine 2.0, which has a mixer to do some > + graphics mixture and feed graphics to TCON, If M is > + selected the module will be called sun8i-mixer. > diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile > index a08df56759e3..a876c6b3027c 100644 > --- a/drivers/gpu/drm/sun4i/Makefile > +++ b/drivers/gpu/drm/sun4i/Makefile > @@ -8,7 +8,10 @@ sun4i-tcon-y += sun4i_crtc.o > > sun4i-backend-y += sun4i_backend.o sun4i_layer.o > > +sun8i-mixer-y += sun8i_mixer.o sun8i_layer.o > + > obj-$(CONFIG_DRM_SUN4I) += sun4i-drm.o sun4i-tcon.o > obj-$(CONFIG_DRM_SUN4I_BACKEND) += sun4i-backend.o > +obj-$(CONFIG_DRM_SUN4I_SUN8I_MIXER) += sun8i-mixer.o > obj-$(CONFIG_DRM_SUN4I) += sun6i_drc.o > obj-$(CONFIG_DRM_SUN4I) += sun4i_tv.o > diff --git a/drivers/gpu/drm/sun4i/sun8i_layer.c > b/drivers/gpu/drm/sun4i/sun8i_layer.c > new file mode 100644 > index ..48f33d8e013b > --- /dev/null > +++ b/drivers/gpu/drm/sun4i/sun8i_layer.c > @@ -0,0 +1,140 @@ > +/* > + * Copyright (C) Icenowy Zheng > + * > + * Based on sun4i_layer.h, which is: > + * Copyright (C) 2015 Free Electrons > + * Copyright (C) 2015 NextThing Co > + * > + * Maxime Ripard > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License as > + * published by the Free Software Foundation; either version 2 of > + * the License, or (at your option) any later version. > + */ > + > +#include > +#include > +#include > + > +#include "sun8i_layer.h" > +#include "sun8i_mixer.h" > + > +struct sun8i_plane_desc { > +enum drm_plane_type type; > +const uint32_t *formats; > +uint32_tnformats; > +}; > + > +static int sun8i_mixer_layer_atomic_check(struct drm_plane *plane, > + struct drm_plane_state *state) > +{ > + return 0; > +} This isn't needed. > +static void sun8i_mixer_layer_atomic_disable(struct drm_plane *plane, > +struct drm_plane_state > *old_state) > +{ > + struct sun8i_layer *layer = plane_to_sun8i_layer(plane); > + struct sun8i_mixer *mixer = layer->mixer; > + > + sun8i_mixer_layer_enable(mixer, layer->id, false); > +} > + > +static void sun8i_mixer_layer_atomic_update(struct drm_plane *plane, > + struct drm_plane_state *old_state) > +{ > + struct sun8i_layer *layer = plane_to_sun8i_layer(plane); > + struct sun8i_mixer *mixer = layer->mixer; > + > + sun8i_mixer_update_layer_coord(mixer, layer->id, plane); > + sun8i_mixer_update_layer_formats(mixer, layer->id, plane); > + sun8i_mixer_update_layer_buffer(mixer, layer->id, plane); > + sun8i_mixer_layer_enable(mixer, layer->id, true); > +} > + > +static struct drm_plane_helper_funcs
[PATCH v6 08/13] drm/sun4i: add support for Allwinner DE2 mixers
Allwinner have a new "Display Engine 2.0" in their new SoCs, which comes with mixers to do graphic processing and feed data to TCON, like the old backends and frontends. Add support for the mixer on Allwinner V3s SoC; it's the simplest one. Currently a lot of functions are still missing -- more investigations are needed to gain enough information for them. Signed-off-by: Icenowy Zheng --- Changes in v6: - Rebased on wens's multi-pipeline patchset. Changes in v5: - Changed some code alignment. - Request real 32-bit DMA (prepare for 64-bit SoCs). Changes in v4: - Killed some dead code according to Jernej. drivers/gpu/drm/sun4i/Kconfig | 10 + drivers/gpu/drm/sun4i/Makefile | 3 + drivers/gpu/drm/sun4i/sun8i_layer.c | 140 + drivers/gpu/drm/sun4i/sun8i_layer.h | 36 drivers/gpu/drm/sun4i/sun8i_mixer.c | 394 drivers/gpu/drm/sun4i/sun8i_mixer.h | 137 + 6 files changed, 720 insertions(+) create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.c create mode 100644 drivers/gpu/drm/sun4i/sun8i_layer.h create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.c create mode 100644 drivers/gpu/drm/sun4i/sun8i_mixer.h diff --git a/drivers/gpu/drm/sun4i/Kconfig b/drivers/gpu/drm/sun4i/Kconfig index 5a8227f37cc4..15557484520d 100644 --- a/drivers/gpu/drm/sun4i/Kconfig +++ b/drivers/gpu/drm/sun4i/Kconfig @@ -22,3 +22,13 @@ config DRM_SUN4I_BACKEND original Allwinner Display Engine, which has a backend to do some alpha blending and feed graphics to TCON. If M is selected the module will be called sun4i-backend. + +config DRM_SUN4I_SUN8I_MIXER + tristate "Support for Allwinner Display Engine 2.0 Mixer" + depends on DRM_SUN4I + default MACH_SUN8I + help + Choose this option if you have an Allwinner SoC with the + Allwinner Display Engine 2.0, which has a mixer to do some + graphics mixture and feed graphics to TCON, If M is + selected the module will be called sun8i-mixer. diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile index a08df56759e3..a876c6b3027c 100644 --- a/drivers/gpu/drm/sun4i/Makefile +++ b/drivers/gpu/drm/sun4i/Makefile @@ -8,7 +8,10 @@ sun4i-tcon-y += sun4i_crtc.o sun4i-backend-y += sun4i_backend.o sun4i_layer.o +sun8i-mixer-y += sun8i_mixer.o sun8i_layer.o + obj-$(CONFIG_DRM_SUN4I)+= sun4i-drm.o sun4i-tcon.o obj-$(CONFIG_DRM_SUN4I_BACKEND)+= sun4i-backend.o +obj-$(CONFIG_DRM_SUN4I_SUN8I_MIXER)+= sun8i-mixer.o obj-$(CONFIG_DRM_SUN4I)+= sun6i_drc.o obj-$(CONFIG_DRM_SUN4I)+= sun4i_tv.o diff --git a/drivers/gpu/drm/sun4i/sun8i_layer.c b/drivers/gpu/drm/sun4i/sun8i_layer.c new file mode 100644 index ..48f33d8e013b --- /dev/null +++ b/drivers/gpu/drm/sun4i/sun8i_layer.c @@ -0,0 +1,140 @@ +/* + * Copyright (C) Icenowy Zheng + * + * Based on sun4i_layer.h, which is: + * Copyright (C) 2015 Free Electrons + * Copyright (C) 2015 NextThing Co + * + * Maxime Ripard + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + */ + +#include +#include +#include + +#include "sun8i_layer.h" +#include "sun8i_mixer.h" + +struct sun8i_plane_desc { + enum drm_plane_type type; + const uint32_t *formats; + uint32_tnformats; +}; + +static int sun8i_mixer_layer_atomic_check(struct drm_plane *plane, + struct drm_plane_state *state) +{ + return 0; +} + +static void sun8i_mixer_layer_atomic_disable(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct sun8i_layer *layer = plane_to_sun8i_layer(plane); + struct sun8i_mixer *mixer = layer->mixer; + + sun8i_mixer_layer_enable(mixer, layer->id, false); +} + +static void sun8i_mixer_layer_atomic_update(struct drm_plane *plane, + struct drm_plane_state *old_state) +{ + struct sun8i_layer *layer = plane_to_sun8i_layer(plane); + struct sun8i_mixer *mixer = layer->mixer; + + sun8i_mixer_update_layer_coord(mixer, layer->id, plane); + sun8i_mixer_update_layer_formats(mixer, layer->id, plane); + sun8i_mixer_update_layer_buffer(mixer, layer->id, plane); + sun8i_mixer_layer_enable(mixer, layer->id, true); +} + +static struct drm_plane_helper_funcs sun8i_mixer_layer_helper_funcs = { + .atomic_check = sun8i_mixer_layer_atomic_check, + .atomic_disable = sun8i_mixer_layer_atomic_disable, + .atomic_update = sun8i_mixer_layer_atomic_update, +}; + +static const struct drm_plane_funcs sun8i_mixer_layer_funcs = { + .a