]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: renesas: vsp1: Pass partition pointer to .configure_partition()
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tue, 14 Nov 2023 22:34:56 +0000 (00:34 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Wed, 19 Jun 2024 22:36:47 +0000 (01:36 +0300)
The entity .configure_partition() function operates on a partition, and
has to retrieve that partition from the pipeline's current partition
field. Pass the partition pointer to the function to make it clearer
what partition it operates on, and remove the vsp1_pipeline.partition
field.

This change clearly shows that the DRM pipeline doesn't use partitions,
which makes entity implementation more complex and error-prone. This
will be addressed in a further cleanup.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
drivers/media/platform/renesas/vsp1/vsp1_drm.c
drivers/media/platform/renesas/vsp1/vsp1_entity.c
drivers/media/platform/renesas/vsp1/vsp1_entity.h
drivers/media/platform/renesas/vsp1/vsp1_pipe.h
drivers/media/platform/renesas/vsp1/vsp1_rpf.c
drivers/media/platform/renesas/vsp1/vsp1_uds.c
drivers/media/platform/renesas/vsp1/vsp1_video.c
drivers/media/platform/renesas/vsp1/vsp1_wpf.c

index 9b087bd8df7d8c6ee4b341c0a99b3d7daaf194ef..3954c138fa7b0e2dc78667647e8b02e35d2fb45b 100644 (file)
@@ -569,7 +569,7 @@ static void vsp1_du_pipeline_configure(struct vsp1_pipeline *pipe)
                vsp1_entity_route_setup(entity, pipe, dlb);
                vsp1_entity_configure_stream(entity, pipe, dl, dlb);
                vsp1_entity_configure_frame(entity, pipe, dl, dlb);
-               vsp1_entity_configure_partition(entity, pipe, dl, dlb);
+               vsp1_entity_configure_partition(entity, pipe, NULL, dl, dlb);
        }
 
        vsp1_dl_list_commit(dl, dl_flags);
