Hello,
(Dave, there's a request for you below)
This patch series adds support for CRC calculation to the rcar-du-drm driver.
CRC calculation is supported starting at the Renesas R-Car Gen3 SoCs, as earlier versions don't have the necessary hardware. On Gen3 SoCs, the CRC is computed by the DISCOM module part of the VSP-D and VSP-DL.
The DISCOM is interfaced to the VSP through the UIF glue and appears as a VSP entity with a sink pad and a source pad.
The series starts with a switch to SPDX license headers in patch 1/8, prompted by a checkpatch.pl warning for a later patch that complained about missing SPDX license headers. It then continues with cleanup and refactoring. Patches 2/8 and 3/8 prepare for DISCOM and UIF support by extending generic code to make it usable for the UIF. Patch 4/8 documents a structure that will receive new fields.
Patch 5/8 then extends the API exposed by the VSP driver to the DU driver to support CRC computation configuration and reporting. The patch unfortunately needs to touch both the VSP and DU drivers, so the whole series will need to be merged through a single tree.
Patch 5/8 adds support for the DISCOM and UIF in the VSP driver, patch 7/8 integrates it in the DRM pipeline, and patch 8/8 finally implements the CRC API in the DU driver to expose CRC computation to userspace.
The hardware supports computing the CRC at any arbitrary point in the pipeline on a configurable window of the frame. This patch series supports CRC computation on input planes or pipeline output, but on the full frame only. Support for CRC window configuration can be added later if needed but will require extending the userspace API, as the DRM/KMS CRC API doesn't support this feature.
Compared to v1, the CRC source names for plane inputs are now constructed from plane IDs instead of plane indices. This allows userspace to match CRC sources with planes.
Compared to v2, various small issues reported by reviewers have been fixed. I believe the series to now be ready for upstream merge.
Note that exposing the DISCOM and UIF though the V4L2 API isn't supported as the module is only found in VSP-D and VSP-DL instances that are not exposed through V4L2. It is possible to expose those instances through V4L2 with a small modification to the driver for testing purpose. If the need arises to test DISCOM and UIF with such an out-of-tree patch, support for CRC reporting through a V4L2 control can be added later without affecting how CRC is exposed through the DRM/KMS API.
The patches are based on top of the "[PATCH v2 00/15] R-Car VSP1: Dynamically assign blend units to display pipelines" patch series, itself based on top of the Linux media master branch and scheduled for merge in v4.18. The new base caused heavy conflicts, requiring this series to be merged through the V4L2 tree.
Dave, I have verified that this series merges cleanly with your drm-next and drm-fixes branches, with the drm-misc-next and drm-misc-fixes branches, and with the R-Car DU patches I would like to get merged in v4.18 through your tree. Could I get your ack to merge this through the V4L2 tree ?
For convenience the patches are available at
git://linuxtv.org/pinchartl/media.git vsp1-discom-v3-20180428
The code has been tested through the kms-test-crc.py script part of the DU test suite available at
git://git.ideasonboard.com/renesas/kms-tests.git discom
Laurent Pinchart (8): v4l: vsp1: Use SPDX license headers v4l: vsp1: Share the CLU, LIF and LUT set_fmt pad operation code v4l: vsp1: Reset the crop and compose rectangles in the set_fmt helper v4l: vsp1: Document the vsp1_du_atomic_config structure v4l: vsp1: Extend the DU API to support CRC computation v4l: vsp1: Add support for the DISCOM entity v4l: vsp1: Integrate DISCOM in display pipeline drm: rcar-du: Add support for CRC computation
drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 156 ++++++++++++++++- drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 15 ++ drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 12 +- drivers/media/platform/vsp1/Makefile | 2 +- drivers/media/platform/vsp1/vsp1.h | 10 +- drivers/media/platform/vsp1/vsp1_brx.c | 6 +- drivers/media/platform/vsp1/vsp1_brx.h | 6 +- drivers/media/platform/vsp1/vsp1_clu.c | 71 ++------ drivers/media/platform/vsp1/vsp1_clu.h | 6 +- drivers/media/platform/vsp1/vsp1_dl.c | 8 +- drivers/media/platform/vsp1/vsp1_dl.h | 6 +- drivers/media/platform/vsp1/vsp1_drm.c | 127 ++++++++++++-- drivers/media/platform/vsp1/vsp1_drm.h | 15 +- drivers/media/platform/vsp1/vsp1_drv.c | 26 ++- drivers/media/platform/vsp1/vsp1_entity.c | 103 +++++++++++- drivers/media/platform/vsp1/vsp1_entity.h | 13 +- drivers/media/platform/vsp1/vsp1_hgo.c | 6 +- drivers/media/platform/vsp1/vsp1_hgo.h | 6 +- drivers/media/platform/vsp1/vsp1_hgt.c | 6 +- drivers/media/platform/vsp1/vsp1_hgt.h | 6 +- drivers/media/platform/vsp1/vsp1_histo.c | 65 +------ drivers/media/platform/vsp1/vsp1_histo.h | 6 +- drivers/media/platform/vsp1/vsp1_hsit.c | 6 +- drivers/media/platform/vsp1/vsp1_hsit.h | 6 +- drivers/media/platform/vsp1/vsp1_lif.c | 71 ++------ drivers/media/platform/vsp1/vsp1_lif.h | 6 +- drivers/media/platform/vsp1/vsp1_lut.c | 71 ++------ drivers/media/platform/vsp1/vsp1_lut.h | 6 +- drivers/media/platform/vsp1/vsp1_pipe.c | 6 +- drivers/media/platform/vsp1/vsp1_pipe.h | 6 +- drivers/media/platform/vsp1/vsp1_regs.h | 46 ++++- drivers/media/platform/vsp1/vsp1_rpf.c | 6 +- drivers/media/platform/vsp1/vsp1_rwpf.c | 6 +- drivers/media/platform/vsp1/vsp1_rwpf.h | 6 +- drivers/media/platform/vsp1/vsp1_sru.c | 6 +- drivers/media/platform/vsp1/vsp1_sru.h | 6 +- drivers/media/platform/vsp1/vsp1_uds.c | 6 +- drivers/media/platform/vsp1/vsp1_uds.h | 6 +- drivers/media/platform/vsp1/vsp1_uif.c | 271 ++++++++++++++++++++++++++++++ drivers/media/platform/vsp1/vsp1_uif.h | 32 ++++ drivers/media/platform/vsp1/vsp1_video.c | 6 +- drivers/media/platform/vsp1/vsp1_video.h | 6 +- drivers/media/platform/vsp1/vsp1_wpf.c | 6 +- include/media/vsp1.h | 45 ++++- 44 files changed, 892 insertions(+), 417 deletions(-) create mode 100644 drivers/media/platform/vsp1/vsp1_uif.c create mode 100644 drivers/media/platform/vsp1/vsp1_uif.h
Adopt the SPDX license identifier headers to ease license compliance management. All files in the driver are licensed under the GPLv2+ except for the vsp1_regs.h file which is licensed under the GPLv2. This is likely an oversight, but fixing this requires contacting the copyright owners and is out of scope for this patch.
While at it fix the file descriptions to match file names where copy and paste error occurred.
Signed-off-by: Laurent Pinchart laurent.pinchart+renesas@ideasonboard.com Reviewed-by: Kieran Bingham kieran.bingham+renesas@ideasonboard.com --- drivers/media/platform/vsp1/vsp1.h | 6 +----- drivers/media/platform/vsp1/vsp1_brx.c | 6 +----- drivers/media/platform/vsp1/vsp1_brx.h | 6 +----- drivers/media/platform/vsp1/vsp1_clu.c | 6 +----- drivers/media/platform/vsp1/vsp1_clu.h | 6 +----- drivers/media/platform/vsp1/vsp1_dl.c | 8 ++------ drivers/media/platform/vsp1/vsp1_dl.h | 6 +----- drivers/media/platform/vsp1/vsp1_drm.c | 8 ++------ drivers/media/platform/vsp1/vsp1_drm.h | 6 +----- drivers/media/platform/vsp1/vsp1_drv.c | 6 +----- drivers/media/platform/vsp1/vsp1_entity.c | 6 +----- drivers/media/platform/vsp1/vsp1_entity.h | 6 +----- drivers/media/platform/vsp1/vsp1_hgo.c | 6 +----- drivers/media/platform/vsp1/vsp1_hgo.h | 6 +----- drivers/media/platform/vsp1/vsp1_hgt.c | 6 +----- drivers/media/platform/vsp1/vsp1_hgt.h | 6 +----- drivers/media/platform/vsp1/vsp1_histo.c | 6 +----- drivers/media/platform/vsp1/vsp1_histo.h | 6 +----- drivers/media/platform/vsp1/vsp1_hsit.c | 6 +----- drivers/media/platform/vsp1/vsp1_hsit.h | 6 +----- drivers/media/platform/vsp1/vsp1_lif.c | 6 +----- drivers/media/platform/vsp1/vsp1_lif.h | 6 +----- drivers/media/platform/vsp1/vsp1_lut.c | 6 +----- drivers/media/platform/vsp1/vsp1_lut.h | 6 +----- drivers/media/platform/vsp1/vsp1_pipe.c | 6 +----- drivers/media/platform/vsp1/vsp1_pipe.h | 6 +----- drivers/media/platform/vsp1/vsp1_regs.h | 5 +---- drivers/media/platform/vsp1/vsp1_rpf.c | 6 +----- drivers/media/platform/vsp1/vsp1_rwpf.c | 6 +----- drivers/media/platform/vsp1/vsp1_rwpf.h | 6 +----- drivers/media/platform/vsp1/vsp1_sru.c | 6 +----- drivers/media/platform/vsp1/vsp1_sru.h | 6 +----- drivers/media/platform/vsp1/vsp1_uds.c | 6 +----- drivers/media/platform/vsp1/vsp1_uds.h | 6 +----- drivers/media/platform/vsp1/vsp1_video.c | 6 +----- drivers/media/platform/vsp1/vsp1_video.h | 6 +----- drivers/media/platform/vsp1/vsp1_wpf.c | 6 +----- 37 files changed, 39 insertions(+), 186 deletions(-)
diff --git a/drivers/media/platform/vsp1/vsp1.h b/drivers/media/platform/vsp1/vsp1.h index 894cc725c2d4..9cf4e1c4b036 100644 --- a/drivers/media/platform/vsp1/vsp1.h +++ b/drivers/media/platform/vsp1/vsp1.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1.h -- R-Car VSP1 Driver * * Copyright (C) 2013-2014 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_H__ #define __VSP1_H__ diff --git a/drivers/media/platform/vsp1/vsp1_brx.c b/drivers/media/platform/vsp1/vsp1_brx.c index b4af1d546022..3beec18fd863 100644 --- a/drivers/media/platform/vsp1/vsp1_brx.c +++ b/drivers/media/platform/vsp1/vsp1_brx.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_brx.c -- R-Car VSP1 Blend ROP Unit (BRU and BRS) * * Copyright (C) 2013 Renesas Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_brx.h b/drivers/media/platform/vsp1/vsp1_brx.h index 927aa4254c0f..6abbb8c3343c 100644 --- a/drivers/media/platform/vsp1/vsp1_brx.h +++ b/drivers/media/platform/vsp1/vsp1_brx.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_brx.h -- R-Car VSP1 Blend ROP Unit (BRU and BRS) * * Copyright (C) 2013 Renesas Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_BRX_H__ #define __VSP1_BRX_H__ diff --git a/drivers/media/platform/vsp1/vsp1_clu.c b/drivers/media/platform/vsp1/vsp1_clu.c index f2fb26e5ab4e..9626b6308585 100644 --- a/drivers/media/platform/vsp1/vsp1_clu.c +++ b/drivers/media/platform/vsp1/vsp1_clu.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_clu.c -- R-Car VSP1 Cubic Look-Up Table * * Copyright (C) 2015-2016 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_clu.h b/drivers/media/platform/vsp1/vsp1_clu.h index 036e0a2f1a42..c45e6e707592 100644 --- a/drivers/media/platform/vsp1/vsp1_clu.h +++ b/drivers/media/platform/vsp1/vsp1_clu.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_clu.h -- R-Car VSP1 Cubic Look-Up Table * * Copyright (C) 2015 Renesas Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_CLU_H__ #define __VSP1_CLU_H__ diff --git a/drivers/media/platform/vsp1/vsp1_dl.c b/drivers/media/platform/vsp1/vsp1_dl.c index 30ad491605ff..801dea475740 100644 --- a/drivers/media/platform/vsp1/vsp1_dl.c +++ b/drivers/media/platform/vsp1/vsp1_dl.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* - * vsp1_dl.h -- R-Car VSP1 Display List + * vsp1_dl.c -- R-Car VSP1 Display List * * Copyright (C) 2015 Renesas Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_dl.h b/drivers/media/platform/vsp1/vsp1_dl.h index 1a5bbd5ddb7b..e6279b1abd19 100644 --- a/drivers/media/platform/vsp1/vsp1_dl.h +++ b/drivers/media/platform/vsp1/vsp1_dl.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_dl.h -- R-Car VSP1 Display List * * Copyright (C) 2015 Renesas Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_DL_H__ #define __VSP1_DL_H__ diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index 095dc48aa25a..2b29a83dceb9 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* - * vsp1_drm.c -- R-Car VSP1 DRM API + * vsp1_drm.c -- R-Car VSP1 DRM/KMS Interface * * Copyright (C) 2015 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_drm.h b/drivers/media/platform/vsp1/vsp1_drm.h index d738cc57f0e3..f4af1b2b12d6 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.h +++ b/drivers/media/platform/vsp1/vsp1_drm.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_drm.h -- R-Car VSP1 DRM/KMS Interface * * Copyright (C) 2015 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_DRM_H__ #define __VSP1_DRM_H__ diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index f41cd70409db..331a2e0af0d3 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_drv.c -- R-Car VSP1 Driver * * Copyright (C) 2013-2015 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/clk.h> diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c index 54de15095709..72354caf5746 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.c +++ b/drivers/media/platform/vsp1/vsp1_entity.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_entity.c -- R-Car VSP1 Base Entity * * Copyright (C) 2013-2014 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h index c26523c56c05..fb20a1578f3b 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.h +++ b/drivers/media/platform/vsp1/vsp1_entity.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_entity.h -- R-Car VSP1 Base Entity * * Copyright (C) 2013-2014 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_ENTITY_H__ #define __VSP1_ENTITY_H__ diff --git a/drivers/media/platform/vsp1/vsp1_hgo.c b/drivers/media/platform/vsp1/vsp1_hgo.c index 50309c053b78..d514807ccdf4 100644 --- a/drivers/media/platform/vsp1/vsp1_hgo.c +++ b/drivers/media/platform/vsp1/vsp1_hgo.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_hgo.c -- R-Car VSP1 Histogram Generator 1D * * Copyright (C) 2016 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_hgo.h b/drivers/media/platform/vsp1/vsp1_hgo.h index c6c0b7a80e0c..6b0c8580e1bf 100644 --- a/drivers/media/platform/vsp1/vsp1_hgo.h +++ b/drivers/media/platform/vsp1/vsp1_hgo.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_hgo.h -- R-Car VSP1 Histogram Generator 1D * * Copyright (C) 2016 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_HGO_H__ #define __VSP1_HGO_H__ diff --git a/drivers/media/platform/vsp1/vsp1_hgt.c b/drivers/media/platform/vsp1/vsp1_hgt.c index b5ce305e3e6f..18dc89f47c45 100644 --- a/drivers/media/platform/vsp1/vsp1_hgt.c +++ b/drivers/media/platform/vsp1/vsp1_hgt.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_hgt.c -- R-Car VSP1 Histogram Generator 2D * * Copyright (C) 2016 Renesas Electronics Corporation * * Contact: Niklas Söderlund (niklas.soderlund@ragnatech.se) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_hgt.h b/drivers/media/platform/vsp1/vsp1_hgt.h index 83f2e130942a..38ec237bdd2d 100644 --- a/drivers/media/platform/vsp1/vsp1_hgt.h +++ b/drivers/media/platform/vsp1/vsp1_hgt.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_hgt.h -- R-Car VSP1 Histogram Generator 2D * * Copyright (C) 2016 Renesas Electronics Corporation * * Contact: Niklas Söderlund (niklas.soderlund@ragnatech.se) - * - * 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. */ #ifndef __VSP1_HGT_H__ #define __VSP1_HGT_H__ diff --git a/drivers/media/platform/vsp1/vsp1_histo.c b/drivers/media/platform/vsp1/vsp1_histo.c index 8638ebc514b4..029181c1fb61 100644 --- a/drivers/media/platform/vsp1/vsp1_histo.c +++ b/drivers/media/platform/vsp1/vsp1_histo.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_histo.c -- R-Car VSP1 Histogram API * @@ -5,11 +6,6 @@ * Copyright (C) 2016 Laurent Pinchart * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_histo.h b/drivers/media/platform/vsp1/vsp1_histo.h index e774adbf251f..06f029846244 100644 --- a/drivers/media/platform/vsp1/vsp1_histo.h +++ b/drivers/media/platform/vsp1/vsp1_histo.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_histo.h -- R-Car VSP1 Histogram API * @@ -5,11 +6,6 @@ * Copyright (C) 2016 Laurent Pinchart * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_HISTO_H__ #define __VSP1_HISTO_H__ diff --git a/drivers/media/platform/vsp1/vsp1_hsit.c b/drivers/media/platform/vsp1/vsp1_hsit.c index 764d405345ee..7ba3535f3c9b 100644 --- a/drivers/media/platform/vsp1/vsp1_hsit.c +++ b/drivers/media/platform/vsp1/vsp1_hsit.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_hsit.c -- R-Car VSP1 Hue Saturation value (Inverse) Transform * * Copyright (C) 2013 Renesas Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_hsit.h b/drivers/media/platform/vsp1/vsp1_hsit.h index 82f1c8426900..a658b1aa49e7 100644 --- a/drivers/media/platform/vsp1/vsp1_hsit.h +++ b/drivers/media/platform/vsp1/vsp1_hsit.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_hsit.h -- R-Car VSP1 Hue Saturation value (Inverse) Transform * * Copyright (C) 2013 Renesas Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_HSIT_H__ #define __VSP1_HSIT_H__ diff --git a/drivers/media/platform/vsp1/vsp1_lif.c b/drivers/media/platform/vsp1/vsp1_lif.c index 704920753998..b20b842f06ba 100644 --- a/drivers/media/platform/vsp1/vsp1_lif.c +++ b/drivers/media/platform/vsp1/vsp1_lif.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_lif.c -- R-Car VSP1 LCD Controller Interface * * Copyright (C) 2013-2014 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_lif.h b/drivers/media/platform/vsp1/vsp1_lif.h index 3417339379b1..71a4eda9c2b2 100644 --- a/drivers/media/platform/vsp1/vsp1_lif.h +++ b/drivers/media/platform/vsp1/vsp1_lif.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_lif.h -- R-Car VSP1 LCD Controller Interface * * Copyright (C) 2013-2014 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_LIF_H__ #define __VSP1_LIF_H__ diff --git a/drivers/media/platform/vsp1/vsp1_lut.c b/drivers/media/platform/vsp1/vsp1_lut.c index c67cc60db0db..7bdabb311c6c 100644 --- a/drivers/media/platform/vsp1/vsp1_lut.c +++ b/drivers/media/platform/vsp1/vsp1_lut.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_lut.c -- R-Car VSP1 Look-Up Table * * Copyright (C) 2013 Renesas Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_lut.h b/drivers/media/platform/vsp1/vsp1_lut.h index f8c4e8f0a79d..dce2fdc315f6 100644 --- a/drivers/media/platform/vsp1/vsp1_lut.h +++ b/drivers/media/platform/vsp1/vsp1_lut.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_lut.h -- R-Car VSP1 Look-Up Table * * Copyright (C) 2013 Renesas Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_LUT_H__ #define __VSP1_LUT_H__ diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c b/drivers/media/platform/vsp1/vsp1_pipe.c index 3fc5ecfa35e8..6fde4c0b9844 100644 --- a/drivers/media/platform/vsp1/vsp1_pipe.c +++ b/drivers/media/platform/vsp1/vsp1_pipe.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_pipe.c -- R-Car VSP1 Pipeline * * Copyright (C) 2013-2015 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/delay.h> diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h b/drivers/media/platform/vsp1/vsp1_pipe.h index 07ccd6b810c5..663d7fed7929 100644 --- a/drivers/media/platform/vsp1/vsp1_pipe.h +++ b/drivers/media/platform/vsp1/vsp1_pipe.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_pipe.h -- R-Car VSP1 Pipeline * * Copyright (C) 2013-2015 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_PIPE_H__ #define __VSP1_PIPE_H__ diff --git a/drivers/media/platform/vsp1/vsp1_regs.h b/drivers/media/platform/vsp1/vsp1_regs.h index dae0c1901297..3201ad4b77d4 100644 --- a/drivers/media/platform/vsp1/vsp1_regs.h +++ b/drivers/media/platform/vsp1/vsp1_regs.h @@ -1,13 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * vsp1_regs.h -- R-Car VSP1 Registers Definitions * * Copyright (C) 2013 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. */
#ifndef __VSP1_REGS_H__ diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index 7e74c2015070..7005a4c6aa88 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_rpf.c -- R-Car VSP1 Read Pixel Formatter * * Copyright (C) 2013-2014 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.c b/drivers/media/platform/vsp1/vsp1_rwpf.c index cfd8f1904fa6..049bdd958e56 100644 --- a/drivers/media/platform/vsp1/vsp1_rwpf.c +++ b/drivers/media/platform/vsp1/vsp1_rwpf.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_rwpf.c -- R-Car VSP1 Read and Write Pixel Formatters * * Copyright (C) 2013-2014 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <media/v4l2-subdev.h> diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h b/drivers/media/platform/vsp1/vsp1_rwpf.h index 915aeadb21dd..70742ecf766f 100644 --- a/drivers/media/platform/vsp1/vsp1_rwpf.h +++ b/drivers/media/platform/vsp1/vsp1_rwpf.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_rwpf.h -- R-Car VSP1 Read and Write Pixel Formatters * * Copyright (C) 2013-2014 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_RWPF_H__ #define __VSP1_RWPF_H__ diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c index 51e5691187c3..44cb9b134a19 100644 --- a/drivers/media/platform/vsp1/vsp1_sru.c +++ b/drivers/media/platform/vsp1/vsp1_sru.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_sru.c -- R-Car VSP1 Super Resolution Unit * * Copyright (C) 2013 Renesas Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_sru.h b/drivers/media/platform/vsp1/vsp1_sru.h index 85e241457af2..ddb00eadd1ea 100644 --- a/drivers/media/platform/vsp1/vsp1_sru.h +++ b/drivers/media/platform/vsp1/vsp1_sru.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_sru.h -- R-Car VSP1 Super Resolution Unit * * Copyright (C) 2013 Renesas Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_SRU_H__ #define __VSP1_SRU_H__ diff --git a/drivers/media/platform/vsp1/vsp1_uds.c b/drivers/media/platform/vsp1/vsp1_uds.c index 72f72a9d2152..e5afd69df939 100644 --- a/drivers/media/platform/vsp1/vsp1_uds.c +++ b/drivers/media/platform/vsp1/vsp1_uds.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_uds.c -- R-Car VSP1 Up and Down Scaler * * Copyright (C) 2013-2014 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h> diff --git a/drivers/media/platform/vsp1/vsp1_uds.h b/drivers/media/platform/vsp1/vsp1_uds.h index 7bf3cdcffc65..2cd9f4b95442 100644 --- a/drivers/media/platform/vsp1/vsp1_uds.h +++ b/drivers/media/platform/vsp1/vsp1_uds.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_uds.h -- R-Car VSP1 Up and Down Scaler * * Copyright (C) 2013-2014 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_UDS_H__ #define __VSP1_UDS_H__ diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index 2b1c94ffc6f5..c8c12223a267 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_video.c -- R-Car VSP1 Video Node * * Copyright (C) 2013-2015 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/list.h> diff --git a/drivers/media/platform/vsp1/vsp1_video.h b/drivers/media/platform/vsp1/vsp1_video.h index 50ea7f02205f..75a5a65c66fe 100644 --- a/drivers/media/platform/vsp1/vsp1_video.h +++ b/drivers/media/platform/vsp1/vsp1_video.h @@ -1,14 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * vsp1_video.h -- R-Car VSP1 Video Node * * Copyright (C) 2013-2015 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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. */ #ifndef __VSP1_VIDEO_H__ #define __VSP1_VIDEO_H__ diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index 53858d100228..65ed2f849551 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -1,14 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * vsp1_wpf.c -- R-Car VSP1 Write Pixel Formatter * * Copyright (C) 2013-2014 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) - * - * 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 <linux/device.h>
The implementation of the set_fmt pad operation is identical in the three modules. Move it to a generic helper function.
Signed-off-by: Laurent Pinchart laurent.pinchart+renesas@ideasonboard.com Reviewed-by: Kieran Bingham kieran.bingham+renesas@ideasonboard.com --- Changes since v2:
- Use entity->source_pad instead of hardcoding pad numbers --- drivers/media/platform/vsp1/vsp1_clu.c | 65 +++++---------------------- drivers/media/platform/vsp1/vsp1_entity.c | 75 +++++++++++++++++++++++++++++++ drivers/media/platform/vsp1/vsp1_entity.h | 6 +++ drivers/media/platform/vsp1/vsp1_lif.c | 65 +++++---------------------- drivers/media/platform/vsp1/vsp1_lut.c | 65 +++++---------------------- 5 files changed, 116 insertions(+), 160 deletions(-)
diff --git a/drivers/media/platform/vsp1/vsp1_clu.c b/drivers/media/platform/vsp1/vsp1_clu.c index 9626b6308585..96a448e1504c 100644 --- a/drivers/media/platform/vsp1/vsp1_clu.c +++ b/drivers/media/platform/vsp1/vsp1_clu.c @@ -114,18 +114,18 @@ static const struct v4l2_ctrl_config clu_mode_control = { * V4L2 Subdevice Pad Operations */
+static const unsigned int clu_codes[] = { + MEDIA_BUS_FMT_ARGB8888_1X32, + MEDIA_BUS_FMT_AHSV8888_1X32, + MEDIA_BUS_FMT_AYUV8_1X32, +}; + static int clu_enum_mbus_code(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code) { - static const unsigned int codes[] = { - MEDIA_BUS_FMT_ARGB8888_1X32, - MEDIA_BUS_FMT_AHSV8888_1X32, - MEDIA_BUS_FMT_AYUV8_1X32, - }; - - return vsp1_subdev_enum_mbus_code(subdev, cfg, code, codes, - ARRAY_SIZE(codes)); + return vsp1_subdev_enum_mbus_code(subdev, cfg, code, clu_codes, + ARRAY_SIZE(clu_codes)); }
static int clu_enum_frame_size(struct v4l2_subdev *subdev, @@ -141,51 +141,10 @@ static int clu_set_format(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { - struct vsp1_clu *clu = to_clu(subdev); - struct v4l2_subdev_pad_config *config; - struct v4l2_mbus_framefmt *format; - int ret = 0; - - mutex_lock(&clu->entity.lock); - - config = vsp1_entity_get_pad_config(&clu->entity, cfg, fmt->which); - if (!config) { - ret = -EINVAL; - goto done; - } - - /* Default to YUV if the requested format is not supported. */ - if (fmt->format.code != MEDIA_BUS_FMT_ARGB8888_1X32 && - fmt->format.code != MEDIA_BUS_FMT_AHSV8888_1X32 && - fmt->format.code != MEDIA_BUS_FMT_AYUV8_1X32) - fmt->format.code = MEDIA_BUS_FMT_AYUV8_1X32; - - format = vsp1_entity_get_pad_format(&clu->entity, config, fmt->pad); - - if (fmt->pad == CLU_PAD_SOURCE) { - /* The CLU output format can't be modified. */ - fmt->format = *format; - goto done; - } - - format->code = fmt->format.code; - format->width = clamp_t(unsigned int, fmt->format.width, - CLU_MIN_SIZE, CLU_MAX_SIZE); - format->height = clamp_t(unsigned int, fmt->format.height, - CLU_MIN_SIZE, CLU_MAX_SIZE); - format->field = V4L2_FIELD_NONE; - format->colorspace = V4L2_COLORSPACE_SRGB; - - fmt->format = *format; - - /* Propagate the format to the source pad. */ - format = vsp1_entity_get_pad_format(&clu->entity, config, - CLU_PAD_SOURCE); - *format = fmt->format; - -done: - mutex_unlock(&clu->entity.lock); - return ret; + return vsp1_subdev_set_pad_format(subdev, cfg, fmt, clu_codes, + ARRAY_SIZE(clu_codes), + CLU_MIN_SIZE, CLU_MIN_SIZE, + CLU_MAX_SIZE, CLU_MAX_SIZE); }
/* ----------------------------------------------------------------------------- diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c index 72354caf5746..9195a0eca467 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.c +++ b/drivers/media/platform/vsp1/vsp1_entity.c @@ -307,6 +307,81 @@ int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev, return ret; }
+/* + * vsp1_subdev_set_pad_format - Subdev pad set_fmt handler + * @subdev: V4L2 subdevice + * @cfg: V4L2 subdev pad configuration + * @fmt: V4L2 subdev format + * @codes: Array of supported media bus codes + * @ncodes: Number of supported media bus codes + * @min_width: Minimum image width + * @min_height: Minimum image height + * @max_width: Maximum image width + * @max_height: Maximum image height + * + * This function implements the subdev set_fmt pad operation for entities that + * do not support scaling or cropping. It defaults to the first supplied media + * bus code if the requested code isn't supported, clamps the size to the + * supplied minimum and maximum, and propagates the sink pad format to the + * source pad. + */ +int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *fmt, + const unsigned int *codes, unsigned int ncodes, + unsigned int min_width, unsigned int min_height, + unsigned int max_width, unsigned int max_height) +{ + struct vsp1_entity *entity = to_vsp1_entity(subdev); + struct v4l2_subdev_pad_config *config; + struct v4l2_mbus_framefmt *format; + unsigned int i; + int ret = 0; + + mutex_lock(&entity->lock); + + config = vsp1_entity_get_pad_config(entity, cfg, fmt->which); + if (!config) { + ret = -EINVAL; + goto done; + } + + format = vsp1_entity_get_pad_format(entity, config, fmt->pad); + + if (fmt->pad == entity->source_pad) { + /* The output format can't be modified. */ + fmt->format = *format; + goto done; + } + + /* + * Default to the first media bus code if the requested format is not + * supported. + */ + for (i = 0; i < ncodes; ++i) { + if (fmt->format.code == codes[i]) + break; + } + + format->code = i < ncodes ? codes[i] : codes[0]; + format->width = clamp_t(unsigned int, fmt->format.width, + min_width, max_width); + format->height = clamp_t(unsigned int, fmt->format.height, + min_height, max_height); + format->field = V4L2_FIELD_NONE; + format->colorspace = V4L2_COLORSPACE_SRGB; + + fmt->format = *format; + + /* Propagate the format to the source pad. */ + format = vsp1_entity_get_pad_format(entity, config, entity->source_pad); + *format = fmt->format; + +done: + mutex_unlock(&entity->lock); + return ret; +} + /* ----------------------------------------------------------------------------- * Media Operations */ diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h index fb20a1578f3b..0839a62cfa71 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.h +++ b/drivers/media/platform/vsp1/vsp1_entity.h @@ -160,6 +160,12 @@ struct media_pad *vsp1_entity_remote_pad(struct media_pad *pad); int vsp1_subdev_get_pad_format(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt); +int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *fmt, + const unsigned int *codes, unsigned int ncodes, + unsigned int min_width, unsigned int min_height, + unsigned int max_width, unsigned int max_height); int vsp1_subdev_enum_mbus_code(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code, diff --git a/drivers/media/platform/vsp1/vsp1_lif.c b/drivers/media/platform/vsp1/vsp1_lif.c index b20b842f06ba..fbdd5715f829 100644 --- a/drivers/media/platform/vsp1/vsp1_lif.c +++ b/drivers/media/platform/vsp1/vsp1_lif.c @@ -33,17 +33,17 @@ static inline void vsp1_lif_write(struct vsp1_lif *lif, struct vsp1_dl_list *dl, * V4L2 Subdevice Operations */
+static const unsigned int lif_codes[] = { + MEDIA_BUS_FMT_ARGB8888_1X32, + MEDIA_BUS_FMT_AYUV8_1X32, +}; + static int lif_enum_mbus_code(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code) { - static const unsigned int codes[] = { - MEDIA_BUS_FMT_ARGB8888_1X32, - MEDIA_BUS_FMT_AYUV8_1X32, - }; - - return vsp1_subdev_enum_mbus_code(subdev, cfg, code, codes, - ARRAY_SIZE(codes)); + return vsp1_subdev_enum_mbus_code(subdev, cfg, code, lif_codes, + ARRAY_SIZE(lif_codes)); }
static int lif_enum_frame_size(struct v4l2_subdev *subdev, @@ -59,53 +59,10 @@ static int lif_set_format(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { - struct vsp1_lif *lif = to_lif(subdev); - struct v4l2_subdev_pad_config *config; - struct v4l2_mbus_framefmt *format; - int ret = 0; - - mutex_lock(&lif->entity.lock); - - config = vsp1_entity_get_pad_config(&lif->entity, cfg, fmt->which); - if (!config) { - ret = -EINVAL; - goto done; - } - - /* Default to YUV if the requested format is not supported. */ - if (fmt->format.code != MEDIA_BUS_FMT_ARGB8888_1X32 && - fmt->format.code != MEDIA_BUS_FMT_AYUV8_1X32) - fmt->format.code = MEDIA_BUS_FMT_AYUV8_1X32; - - format = vsp1_entity_get_pad_format(&lif->entity, config, fmt->pad); - - if (fmt->pad == LIF_PAD_SOURCE) { - /* - * The LIF source format is always identical to its sink - * format. - */ - fmt->format = *format; - goto done; - } - - format->code = fmt->format.code; - format->width = clamp_t(unsigned int, fmt->format.width, - LIF_MIN_SIZE, LIF_MAX_SIZE); - format->height = clamp_t(unsigned int, fmt->format.height, - LIF_MIN_SIZE, LIF_MAX_SIZE); - format->field = V4L2_FIELD_NONE; - format->colorspace = V4L2_COLORSPACE_SRGB; - - fmt->format = *format; - - /* Propagate the format to the source pad. */ - format = vsp1_entity_get_pad_format(&lif->entity, config, - LIF_PAD_SOURCE); - *format = fmt->format; - -done: - mutex_unlock(&lif->entity.lock); - return ret; + return vsp1_subdev_set_pad_format(subdev, cfg, fmt, lif_codes, + ARRAY_SIZE(lif_codes), + LIF_MIN_SIZE, LIF_MIN_SIZE, + LIF_MAX_SIZE, LIF_MAX_SIZE); }
static const struct v4l2_subdev_pad_ops lif_pad_ops = { diff --git a/drivers/media/platform/vsp1/vsp1_lut.c b/drivers/media/platform/vsp1/vsp1_lut.c index 7bdabb311c6c..f2e48a02ca7d 100644 --- a/drivers/media/platform/vsp1/vsp1_lut.c +++ b/drivers/media/platform/vsp1/vsp1_lut.c @@ -90,18 +90,18 @@ static const struct v4l2_ctrl_config lut_table_control = { * V4L2 Subdevice Pad Operations */
+static const unsigned int lut_codes[] = { + MEDIA_BUS_FMT_ARGB8888_1X32, + MEDIA_BUS_FMT_AHSV8888_1X32, + MEDIA_BUS_FMT_AYUV8_1X32, +}; + static int lut_enum_mbus_code(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code) { - static const unsigned int codes[] = { - MEDIA_BUS_FMT_ARGB8888_1X32, - MEDIA_BUS_FMT_AHSV8888_1X32, - MEDIA_BUS_FMT_AYUV8_1X32, - }; - - return vsp1_subdev_enum_mbus_code(subdev, cfg, code, codes, - ARRAY_SIZE(codes)); + return vsp1_subdev_enum_mbus_code(subdev, cfg, code, lut_codes, + ARRAY_SIZE(lut_codes)); }
static int lut_enum_frame_size(struct v4l2_subdev *subdev, @@ -117,51 +117,10 @@ static int lut_set_format(struct v4l2_subdev *subdev, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { - struct vsp1_lut *lut = to_lut(subdev); - struct v4l2_subdev_pad_config *config; - struct v4l2_mbus_framefmt *format; - int ret = 0; - - mutex_lock(&lut->entity.lock); - - config = vsp1_entity_get_pad_config(&lut->entity, cfg, fmt->which); - if (!config) { - ret = -EINVAL; - goto done; - } - - /* Default to YUV if the requested format is not supported. */ - if (fmt->format.code != MEDIA_BUS_FMT_ARGB8888_1X32 && - fmt->format.code != MEDIA_BUS_FMT_AHSV8888_1X32 && - fmt->format.code != MEDIA_BUS_FMT_AYUV8_1X32) - fmt->format.code = MEDIA_BUS_FMT_AYUV8_1X32; - - format = vsp1_entity_get_pad_format(&lut->entity, config, fmt->pad); - - if (fmt->pad == LUT_PAD_SOURCE) { - /* The LUT output format can't be modified. */ - fmt->format = *format; - goto done; - } - - format->code = fmt->format.code; - format->width = clamp_t(unsigned int, fmt->format.width, - LUT_MIN_SIZE, LUT_MAX_SIZE); - format->height = clamp_t(unsigned int, fmt->format.height, - LUT_MIN_SIZE, LUT_MAX_SIZE); - format->field = V4L2_FIELD_NONE; - format->colorspace = V4L2_COLORSPACE_SRGB; - - fmt->format = *format; - - /* Propagate the format to the source pad. */ - format = vsp1_entity_get_pad_format(&lut->entity, config, - LUT_PAD_SOURCE); - *format = fmt->format; - -done: - mutex_unlock(&lut->entity.lock); - return ret; + return vsp1_subdev_set_pad_format(subdev, cfg, fmt, lut_codes, + ARRAY_SIZE(lut_codes), + LUT_MIN_SIZE, LUT_MIN_SIZE, + LUT_MAX_SIZE, LUT_MAX_SIZE); }
/* -----------------------------------------------------------------------------
To make vsp1_subdev_set_pad_format() usable by entities that support selection rectangles, we need to reset the crop and compose rectangles when setting the format on the sink pad. Do so and replace the custom set_fmt implementation of the histogram code by a call to vsp1_subdev_set_pad_format().
Resetting the crop and compose rectangles for entities that don't support crop and compose has no adverse effect as the rectangles are ignored anyway.
Signed-off-by: Laurent Pinchart laurent.pinchart+renesas@ideasonboard.com Reviewed-by: Jacopo Mondi jacopo@jmondi.org Reviewed-by: Kieran Bingham kieran.bingham+renesas@ideasonboard.com --- drivers/media/platform/vsp1/vsp1_entity.c | 16 +++++++++ drivers/media/platform/vsp1/vsp1_histo.c | 59 +++---------------------------- 2 files changed, 20 insertions(+), 55 deletions(-)
diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c index 9195a0eca467..f10c61339d46 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.c +++ b/drivers/media/platform/vsp1/vsp1_entity.c @@ -335,6 +335,7 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, struct vsp1_entity *entity = to_vsp1_entity(subdev); struct v4l2_subdev_pad_config *config; struct v4l2_mbus_framefmt *format; + struct v4l2_rect *selection; unsigned int i; int ret = 0;
@@ -377,6 +378,21 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, format = vsp1_entity_get_pad_format(entity, config, entity->source_pad); *format = fmt->format;
+ /* Reset the crop and compose rectangles */ + selection = vsp1_entity_get_pad_selection(entity, config, fmt->pad, + V4L2_SEL_TGT_CROP); + selection->left = 0; + selection->top = 0; + selection->width = format->width; + selection->height = format->height; + + selection = vsp1_entity_get_pad_selection(entity, config, fmt->pad, + V4L2_SEL_TGT_COMPOSE); + selection->left = 0; + selection->top = 0; + selection->width = format->width; + selection->height = format->height; + done: mutex_unlock(&entity->lock); return ret; diff --git a/drivers/media/platform/vsp1/vsp1_histo.c b/drivers/media/platform/vsp1/vsp1_histo.c index 029181c1fb61..5e15c8ff88d9 100644 --- a/drivers/media/platform/vsp1/vsp1_histo.c +++ b/drivers/media/platform/vsp1/vsp1_histo.c @@ -389,65 +389,14 @@ static int histo_set_format(struct v4l2_subdev *subdev, struct v4l2_subdev_format *fmt) { struct vsp1_histogram *histo = subdev_to_histo(subdev); - struct v4l2_subdev_pad_config *config; - struct v4l2_mbus_framefmt *format; - struct v4l2_rect *selection; - unsigned int i; - int ret = 0;
if (fmt->pad != HISTO_PAD_SINK) return histo_get_format(subdev, cfg, fmt);
- mutex_lock(&histo->entity.lock); - - config = vsp1_entity_get_pad_config(&histo->entity, cfg, fmt->which); - if (!config) { - ret = -EINVAL; - goto done; - } - - /* - * Default to the first format if the requested format is not - * supported. - */ - for (i = 0; i < histo->num_formats; ++i) { - if (fmt->format.code == histo->formats[i]) - break; - } - if (i == histo->num_formats) - fmt->format.code = histo->formats[0]; - - format = vsp1_entity_get_pad_format(&histo->entity, config, fmt->pad); - - format->code = fmt->format.code; - format->width = clamp_t(unsigned int, fmt->format.width, - HISTO_MIN_SIZE, HISTO_MAX_SIZE); - format->height = clamp_t(unsigned int, fmt->format.height, - HISTO_MIN_SIZE, HISTO_MAX_SIZE); - format->field = V4L2_FIELD_NONE; - format->colorspace = V4L2_COLORSPACE_SRGB; - - fmt->format = *format; - - /* Reset the crop and compose rectangles */ - selection = vsp1_entity_get_pad_selection(&histo->entity, config, - fmt->pad, V4L2_SEL_TGT_CROP); - selection->left = 0; - selection->top = 0; - selection->width = format->width; - selection->height = format->height; - - selection = vsp1_entity_get_pad_selection(&histo->entity, config, - fmt->pad, - V4L2_SEL_TGT_COMPOSE); - selection->left = 0; - selection->top = 0; - selection->width = format->width; - selection->height = format->height; - -done: - mutex_unlock(&histo->entity.lock); - return ret; + return vsp1_subdev_set_pad_format(subdev, cfg, fmt, + histo->formats, histo->num_formats, + HISTO_MIN_SIZE, HISTO_MIN_SIZE, + HISTO_MAX_SIZE, HISTO_MAX_SIZE); }
static const struct v4l2_subdev_pad_ops histo_pad_ops = {
The structure is used in the API that the VSP1 driver exposes to the DU driver. Documenting it is thus important.
Signed-off-by: Laurent Pinchart laurent.pinchart+renesas@ideasonboard.com Reviewed-by: Kieran Bingham kieran.bingham+renesas@ideasonboard.com --- Changes since v2:
- Fixed typo --- include/media/vsp1.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/include/media/vsp1.h b/include/media/vsp1.h index 68a8abe4fac5..ff7ef894465d 100644 --- a/include/media/vsp1.h +++ b/include/media/vsp1.h @@ -41,6 +41,16 @@ struct vsp1_du_lif_config { int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index, const struct vsp1_du_lif_config *cfg);
+/** + * struct vsp1_du_atomic_config - VSP atomic configuration parameters + * @pixelformat: plane pixel format (V4L2 4CC) + * @pitch: line pitch in bytes, for all planes + * @mem: DMA memory address for each plane of the frame buffer + * @src: source rectangle in the frame buffer (integer coordinates) + * @dst: destination rectangle on the display (integer coordinates) + * @alpha: alpha value (0: fully transparent, 255: fully opaque) + * @zpos: Z position of the plane (from 0 to number of planes minus 1) + */ struct vsp1_du_atomic_config { u32 pixelformat; unsigned int pitch;
Add a parameter (in the form of a structure to ease future API extensions) to the VSP atomic flush handler to pass CRC source configuration, and pass the CRC value to the completion callback.
Signed-off-by: Laurent Pinchart laurent.pinchart+renesas@ideasonboard.com Reviewed-by: Kieran Bingham kieran.bingham+renesas@ideasonboard.com --- Changes since v2:
- Name the CRC computation configuration parameters structure --- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 6 ++++-- drivers/media/platform/vsp1/vsp1_drm.c | 6 ++++-- drivers/media/platform/vsp1/vsp1_drm.h | 2 +- include/media/vsp1.h | 35 ++++++++++++++++++++++++++++++++-- 4 files changed, 42 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 2c260c33840b..bdcec201591f 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c @@ -31,7 +31,7 @@ #include "rcar_du_kms.h" #include "rcar_du_vsp.h"
-static void rcar_du_vsp_complete(void *private, bool completed) +static void rcar_du_vsp_complete(void *private, bool completed, u32 crc) { struct rcar_du_crtc *crtc = private;
@@ -102,7 +102,9 @@ void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc)
void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc) { - vsp1_du_atomic_flush(crtc->vsp->vsp, crtc->vsp_pipe); + struct vsp1_du_atomic_pipe_config cfg = { { 0, } }; + + vsp1_du_atomic_flush(crtc->vsp->vsp, crtc->vsp_pipe, &cfg); }
/* Keep the two tables in sync. */ diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index 2b29a83dceb9..5fc31578f9b0 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -36,7 +36,7 @@ static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline *pipe, bool complete = completion == VSP1_DL_FRAME_END_COMPLETED;
if (drm_pipe->du_complete) - drm_pipe->du_complete(drm_pipe->du_private, complete); + drm_pipe->du_complete(drm_pipe->du_private, complete, 0);
if (completion & VSP1_DL_FRAME_END_INTERNAL) { drm_pipe->force_brx_release = false; @@ -739,8 +739,10 @@ EXPORT_SYMBOL_GPL(vsp1_du_atomic_update); * vsp1_du_atomic_flush - Commit an atomic update * @dev: the VSP device * @pipe_index: the DRM pipeline index + * @cfg: atomic pipe configuration */ -void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index) +void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index, + const struct vsp1_du_atomic_pipe_config *cfg) { struct vsp1_device *vsp1 = dev_get_drvdata(dev); struct vsp1_drm_pipeline *drm_pipe = &vsp1->drm->pipe[pipe_index]; diff --git a/drivers/media/platform/vsp1/vsp1_drm.h b/drivers/media/platform/vsp1/vsp1_drm.h index f4af1b2b12d6..e5b88b28806c 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.h +++ b/drivers/media/platform/vsp1/vsp1_drm.h @@ -35,7 +35,7 @@ struct vsp1_drm_pipeline { wait_queue_head_t wait_queue;
/* Frame synchronisation */ - void (*du_complete)(void *, bool); + void (*du_complete)(void *data, bool completed, u32 crc); void *du_private; };
diff --git a/include/media/vsp1.h b/include/media/vsp1.h index ff7ef894465d..678c24de1ac6 100644 --- a/include/media/vsp1.h +++ b/include/media/vsp1.h @@ -34,7 +34,7 @@ struct vsp1_du_lif_config { unsigned int width; unsigned int height;
- void (*callback)(void *, bool); + void (*callback)(void *data, bool completed, u32 crc); void *callback_data; };
@@ -61,11 +61,42 @@ struct vsp1_du_atomic_config { unsigned int zpos; };
+/** + * enum vsp1_du_crc_source - Source used for CRC calculation + * @VSP1_DU_CRC_NONE: CRC calculation disabled + * @VSP1_DU_CRC_PLANE: Perform CRC calculation on an input plane + * @VSP1_DU_CRC_OUTPUT: Perform CRC calculation on the composed output + */ +enum vsp1_du_crc_source { + VSP1_DU_CRC_NONE, + VSP1_DU_CRC_PLANE, + VSP1_DU_CRC_OUTPUT, +}; + +/** + * struct vsp1_du_crc_config - VSP CRC computation configuration parameters + * @source: source for CRC calculation + * @index: index of the CRC source plane (when source is set to plane) + */ +struct vsp1_du_crc_config { + enum vsp1_du_crc_source source; + unsigned int index; +}; + +/** + * struct vsp1_du_atomic_pipe_config - VSP atomic pipe configuration parameters + * @crc: CRC computation configuration + */ +struct vsp1_du_atomic_pipe_config { + struct vsp1_du_crc_config crc; +}; + void vsp1_du_atomic_begin(struct device *dev, unsigned int pipe_index); int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index, unsigned int rpf, const struct vsp1_du_atomic_config *cfg); -void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index); +void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index, + const struct vsp1_du_atomic_pipe_config *cfg); int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt); void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt);
Hi Laurent, thanks for the patch
On Sat, Apr 28, 2018 at 11:50:24PM +0300, Laurent Pinchart wrote:
Add a parameter (in the form of a structure to ease future API extensions) to the VSP atomic flush handler to pass CRC source configuration, and pass the CRC value to the completion callback.
Signed-off-by: Laurent Pinchart laurent.pinchart+renesas@ideasonboard.com Reviewed-by: Kieran Bingham kieran.bingham+renesas@ideasonboard.com
Reviewed-by: Jacopo Mondi jacopo+renesas@jmondi.org
Thanks j
Changes since v2:
- Name the CRC computation configuration parameters structure
drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 6 ++++-- drivers/media/platform/vsp1/vsp1_drm.c | 6 ++++-- drivers/media/platform/vsp1/vsp1_drm.h | 2 +- include/media/vsp1.h | 35 ++++++++++++++++++++++++++++++++-- 4 files changed, 42 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 2c260c33840b..bdcec201591f 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c @@ -31,7 +31,7 @@ #include "rcar_du_kms.h" #include "rcar_du_vsp.h"
-static void rcar_du_vsp_complete(void *private, bool completed) +static void rcar_du_vsp_complete(void *private, bool completed, u32 crc) { struct rcar_du_crtc *crtc = private;
@@ -102,7 +102,9 @@ void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc)
void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc) {
- vsp1_du_atomic_flush(crtc->vsp->vsp, crtc->vsp_pipe);
- struct vsp1_du_atomic_pipe_config cfg = { { 0, } };
- vsp1_du_atomic_flush(crtc->vsp->vsp, crtc->vsp_pipe, &cfg);
}
/* Keep the two tables in sync. */ diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index 2b29a83dceb9..5fc31578f9b0 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -36,7 +36,7 @@ static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline *pipe, bool complete = completion == VSP1_DL_FRAME_END_COMPLETED;
if (drm_pipe->du_complete)
drm_pipe->du_complete(drm_pipe->du_private, complete);
drm_pipe->du_complete(drm_pipe->du_private, complete, 0);
if (completion & VSP1_DL_FRAME_END_INTERNAL) { drm_pipe->force_brx_release = false;
@@ -739,8 +739,10 @@ EXPORT_SYMBOL_GPL(vsp1_du_atomic_update);
- vsp1_du_atomic_flush - Commit an atomic update
- @dev: the VSP device
- @pipe_index: the DRM pipeline index
*/
- @cfg: atomic pipe configuration
-void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index) +void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index,
const struct vsp1_du_atomic_pipe_config *cfg)
{ struct vsp1_device *vsp1 = dev_get_drvdata(dev); struct vsp1_drm_pipeline *drm_pipe = &vsp1->drm->pipe[pipe_index]; diff --git a/drivers/media/platform/vsp1/vsp1_drm.h b/drivers/media/platform/vsp1/vsp1_drm.h index f4af1b2b12d6..e5b88b28806c 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.h +++ b/drivers/media/platform/vsp1/vsp1_drm.h @@ -35,7 +35,7 @@ struct vsp1_drm_pipeline { wait_queue_head_t wait_queue;
/* Frame synchronisation */
- void (*du_complete)(void *, bool);
- void (*du_complete)(void *data, bool completed, u32 crc); void *du_private;
};
diff --git a/include/media/vsp1.h b/include/media/vsp1.h index ff7ef894465d..678c24de1ac6 100644 --- a/include/media/vsp1.h +++ b/include/media/vsp1.h @@ -34,7 +34,7 @@ struct vsp1_du_lif_config { unsigned int width; unsigned int height;
- void (*callback)(void *, bool);
- void (*callback)(void *data, bool completed, u32 crc); void *callback_data;
};
@@ -61,11 +61,42 @@ struct vsp1_du_atomic_config { unsigned int zpos; };
+/**
- enum vsp1_du_crc_source - Source used for CRC calculation
- @VSP1_DU_CRC_NONE: CRC calculation disabled
- @VSP1_DU_CRC_PLANE: Perform CRC calculation on an input plane
- @VSP1_DU_CRC_OUTPUT: Perform CRC calculation on the composed output
- */
+enum vsp1_du_crc_source {
- VSP1_DU_CRC_NONE,
- VSP1_DU_CRC_PLANE,
- VSP1_DU_CRC_OUTPUT,
+};
+/**
- struct vsp1_du_crc_config - VSP CRC computation configuration parameters
- @source: source for CRC calculation
- @index: index of the CRC source plane (when source is set to plane)
- */
+struct vsp1_du_crc_config {
- enum vsp1_du_crc_source source;
- unsigned int index;
+};
+/**
- struct vsp1_du_atomic_pipe_config - VSP atomic pipe configuration parameters
- @crc: CRC computation configuration
- */
+struct vsp1_du_atomic_pipe_config {
- struct vsp1_du_crc_config crc;
+};
void vsp1_du_atomic_begin(struct device *dev, unsigned int pipe_index); int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index, unsigned int rpf, const struct vsp1_du_atomic_config *cfg); -void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index); +void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index,
const struct vsp1_du_atomic_pipe_config *cfg);
int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt); void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt);
-- Regards,
Laurent Pinchart
The DISCOM calculates a CRC on a configurable window of the frame. It interfaces to the VSP through the UIF glue, hence the name used in the code.
The module supports configuration of the CRC window through the crop rectangle on the sink pad of the corresponding entity. However, unlike the traditional V4L2 subdevice model, the crop rectangle does not influence the format on the source pad.
Modeling the DISCOM as a sink-only entity would allow adhering to the V4L2 subdevice model at the expense of more complex code in the driver, as at the hardware level the UIF is handled as a sink+source entity. As the DISCOM is only present in R-Car Gen3 VSP-D and VSP-DL instances it is not exposed to userspace through V4L2 but controlled through the DU driver. We can thus change this model later if needed without fear of affecting userspace.
Signed-off-by: Laurent Pinchart laurent.pinchart+renesas@ideasonboard.com Reviewed-by: Jacopo Mondi jacopo@jmondi.org Reviewed-by: Kieran Bingham kieran.bingham+renesas@ideasonboard.com --- Changes since v2:
- Change comparison to NULL to the ! operator - Clarify M3-W quirk handling - Fix typo in commit message
Changes since v1:
- Don't return uninitialized value from uif_set_selection() --- drivers/media/platform/vsp1/Makefile | 2 +- drivers/media/platform/vsp1/vsp1.h | 4 + drivers/media/platform/vsp1/vsp1_drv.c | 20 +++ drivers/media/platform/vsp1/vsp1_entity.c | 6 + drivers/media/platform/vsp1/vsp1_entity.h | 1 + drivers/media/platform/vsp1/vsp1_regs.h | 41 +++++ drivers/media/platform/vsp1/vsp1_uif.c | 271 ++++++++++++++++++++++++++++++ drivers/media/platform/vsp1/vsp1_uif.h | 32 ++++ 8 files changed, 376 insertions(+), 1 deletion(-) create mode 100644 drivers/media/platform/vsp1/vsp1_uif.c create mode 100644 drivers/media/platform/vsp1/vsp1_uif.h
diff --git a/drivers/media/platform/vsp1/Makefile b/drivers/media/platform/vsp1/Makefile index 596775f932c0..4bb4dcbef7b5 100644 --- a/drivers/media/platform/vsp1/Makefile +++ b/drivers/media/platform/vsp1/Makefile @@ -5,6 +5,6 @@ vsp1-y += vsp1_rpf.o vsp1_rwpf.o vsp1_wpf.o vsp1-y += vsp1_clu.o vsp1_hsit.o vsp1_lut.o vsp1-y += vsp1_brx.o vsp1_sru.o vsp1_uds.o vsp1-y += vsp1_hgo.o vsp1_hgt.o vsp1_histo.o -vsp1-y += vsp1_lif.o +vsp1-y += vsp1_lif.o vsp1_uif.o
obj-$(CONFIG_VIDEO_RENESAS_VSP1) += vsp1.o diff --git a/drivers/media/platform/vsp1/vsp1.h b/drivers/media/platform/vsp1/vsp1.h index 9cf4e1c4b036..33f632331474 100644 --- a/drivers/media/platform/vsp1/vsp1.h +++ b/drivers/media/platform/vsp1/vsp1.h @@ -36,10 +36,12 @@ struct vsp1_lut; struct vsp1_rwpf; struct vsp1_sru; struct vsp1_uds; +struct vsp1_uif;
#define VSP1_MAX_LIF 2 #define VSP1_MAX_RPF 5 #define VSP1_MAX_UDS 3 +#define VSP1_MAX_UIF 2 #define VSP1_MAX_WPF 4
#define VSP1_HAS_LUT (1 << 1) @@ -60,6 +62,7 @@ struct vsp1_device_info { unsigned int lif_count; unsigned int rpf_count; unsigned int uds_count; + unsigned int uif_count; unsigned int wpf_count; unsigned int num_bru_inputs; bool uapi; @@ -86,6 +89,7 @@ struct vsp1_device { struct vsp1_rwpf *rpf[VSP1_MAX_RPF]; struct vsp1_sru *sru; struct vsp1_uds *uds[VSP1_MAX_UDS]; + struct vsp1_uif *uif[VSP1_MAX_UIF]; struct vsp1_rwpf *wpf[VSP1_MAX_WPF];
struct list_head entities; diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index 331a2e0af0d3..d29f9c4baebe 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -35,6 +35,7 @@ #include "vsp1_rwpf.h" #include "vsp1_sru.h" #include "vsp1_uds.h" +#include "vsp1_uif.h" #include "vsp1_video.h"
/* ----------------------------------------------------------------------------- @@ -409,6 +410,19 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) list_add_tail(&uds->entity.list_dev, &vsp1->entities); }
+ for (i = 0; i < vsp1->info->uif_count; ++i) { + struct vsp1_uif *uif; + + uif = vsp1_uif_create(vsp1, i); + if (IS_ERR(uif)) { + ret = PTR_ERR(uif); + goto done; + } + + vsp1->uif[i] = uif; + list_add_tail(&uif->entity.list_dev, &vsp1->entities); + } + for (i = 0; i < vsp1->info->wpf_count; ++i) { struct vsp1_rwpf *wpf;
@@ -513,6 +527,9 @@ static int vsp1_device_init(struct vsp1_device *vsp1) for (i = 0; i < vsp1->info->uds_count; ++i) vsp1_write(vsp1, VI6_DPR_UDS_ROUTE(i), VI6_DPR_NODE_UNUSED);
+ for (i = 0; i < vsp1->info->uif_count; ++i) + vsp1_write(vsp1, VI6_DPR_UIF_ROUTE(i), VI6_DPR_NODE_UNUSED); + vsp1_write(vsp1, VI6_DPR_SRU_ROUTE, VI6_DPR_NODE_UNUSED); vsp1_write(vsp1, VI6_DPR_LUT_ROUTE, VI6_DPR_NODE_UNUSED); vsp1_write(vsp1, VI6_DPR_CLU_ROUTE, VI6_DPR_NODE_UNUSED); @@ -740,6 +757,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { .features = VSP1_HAS_BRU | VSP1_HAS_WPF_VFLIP, .lif_count = 1, .rpf_count = 5, + .uif_count = 1, .wpf_count = 2, .num_bru_inputs = 5, }, { @@ -749,6 +767,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { .features = VSP1_HAS_BRS | VSP1_HAS_BRU, .lif_count = 1, .rpf_count = 5, + .uif_count = 1, .wpf_count = 1, .num_bru_inputs = 5, }, { @@ -758,6 +777,7 @@ static const struct vsp1_device_info vsp1_device_infos[] = { .features = VSP1_HAS_BRS | VSP1_HAS_BRU, .lif_count = 2, .rpf_count = 5, + .uif_count = 2, .wpf_count = 2, .num_bru_inputs = 5, }, diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c index f10c61339d46..c411643695e4 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.c +++ b/drivers/media/platform/vsp1/vsp1_entity.c @@ -539,6 +539,10 @@ struct media_pad *vsp1_entity_remote_pad(struct media_pad *pad) { VSP1_ENTITY_UDS, idx, VI6_DPR_UDS_ROUTE(idx), \ { VI6_DPR_NODE_UDS(idx) }, VI6_DPR_NODE_UDS(idx) }
+#define VSP1_ENTITY_ROUTE_UIF(idx) \ + { VSP1_ENTITY_UIF, idx, VI6_DPR_UIF_ROUTE(idx), \ + { VI6_DPR_NODE_UIF(idx) }, VI6_DPR_NODE_UIF(idx) } + #define VSP1_ENTITY_ROUTE_WPF(idx) \ { VSP1_ENTITY_WPF, idx, 0, \ { VI6_DPR_NODE_WPF(idx) }, VI6_DPR_NODE_WPF(idx) } @@ -567,6 +571,8 @@ static const struct vsp1_route vsp1_routes[] = { VSP1_ENTITY_ROUTE_UDS(0), VSP1_ENTITY_ROUTE_UDS(1), VSP1_ENTITY_ROUTE_UDS(2), + VSP1_ENTITY_ROUTE_UIF(0), /* Named UIF4 in the documentation */ + VSP1_ENTITY_ROUTE_UIF(1), /* Named UIF5 in the documentation */ VSP1_ENTITY_ROUTE_WPF(0), VSP1_ENTITY_ROUTE_WPF(1), VSP1_ENTITY_ROUTE_WPF(2), diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h index 0839a62cfa71..94490d697dcf 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.h +++ b/drivers/media/platform/vsp1/vsp1_entity.h @@ -33,6 +33,7 @@ enum vsp1_entity_type { VSP1_ENTITY_RPF, VSP1_ENTITY_SRU, VSP1_ENTITY_UDS, + VSP1_ENTITY_UIF, VSP1_ENTITY_WPF, };
diff --git a/drivers/media/platform/vsp1/vsp1_regs.h b/drivers/media/platform/vsp1/vsp1_regs.h index 3201ad4b77d4..0d249ff9f564 100644 --- a/drivers/media/platform/vsp1/vsp1_regs.h +++ b/drivers/media/platform/vsp1/vsp1_regs.h @@ -307,6 +307,44 @@ #define VI6_WPF_WRBCK_CTRL 0x1034 #define VI6_WPF_WRBCK_CTRL_WBMD (1 << 0)
+/* ----------------------------------------------------------------------------- + * UIF Control Registers + */ + +#define VI6_UIF_OFFSET 0x100 + +#define VI6_UIF_DISCOM_DOCMCR 0x1c00 +#define VI6_UIF_DISCOM_DOCMCR_CMPRU (1 << 16) +#define VI6_UIF_DISCOM_DOCMCR_CMPR (1 << 0) + +#define VI6_UIF_DISCOM_DOCMSTR 0x1c04 +#define VI6_UIF_DISCOM_DOCMSTR_CMPPRE (1 << 1) +#define VI6_UIF_DISCOM_DOCMSTR_CMPST (1 << 0) + +#define VI6_UIF_DISCOM_DOCMCLSTR 0x1c08 +#define VI6_UIF_DISCOM_DOCMCLSTR_CMPCLPRE (1 << 1) +#define VI6_UIF_DISCOM_DOCMCLSTR_CMPCLST (1 << 0) + +#define VI6_UIF_DISCOM_DOCMIENR 0x1c0c +#define VI6_UIF_DISCOM_DOCMIENR_CMPPREIEN (1 << 1) +#define VI6_UIF_DISCOM_DOCMIENR_CMPIEN (1 << 0) + +#define VI6_UIF_DISCOM_DOCMMDR 0x1c10 +#define VI6_UIF_DISCOM_DOCMMDR_INTHRH(n) ((n) << 16) + +#define VI6_UIF_DISCOM_DOCMPMR 0x1c14 +#define VI6_UIF_DISCOM_DOCMPMR_CMPDFF(n) ((n) << 17) +#define VI6_UIF_DISCOM_DOCMPMR_CMPDFA(n) ((n) << 8) +#define VI6_UIF_DISCOM_DOCMPMR_CMPDAUF (1 << 7) +#define VI6_UIF_DISCOM_DOCMPMR_SEL(n) ((n) << 0) + +#define VI6_UIF_DISCOM_DOCMECRCR 0x1c18 +#define VI6_UIF_DISCOM_DOCMCCRCR 0x1c1c +#define VI6_UIF_DISCOM_DOCMSPXR 0x1c20 +#define VI6_UIF_DISCOM_DOCMSPYR 0x1c24 +#define VI6_UIF_DISCOM_DOCMSZXR 0x1c28 +#define VI6_UIF_DISCOM_DOCMSZYR 0x1c2c + /* ----------------------------------------------------------------------------- * DPR Control Registers */ @@ -339,7 +377,10 @@ #define VI6_DPR_SMPPT_PT_MASK (0x3f << 0) #define VI6_DPR_SMPPT_PT_SHIFT 0
+#define VI6_DPR_UIF_ROUTE(n) (0x2074 + (n) * 4) + #define VI6_DPR_NODE_RPF(n) (n) +#define VI6_DPR_NODE_UIF(n) (12 + (n)) #define VI6_DPR_NODE_SRU 16 #define VI6_DPR_NODE_UDS(n) (17 + (n)) #define VI6_DPR_NODE_LUT 22 diff --git a/drivers/media/platform/vsp1/vsp1_uif.c b/drivers/media/platform/vsp1/vsp1_uif.c new file mode 100644 index 000000000000..c219165b15b9 --- /dev/null +++ b/drivers/media/platform/vsp1/vsp1_uif.c @@ -0,0 +1,271 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * vsp1_uif.c -- R-Car VSP1 User Logic Interface + * + * Copyright (C) 2017-2018 Laurent Pinchart + * + * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) + */ + +#include <linux/device.h> +#include <linux/gfp.h> +#include <linux/sys_soc.h> + +#include <media/media-entity.h> +#include <media/v4l2-subdev.h> + +#include "vsp1.h" +#include "vsp1_dl.h" +#include "vsp1_entity.h" +#include "vsp1_uif.h" + +#define UIF_MIN_SIZE 4U +#define UIF_MAX_SIZE 8190U + +/* ----------------------------------------------------------------------------- + * Device Access + */ + +static inline u32 vsp1_uif_read(struct vsp1_uif *uif, u32 reg) +{ + return vsp1_read(uif->entity.vsp1, + uif->entity.index * VI6_UIF_OFFSET + reg); +} +static inline void vsp1_uif_write(struct vsp1_uif *uif, struct vsp1_dl_list *dl, + u32 reg, u32 data) +{ + vsp1_dl_list_write(dl, reg + uif->entity.index * VI6_UIF_OFFSET, data); +} + +u32 vsp1_uif_get_crc(struct vsp1_uif *uif) +{ + return vsp1_uif_read(uif, VI6_UIF_DISCOM_DOCMCCRCR); +} + +/* ----------------------------------------------------------------------------- + * V4L2 Subdevice Pad Operations + */ + +static const unsigned int uif_codes[] = { + MEDIA_BUS_FMT_ARGB8888_1X32, + MEDIA_BUS_FMT_AHSV8888_1X32, + MEDIA_BUS_FMT_AYUV8_1X32, +}; + +static int uif_enum_mbus_code(struct v4l2_subdev *subdev, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_mbus_code_enum *code) +{ + return vsp1_subdev_enum_mbus_code(subdev, cfg, code, uif_codes, + ARRAY_SIZE(uif_codes)); +} + +static int uif_enum_frame_size(struct v4l2_subdev *subdev, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_frame_size_enum *fse) +{ + return vsp1_subdev_enum_frame_size(subdev, cfg, fse, UIF_MIN_SIZE, + UIF_MIN_SIZE, UIF_MAX_SIZE, + UIF_MAX_SIZE); +} + +static int uif_set_format(struct v4l2_subdev *subdev, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *fmt) +{ + return vsp1_subdev_set_pad_format(subdev, cfg, fmt, uif_codes, + ARRAY_SIZE(uif_codes), + UIF_MIN_SIZE, UIF_MIN_SIZE, + UIF_MAX_SIZE, UIF_MAX_SIZE); +} + +static int uif_get_selection(struct v4l2_subdev *subdev, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) +{ + struct vsp1_uif *uif = to_uif(subdev); + struct v4l2_subdev_pad_config *config; + struct v4l2_mbus_framefmt *format; + int ret = 0; + + if (sel->pad != UIF_PAD_SINK) + return -EINVAL; + + mutex_lock(&uif->entity.lock); + + config = vsp1_entity_get_pad_config(&uif->entity, cfg, sel->which); + if (!config) { + ret = -EINVAL; + goto done; + } + + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + format = vsp1_entity_get_pad_format(&uif->entity, config, + UIF_PAD_SINK); + sel->r.left = 0; + sel->r.top = 0; + sel->r.width = format->width; + sel->r.height = format->height; + break; + + case V4L2_SEL_TGT_CROP: + sel->r = *vsp1_entity_get_pad_selection(&uif->entity, config, + sel->pad, sel->target); + break; + + default: + ret = -EINVAL; + break; + } + +done: + mutex_unlock(&uif->entity.lock); + return ret; +} + +static int uif_set_selection(struct v4l2_subdev *subdev, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_selection *sel) +{ + struct vsp1_uif *uif = to_uif(subdev); + struct v4l2_subdev_pad_config *config; + struct v4l2_mbus_framefmt *format; + struct v4l2_rect *selection; + int ret = 0; + + if (sel->pad != UIF_PAD_SINK || + sel->target != V4L2_SEL_TGT_CROP) + return -EINVAL; + + mutex_lock(&uif->entity.lock); + + config = vsp1_entity_get_pad_config(&uif->entity, cfg, sel->which); + if (!config) { + ret = -EINVAL; + goto done; + } + + /* The crop rectangle must be inside the input frame. */ + format = vsp1_entity_get_pad_format(&uif->entity, config, UIF_PAD_SINK); + + sel->r.left = clamp_t(unsigned int, sel->r.left, 0, format->width - 1); + sel->r.top = clamp_t(unsigned int, sel->r.top, 0, format->height - 1); + sel->r.width = clamp_t(unsigned int, sel->r.width, UIF_MIN_SIZE, + format->width - sel->r.left); + sel->r.height = clamp_t(unsigned int, sel->r.height, UIF_MIN_SIZE, + format->height - sel->r.top); + + /* Store the crop rectangle. */ + selection = vsp1_entity_get_pad_selection(&uif->entity, config, + sel->pad, V4L2_SEL_TGT_CROP); + *selection = sel->r; + +done: + mutex_unlock(&uif->entity.lock); + return ret; +} + +/* ----------------------------------------------------------------------------- + * V4L2 Subdevice Operations + */ + +static const struct v4l2_subdev_pad_ops uif_pad_ops = { + .init_cfg = vsp1_entity_init_cfg, + .enum_mbus_code = uif_enum_mbus_code, + .enum_frame_size = uif_enum_frame_size, + .get_fmt = vsp1_subdev_get_pad_format, + .set_fmt = uif_set_format, + .get_selection = uif_get_selection, + .set_selection = uif_set_selection, +}; + +static const struct v4l2_subdev_ops uif_ops = { + .pad = &uif_pad_ops, +}; + +/* ----------------------------------------------------------------------------- + * VSP1 Entity Operations + */ + +static void uif_configure(struct vsp1_entity *entity, + struct vsp1_pipeline *pipe, + struct vsp1_dl_list *dl, + enum vsp1_entity_params params) +{ + struct vsp1_uif *uif = to_uif(&entity->subdev); + const struct v4l2_rect *crop; + unsigned int left; + unsigned int width; + + /* + * Per-partition configuration isn't needed as the DISCOM is used in + * display pipelines only. + */ + if (params != VSP1_ENTITY_PARAMS_INIT) + return; + + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMPMR, + VI6_UIF_DISCOM_DOCMPMR_SEL(9)); + + crop = vsp1_entity_get_pad_selection(entity, entity->config, + UIF_PAD_SINK, V4L2_SEL_TGT_CROP); + + left = crop->left; + width = crop->width; + + /* On M3-W the horizontal coordinates are twice the register value. */ + if (uif->m3w_quirk) { + left /= 2; + width /= 2; + } + + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMSPXR, left); + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMSPYR, crop->top); + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMSZXR, width); + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMSZYR, crop->height); + + vsp1_uif_write(uif, dl, VI6_UIF_DISCOM_DOCMCR, + VI6_UIF_DISCOM_DOCMCR_CMPR); +} + +static const struct vsp1_entity_operations uif_entity_ops = { + .configure = uif_configure, +}; + +/* ----------------------------------------------------------------------------- + * Initialization and Cleanup + */ + +static const struct soc_device_attribute vsp1_r8a7796[] = { + { .soc_id = "r8a7796" }, + { /* sentinel */ } +}; + +struct vsp1_uif *vsp1_uif_create(struct vsp1_device *vsp1, unsigned int index) +{ + struct vsp1_uif *uif; + char name[6]; + int ret; + + uif = devm_kzalloc(vsp1->dev, sizeof(*uif), GFP_KERNEL); + if (!uif) + return ERR_PTR(-ENOMEM); + + if (soc_device_match(vsp1_r8a7796)) + uif->m3w_quirk = true; + + uif->entity.ops = &uif_entity_ops; + uif->entity.type = VSP1_ENTITY_UIF; + uif->entity.index = index; + + /* The datasheet names the two UIF instances UIF4 and UIF5. */ + sprintf(name, "uif.%u", index + 4); + ret = vsp1_entity_init(vsp1, &uif->entity, name, 2, &uif_ops, + MEDIA_ENT_F_PROC_VIDEO_STATISTICS); + if (ret < 0) + return ERR_PTR(ret); + + return uif; +} diff --git a/drivers/media/platform/vsp1/vsp1_uif.h b/drivers/media/platform/vsp1/vsp1_uif.h new file mode 100644 index 000000000000..c71ab5f6a6f8 --- /dev/null +++ b/drivers/media/platform/vsp1/vsp1_uif.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * vsp1_uif.h -- R-Car VSP1 User Logic Interface + * + * Copyright (C) 2017-2018 Laurent Pinchart + * + * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) + */ +#ifndef __VSP1_UIF_H__ +#define __VSP1_UIF_H__ + +#include "vsp1_entity.h" + +struct vsp1_device; + +#define UIF_PAD_SINK 0 +#define UIF_PAD_SOURCE 1 + +struct vsp1_uif { + struct vsp1_entity entity; + bool m3w_quirk; +}; + +static inline struct vsp1_uif *to_uif(struct v4l2_subdev *subdev) +{ + return container_of(subdev, struct vsp1_uif, entity.subdev); +} + +struct vsp1_uif *vsp1_uif_create(struct vsp1_device *vsp1, unsigned int index); +u32 vsp1_uif_get_crc(struct vsp1_uif *uif); + +#endif /* __VSP1_UIF_H__ */
The DISCOM is used to compute CRCs on display frames. Integrate it in the display pipeline at the output of the blending unit to process output frames.
Computing CRCs on input frames is possible by positioning the DISCOM at a different point in the pipeline. This use case isn't supported at the moment and could be implemented by extending the API between the VSP1 and DU drivers if needed.
Signed-off-by: Laurent Pinchart laurent.pinchart+renesas@ideasonboard.com Reviewed-by: Kieran Bingham kieran.bingham+renesas@ideasonboard.com --- Changes since v2:
- Reduce indentation in vsp1_du_insert_uif() - Use vsp1_du_crc_config structure in vsp1_drm_pipeline --- drivers/media/platform/vsp1/vsp1_drm.c | 115 ++++++++++++++++++++++++++++++++- drivers/media/platform/vsp1/vsp1_drm.h | 7 ++ 2 files changed, 119 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index 5fc31578f9b0..08667e3640b2 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -22,6 +22,7 @@ #include "vsp1_lif.h" #include "vsp1_pipe.h" #include "vsp1_rwpf.h" +#include "vsp1_uif.h"
#define BRX_NAME(e) (e)->type == VSP1_ENTITY_BRU ? "BRU" : "BRS"
@@ -35,8 +36,13 @@ static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline *pipe, struct vsp1_drm_pipeline *drm_pipe = to_vsp1_drm_pipeline(pipe); bool complete = completion == VSP1_DL_FRAME_END_COMPLETED;
- if (drm_pipe->du_complete) - drm_pipe->du_complete(drm_pipe->du_private, complete, 0); + if (drm_pipe->du_complete) { + struct vsp1_entity *uif = drm_pipe->uif; + u32 crc; + + crc = uif ? vsp1_uif_get_crc(to_uif(&uif->subdev)) : 0; + drm_pipe->du_complete(drm_pipe->du_private, complete, crc); + }
if (completion & VSP1_DL_FRAME_END_INTERNAL) { drm_pipe->force_brx_release = false; @@ -48,10 +54,66 @@ static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline *pipe, * Pipeline Configuration */
+/* + * Insert the UIF in the pipeline between the prev and next entities. If no UIF + * is available connect the two entities directly. + */ +static int vsp1_du_insert_uif(struct vsp1_device *vsp1, + struct vsp1_pipeline *pipe, + struct vsp1_entity *uif, + struct vsp1_entity *prev, unsigned int prev_pad, + struct vsp1_entity *next, unsigned int next_pad) +{ + struct v4l2_subdev_format format; + int ret; + + if (!uif) { + /* + * If there's no UIF to bee inserted connected the previous and + * next entities directly. + */ + prev->sink = next; + prev->sink_pad = next_pad; + return 0; + } + + prev->sink = uif; + prev->sink_pad = UIF_PAD_SINK; + + memset(&format, 0, sizeof(format)); + format.which = V4L2_SUBDEV_FORMAT_ACTIVE; + format.pad = prev_pad; + + ret = v4l2_subdev_call(&prev->subdev, pad, get_fmt, NULL, &format); + if (ret < 0) + return ret; + + format.pad = UIF_PAD_SINK; + + ret = v4l2_subdev_call(&uif->subdev, pad, set_fmt, NULL, &format); + if (ret < 0) + return ret; + + dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on UIF sink\n", + __func__, format.format.width, format.format.height, + format.format.code); + + /* + * The UIF doesn't mangle the format between its sink and source pads, + * so there is no need to retrieve the format on its source pad. + */ + + uif->sink = next; + uif->sink_pad = next_pad; + + return 0; +} + /* Setup one RPF and the connected BRx sink pad. */ static int vsp1_du_pipeline_setup_rpf(struct vsp1_device *vsp1, struct vsp1_pipeline *pipe, struct vsp1_rwpf *rpf, + struct vsp1_entity *uif, unsigned int brx_input) { struct v4l2_subdev_selection sel; @@ -122,6 +184,12 @@ static int vsp1_du_pipeline_setup_rpf(struct vsp1_device *vsp1, if (ret < 0) return ret;
+ /* Insert and configure the UIF if available. */ + ret = vsp1_du_insert_uif(vsp1, pipe, uif, &rpf->entity, RWPF_PAD_SOURCE, + pipe->brx, brx_input); + if (ret < 0) + return ret; + /* BRx sink, propagate the format from the RPF source. */ format.pad = brx_input;
@@ -297,7 +365,10 @@ static unsigned int rpf_zpos(struct vsp1_device *vsp1, struct vsp1_rwpf *rpf) static int vsp1_du_pipeline_setup_inputs(struct vsp1_device *vsp1, struct vsp1_pipeline *pipe) { + struct vsp1_drm_pipeline *drm_pipe = to_vsp1_drm_pipeline(pipe); struct vsp1_rwpf *inputs[VSP1_MAX_RPF] = { NULL, }; + struct vsp1_entity *uif; + bool use_uif = false; struct vsp1_brx *brx; unsigned int i; int ret; @@ -358,7 +429,11 @@ static int vsp1_du_pipeline_setup_inputs(struct vsp1_device *vsp1, dev_dbg(vsp1->dev, "%s: connecting RPF.%u to %s:%u\n", __func__, rpf->entity.index, BRX_NAME(pipe->brx), i);
- ret = vsp1_du_pipeline_setup_rpf(vsp1, pipe, rpf, i); + uif = drm_pipe->crc.source == VSP1_DU_CRC_PLANE && + drm_pipe->crc.index == i ? drm_pipe->uif : NULL; + if (uif) + use_uif = true; + ret = vsp1_du_pipeline_setup_rpf(vsp1, pipe, rpf, uif, i); if (ret < 0) { dev_err(vsp1->dev, "%s: failed to setup RPF.%u\n", @@ -367,6 +442,31 @@ static int vsp1_du_pipeline_setup_inputs(struct vsp1_device *vsp1, } }
+ /* Insert and configure the UIF at the BRx output if available. */ + uif = drm_pipe->crc.source == VSP1_DU_CRC_OUTPUT ? drm_pipe->uif : NULL; + if (uif) + use_uif = true; + ret = vsp1_du_insert_uif(vsp1, pipe, uif, + pipe->brx, pipe->brx->source_pad, + &pipe->output->entity, 0); + if (ret < 0) + dev_err(vsp1->dev, "%s: failed to setup UIF after %s\n", + __func__, BRX_NAME(pipe->brx)); + + /* + * If the UIF is not in use schedule it for removal by setting its pipe + * pointer to NULL, vsp1_du_pipeline_configure() will remove it from the + * hardware pipeline and from the pipeline's list of entities. Otherwise + * make sure it is present in the pipeline's list of entities if it + * wasn't already. + */ + if (!use_uif) { + drm_pipe->uif->pipe = NULL; + } else if (!drm_pipe->uif->pipe) { + drm_pipe->uif->pipe = pipe; + list_add_tail(&drm_pipe->uif->list_pipe, &pipe->entities); + } + return 0; }
@@ -748,6 +848,8 @@ void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index, struct vsp1_drm_pipeline *drm_pipe = &vsp1->drm->pipe[pipe_index]; struct vsp1_pipeline *pipe = &drm_pipe->pipe;
+ drm_pipe->crc = cfg->crc; + vsp1_du_pipeline_setup_inputs(vsp1, pipe); vsp1_du_pipeline_configure(pipe); mutex_unlock(&vsp1->drm->lock); @@ -816,6 +918,13 @@ int vsp1_drm_init(struct vsp1_device *vsp1)
pipe->lif->pipe = pipe; list_add_tail(&pipe->lif->list_pipe, &pipe->entities); + + /* + * CRC computation is initially disabled, don't add the UIF to + * the pipeline. + */ + if (i < vsp1->info->uif_count) + drm_pipe->uif = &vsp1->uif[i]->entity; }
/* Disable all RPFs initially. */ diff --git a/drivers/media/platform/vsp1/vsp1_drm.h b/drivers/media/platform/vsp1/vsp1_drm.h index e5b88b28806c..8dfd274a59e2 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.h +++ b/drivers/media/platform/vsp1/vsp1_drm.h @@ -13,6 +13,8 @@ #include <linux/videodev2.h> #include <linux/wait.h>
+#include <media/vsp1.h> + #include "vsp1_pipe.h"
/** @@ -22,6 +24,8 @@ * @height: output display height * @force_brx_release: when set, release the BRx during the next reconfiguration * @wait_queue: wait queue to wait for BRx release completion + * @uif: UIF entity if available for the pipeline + * @crc: CRC computation configuration * @du_complete: frame completion callback for the DU driver (optional) * @du_private: data to be passed to the du_complete callback */ @@ -34,6 +38,9 @@ struct vsp1_drm_pipeline { bool force_brx_release; wait_queue_head_t wait_queue;
+ struct vsp1_entity *uif; + struct vsp1_du_crc_config crc; + /* Frame synchronisation */ void (*du_complete)(void *data, bool completed, u32 crc); void *du_private;
Hi Laurent, thanks for addressing comments on v2
On Sat, Apr 28, 2018 at 11:50:26PM +0300, Laurent Pinchart wrote:
The DISCOM is used to compute CRCs on display frames. Integrate it in the display pipeline at the output of the blending unit to process output frames.
Computing CRCs on input frames is possible by positioning the DISCOM at a different point in the pipeline. This use case isn't supported at the moment and could be implemented by extending the API between the VSP1 and DU drivers if needed.
Signed-off-by: Laurent Pinchart laurent.pinchart+renesas@ideasonboard.com Reviewed-by: Kieran Bingham kieran.bingham+renesas@ideasonboard.com
Reviewed-by: Jacopo Mondi jacopo+renesas@jmondi.org
Thanks j
Changes since v2:
- Reduce indentation in vsp1_du_insert_uif()
- Use vsp1_du_crc_config structure in vsp1_drm_pipeline
drivers/media/platform/vsp1/vsp1_drm.c | 115 ++++++++++++++++++++++++++++++++- drivers/media/platform/vsp1/vsp1_drm.h | 7 ++ 2 files changed, 119 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c index 5fc31578f9b0..08667e3640b2 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.c +++ b/drivers/media/platform/vsp1/vsp1_drm.c @@ -22,6 +22,7 @@ #include "vsp1_lif.h" #include "vsp1_pipe.h" #include "vsp1_rwpf.h" +#include "vsp1_uif.h"
#define BRX_NAME(e) (e)->type == VSP1_ENTITY_BRU ? "BRU" : "BRS"
@@ -35,8 +36,13 @@ static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline *pipe, struct vsp1_drm_pipeline *drm_pipe = to_vsp1_drm_pipeline(pipe); bool complete = completion == VSP1_DL_FRAME_END_COMPLETED;
- if (drm_pipe->du_complete)
drm_pipe->du_complete(drm_pipe->du_private, complete, 0);
if (drm_pipe->du_complete) {
struct vsp1_entity *uif = drm_pipe->uif;
u32 crc;
crc = uif ? vsp1_uif_get_crc(to_uif(&uif->subdev)) : 0;
drm_pipe->du_complete(drm_pipe->du_private, complete, crc);
}
if (completion & VSP1_DL_FRAME_END_INTERNAL) { drm_pipe->force_brx_release = false;
@@ -48,10 +54,66 @@ static void vsp1_du_pipeline_frame_end(struct vsp1_pipeline *pipe,
- Pipeline Configuration
*/
+/*
- Insert the UIF in the pipeline between the prev and next entities. If no UIF
- is available connect the two entities directly.
- */
+static int vsp1_du_insert_uif(struct vsp1_device *vsp1,
struct vsp1_pipeline *pipe,
struct vsp1_entity *uif,
struct vsp1_entity *prev, unsigned int prev_pad,
struct vsp1_entity *next, unsigned int next_pad)
+{
- struct v4l2_subdev_format format;
- int ret;
- if (!uif) {
/*
* If there's no UIF to bee inserted connected the previous and
* next entities directly.
*/
prev->sink = next;
prev->sink_pad = next_pad;
return 0;
- }
- prev->sink = uif;
- prev->sink_pad = UIF_PAD_SINK;
- memset(&format, 0, sizeof(format));
- format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
- format.pad = prev_pad;
- ret = v4l2_subdev_call(&prev->subdev, pad, get_fmt, NULL, &format);
- if (ret < 0)
return ret;
- format.pad = UIF_PAD_SINK;
- ret = v4l2_subdev_call(&uif->subdev, pad, set_fmt, NULL, &format);
- if (ret < 0)
return ret;
- dev_dbg(vsp1->dev, "%s: set format %ux%u (%x) on UIF sink\n",
__func__, format.format.width, format.format.height,
format.format.code);
- /*
* The UIF doesn't mangle the format between its sink and source pads,
* so there is no need to retrieve the format on its source pad.
*/
- uif->sink = next;
- uif->sink_pad = next_pad;
- return 0;
+}
/* Setup one RPF and the connected BRx sink pad. */ static int vsp1_du_pipeline_setup_rpf(struct vsp1_device *vsp1, struct vsp1_pipeline *pipe, struct vsp1_rwpf *rpf,
struct vsp1_entity *uif, unsigned int brx_input)
{ struct v4l2_subdev_selection sel; @@ -122,6 +184,12 @@ static int vsp1_du_pipeline_setup_rpf(struct vsp1_device *vsp1, if (ret < 0) return ret;
- /* Insert and configure the UIF if available. */
- ret = vsp1_du_insert_uif(vsp1, pipe, uif, &rpf->entity, RWPF_PAD_SOURCE,
pipe->brx, brx_input);
- if (ret < 0)
return ret;
- /* BRx sink, propagate the format from the RPF source. */ format.pad = brx_input;
@@ -297,7 +365,10 @@ static unsigned int rpf_zpos(struct vsp1_device *vsp1, struct vsp1_rwpf *rpf) static int vsp1_du_pipeline_setup_inputs(struct vsp1_device *vsp1, struct vsp1_pipeline *pipe) {
- struct vsp1_drm_pipeline *drm_pipe = to_vsp1_drm_pipeline(pipe); struct vsp1_rwpf *inputs[VSP1_MAX_RPF] = { NULL, };
- struct vsp1_entity *uif;
- bool use_uif = false; struct vsp1_brx *brx; unsigned int i; int ret;
@@ -358,7 +429,11 @@ static int vsp1_du_pipeline_setup_inputs(struct vsp1_device *vsp1, dev_dbg(vsp1->dev, "%s: connecting RPF.%u to %s:%u\n", __func__, rpf->entity.index, BRX_NAME(pipe->brx), i);
ret = vsp1_du_pipeline_setup_rpf(vsp1, pipe, rpf, i);
uif = drm_pipe->crc.source == VSP1_DU_CRC_PLANE &&
drm_pipe->crc.index == i ? drm_pipe->uif : NULL;
if (uif)
use_uif = true;
if (ret < 0) { dev_err(vsp1->dev, "%s: failed to setup RPF.%u\n",ret = vsp1_du_pipeline_setup_rpf(vsp1, pipe, rpf, uif, i);
@@ -367,6 +442,31 @@ static int vsp1_du_pipeline_setup_inputs(struct vsp1_device *vsp1, } }
- /* Insert and configure the UIF at the BRx output if available. */
- uif = drm_pipe->crc.source == VSP1_DU_CRC_OUTPUT ? drm_pipe->uif : NULL;
- if (uif)
use_uif = true;
- ret = vsp1_du_insert_uif(vsp1, pipe, uif,
pipe->brx, pipe->brx->source_pad,
&pipe->output->entity, 0);
- if (ret < 0)
dev_err(vsp1->dev, "%s: failed to setup UIF after %s\n",
__func__, BRX_NAME(pipe->brx));
- /*
* If the UIF is not in use schedule it for removal by setting its pipe
* pointer to NULL, vsp1_du_pipeline_configure() will remove it from the
* hardware pipeline and from the pipeline's list of entities. Otherwise
* make sure it is present in the pipeline's list of entities if it
* wasn't already.
*/
- if (!use_uif) {
drm_pipe->uif->pipe = NULL;
- } else if (!drm_pipe->uif->pipe) {
drm_pipe->uif->pipe = pipe;
list_add_tail(&drm_pipe->uif->list_pipe, &pipe->entities);
- }
- return 0;
}
@@ -748,6 +848,8 @@ void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index, struct vsp1_drm_pipeline *drm_pipe = &vsp1->drm->pipe[pipe_index]; struct vsp1_pipeline *pipe = &drm_pipe->pipe;
- drm_pipe->crc = cfg->crc;
- vsp1_du_pipeline_setup_inputs(vsp1, pipe); vsp1_du_pipeline_configure(pipe); mutex_unlock(&vsp1->drm->lock);
@@ -816,6 +918,13 @@ int vsp1_drm_init(struct vsp1_device *vsp1)
pipe->lif->pipe = pipe; list_add_tail(&pipe->lif->list_pipe, &pipe->entities);
/*
* CRC computation is initially disabled, don't add the UIF to
* the pipeline.
*/
if (i < vsp1->info->uif_count)
drm_pipe->uif = &vsp1->uif[i]->entity;
}
/* Disable all RPFs initially. */
diff --git a/drivers/media/platform/vsp1/vsp1_drm.h b/drivers/media/platform/vsp1/vsp1_drm.h index e5b88b28806c..8dfd274a59e2 100644 --- a/drivers/media/platform/vsp1/vsp1_drm.h +++ b/drivers/media/platform/vsp1/vsp1_drm.h @@ -13,6 +13,8 @@ #include <linux/videodev2.h> #include <linux/wait.h>
+#include <media/vsp1.h>
#include "vsp1_pipe.h"
/** @@ -22,6 +24,8 @@
- @height: output display height
- @force_brx_release: when set, release the BRx during the next reconfiguration
- @wait_queue: wait queue to wait for BRx release completion
- @uif: UIF entity if available for the pipeline
*/
- @crc: CRC computation configuration
- @du_complete: frame completion callback for the DU driver (optional)
- @du_private: data to be passed to the du_complete callback
@@ -34,6 +38,9 @@ struct vsp1_drm_pipeline { bool force_brx_release; wait_queue_head_t wait_queue;
- struct vsp1_entity *uif;
- struct vsp1_du_crc_config crc;
- /* Frame synchronisation */ void (*du_complete)(void *data, bool completed, u32 crc); void *du_private;
-- Regards,
Laurent Pinchart
Implement CRC computation configuration and reporting through the DRM debugfs-based CRC API. The CRC source can be configured to any input plane or the pipeline output.
Signed-off-by: Laurent Pinchart laurent.pinchart+renesas@ideasonboard.com Reviewed-by: Kieran Bingham kieran.bingham+renesas@ideasonboard.com --- Changes since v2:
- Use vsp1_du_crc_config structure in vsp1_drm_pipeline
Changes since v1:
- Format the source names using plane IDs instead of plane indices --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 156 +++++++++++++++++++++++++++++++-- drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 15 ++++ drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 6 ++ 3 files changed, 171 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index c4420538ec85..d71d709fe3d9 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -691,6 +691,52 @@ static const struct drm_crtc_helper_funcs crtc_helper_funcs = { .atomic_disable = rcar_du_crtc_atomic_disable, };
+static struct drm_crtc_state * +rcar_du_crtc_atomic_duplicate_state(struct drm_crtc *crtc) +{ + struct rcar_du_crtc_state *state; + struct rcar_du_crtc_state *copy; + + if (WARN_ON(!crtc->state)) + return NULL; + + state = to_rcar_crtc_state(crtc->state); + copy = kmemdup(state, sizeof(*state), GFP_KERNEL); + if (copy == NULL) + return NULL; + + __drm_atomic_helper_crtc_duplicate_state(crtc, ©->state); + + return ©->state; +} + +static void rcar_du_crtc_atomic_destroy_state(struct drm_crtc *crtc, + struct drm_crtc_state *state) +{ + __drm_atomic_helper_crtc_destroy_state(state); + kfree(to_rcar_crtc_state(state)); +} + +static void rcar_du_crtc_reset(struct drm_crtc *crtc) +{ + struct rcar_du_crtc_state *state; + + if (crtc->state) { + rcar_du_crtc_atomic_destroy_state(crtc, crtc->state); + crtc->state = NULL; + } + + state = kzalloc(sizeof(*state), GFP_KERNEL); + if (state == NULL) + return; + + state->crc.source = VSP1_DU_CRC_NONE; + state->crc.index = 0; + + crtc->state = &state->state; + crtc->state->crtc = crtc; +} + static int rcar_du_crtc_enable_vblank(struct drm_crtc *crtc) { struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); @@ -710,15 +756,111 @@ static void rcar_du_crtc_disable_vblank(struct drm_crtc *crtc) rcrtc->vblank_enable = false; }
-static const struct drm_crtc_funcs crtc_funcs = { - .reset = drm_atomic_helper_crtc_reset, +static int rcar_du_crtc_set_crc_source(struct drm_crtc *crtc, + const char *source_name, + size_t *values_cnt) +{ + struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); + struct drm_modeset_acquire_ctx ctx; + struct drm_crtc_state *crtc_state; + struct drm_atomic_state *state; + enum vsp1_du_crc_source source; + unsigned int index = 0; + unsigned int i; + int ret; + + /* + * Parse the source name. Supported values are "plane%u" to compute the + * CRC on an input plane (%u is the plane ID), and "auto" to compute the + * CRC on the composer (VSP) output. + */ + if (!source_name) { + source = VSP1_DU_CRC_NONE; + } else if (!strcmp(source_name, "auto")) { + source = VSP1_DU_CRC_OUTPUT; + } else if (strstarts(source_name, "plane")) { + source = VSP1_DU_CRC_PLANE; + + ret = kstrtouint(source_name + strlen("plane"), 10, &index); + if (ret < 0) + return ret; + + for (i = 0; i < rcrtc->vsp->num_planes; ++i) { + if (index == rcrtc->vsp->planes[i].plane.base.id) { + index = i; + break; + } + } + + if (i >= rcrtc->vsp->num_planes) + return -EINVAL; + } else { + return -EINVAL; + } + + *values_cnt = 1; + + /* Perform an atomic commit to set the CRC source. */ + drm_modeset_acquire_init(&ctx, 0); + + state = drm_atomic_state_alloc(crtc->dev); + if (!state) { + ret = -ENOMEM; + goto unlock; + } + + state->acquire_ctx = &ctx; + +retry: + crtc_state = drm_atomic_get_crtc_state(state, crtc); + if (!IS_ERR(crtc_state)) { + struct rcar_du_crtc_state *rcrtc_state; + + rcrtc_state = to_rcar_crtc_state(crtc_state); + rcrtc_state->crc.source = source; + rcrtc_state->crc.index = index; + + ret = drm_atomic_commit(state); + } else { + ret = PTR_ERR(crtc_state); + } + + if (ret == -EDEADLK) { + drm_atomic_state_clear(state); + drm_modeset_backoff(&ctx); + goto retry; + } + + drm_atomic_state_put(state); + +unlock: + drm_modeset_drop_locks(&ctx); + drm_modeset_acquire_fini(&ctx); + + return 0; +} + +static const struct drm_crtc_funcs crtc_funcs_gen2 = { + .reset = rcar_du_crtc_reset, + .destroy = drm_crtc_cleanup, + .set_config = drm_atomic_helper_set_config, + .page_flip = drm_atomic_helper_page_flip, + .atomic_duplicate_state = rcar_du_crtc_atomic_duplicate_state, + .atomic_destroy_state = rcar_du_crtc_atomic_destroy_state, + .enable_vblank = rcar_du_crtc_enable_vblank, + .disable_vblank = rcar_du_crtc_disable_vblank, +}; + +static const struct drm_crtc_funcs crtc_funcs_gen3 = { + .reset = rcar_du_crtc_reset, .destroy = drm_crtc_cleanup, .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, - .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, + .atomic_duplicate_state = rcar_du_crtc_atomic_duplicate_state, + .atomic_destroy_state = rcar_du_crtc_atomic_destroy_state, .enable_vblank = rcar_du_crtc_enable_vblank, .disable_vblank = rcar_du_crtc_disable_vblank, + .set_crc_source = rcar_du_crtc_set_crc_source, };
/* ----------------------------------------------------------------------------- @@ -821,8 +963,10 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index) else primary = &rgrp->planes[index % 2].plane;
- ret = drm_crtc_init_with_planes(rcdu->ddev, crtc, primary, - NULL, &crtc_funcs, NULL); + ret = drm_crtc_init_with_planes(rcdu->ddev, crtc, primary, NULL, + rcdu->info->gen <= 2 ? + &crtc_funcs_gen2 : &crtc_funcs_gen3, + NULL); if (ret < 0) return ret;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h index fdc2bf99bda1..07a718232309 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h @@ -21,6 +21,8 @@ #include <drm/drmP.h> #include <drm/drm_crtc.h>
+#include <media/vsp1.h> + struct rcar_du_group; struct rcar_du_vsp;
@@ -69,6 +71,19 @@ struct rcar_du_crtc {
#define to_rcar_crtc(c) container_of(c, struct rcar_du_crtc, crtc)
+/** + * struct rcar_du_crtc_state - Driver-specific CRTC state + * @state: base DRM CRTC state + * @crc: CRC computation configuration + */ +struct rcar_du_crtc_state { + struct drm_crtc_state state; + + struct vsp1_du_crc_config crc; +}; + +#define to_rcar_crtc_state(s) container_of(s, struct rcar_du_crtc_state, state) + enum rcar_du_output { RCAR_DU_OUTPUT_DPAD0, RCAR_DU_OUTPUT_DPAD1, diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index bdcec201591f..af7822a66dee 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c @@ -40,6 +40,8 @@ static void rcar_du_vsp_complete(void *private, bool completed, u32 crc)
if (completed) rcar_du_crtc_finish_page_flip(crtc); + + drm_crtc_add_crc_entry(&crtc->crtc, false, 0, &crc); }
void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) @@ -103,6 +105,10 @@ void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc) void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc) { struct vsp1_du_atomic_pipe_config cfg = { { 0, } }; + struct rcar_du_crtc_state *state; + + state = to_rcar_crtc_state(crtc->crtc.state); + cfg.crc = state->crc;
vsp1_du_atomic_flush(crtc->vsp->vsp, crtc->vsp_pipe, &cfg); }
Hi Dave,
Ping ?
On Saturday, 28 April 2018 23:50:19 EEST Laurent Pinchart wrote:
Hello,
(Dave, there's a request for you below)
This patch series adds support for CRC calculation to the rcar-du-drm driver.
CRC calculation is supported starting at the Renesas R-Car Gen3 SoCs, as earlier versions don't have the necessary hardware. On Gen3 SoCs, the CRC is computed by the DISCOM module part of the VSP-D and VSP-DL.
The DISCOM is interfaced to the VSP through the UIF glue and appears as a VSP entity with a sink pad and a source pad.
The series starts with a switch to SPDX license headers in patch 1/8, prompted by a checkpatch.pl warning for a later patch that complained about missing SPDX license headers. It then continues with cleanup and refactoring. Patches 2/8 and 3/8 prepare for DISCOM and UIF support by extending generic code to make it usable for the UIF. Patch 4/8 documents a structure that will receive new fields.
Patch 5/8 then extends the API exposed by the VSP driver to the DU driver to support CRC computation configuration and reporting. The patch unfortunately needs to touch both the VSP and DU drivers, so the whole series will need to be merged through a single tree.
Patch 5/8 adds support for the DISCOM and UIF in the VSP driver, patch 7/8 integrates it in the DRM pipeline, and patch 8/8 finally implements the CRC API in the DU driver to expose CRC computation to userspace.
The hardware supports computing the CRC at any arbitrary point in the pipeline on a configurable window of the frame. This patch series supports CRC computation on input planes or pipeline output, but on the full frame only. Support for CRC window configuration can be added later if needed but will require extending the userspace API, as the DRM/KMS CRC API doesn't support this feature.
Compared to v1, the CRC source names for plane inputs are now constructed from plane IDs instead of plane indices. This allows userspace to match CRC sources with planes.
Compared to v2, various small issues reported by reviewers have been fixed. I believe the series to now be ready for upstream merge.
Note that exposing the DISCOM and UIF though the V4L2 API isn't supported as the module is only found in VSP-D and VSP-DL instances that are not exposed through V4L2. It is possible to expose those instances through V4L2 with a small modification to the driver for testing purpose. If the need arises to test DISCOM and UIF with such an out-of-tree patch, support for CRC reporting through a V4L2 control can be added later without affecting how CRC is exposed through the DRM/KMS API.
The patches are based on top of the "[PATCH v2 00/15] R-Car VSP1: Dynamically assign blend units to display pipelines" patch series, itself based on top of the Linux media master branch and scheduled for merge in v4.18. The new base caused heavy conflicts, requiring this series to be merged through the V4L2 tree.
Dave, I have verified that this series merges cleanly with your drm-next and drm-fixes branches, with the drm-misc-next and drm-misc-fixes branches, and with the R-Car DU patches I would like to get merged in v4.18 through your tree. Could I get your ack to merge this through the V4L2 tree ?
For convenience the patches are available at
git://linuxtv.org/pinchartl/media.git vsp1-discom-v3-20180428
The code has been tested through the kms-test-crc.py script part of the DU test suite available at
git://git.ideasonboard.com/renesas/kms-tests.git discom
Laurent Pinchart (8): v4l: vsp1: Use SPDX license headers v4l: vsp1: Share the CLU, LIF and LUT set_fmt pad operation code v4l: vsp1: Reset the crop and compose rectangles in the set_fmt helper v4l: vsp1: Document the vsp1_du_atomic_config structure v4l: vsp1: Extend the DU API to support CRC computation v4l: vsp1: Add support for the DISCOM entity v4l: vsp1: Integrate DISCOM in display pipeline drm: rcar-du: Add support for CRC computation
drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 156 ++++++++++++++++- drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 15 ++ drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 12 +- drivers/media/platform/vsp1/Makefile | 2 +- drivers/media/platform/vsp1/vsp1.h | 10 +- drivers/media/platform/vsp1/vsp1_brx.c | 6 +- drivers/media/platform/vsp1/vsp1_brx.h | 6 +- drivers/media/platform/vsp1/vsp1_clu.c | 71 ++------ drivers/media/platform/vsp1/vsp1_clu.h | 6 +- drivers/media/platform/vsp1/vsp1_dl.c | 8 +- drivers/media/platform/vsp1/vsp1_dl.h | 6 +- drivers/media/platform/vsp1/vsp1_drm.c | 127 ++++++++++++-- drivers/media/platform/vsp1/vsp1_drm.h | 15 +- drivers/media/platform/vsp1/vsp1_drv.c | 26 ++- drivers/media/platform/vsp1/vsp1_entity.c | 103 +++++++++++- drivers/media/platform/vsp1/vsp1_entity.h | 13 +- drivers/media/platform/vsp1/vsp1_hgo.c | 6 +- drivers/media/platform/vsp1/vsp1_hgo.h | 6 +- drivers/media/platform/vsp1/vsp1_hgt.c | 6 +- drivers/media/platform/vsp1/vsp1_hgt.h | 6 +- drivers/media/platform/vsp1/vsp1_histo.c | 65 +------ drivers/media/platform/vsp1/vsp1_histo.h | 6 +- drivers/media/platform/vsp1/vsp1_hsit.c | 6 +- drivers/media/platform/vsp1/vsp1_hsit.h | 6 +- drivers/media/platform/vsp1/vsp1_lif.c | 71 ++------ drivers/media/platform/vsp1/vsp1_lif.h | 6 +- drivers/media/platform/vsp1/vsp1_lut.c | 71 ++------ drivers/media/platform/vsp1/vsp1_lut.h | 6 +- drivers/media/platform/vsp1/vsp1_pipe.c | 6 +- drivers/media/platform/vsp1/vsp1_pipe.h | 6 +- drivers/media/platform/vsp1/vsp1_regs.h | 46 ++++- drivers/media/platform/vsp1/vsp1_rpf.c | 6 +- drivers/media/platform/vsp1/vsp1_rwpf.c | 6 +- drivers/media/platform/vsp1/vsp1_rwpf.h | 6 +- drivers/media/platform/vsp1/vsp1_sru.c | 6 +- drivers/media/platform/vsp1/vsp1_sru.h | 6 +- drivers/media/platform/vsp1/vsp1_uds.c | 6 +- drivers/media/platform/vsp1/vsp1_uds.h | 6 +- drivers/media/platform/vsp1/vsp1_uif.c | 271 +++++++++++++++++++++++++++ drivers/media/platform/vsp1/vsp1_uif.h | 32 ++++ drivers/media/platform/vsp1/vsp1_video.c | 6 +- drivers/media/platform/vsp1/vsp1_video.h | 6 +- drivers/media/platform/vsp1/vsp1_wpf.c | 6 +- include/media/vsp1.h | 45 ++++- 44 files changed, 892 insertions(+), 417 deletions(-) create mode 100644 drivers/media/platform/vsp1/vsp1_uif.c create mode 100644 drivers/media/platform/vsp1/vsp1_uif.h
On Thu, May 3, 2018 at 2:06 PM, Laurent Pinchart laurent.pinchart@ideasonboard.com wrote:
Hi Dave,
Ping ?
Not aware of any crc core work going on in drm, so has my ack. Worst case we do a topic branch or something like that (since I guess you'll do a pull request anyway on the v4l side). Acked-by: me. -Daniel
On Saturday, 28 April 2018 23:50:19 EEST Laurent Pinchart wrote:
Hello,
(Dave, there's a request for you below)
This patch series adds support for CRC calculation to the rcar-du-drm driver.
CRC calculation is supported starting at the Renesas R-Car Gen3 SoCs, as earlier versions don't have the necessary hardware. On Gen3 SoCs, the CRC is computed by the DISCOM module part of the VSP-D and VSP-DL.
The DISCOM is interfaced to the VSP through the UIF glue and appears as a VSP entity with a sink pad and a source pad.
The series starts with a switch to SPDX license headers in patch 1/8, prompted by a checkpatch.pl warning for a later patch that complained about missing SPDX license headers. It then continues with cleanup and refactoring. Patches 2/8 and 3/8 prepare for DISCOM and UIF support by extending generic code to make it usable for the UIF. Patch 4/8 documents a structure that will receive new fields.
Patch 5/8 then extends the API exposed by the VSP driver to the DU driver to support CRC computation configuration and reporting. The patch unfortunately needs to touch both the VSP and DU drivers, so the whole series will need to be merged through a single tree.
Patch 5/8 adds support for the DISCOM and UIF in the VSP driver, patch 7/8 integrates it in the DRM pipeline, and patch 8/8 finally implements the CRC API in the DU driver to expose CRC computation to userspace.
The hardware supports computing the CRC at any arbitrary point in the pipeline on a configurable window of the frame. This patch series supports CRC computation on input planes or pipeline output, but on the full frame only. Support for CRC window configuration can be added later if needed but will require extending the userspace API, as the DRM/KMS CRC API doesn't support this feature.
Compared to v1, the CRC source names for plane inputs are now constructed from plane IDs instead of plane indices. This allows userspace to match CRC sources with planes.
Compared to v2, various small issues reported by reviewers have been fixed. I believe the series to now be ready for upstream merge.
Note that exposing the DISCOM and UIF though the V4L2 API isn't supported as the module is only found in VSP-D and VSP-DL instances that are not exposed through V4L2. It is possible to expose those instances through V4L2 with a small modification to the driver for testing purpose. If the need arises to test DISCOM and UIF with such an out-of-tree patch, support for CRC reporting through a V4L2 control can be added later without affecting how CRC is exposed through the DRM/KMS API.
The patches are based on top of the "[PATCH v2 00/15] R-Car VSP1: Dynamically assign blend units to display pipelines" patch series, itself based on top of the Linux media master branch and scheduled for merge in v4.18. The new base caused heavy conflicts, requiring this series to be merged through the V4L2 tree.
Dave, I have verified that this series merges cleanly with your drm-next and drm-fixes branches, with the drm-misc-next and drm-misc-fixes branches, and with the R-Car DU patches I would like to get merged in v4.18 through your tree. Could I get your ack to merge this through the V4L2 tree ?
For convenience the patches are available at
git://linuxtv.org/pinchartl/media.git vsp1-discom-v3-20180428
The code has been tested through the kms-test-crc.py script part of the DU test suite available at
git://git.ideasonboard.com/renesas/kms-tests.git discom
Laurent Pinchart (8): v4l: vsp1: Use SPDX license headers v4l: vsp1: Share the CLU, LIF and LUT set_fmt pad operation code v4l: vsp1: Reset the crop and compose rectangles in the set_fmt helper v4l: vsp1: Document the vsp1_du_atomic_config structure v4l: vsp1: Extend the DU API to support CRC computation v4l: vsp1: Add support for the DISCOM entity v4l: vsp1: Integrate DISCOM in display pipeline drm: rcar-du: Add support for CRC computation
drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 156 ++++++++++++++++- drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 15 ++ drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 12 +- drivers/media/platform/vsp1/Makefile | 2 +- drivers/media/platform/vsp1/vsp1.h | 10 +- drivers/media/platform/vsp1/vsp1_brx.c | 6 +- drivers/media/platform/vsp1/vsp1_brx.h | 6 +- drivers/media/platform/vsp1/vsp1_clu.c | 71 ++------ drivers/media/platform/vsp1/vsp1_clu.h | 6 +- drivers/media/platform/vsp1/vsp1_dl.c | 8 +- drivers/media/platform/vsp1/vsp1_dl.h | 6 +- drivers/media/platform/vsp1/vsp1_drm.c | 127 ++++++++++++-- drivers/media/platform/vsp1/vsp1_drm.h | 15 +- drivers/media/platform/vsp1/vsp1_drv.c | 26 ++- drivers/media/platform/vsp1/vsp1_entity.c | 103 +++++++++++- drivers/media/platform/vsp1/vsp1_entity.h | 13 +- drivers/media/platform/vsp1/vsp1_hgo.c | 6 +- drivers/media/platform/vsp1/vsp1_hgo.h | 6 +- drivers/media/platform/vsp1/vsp1_hgt.c | 6 +- drivers/media/platform/vsp1/vsp1_hgt.h | 6 +- drivers/media/platform/vsp1/vsp1_histo.c | 65 +------ drivers/media/platform/vsp1/vsp1_histo.h | 6 +- drivers/media/platform/vsp1/vsp1_hsit.c | 6 +- drivers/media/platform/vsp1/vsp1_hsit.h | 6 +- drivers/media/platform/vsp1/vsp1_lif.c | 71 ++------ drivers/media/platform/vsp1/vsp1_lif.h | 6 +- drivers/media/platform/vsp1/vsp1_lut.c | 71 ++------ drivers/media/platform/vsp1/vsp1_lut.h | 6 +- drivers/media/platform/vsp1/vsp1_pipe.c | 6 +- drivers/media/platform/vsp1/vsp1_pipe.h | 6 +- drivers/media/platform/vsp1/vsp1_regs.h | 46 ++++- drivers/media/platform/vsp1/vsp1_rpf.c | 6 +- drivers/media/platform/vsp1/vsp1_rwpf.c | 6 +- drivers/media/platform/vsp1/vsp1_rwpf.h | 6 +- drivers/media/platform/vsp1/vsp1_sru.c | 6 +- drivers/media/platform/vsp1/vsp1_sru.h | 6 +- drivers/media/platform/vsp1/vsp1_uds.c | 6 +- drivers/media/platform/vsp1/vsp1_uds.h | 6 +- drivers/media/platform/vsp1/vsp1_uif.c | 271 +++++++++++++++++++++++++++ drivers/media/platform/vsp1/vsp1_uif.h | 32 ++++ drivers/media/platform/vsp1/vsp1_video.c | 6 +- drivers/media/platform/vsp1/vsp1_video.h | 6 +- drivers/media/platform/vsp1/vsp1_wpf.c | 6 +- include/media/vsp1.h | 45 ++++- 44 files changed, 892 insertions(+), 417 deletions(-) create mode 100644 drivers/media/platform/vsp1/vsp1_uif.c create mode 100644 drivers/media/platform/vsp1/vsp1_uif.h
-- Regards,
Laurent Pinchart
dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
On 3 May 2018 at 23:45, Daniel Vetter daniel@ffwll.ch wrote:
On Thu, May 3, 2018 at 2:06 PM, Laurent Pinchart laurent.pinchart@ideasonboard.com wrote:
Hi Dave,
Ping ?
Not aware of any crc core work going on in drm, so has my ack. Worst case we do a topic branch or something like that (since I guess you'll do a pull request anyway on the v4l side). Acked-by: me.
Oops,
Acked-by: Dave Airlie airlied@redhat.com
Dave.
Hi Daniel,
(CC'ing Mauro)
On Thursday, 3 May 2018 16:45:36 EEST Daniel Vetter wrote:
On Thu, May 3, 2018 at 2:06 PM, Laurent Pinchart wrote:
Hi Dave,
Ping ?
Not aware of any crc core work going on in drm, so has my ack.
Thank you.
Worst case we do a topic branch or something like that (since I guess you'll do a pull request anyway on the v4l side).
That would unfortunately not be possible, as Mauro cherry-picks patches instead of merging pull requests. In rare cases I can ask for a pull-request to be merged as-is, but it's too late in this case as the previous pull request that this series is based on has been cherry-picked, not merged.
Acked-by: me.
On Saturday, 28 April 2018 23:50:19 EEST Laurent Pinchart wrote:
Hello,
(Dave, there's a request for you below)
This patch series adds support for CRC calculation to the rcar-du-drm driver.
CRC calculation is supported starting at the Renesas R-Car Gen3 SoCs, as earlier versions don't have the necessary hardware. On Gen3 SoCs, the CRC is computed by the DISCOM module part of the VSP-D and VSP-DL.
The DISCOM is interfaced to the VSP through the UIF glue and appears as a VSP entity with a sink pad and a source pad.
The series starts with a switch to SPDX license headers in patch 1/8, prompted by a checkpatch.pl warning for a later patch that complained about missing SPDX license headers. It then continues with cleanup and refactoring. Patches 2/8 and 3/8 prepare for DISCOM and UIF support by extending generic code to make it usable for the UIF. Patch 4/8 documents a structure that will receive new fields.
Patch 5/8 then extends the API exposed by the VSP driver to the DU driver to support CRC computation configuration and reporting. The patch unfortunately needs to touch both the VSP and DU drivers, so the whole series will need to be merged through a single tree.
Patch 5/8 adds support for the DISCOM and UIF in the VSP driver, patch 7/8 integrates it in the DRM pipeline, and patch 8/8 finally implements the CRC API in the DU driver to expose CRC computation to userspace.
The hardware supports computing the CRC at any arbitrary point in the pipeline on a configurable window of the frame. This patch series supports CRC computation on input planes or pipeline output, but on the full frame only. Support for CRC window configuration can be added later if needed but will require extending the userspace API, as the DRM/KMS CRC API doesn't support this feature.
Compared to v1, the CRC source names for plane inputs are now constructed from plane IDs instead of plane indices. This allows userspace to match CRC sources with planes.
Compared to v2, various small issues reported by reviewers have been fixed. I believe the series to now be ready for upstream merge.
Note that exposing the DISCOM and UIF though the V4L2 API isn't supported as the module is only found in VSP-D and VSP-DL instances that are not exposed through V4L2. It is possible to expose those instances through V4L2 with a small modification to the driver for testing purpose. If the need arises to test DISCOM and UIF with such an out-of-tree patch, support for CRC reporting through a V4L2 control can be added later without affecting how CRC is exposed through the DRM/KMS API.
The patches are based on top of the "[PATCH v2 00/15] R-Car VSP1: Dynamically assign blend units to display pipelines" patch series, itself based on top of the Linux media master branch and scheduled for merge in v4.18. The new base caused heavy conflicts, requiring this series to be merged through the V4L2 tree.
Dave, I have verified that this series merges cleanly with your drm-next and drm-fixes branches, with the drm-misc-next and drm-misc-fixes branches, and with the R-Car DU patches I would like to get merged in v4.18 through your tree. Could I get your ack to merge this through the V4L2 tree ?
For convenience the patches are available at
git://linuxtv.org/pinchartl/media.git vsp1-discom-v3-20180428
The code has been tested through the kms-test-crc.py script part of the DU test suite available at
git://git.ideasonboard.com/renesas/kms-tests.git discom
Laurent Pinchart (8): v4l: vsp1: Use SPDX license headers v4l: vsp1: Share the CLU, LIF and LUT set_fmt pad operation code v4l: vsp1: Reset the crop and compose rectangles in the set_fmt helper v4l: vsp1: Document the vsp1_du_atomic_config structure v4l: vsp1: Extend the DU API to support CRC computation v4l: vsp1: Add support for the DISCOM entity v4l: vsp1: Integrate DISCOM in display pipeline drm: rcar-du: Add support for CRC computation
drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 156 ++++++++++++++++- drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 15 ++ drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 12 +- drivers/media/platform/vsp1/Makefile | 2 +- drivers/media/platform/vsp1/vsp1.h | 10 +- drivers/media/platform/vsp1/vsp1_brx.c | 6 +- drivers/media/platform/vsp1/vsp1_brx.h | 6 +- drivers/media/platform/vsp1/vsp1_clu.c | 71 ++------ drivers/media/platform/vsp1/vsp1_clu.h | 6 +- drivers/media/platform/vsp1/vsp1_dl.c | 8 +- drivers/media/platform/vsp1/vsp1_dl.h | 6 +- drivers/media/platform/vsp1/vsp1_drm.c | 127 ++++++++++++-- drivers/media/platform/vsp1/vsp1_drm.h | 15 +- drivers/media/platform/vsp1/vsp1_drv.c | 26 ++- drivers/media/platform/vsp1/vsp1_entity.c | 103 +++++++++++- drivers/media/platform/vsp1/vsp1_entity.h | 13 +- drivers/media/platform/vsp1/vsp1_hgo.c | 6 +- drivers/media/platform/vsp1/vsp1_hgo.h | 6 +- drivers/media/platform/vsp1/vsp1_hgt.c | 6 +- drivers/media/platform/vsp1/vsp1_hgt.h | 6 +- drivers/media/platform/vsp1/vsp1_histo.c | 65 +------ drivers/media/platform/vsp1/vsp1_histo.h | 6 +- drivers/media/platform/vsp1/vsp1_hsit.c | 6 +- drivers/media/platform/vsp1/vsp1_hsit.h | 6 +- drivers/media/platform/vsp1/vsp1_lif.c | 71 ++------ drivers/media/platform/vsp1/vsp1_lif.h | 6 +- drivers/media/platform/vsp1/vsp1_lut.c | 71 ++------ drivers/media/platform/vsp1/vsp1_lut.h | 6 +- drivers/media/platform/vsp1/vsp1_pipe.c | 6 +- drivers/media/platform/vsp1/vsp1_pipe.h | 6 +- drivers/media/platform/vsp1/vsp1_regs.h | 46 ++++- drivers/media/platform/vsp1/vsp1_rpf.c | 6 +- drivers/media/platform/vsp1/vsp1_rwpf.c | 6 +- drivers/media/platform/vsp1/vsp1_rwpf.h | 6 +- drivers/media/platform/vsp1/vsp1_sru.c | 6 +- drivers/media/platform/vsp1/vsp1_sru.h | 6 +- drivers/media/platform/vsp1/vsp1_uds.c | 6 +- drivers/media/platform/vsp1/vsp1_uds.h | 6 +- drivers/media/platform/vsp1/vsp1_uif.c | 271 ++++++++++++++++++++++++ drivers/media/platform/vsp1/vsp1_uif.h | 32 ++++ drivers/media/platform/vsp1/vsp1_video.c | 6 +- drivers/media/platform/vsp1/vsp1_video.h | 6 +- drivers/media/platform/vsp1/vsp1_wpf.c | 6 +- include/media/vsp1.h | 45 ++++- 44 files changed, 892 insertions(+), 417 deletions(-) create mode 100644 drivers/media/platform/vsp1/vsp1_uif.c create mode 100644 drivers/media/platform/vsp1/vsp1_uif.h
Em Sat, 05 May 2018 17:06:50 +0300 Laurent Pinchart laurent.pinchart@ideasonboard.com escreveu:
Hi Daniel,
(CC'ing Mauro)
On Thursday, 3 May 2018 16:45:36 EEST Daniel Vetter wrote:
On Thu, May 3, 2018 at 2:06 PM, Laurent Pinchart wrote:
Hi Dave,
Ping ?
Not aware of any crc core work going on in drm, so has my ack.
Thank you.
Worst case we do a topic branch or something like that (since I guess you'll do a pull request anyway on the v4l side).
That would unfortunately not be possible, as Mauro cherry-picks patches instead of merging pull requests. In rare cases I can ask for a pull-request to be merged as-is, but it's too late in this case as the previous pull request that this series is based on has been cherry-picked, not merged.
I probably missed something, but I fail to see what's the problem.
If DRM needs a patch that was already merged on our tree, I can gladly create a stable branch/tag for it - well, media master branch is stable, but I can add a tag there just after the patch DRM needs, in order to avoid them to merge from us at some random point.
If otherwise we need a patch applied at DRM, they can do the same: create a branch/tag, and I can pull from it.
Thanks, Mauro
Hi Mauro,
On Saturday, 5 May 2018 18:05:13 EEST Mauro Carvalho Chehab wrote:
Em Sat, 05 May 2018 17:06:50 +0300 Laurent Pinchart escreveu:
On Thursday, 3 May 2018 16:45:36 EEST Daniel Vetter wrote:
On Thu, May 3, 2018 at 2:06 PM, Laurent Pinchart wrote:
Hi Dave,
Ping ?
Not aware of any crc core work going on in drm, so has my ack.
Thank you.
Worst case we do a topic branch or something like that (since I guess you'll do a pull request anyway on the v4l side).
That would unfortunately not be possible, as Mauro cherry-picks patches instead of merging pull requests. In rare cases I can ask for a pull-request to be merged as-is, but it's too late in this case as the previous pull request that this series is based on has been cherry-picked, not merged.
I probably missed something, but I fail to see what's the problem.
If DRM needs a patch that was already merged on our tree, I can gladly create a stable branch/tag for it - well, media master branch is stable, but I can add a tag there just after the patch DRM needs, in order to avoid them to merge from us at some random point.
If otherwise we need a patch applied at DRM, they can do the same: create a branch/tag, and I can pull from it.
Well, my assumption is that Dave would rather not pull the whole linux-media tree in the DRM tree. That's easily prevented when handling pull requests through a merge instead of a cherry-pick operation, in that case I can just base a patch series on top of -rc1 and send a pull request to both of you. The linux-media and DRM tree will merge cleanly in Linus' tree as they will both contain the same branch.
dri-devel@lists.freedesktop.org