[RFC,v2,1/5] media: vsp1: Define partition algorithm helper
Commit Message
From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
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>
---
drivers/media/platform/vsp1/vsp1_pipe.c | 8 ++++++++
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, 12 insertions(+), 3 deletions(-)
@@ -364,6 +364,14 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
vsp1_uds_set_alpha(pipe->uds, dlb, alpha);
}
+/*
+ * 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
*
@@ -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 |