Hello,
This patch series is the second version of the second (and most probably last) round of vsp1 driver improvements for v4.7. In particular, it enables runtime PM support (03/13 and 04/13), adds support for the FCP (01/13, 02/13 and 05/13), prepare for HGO (histogram) support (06/13 to 09/13) and update the API towards the DRM driver (10/13 to 13/13).
The FCP is a companion module of video processing modules in the Renesas R-Car Gen3 SoCs. It provides data compression and decompression, data caching, and conversion of AXI transaction in order to reduce the memory bandwidth. The FCP driver is not meant to be used standalone but provides an API to the video processing modules to control the FCP.
The API towards the DRM driver is updated to store all configuration parameters in a structure in order to improve readability and make future updates easier. This series contain two R-Car DU DRM patches that update the DU DRM driver to the new API. They would normally be merged through Dave Airlie's tree, but due to dependencies on VSP1 patches queued up for v4.7 Dave agreed to get them merged through the linux-media tree (hence his Acked-by for the two patches). They should not conflict with any patch queued up for v4.7 through Dave's tree.
Note that patch 10/13 adds some macro magic to make the API transition easier. Depending on your taste you will find the implementation beautiful or ugly, but in any case patch 13/13 removes the macros and inline wrapper.
The code is based on top of the latest linux-media master branch. For convenience I've pushed the patches to the following git tree branch. patches on top of the latest Linux media master branch to
git://linuxtv.org/pinchartl/media.git vsp1/next
Changes since v1:
- Fixed typos - Made rcar_fcp_enable() return a status - Dropped the unneeded dependency on PM for the VSP driver
Cc: devicetree@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: Dave Airlie airlied@redhat.com
Laurent Pinchart (13): dt-bindings: Add Renesas R-Car FCP DT bindings v4l: Add Renesas R-Car FCP driver v4l: vsp1: Implement runtime PM support v4l: vsp1: Don't handle clocks manually v4l: vsp1: Add FCP support v4l: vsp1: Add output node value to routing table v4l: vsp1: Replace container_of() with dedicated macro v4l: vsp1: Make vsp1_entity_get_pad_compose() more generic v4l: vsp1: Move frame sequence number from video node to pipeline v4l: vsp1: Group DRM RPF parameters in a structure drm: rcar-du: Add alpha support for VSP planes drm: rcar-du: Add Z-order support for VSP planes v4l: vsp1: Remove deprecated DRM API
.../devicetree/bindings/media/renesas,fcp.txt | 31 ++++ .../devicetree/bindings/media/renesas,vsp1.txt | 5 + MAINTAINERS | 10 ++ drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 45 ++--- drivers/gpu/drm/rcar-du/rcar_du_vsp.h | 2 + drivers/media/platform/Kconfig | 14 ++ drivers/media/platform/Makefile | 1 + drivers/media/platform/rcar-fcp.c | 181 +++++++++++++++++++++ drivers/media/platform/vsp1/vsp1.h | 6 +- drivers/media/platform/vsp1/vsp1_drm.c | 68 ++++---- drivers/media/platform/vsp1/vsp1_drv.c | 120 +++++++------- drivers/media/platform/vsp1/vsp1_entity.c | 86 +++++++--- drivers/media/platform/vsp1/vsp1_entity.h | 12 +- drivers/media/platform/vsp1/vsp1_pipe.c | 4 +- drivers/media/platform/vsp1/vsp1_pipe.h | 2 + drivers/media/platform/vsp1/vsp1_rpf.c | 7 +- drivers/media/platform/vsp1/vsp1_video.c | 4 +- drivers/media/platform/vsp1/vsp1_video.h | 1 - include/media/rcar-fcp.h | 37 +++++ include/media/vsp1.h | 29 ++-- 20 files changed, 494 insertions(+), 171 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/renesas,fcp.txt create mode 100644 drivers/media/platform/rcar-fcp.c create mode 100644 include/media/rcar-fcp.h
Make the global alpha multiplier of VSP planes configurable through the alpha property, exactly as for the native DU planes.
Signed-off-by: Laurent Pinchart laurent.pinchart+renesas@ideasonboard.com Acked-by: Dave Airlie airlied@redhat.com --- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 38 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-)
Cc: dri-devel@lists.freedesktop.org
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index de7ef041182b..8c89a6401542 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c @@ -148,40 +148,41 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane) struct rcar_du_vsp_plane_state *state = to_rcar_vsp_plane_state(plane->plane.state); struct drm_framebuffer *fb = plane->plane.state->fb; - struct v4l2_rect src; - struct v4l2_rect dst; - dma_addr_t paddr[2] = { 0, }; - u32 pixelformat = 0; + struct vsp1_du_atomic_config cfg = { + .pixelformat = 0, + .pitch = fb->pitches[0], + .alpha = state->alpha, + .zpos = 0, + }; unsigned int i;
- src.left = state->state.src_x >> 16; - src.top = state->state.src_y >> 16; - src.width = state->state.src_w >> 16; - src.height = state->state.src_h >> 16; + cfg.src.left = state->state.src_x >> 16; + cfg.src.top = state->state.src_y >> 16; + cfg.src.width = state->state.src_w >> 16; + cfg.src.height = state->state.src_h >> 16;
- dst.left = state->state.crtc_x; - dst.top = state->state.crtc_y; - dst.width = state->state.crtc_w; - dst.height = state->state.crtc_h; + cfg.dst.left = state->state.crtc_x; + cfg.dst.top = state->state.crtc_y; + cfg.dst.width = state->state.crtc_w; + cfg.dst.height = state->state.crtc_h;
for (i = 0; i < state->format->planes; ++i) { struct drm_gem_cma_object *gem;
gem = drm_fb_cma_get_gem_obj(fb, i); - paddr[i] = gem->paddr + fb->offsets[i]; + cfg.mem[i] = gem->paddr + fb->offsets[i]; }
for (i = 0; i < ARRAY_SIZE(formats_kms); ++i) { if (formats_kms[i] == state->format->fourcc) { - pixelformat = formats_v4l2[i]; + cfg.pixelformat = formats_v4l2[i]; break; } }
- WARN_ON(!pixelformat); + WARN_ON(!cfg.pixelformat);
- vsp1_du_atomic_update(plane->vsp->vsp, plane->index, pixelformat, - fb->pitches[0], paddr, &src, &dst); + vsp1_du_atomic_update(plane->vsp->vsp, plane->index, &cfg); }
static int rcar_du_vsp_plane_atomic_check(struct drm_plane *plane, @@ -220,8 +221,7 @@ static void rcar_du_vsp_plane_atomic_update(struct drm_plane *plane, if (plane->state->crtc) rcar_du_vsp_plane_setup(rplane); else - vsp1_du_atomic_update(rplane->vsp->vsp, rplane->index, 0, 0, 0, - NULL, NULL); + vsp1_du_atomic_update(rplane->vsp->vsp, rplane->index, NULL); }
static const struct drm_plane_helper_funcs rcar_du_vsp_plane_helper_funcs = {
Make the Z-order of VSP planes configurable through the zpos property, exactly as for the native DU planes.
Signed-off-by: Laurent Pinchart laurent.pinchart+renesas@ideasonboard.com Acked-by: Dave Airlie airlied@redhat.com --- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 11 ++++++++--- drivers/gpu/drm/rcar-du/rcar_du_vsp.h | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-)
Cc: dri-devel@lists.freedesktop.org
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 8c89a6401542..4927fb3b8554 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c @@ -152,7 +152,7 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane) .pixelformat = 0, .pitch = fb->pitches[0], .alpha = state->alpha, - .zpos = 0, + .zpos = state->zpos, }; unsigned int i;
@@ -180,8 +180,6 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane) } }
- WARN_ON(!cfg.pixelformat); - vsp1_du_atomic_update(plane->vsp->vsp, plane->index, &cfg); }
@@ -269,6 +267,7 @@ static void rcar_du_vsp_plane_reset(struct drm_plane *plane) return;
state->alpha = 255; + state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
plane->state = &state->state; plane->state->plane = plane; @@ -283,6 +282,8 @@ static int rcar_du_vsp_plane_atomic_set_property(struct drm_plane *plane,
if (property == rcdu->props.alpha) rstate->alpha = val; + else if (property == rcdu->props.zpos) + rstate->zpos = val; else return -EINVAL;
@@ -299,6 +300,8 @@ static int rcar_du_vsp_plane_atomic_get_property(struct drm_plane *plane,
if (property == rcdu->props.alpha) *val = rstate->alpha; + else if (property == rcdu->props.zpos) + *val = rstate->zpos; else return -EINVAL;
@@ -378,6 +381,8 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp)
drm_object_attach_property(&plane->plane.base, rcdu->props.alpha, 255); + drm_object_attach_property(&plane->plane.base, + rcdu->props.zpos, 1); }
return 0; diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h index df3bf3805c69..510dcc9c6816 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h @@ -44,6 +44,7 @@ static inline struct rcar_du_vsp_plane *to_rcar_vsp_plane(struct drm_plane *p) * @state: base DRM plane state * @format: information about the pixel format used by the plane * @alpha: value of the plane alpha property + * @zpos: value of the plane zpos property */ struct rcar_du_vsp_plane_state { struct drm_plane_state state; @@ -51,6 +52,7 @@ struct rcar_du_vsp_plane_state { const struct rcar_du_format_info *format;
unsigned int alpha; + unsigned int zpos; };
static inline struct rcar_du_vsp_plane_state *
dri-devel@lists.freedesktop.org