blob: 74f2db021839a40de52eb50932e3c55910a2bf4a [file] [log] [blame] [edit]
From a972f85d483976030bdcdf58ff56bbde528d7f6d Mon Sep 17 00:00:00 2001
From: Mansur Alisha Shaik <mansur@codeaurora.org>
Date: Wed, 4 Mar 2020 16:35:32 +0530
Subject: [PATCH] HACK: CHROMIUM: vidc: vdec: changes to enable UBWC on sc7180
Driver chagnes to enable UBWC on sc7180
There currently isn't any way of using modifiers to tell
v4l2 that a buffer is expecting UBWC video and that the
decoder should use UBWC when decoding.
The long term approach is to use ioctls extensions that
have been purposed on the ml.
https://lore.kernel.org/linux-media/20191008091119.7294-1-boris.brezillon@collabora.com/
BUG=b:149525848
TEST=build kernel for trogdor
Change-Id: I8067bef4459ac5b26e250ef046936d487781ee78
Signed-off-by: Fritz Koenig <frkoenig@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2216935
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
---
drivers/media/platform/qcom/venus/helpers.c | 2 ++
drivers/media/platform/qcom/venus/vdec.c | 12 +++++++++++-
include/uapi/linux/videodev2.h | 3 +++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
index ab6a29ffc81e2d79b8e96fd8ec9c83ba6d209149..8475df1777f7f74c924567d472c8ada3f4e07c8e 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -612,6 +612,8 @@ static u32 to_hfi_raw_fmt(u32 v4l2_fmt)
return HFI_COLOR_FORMAT_NV12_UBWC;
case V4L2_PIX_FMT_QC10C:
return HFI_COLOR_FORMAT_YUV420_TP10_UBWC;
+ case V4L2_PIX_FMT_NV12_UBWC:
+ return HFI_COLOR_FORMAT_NV12_UBWC;
default:
break;
}
diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index 4ceaba37e2e573928874afee6172e28446312e4f..0674714bff1f63c3291ea4de65610174eea7a795 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -31,6 +31,10 @@
*/
static const struct venus_format vdec_formats[] = {
{
+ .pixfmt = V4L2_PIX_FMT_NV12_UBWC,
+ .num_planes = 1,
+ .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
+ }, {
.pixfmt = V4L2_PIX_FMT_QC08C,
.num_planes = 1,
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
@@ -739,7 +743,13 @@ static int vdec_output_conf(struct venus_inst *inst)
inst->output2_buf_size =
venus_helper_get_framesz_raw(out2_fmt, width, height);
- if (is_ubwc_fmt(out_fmt)) {
+ if (is_ubwc_fmt(out_fmt) && is_ubwc_fmt(out2_fmt)) {
+ inst->output2_buf_size = 0;
+ inst->opb_buftype = HFI_BUFFER_OUTPUT;
+ inst->opb_fmt = out_fmt;
+ inst->dpb_buftype = 0;
+ inst->dpb_fmt = 0;
+ } else if (is_ubwc_fmt(out_fmt)) {
inst->opb_buftype = HFI_BUFFER_OUTPUT2;
inst->opb_fmt = out2_fmt;
inst->dpb_buftype = HFI_BUFFER_OUTPUT;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 29da1f4b4578e0a24bbdaf474bb39936cd67fae5..5efbafcfbba82d2a40930c5f899d3ad5eb0c7e8f 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -627,6 +627,9 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */
#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/CbCr 4:2:0 10-bit per component */
+/* UBWC 8-bit Y/CbCr 4:2:0 */
+#define V4L2_PIX_FMT_NV12_UBWC v4l2_fourcc('Q', '1', '2', '8')
+
/* two non contiguous planes - one Y, one Cr + Cb interleaved */
#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/CrCb 4:2:0 */
--
2.38.1.584.g0f3c55d4c2-goog