[v4,1/4] media: vsp1: Define partition algorithm helper
Commit Message
Provide a helper to describe when the partition algorithm is in use on a
given pipeline. This improves readability to the purpose of the code,
rather than obtusely checking the number of partitions.
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
v4:
- Fix periods at the end of comments (adjacent comment included)
drivers/media/platform/vsp1/vsp1_pipe.c | 10 +++++++++-
drivers/media/platform/vsp1/vsp1_pipe.h | 1 +
drivers/media/platform/vsp1/vsp1_rpf.c | 2 +-
drivers/media/platform/vsp1/vsp1_video.c | 2 +-
drivers/media/platform/vsp1/vsp1_wpf.c | 2 +-
5 files changed, 13 insertions(+), 4 deletions(-)
@@ -427,7 +427,15 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
}
/*
- * Propagate the partition calculations through the pipeline
+ * Identify if the partition algorithm is in use or not.
+ */
+bool vsp1_pipeline_partitioned(struct vsp1_pipeline *pipe)
+{
+ return pipe->partitions > 1;
+}
+
+/*
+ * Propagate the partition calculations through the pipeline.
*
* Work backwards through the pipe, allowing each entity to update the partition
* parameters based on its configuration, and the entity connected to its
@@ -164,6 +164,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
struct vsp1_dl_body *dlb,
unsigned int alpha);
+bool vsp1_pipeline_partitioned(struct vsp1_pipeline *pipe);
void vsp1_pipeline_propagate_partition(struct vsp1_pipeline *pipe,
struct vsp1_partition *partition,
unsigned int index,
@@ -269,7 +269,7 @@ static void rpf_configure_partition(struct vsp1_entity *entity,
* matching the expected partition window. Only 'left' and
* 'width' need to be adjusted.
*/
- if (pipe->partitions > 1) {
+ if (vsp1_pipeline_partitioned(pipe)) {
crop.width = pipe->partition->rpf.width;
crop.left += pipe->partition->rpf.left;
}
@@ -201,7 +201,7 @@ static void vsp1_video_calculate_partition(struct vsp1_pipeline *pipe,
RWPF_PAD_SINK);
/* A single partition simply processes the output size in full. */
- if (pipe->partitions <= 1) {
+ if (!vsp1_pipeline_partitioned(pipe)) {
window.left = 0;
window.width = format->width;
@@ -376,7 +376,7 @@ static void wpf_configure_partition(struct vsp1_entity *entity,
* Cropping. The partition algorithm can split the image into
* multiple slices.
*/
- if (pipe->partitions > 1)
+ if (vsp1_pipeline_partitioned(pipe))
width = pipe->partition->wpf.width;
vsp1_wpf_write(wpf, dlb, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN |