Commit 6c49796d authored by Ren-Pei Zeng's avatar Ren-Pei Zeng Committed by Commit Bot

chromeos_camera: Deprecated shared memory based MJDA interface

Remove DecodeWithFD() Mojo interface from MJPEG Decode Accelerator
because CrOS camera service has migrated to use DecodeWithDmaBuf().

Bug: b:165883754
Test: camera preview in CCA
Change-Id: I6c58a9abe2c6a4775829ccbd8c62cb67ddedb33e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2384710
Commit-Queue: Ren-Pei Zeng <kamesan@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarShik Chen <shik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803490}
parent 7c4f404b
......@@ -33,11 +33,14 @@ struct BitstreamBuffer {
};
// GPU process interface exposed to the browser for decoding MJPEG streams.
//
// Deprecated method IDs: 2
// Next method ID: 5
interface MjpegDecodeAccelerator {
// Initializes the MJPEG decoder. Should be called once per decoder
// construction and before using Decode(). This call returns true if
// initialization is successful.
Initialize() => (bool success);
Initialize@0() => (bool success);
// Decodes the given bitstream buffer that contains one JPEG image.
// The image is decoded from shared memory |input_buffer.memory_handle|
......@@ -48,37 +51,20 @@ interface MjpegDecodeAccelerator {
// Returns |bitstream_buffer_id| and |error| in a callback to notify the
// decode status. |bitstream_buffer_id| is the id of BitstreamBuffer
// |input_buffer| and |error| is the error code.
Decode(BitstreamBuffer input_buffer, gfx.mojom.Size coded_size,
handle<shared_buffer> output_handle, uint32 output_buffer_size)
Decode@1(BitstreamBuffer input_buffer, gfx.mojom.Size coded_size,
handle<shared_buffer> output_handle, uint32 output_buffer_size)
=> (int32 bitstream_buffer_id, DecodeError error);
// Decodes the given buffer that contains one JPEG image.
// |input_fd| and |output_fd| are file descriptors of shared memory.
// The image is decoded from memory of |input_fd|
// with size |input_buffer_size|. The input buffer is associated with
// |buffer_id| and the size of JPEG image is |coded_size|. Decoded I420
// frame data will be put onto memory associated with |output_fd|
// with allocated size |output_buffer_size|.
// Returns |buffer_id| and |error| in a callback to notify the
// decode status. |buffer_id| is the id of |input_buffer| and |error| is the
// error code.
// TODO(kamesan): deprecate this function when all clients have switched to
// DecodeWithDmaBuf().
DecodeWithFD(int32 buffer_id, handle input_fd, uint32 input_buffer_size,
int32 coded_size_width, int32 coded_size_height,
handle output_fd, uint32 output_buffer_size)
=> (int32 buffer_id, DecodeError error);
// Decodes one MJPEG image with the given input and output buffers.
// |task_id| is used to distinguish different tasks. The input image is stored
// in the DMA buffer described by |src_dmabuf_fd|, |src_size|, and
// |src_offset|. The decoded result will be put into |dst_frame| backed by DMA
// buffer. Returns the decode status |error| in the Mojo callback.
DecodeWithDmaBuf(int32 task_id, handle src_dmabuf_fd, uint32 src_size,
uint32 src_offset, DmaBufVideoFrame dst_frame)
DecodeWithDmaBuf@3(int32 task_id, handle src_dmabuf_fd, uint32 src_size,
uint32 src_offset, DmaBufVideoFrame dst_frame)
=> (DecodeError error);
// TODO(c.padhi): This method might not be required, see
// http://crbug.com/699255.
Uninitialize();
Uninitialize@4();
};
......@@ -187,57 +187,6 @@ void MojoMjpegDecodeAcceleratorService::Decode(
accelerator_->Decode(std::move(input_buffer), frame);
}
void MojoMjpegDecodeAcceleratorService::DecodeWithFD(
int32_t buffer_id,
mojo::ScopedHandle input_handle,
uint32_t input_buffer_size,
int32_t coded_size_width,
int32_t coded_size_height,
mojo::ScopedHandle output_handle,
uint32_t output_buffer_size,
DecodeWithFDCallback callback) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
base::PlatformFile input_fd;
base::PlatformFile output_fd;
MojoResult result;
result = mojo::UnwrapPlatformFile(std::move(input_handle), &input_fd);
if (result != MOJO_RESULT_OK) {
std::move(callback).Run(
buffer_id,
::chromeos_camera::MjpegDecodeAccelerator::Error::PLATFORM_FAILURE);
return;
}
result = mojo::UnwrapPlatformFile(std::move(output_handle), &output_fd);
if (result != MOJO_RESULT_OK) {
std::move(callback).Run(
buffer_id,
::chromeos_camera::MjpegDecodeAccelerator::Error::PLATFORM_FAILURE);
return;
}
base::subtle::PlatformSharedMemoryRegion input_shm_region =
base::subtle::PlatformSharedMemoryRegion::Take(
base::ScopedFD(input_fd),
base::subtle::PlatformSharedMemoryRegion::Mode::kUnsafe,
input_buffer_size, base::UnguessableToken::Create());
media::BitstreamBuffer in_buffer(buffer_id, std::move(input_shm_region),
input_buffer_size);
gfx::Size coded_size(coded_size_width, coded_size_height);
base::subtle::PlatformSharedMemoryRegion output_shm_region =
base::subtle::PlatformSharedMemoryRegion::Take(
base::ScopedFD(output_fd),
base::subtle::PlatformSharedMemoryRegion::Mode::kUnsafe,
output_buffer_size, base::UnguessableToken::Create());
mojo::ScopedSharedBufferHandle output_scoped_handle =
mojo::WrapPlatformSharedMemoryRegion(std::move(output_shm_region));
Decode(std::move(in_buffer), coded_size, std::move(output_scoped_handle),
output_buffer_size, std::move(callback));
}
void MojoMjpegDecodeAcceleratorService::DecodeWithDmaBuf(
int32_t task_id,
mojo::ScopedHandle src_dmabuf_fd,
......
......@@ -57,14 +57,6 @@ class MojoMjpegDecodeAcceleratorService
mojo::ScopedSharedBufferHandle output_handle,
uint32_t output_buffer_size,
DecodeCallback callback) override;
void DecodeWithFD(int32_t buffer_id,
mojo::ScopedHandle input_fd,
uint32_t input_buffer_size,
int32_t coded_size_width,
int32_t coded_size_height,
mojo::ScopedHandle output_fd,
uint32_t output_buffer_size,
DecodeWithFDCallback callback) override;
void DecodeWithDmaBuf(int32_t task_id,
mojo::ScopedHandle src_dmabuf_fd,
uint32_t src_size,
......
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