.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * linux/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * |
---|
7 | 8 | * Jeongtae Park <jtp.park@samsung.com> |
---|
8 | 9 | * Kamil Debski <k.debski@samsung.com> |
---|
9 | | - * |
---|
10 | | - * This program is free software; you can redistribute it and/or modify |
---|
11 | | - * it under the terms of the GNU General Public License as published by |
---|
12 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
13 | | - * (at your option) any later version. |
---|
14 | 10 | */ |
---|
15 | 11 | |
---|
16 | 12 | #include <linux/clk.h> |
---|
.. | .. |
---|
36 | 32 | |
---|
37 | 33 | static struct s5p_mfc_fmt formats[] = { |
---|
38 | 34 | { |
---|
39 | | - .name = "4:2:0 2 Planes 16x16 Tiles", |
---|
40 | 35 | .fourcc = V4L2_PIX_FMT_NV12MT_16X16, |
---|
41 | 36 | .codec_mode = S5P_MFC_CODEC_NONE, |
---|
42 | 37 | .type = MFC_FMT_RAW, |
---|
.. | .. |
---|
44 | 39 | .versions = MFC_V6_BIT | MFC_V7_BIT, |
---|
45 | 40 | }, |
---|
46 | 41 | { |
---|
47 | | - .name = "4:2:0 2 Planes 64x32 Tiles", |
---|
48 | 42 | .fourcc = V4L2_PIX_FMT_NV12MT, |
---|
49 | 43 | .codec_mode = S5P_MFC_CODEC_NONE, |
---|
50 | 44 | .type = MFC_FMT_RAW, |
---|
.. | .. |
---|
52 | 46 | .versions = MFC_V5_BIT, |
---|
53 | 47 | }, |
---|
54 | 48 | { |
---|
55 | | - .name = "4:2:0 2 Planes Y/CbCr", |
---|
56 | 49 | .fourcc = V4L2_PIX_FMT_NV12M, |
---|
57 | 50 | .codec_mode = S5P_MFC_CODEC_NONE, |
---|
58 | 51 | .type = MFC_FMT_RAW, |
---|
.. | .. |
---|
60 | 53 | .versions = MFC_V5PLUS_BITS, |
---|
61 | 54 | }, |
---|
62 | 55 | { |
---|
63 | | - .name = "4:2:0 2 Planes Y/CrCb", |
---|
64 | 56 | .fourcc = V4L2_PIX_FMT_NV21M, |
---|
65 | 57 | .codec_mode = S5P_MFC_CODEC_NONE, |
---|
66 | 58 | .type = MFC_FMT_RAW, |
---|
.. | .. |
---|
68 | 60 | .versions = MFC_V6PLUS_BITS, |
---|
69 | 61 | }, |
---|
70 | 62 | { |
---|
71 | | - .name = "H264 Encoded Stream", |
---|
72 | 63 | .fourcc = V4L2_PIX_FMT_H264, |
---|
73 | 64 | .codec_mode = S5P_MFC_CODEC_H264_ENC, |
---|
74 | 65 | .type = MFC_FMT_ENC, |
---|
.. | .. |
---|
76 | 67 | .versions = MFC_V5PLUS_BITS, |
---|
77 | 68 | }, |
---|
78 | 69 | { |
---|
79 | | - .name = "MPEG4 Encoded Stream", |
---|
80 | 70 | .fourcc = V4L2_PIX_FMT_MPEG4, |
---|
81 | 71 | .codec_mode = S5P_MFC_CODEC_MPEG4_ENC, |
---|
82 | 72 | .type = MFC_FMT_ENC, |
---|
.. | .. |
---|
84 | 74 | .versions = MFC_V5PLUS_BITS, |
---|
85 | 75 | }, |
---|
86 | 76 | { |
---|
87 | | - .name = "H263 Encoded Stream", |
---|
88 | 77 | .fourcc = V4L2_PIX_FMT_H263, |
---|
89 | 78 | .codec_mode = S5P_MFC_CODEC_H263_ENC, |
---|
90 | 79 | .type = MFC_FMT_ENC, |
---|
.. | .. |
---|
92 | 81 | .versions = MFC_V5PLUS_BITS, |
---|
93 | 82 | }, |
---|
94 | 83 | { |
---|
95 | | - .name = "VP8 Encoded Stream", |
---|
96 | 84 | .fourcc = V4L2_PIX_FMT_VP8, |
---|
97 | 85 | .codec_mode = S5P_MFC_CODEC_VP8_ENC, |
---|
98 | 86 | .type = MFC_FMT_ENC, |
---|
.. | .. |
---|
134 | 122 | .id = V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE, |
---|
135 | 123 | .type = V4L2_CTRL_TYPE_MENU, |
---|
136 | 124 | .minimum = V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE, |
---|
137 | | - .maximum = V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES, |
---|
| 125 | + .maximum = V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_MAX_BYTES, |
---|
138 | 126 | .default_value = V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE, |
---|
139 | 127 | .menu_skip_mask = 0, |
---|
140 | 128 | }, |
---|
.. | .. |
---|
272 | 260 | .maximum = V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT, |
---|
273 | 261 | .menu_skip_mask = 0, |
---|
274 | 262 | .default_value = V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED, |
---|
| 263 | + }, |
---|
| 264 | + { |
---|
| 265 | + .id = V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE, |
---|
| 266 | + .type = V4L2_CTRL_TYPE_MENU, |
---|
| 267 | + .maximum = V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT, |
---|
| 268 | + .default_value = V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED, |
---|
275 | 269 | }, |
---|
276 | 270 | { |
---|
277 | 271 | .id = V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT, |
---|
.. | .. |
---|
1313 | 1307 | { |
---|
1314 | 1308 | struct s5p_mfc_dev *dev = video_drvdata(file); |
---|
1315 | 1309 | |
---|
1316 | | - strlcpy(cap->driver, S5P_MFC_NAME, sizeof(cap->driver)); |
---|
1317 | | - strlcpy(cap->card, dev->vfd_enc->name, sizeof(cap->card)); |
---|
| 1310 | + strscpy(cap->driver, S5P_MFC_NAME, sizeof(cap->driver)); |
---|
| 1311 | + strscpy(cap->card, dev->vfd_enc->name, sizeof(cap->card)); |
---|
1318 | 1312 | snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", |
---|
1319 | 1313 | dev_name(&dev->plat_dev->dev)); |
---|
1320 | | - /* |
---|
1321 | | - * This is only a mem-to-mem video device. The capture and output |
---|
1322 | | - * device capability flags are left only for backward compatibility |
---|
1323 | | - * and are scheduled for removal. |
---|
1324 | | - */ |
---|
1325 | | - cap->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; |
---|
1326 | | - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; |
---|
1327 | 1314 | return 0; |
---|
1328 | 1315 | } |
---|
1329 | 1316 | |
---|
.. | .. |
---|
1331 | 1318 | bool out) |
---|
1332 | 1319 | { |
---|
1333 | 1320 | struct s5p_mfc_dev *dev = video_drvdata(file); |
---|
1334 | | - struct s5p_mfc_fmt *fmt; |
---|
1335 | 1321 | int i, j = 0; |
---|
1336 | 1322 | |
---|
1337 | 1323 | for (i = 0; i < ARRAY_SIZE(formats); ++i) { |
---|
.. | .. |
---|
1343 | 1329 | continue; |
---|
1344 | 1330 | |
---|
1345 | 1331 | if (j == f->index) { |
---|
1346 | | - fmt = &formats[i]; |
---|
1347 | | - strlcpy(f->description, fmt->name, |
---|
1348 | | - sizeof(f->description)); |
---|
1349 | | - f->pixelformat = fmt->fourcc; |
---|
| 1332 | + f->pixelformat = formats[i].fourcc; |
---|
1350 | 1333 | return 0; |
---|
1351 | 1334 | } |
---|
1352 | 1335 | ++j; |
---|
.. | .. |
---|
1354 | 1337 | return -EINVAL; |
---|
1355 | 1338 | } |
---|
1356 | 1339 | |
---|
1357 | | -static int vidioc_enum_fmt_vid_cap_mplane(struct file *file, void *pirv, |
---|
1358 | | - struct v4l2_fmtdesc *f) |
---|
| 1340 | +static int vidioc_enum_fmt_vid_cap(struct file *file, void *pirv, |
---|
| 1341 | + struct v4l2_fmtdesc *f) |
---|
1359 | 1342 | { |
---|
1360 | 1343 | return vidioc_enum_fmt(file, f, false); |
---|
1361 | 1344 | } |
---|
1362 | 1345 | |
---|
1363 | | -static int vidioc_enum_fmt_vid_out_mplane(struct file *file, void *prov, |
---|
1364 | | - struct v4l2_fmtdesc *f) |
---|
| 1346 | +static int vidioc_enum_fmt_vid_out(struct file *file, void *priv, |
---|
| 1347 | + struct v4l2_fmtdesc *f) |
---|
1365 | 1348 | { |
---|
1366 | 1349 | return vidioc_enum_fmt(file, f, true); |
---|
1367 | 1350 | } |
---|
.. | .. |
---|
1621 | 1604 | mfc_err("Call on QBUF after EOS command\n"); |
---|
1622 | 1605 | return -EIO; |
---|
1623 | 1606 | } |
---|
1624 | | - return vb2_qbuf(&ctx->vq_src, buf); |
---|
| 1607 | + return vb2_qbuf(&ctx->vq_src, NULL, buf); |
---|
1625 | 1608 | } else if (buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
---|
1626 | | - return vb2_qbuf(&ctx->vq_dst, buf); |
---|
| 1609 | + return vb2_qbuf(&ctx->vq_dst, NULL, buf); |
---|
1627 | 1610 | } |
---|
1628 | 1611 | return -EINVAL; |
---|
1629 | 1612 | } |
---|
.. | .. |
---|
1872 | 1855 | p->seq_hdr_mode = ctrl->val; |
---|
1873 | 1856 | break; |
---|
1874 | 1857 | case V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE: |
---|
| 1858 | + case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE: |
---|
1875 | 1859 | p->frame_skip_mode = ctrl->val; |
---|
1876 | 1860 | break; |
---|
1877 | 1861 | case V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT: |
---|
.. | .. |
---|
2343 | 2327 | |
---|
2344 | 2328 | static const struct v4l2_ioctl_ops s5p_mfc_enc_ioctl_ops = { |
---|
2345 | 2329 | .vidioc_querycap = vidioc_querycap, |
---|
2346 | | - .vidioc_enum_fmt_vid_cap_mplane = vidioc_enum_fmt_vid_cap_mplane, |
---|
2347 | | - .vidioc_enum_fmt_vid_out_mplane = vidioc_enum_fmt_vid_out_mplane, |
---|
| 2330 | + .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, |
---|
| 2331 | + .vidioc_enum_fmt_vid_out = vidioc_enum_fmt_vid_out, |
---|
2348 | 2332 | .vidioc_g_fmt_vid_cap_mplane = vidioc_g_fmt, |
---|
2349 | 2333 | .vidioc_g_fmt_vid_out_mplane = vidioc_g_fmt, |
---|
2350 | 2334 | .vidioc_try_fmt_vid_cap_mplane = vidioc_try_fmt, |
---|