Commit 9a0342b7 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu/V4L2IP: Support GpuMemoryBuffer based VideoFrame

This enables V4L2IP to work with GpuMemoryBuffer based VideoFrame
on input and output.

      on kukui

Bug: 1033799, 1011281
Test: IP test --gtest_filter=NV12DownScaling/ImageProcessorParamTest.*
Test: VD tests on hana, kukui
Change-Id: I3001c1bb4d782c448e7e45fa52f4be7ed58dd88a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1965789
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarChih-Yu Huang <akahuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726358}
parent d104670a
...@@ -187,6 +187,7 @@ v4l2_memory InputStorageTypeToV4L2Memory(VideoFrame::StorageType storage_type) { ...@@ -187,6 +187,7 @@ v4l2_memory InputStorageTypeToV4L2Memory(VideoFrame::StorageType storage_type) {
case VideoFrame::STORAGE_MOJO_SHARED_BUFFER: case VideoFrame::STORAGE_MOJO_SHARED_BUFFER:
return V4L2_MEMORY_USERPTR; return V4L2_MEMORY_USERPTR;
case VideoFrame::STORAGE_DMABUFS: case VideoFrame::STORAGE_DMABUFS:
case VideoFrame::STORAGE_GPU_MEMORY_BUFFER:
return V4L2_MEMORY_DMABUF; return V4L2_MEMORY_DMABUF;
default: default:
return static_cast<v4l2_memory>(0); return static_cast<v4l2_memory>(0);
...@@ -236,8 +237,9 @@ std::unique_ptr<ImageProcessorBackend> V4L2ImageProcessor::CreateWithOutputMode( ...@@ -236,8 +237,9 @@ std::unique_ptr<ImageProcessorBackend> V4L2ImageProcessor::CreateWithOutputMode(
// frame for input. // frame for input.
VideoFrame::StorageType input_storage_type = VideoFrame::STORAGE_UNKNOWN; VideoFrame::StorageType input_storage_type = VideoFrame::STORAGE_UNKNOWN;
for (auto input_type : input_config.preferred_storage_types) { for (auto input_type : input_config.preferred_storage_types) {
if (input_type == VideoFrame::STORAGE_DMABUFS || v4l2_memory v4l2_memory_type = InputStorageTypeToV4L2Memory(input_type);
VideoFrame::IsStorageTypeMappable(input_type)) { if (v4l2_memory_type == V4L2_MEMORY_USERPTR ||
v4l2_memory_type == V4L2_MEMORY_DMABUF) {
input_storage_type = input_type; input_storage_type = input_type;
break; break;
} }
...@@ -250,7 +252,9 @@ std::unique_ptr<ImageProcessorBackend> V4L2ImageProcessor::CreateWithOutputMode( ...@@ -250,7 +252,9 @@ std::unique_ptr<ImageProcessorBackend> V4L2ImageProcessor::CreateWithOutputMode(
// V4L2ImageProcessor only supports DmaBuf-backed video frame for output. // V4L2ImageProcessor only supports DmaBuf-backed video frame for output.
VideoFrame::StorageType output_storage_type = VideoFrame::STORAGE_UNKNOWN; VideoFrame::StorageType output_storage_type = VideoFrame::STORAGE_UNKNOWN;
for (auto output_type : output_config.preferred_storage_types) { for (auto output_type : output_config.preferred_storage_types) {
if (output_type == VideoFrame::STORAGE_DMABUFS) { v4l2_memory v4l2_memory_type = InputStorageTypeToV4L2Memory(output_type);
if (v4l2_memory_type == V4L2_MEMORY_USERPTR ||
v4l2_memory_type == V4L2_MEMORY_DMABUF) {
output_storage_type = output_type; output_storage_type = output_type;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment