hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/platform/vsp1/vsp1_video.c
....@@ -38,9 +38,7 @@
3838 #define VSP1_VIDEO_DEF_WIDTH 1024
3939 #define VSP1_VIDEO_DEF_HEIGHT 768
4040
41
-#define VSP1_VIDEO_MIN_WIDTH 2U
4241 #define VSP1_VIDEO_MAX_WIDTH 8190U
43
-#define VSP1_VIDEO_MIN_HEIGHT 2U
4442 #define VSP1_VIDEO_MAX_HEIGHT 8190U
4543
4644 /* -----------------------------------------------------------------------------
....@@ -136,9 +134,8 @@
136134 height = round_down(height, info->vsub);
137135
138136 /* Clamp the width and height. */
139
- pix->width = clamp(width, VSP1_VIDEO_MIN_WIDTH, VSP1_VIDEO_MAX_WIDTH);
140
- pix->height = clamp(height, VSP1_VIDEO_MIN_HEIGHT,
141
- VSP1_VIDEO_MAX_HEIGHT);
137
+ pix->width = clamp(width, info->hsub, VSP1_VIDEO_MAX_WIDTH);
138
+ pix->height = clamp(height, info->vsub, VSP1_VIDEO_MAX_HEIGHT);
142139
143140 /*
144141 * Compute and clamp the stride and image size. While not documented in
....@@ -226,7 +223,7 @@
226223 * If the modulus is less than half of the partition size,
227224 * the penultimate partition is reduced to half, which is added
228225 * to the final partition: |1234|1234|1234|12|341|
229
- * to prevents this: |1234|1234|1234|1234|1|.
226
+ * to prevent this: |1234|1234|1234|1234|1|.
230227 */
231228 if (modulus) {
232229 /*
....@@ -310,11 +307,6 @@
310307 * This function completes the current buffer by filling its sequence number,
311308 * time stamp and payload size, and hands it back to the videobuf core.
312309 *
313
- * When operating in DU output mode (deep pipeline to the DU through the LIF),
314
- * the VSP1 needs to constantly supply frames to the display. In that case, if
315
- * no other buffer is queued, reuse the one that has just been processed instead
316
- * of handing it back to the videobuf core.
317
- *
318310 * Return the next queued buffer or NULL if the queue is empty.
319311 */
320312 static struct vsp1_vb2_buffer *
....@@ -335,12 +327,6 @@
335327
336328 done = list_first_entry(&video->irqqueue,
337329 struct vsp1_vb2_buffer, queue);
338
-
339
- /* In DU output mode reuse the buffer if the list is singular. */
340
- if (pipe->lif && list_is_singular(&video->irqqueue)) {
341
- spin_unlock_irqrestore(&video->irqlock, flags);
342
- return done;
343
- }
344330
345331 list_del(&done->queue);
346332
....@@ -435,7 +421,7 @@
435421 }
436422
437423 /* Complete, and commit the head display list. */
438
- vsp1_dl_list_commit(dl, false);
424
+ vsp1_dl_list_commit(dl, 0);
439425 pipe->configured = true;
440426
441427 vsp1_pipeline_run(pipe);
....@@ -839,7 +825,8 @@
839825
840826 list_for_each_entry(entity, &pipe->entities, list_pipe) {
841827 vsp1_entity_route_setup(entity, pipe, pipe->stream_config);
842
- vsp1_entity_configure_stream(entity, pipe, pipe->stream_config);
828
+ vsp1_entity_configure_stream(entity, pipe, NULL,
829
+ pipe->stream_config);
843830 }
844831
845832 return 0;
....@@ -867,7 +854,7 @@
867854 pipe->stream_config = NULL;
868855 pipe->configured = false;
869856
870
- /* Release our partition table allocation */
857
+ /* Release our partition table allocation. */
871858 kfree(pipe->part_table);
872859 pipe->part_table = NULL;
873860 }
....@@ -969,15 +956,9 @@
969956 | V4L2_CAP_VIDEO_CAPTURE_MPLANE
970957 | V4L2_CAP_VIDEO_OUTPUT_MPLANE;
971958
972
- if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
973
- cap->device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE
974
- | V4L2_CAP_STREAMING;
975
- else
976
- cap->device_caps = V4L2_CAP_VIDEO_OUTPUT_MPLANE
977
- | V4L2_CAP_STREAMING;
978959
979
- strlcpy(cap->driver, "vsp1", sizeof(cap->driver));
980
- strlcpy(cap->card, video->video.name, sizeof(cap->card));
960
+ strscpy(cap->driver, "vsp1", sizeof(cap->driver));
961
+ strscpy(cap->card, video->video.name, sizeof(cap->card));
981962 snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
982963 dev_name(video->vsp1->dev));
983964
....@@ -1281,11 +1262,15 @@
12811262 video->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
12821263 video->pad.flags = MEDIA_PAD_FL_SOURCE;
12831264 video->video.vfl_dir = VFL_DIR_TX;
1265
+ video->video.device_caps = V4L2_CAP_VIDEO_OUTPUT_MPLANE |
1266
+ V4L2_CAP_STREAMING;
12841267 } else {
12851268 direction = "output";
12861269 video->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
12871270 video->pad.flags = MEDIA_PAD_FL_SINK;
12881271 video->video.vfl_dir = VFL_DIR_RX;
1272
+ video->video.device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE |
1273
+ V4L2_CAP_STREAMING;
12891274 }
12901275
12911276 mutex_init(&video->lock);
....@@ -1308,7 +1293,7 @@
13081293 video->video.fops = &vsp1_video_fops;
13091294 snprintf(video->video.name, sizeof(video->video.name), "%s %s",
13101295 rwpf->entity.subdev.name, direction);
1311
- video->video.vfl_type = VFL_TYPE_GRABBER;
1296
+ video->video.vfl_type = VFL_TYPE_VIDEO;
13121297 video->video.release = video_device_release_empty;
13131298 video->video.ioctl_ops = &vsp1_video_ioctl_ops;
13141299
....@@ -1331,7 +1316,7 @@
13311316
13321317 /* ... and register the video device. */
13331318 video->video.queue = &video->queue;
1334
- ret = video_register_device(&video->video, VFL_TYPE_GRABBER, -1);
1319
+ ret = video_register_device(&video->video, VFL_TYPE_VIDEO, -1);
13351320 if (ret < 0) {
13361321 dev_err(video->vsp1->dev, "failed to register video device\n");
13371322 goto error;