]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: renesas: vsp1: Replace vsp1_partition_window with v4l2_rect
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Mon, 13 Nov 2023 22:53:07 +0000 (00:53 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Wed, 19 Jun 2024 22:36:48 +0000 (01:36 +0300)
The vsp1_partition_window structure is used to store the horizontal size
of a partition window. This is all that is currently needed, as all
partitions span the whole image vertically. The horizontal window size
is retrieved in the .configure_partition() handler from the
vsp1_partition_window structure, and the vertical window size from the
subdev state.

Accessing the subdev state in the .configure_partition() handler is
problematic in the context of moving to the V4L2 subdev active state
API, as .configure_partition() is called in non-interruptable context,
and the state lock can't be taken. To avoid this, start by storing the
vertical size in the window, replacing the custom vsp1_partition_window
structure with a v4l2_rect. Retrieving the vertical size from the window
in .configure_partition() will be done in a subsequent change.

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_entity.h
drivers/media/platform/renesas/vsp1/vsp1_pipe.c
drivers/media/platform/renesas/vsp1/vsp1_pipe.h
drivers/media/platform/renesas/vsp1/vsp1_rpf.c
drivers/media/platform/renesas/vsp1/vsp1_sru.c
drivers/media/platform/renesas/vsp1/vsp1_uds.c
drivers/media/platform/renesas/vsp1/vsp1_wpf.c

index 7b86b2fef3e5eef33b95b9e782e58cbfc312b480..f67f60677644424782e5b062ebb5aafa2595890e 100644 (file)
@@ -19,7 +19,6 @@ struct vsp1_dl_body;
 struct vsp1_dl_list;
 struct vsp1_pipeline;
 struct vsp1_partition;
-struct vsp1_partition_window;
 
 enum vsp1_entity_type {
        VSP1_ENTITY_BRS,
@@ -91,7 +90,7 @@ struct vsp1_entity_operations {
        unsigned int (*max_width)(struct vsp1_entity *, struct vsp1_pipeline *);
        void (*partition)(struct vsp1_entity *, struct vsp1_pipeline *,
                          struct vsp1_partition *, unsigned int,
-                         struct vsp1_partition_window *);
+                         struct v4l2_rect *);
 };
 
 struct vsp1_entity {
index ac52ed8f65babcef1d888441a9805a632ccabaf1..f7701c5ff492c0e4fd94c83427c581a18ef6a8db 100644 (file)
@@ -459,7 +459,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
 static void vsp1_pipeline_propagate_partition(struct vsp1_pipeline *pipe,
                                              struct vsp1_partition *partition,
                                              unsigned int index,
-                                             struct vsp1_partition_window *window)
+                                             struct v4l2_rect *window)
 {
        struct vsp1_entity *entity;
 
@@ -485,7 +485,7 @@ void vsp1_pipeline_calculate_partition(struct vsp1_pipeline *pipe,
                                       unsigned int index)
 {
        const struct v4l2_mbus_framefmt *format;
-       struct vsp1_partition_window window;
+       struct v4l2_rect window;
        unsigned int modulus;
 
        /*
@@ -498,6 +498,8 @@ void vsp1_pipeline_calculate_partition(struct vsp1_pipeline *pipe,
        /* Initialise the partition with sane starting conditions. */
        window.left = index * div_size;
        window.width = div_size;
+       window.top = 0;
+       window.height = format->height;
 
        modulus = format->width % div_size;
 
index 3d2e35ac8fa04a004585f9dcc2f319ce24c2643f..c1f411227de73ffbe245a6aa680c181d6c871632 100644 (file)
@@ -53,17 +53,6 @@ enum vsp1_pipeline_state {
        VSP1_PIPELINE_STOPPING,
 };
 
-/*
- * struct vsp1_partition_window - Partition window coordinates
- * @left: horizontal coordinate of the partition start in pixels relative to the
- *       left edge of the image
- * @width: partition width in pixels
- */
-struct vsp1_partition_window {
-       unsigned int left;
-       unsigned int width;
-};
-
 /*
  * struct vsp1_partition - A description of a slice for the partition algorithm
  * @rpf: The RPF partition window configuration
@@ -73,11 +62,11 @@ struct vsp1_partition_window {
  * @wpf: The WPF partition window configuration
  */
 struct vsp1_partition {
-       struct vsp1_partition_window rpf[VSP1_MAX_RPF];
-       struct vsp1_partition_window uds_sink;
-       struct vsp1_partition_window uds_source;
-       struct vsp1_partition_window sru;
-       struct vsp1_partition_window wpf;
+       struct v4l2_rect rpf[VSP1_MAX_RPF];
+       struct v4l2_rect uds_sink;
+       struct v4l2_rect uds_source;
+       struct v4l2_rect sru;
+       struct v4l2_rect wpf;
 };
 
 /*
index 3b8a622992268b87ef7425602cf2f9f1802835ed..862751616646d683e2150ae68b86493a50b06a5d 100644 (file)
@@ -366,7 +366,7 @@ static void rpf_partition(struct vsp1_entity *entity,
                          struct vsp1_pipeline *pipe,
                          struct vsp1_partition *partition,
                          unsigned int partition_idx,
-                         struct vsp1_partition_window *window)
+                         struct v4l2_rect *window)
 {
        struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev);
 
index 749ba7705000b2d134b737720fcec41164371e37..8ce949de8d9aa022675531373ab4b767c20fac72 100644 (file)
@@ -323,7 +323,7 @@ static void sru_partition(struct vsp1_entity *entity,
                          struct vsp1_pipeline *pipe,
                          struct vsp1_partition *partition,
                          unsigned int partition_idx,
-                         struct vsp1_partition_window *window)
+                         struct v4l2_rect *window)
 {
        struct vsp1_sru *sru = to_sru(&entity->subdev);
        struct v4l2_mbus_framefmt *input;
@@ -337,6 +337,8 @@ static void sru_partition(struct vsp1_entity *entity,
        if (input->width != output->width) {
                window->width /= 2;
                window->left /= 2;
+               window->height /= 2;
+               window->top /= 2;
        }
 
        partition->sru = *window;
index 737362ca23153b73cf4be044c24181b668016feb..4a14fd3baac1b4a03ade30c5e9439fdcd4a33707 100644 (file)
@@ -363,16 +363,12 @@ static void uds_partition(struct vsp1_entity *entity,
                          struct vsp1_pipeline *pipe,
                          struct vsp1_partition *partition,
                          unsigned int partition_idx,
-                         struct vsp1_partition_window *window)
+                         struct v4l2_rect *window)
 {
        struct vsp1_uds *uds = to_uds(&entity->subdev);
        const struct v4l2_mbus_framefmt *output;
        const struct v4l2_mbus_framefmt *input;
 
-       /* Initialise the partition state. */
-       partition->uds_sink = *window;
-       partition->uds_source = *window;
-
        input = v4l2_subdev_state_get_format(uds->entity.state, UDS_PAD_SINK);
        output = v4l2_subdev_state_get_format(uds->entity.state,
                                              UDS_PAD_SOURCE);
@@ -381,6 +377,10 @@ static void uds_partition(struct vsp1_entity *entity,
                                  / output->width;
        partition->uds_sink.left = window->left * input->width
                                 / output->width;
+       partition->uds_sink.height = input->height;
+       partition->uds_sink.top = 0;
+
+       partition->uds_source = *window;
 
        *window = partition->uds_sink;
 }
index 80fe7571f4ffbdfc4e4743e9bcb997c40a8f3d44..f8d1e2f476914eb4d6770ffaaad8c6c35c9a5cb8 100644 (file)
@@ -515,7 +515,7 @@ static void wpf_partition(struct vsp1_entity *entity,
                          struct vsp1_pipeline *pipe,
                          struct vsp1_partition *partition,
                          unsigned int partition_idx,
-                         struct vsp1_partition_window *window)
+                         struct v4l2_rect *window)
 {
        partition->wpf = *window;
 }