index 8d39f1ee00ab08d9f53c0123193e16f4affe9249..e9de75de8bde0662d9add215dc3ad85a6e9667c3 100644 (file)
@@ -89,11 +89,13 @@ void vsp1_entity_configure_frame(struct vsp1_entity *entity,
 
 void vsp1_entity_configure_partition(struct vsp1_entity *entity,
                                     struct vsp1_pipeline *pipe,
+                                    const struct vsp1_partition *partition,
                                     struct vsp1_dl_list *dl,
                                     struct vsp1_dl_body *dlb)
 {
        if (entity->ops->configure_partition)
-               entity->ops->configure_partition(entity, pipe, dl, dlb);
+               entity->ops->configure_partition(entity, pipe, partition,
+                                                dl, dlb);
 }
 
 /* -----------------------------------------------------------------------------
index 802c0c2acab01863a2159555581173ee3c5c159e..7b86b2fef3e5eef33b95b9e782e58cbfc312b480 100644 (file)
@@ -85,6 +85,7 @@ struct vsp1_entity_operations {
                                struct vsp1_dl_list *, struct vsp1_dl_body *);
        void (*configure_partition)(struct vsp1_entity *,
                                    struct vsp1_pipeline *,
+                                   const struct vsp1_partition *,
                                    struct vsp1_dl_list *,
                                    struct vsp1_dl_body *);
        unsigned int (*max_width)(struct vsp1_entity *, struct vsp1_pipeline *);
@@ -155,6 +156,7 @@ void vsp1_entity_configure_frame(struct vsp1_entity *entity,
 
 void vsp1_entity_configure_partition(struct vsp1_entity *entity,
                                     struct vsp1_pipeline *pipe,
+                                    const struct vsp1_partition *partition,
                                     struct vsp1_dl_list *dl,
                                     struct vsp1_dl_body *dlb);
 
index 840fd3288efb02f30604a6dcb117721853f29292..3d2e35ac8fa04a004585f9dcc2f319ce24c2643f 100644 (file)
@@ -106,7 +106,6 @@ struct vsp1_partition {
  * @configured: when false the @stream_config shall be written to the hardware
  * @interlaced: True when the pipeline is configured in interlaced mode
  * @partitions: The number of partitions used to process one frame
- * @partition: The current partition for configuration to process
  * @part_table: The pre-calculated partitions used by the pipeline
  */
 struct vsp1_pipeline {
@@ -146,7 +145,6 @@ struct vsp1_pipeline {
        bool interlaced;
 
        unsigned int partitions;
-       struct vsp1_partition *partition;
        struct vsp1_partition *part_table;
 
        u32 underrun_count;
index 42b0c5655404149d65f00cf56df4cc6a2f1e09f6..3b8a622992268b87ef7425602cf2f9f1802835ed 100644 (file)
@@ -280,6 +280,7 @@ static void rpf_configure_frame(struct vsp1_entity *entity,
 
 static void rpf_configure_partition(struct vsp1_entity *entity,
                                    struct vsp1_pipeline *pipe,
+                                   const struct vsp1_partition *partition,
                                    struct vsp1_dl_list *dl,
                                    struct vsp1_dl_body *dlb)
 {
@@ -311,8 +312,8 @@ static void rpf_configure_partition(struct vsp1_entity *entity,
         * 'width' need to be adjusted.
         */
        if (pipe->partitions > 1) {
-               crop.width = pipe->partition->rpf[rpf->entity.index].width;
-               crop.left += pipe->partition->rpf[rpf->entity.index].left;
+               crop.width = partition->rpf[rpf->entity.index].width;
+               crop.left += partition->rpf[rpf->entity.index].left;
        }
 
        if (pipe->interlaced) {
index 887b1f70611adf3059c5aa7f6a35d631cb03fe7a..737362ca23153b73cf4be044c24181b668016feb 100644 (file)
@@ -300,11 +300,11 @@ static void uds_configure_stream(struct vsp1_entity *entity,
 
 static void uds_configure_partition(struct vsp1_entity *entity,
                                    struct vsp1_pipeline *pipe,
+                                   const struct vsp1_partition *partition,
                                    struct vsp1_dl_list *dl,
                                    struct vsp1_dl_body *dlb)
 {
        struct vsp1_uds *uds = to_uds(&entity->subdev);
-       struct vsp1_partition *partition = pipe->partition;
        const struct v4l2_mbus_framefmt *output;
 
        output = v4l2_subdev_state_get_format(uds->entity.state,
index b5181bd192e650f305e8906df6b37c4f4accccc6..d3222c38709bb1dc9c7c3278f0ebdb901abbadb7 100644 (file)
@@ -246,13 +246,12 @@ static void vsp1_video_pipeline_run_partition(struct vsp1_pipeline *pipe,
                                              struct vsp1_dl_list *dl,
                                              unsigned int partition)
 {
+       struct vsp1_partition *part = &pipe->part_table[partition];
        struct vsp1_dl_body *dlb = vsp1_dl_list_get_body0(dl);
        struct vsp1_entity *entity;
 
-       pipe->partition = &pipe->part_table[partition];
-
        list_for_each_entry(entity, &pipe->entities, list_pipe)
-               vsp1_entity_configure_partition(entity, pipe, dl, dlb);
+               vsp1_entity_configure_partition(entity, pipe, part, dl, dlb);
 }
 
 static void vsp1_video_pipeline_run(struct vsp1_pipeline *pipe)
index 5129181b82170589bd9d2888c41230ca162f8b25..80fe7571f4ffbdfc4e4743e9bcb997c40a8f3d44 100644 (file)
@@ -363,6 +363,7 @@ static void wpf_configure_frame(struct vsp1_entity *entity,
 
 static void wpf_configure_partition(struct vsp1_entity *entity,
                                    struct vsp1_pipeline *pipe,
+                                   const struct vsp1_partition *partition,
                                    struct vsp1_dl_list *dl,
                                    struct vsp1_dl_body *dlb)
 {
@@ -390,8 +391,8 @@ static void wpf_configure_partition(struct vsp1_entity *entity,
         * multiple slices.
         */
        if (pipe->partitions > 1) {
-               width = pipe->partition->wpf.width;
-               left = pipe->partition->wpf.left;
+               width = partition->wpf.width;
+               left = partition->wpf.left;
        }
 
        vsp1_wpf_write(wpf, dlb, VI6_WPF_HSZCLIP, VI6_WPF_SZCLIP_EN |