Commit eed40bc7 authored by c.padhi's avatar c.padhi Committed by Commit Bot

Add Mojo interfaces for GpuJpegDecodeAccelerator and GpuJpegDecodeAcceleratorHost

This CL is the first step towards mojification of GpuJpegDecodeAccelerator(GJDA)
and GpuJpegDecodeAcceleratorHost(GJDAH).

1. Defines media::BitstreamBuffer and AcceleratedJpegDecoderMsg_Decode_Params for mojo.
2. GJDA and GJDAH implement these interfaces. Currently, these implementations are empty.

BUG=699255
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2905823002
Cr-Commit-Position: refs/heads/master@{#476712}
parent d3470852
......@@ -25,6 +25,7 @@ source_set("client") {
"//media:media_features",
"//media/gpu",
"//media/gpu/ipc/common",
"//media/gpu/mojo:jpeg_decoder",
"//ui/gfx:memory_buffer",
"//ui/gfx/geometry",
"//ui/gfx/ipc",
......
......@@ -29,6 +29,8 @@ class Message;
namespace media {
// TODO(c.padhi): Move GpuJpegDecodeAcceleratorHost to media/gpu/mojo, see
// http://crbug.com/699255.
// This class is used to talk to JpegDecodeAccelerator in the GPU process
// through IPC messages.
class GpuJpegDecodeAcceleratorHost : public JpegDecodeAccelerator {
......
......@@ -41,6 +41,7 @@ target(link_target_type, "service") {
"//gpu/ipc/service",
"//media:media_features",
"//media/gpu/ipc/common",
"//media/gpu/mojo:jpeg_decoder",
"//third_party/mesa:mesa_headers",
"//ui/gfx/ipc/color",
]
......
......@@ -454,4 +454,24 @@ bool GpuJpegDecodeAccelerator::Send(IPC::Message* message) {
return channel_->Send(message);
}
void GpuJpegDecodeAccelerator::Initialize(InitializeCallback callback) {
// TODO(c.padhi): see http://crbug.com/699255.
NOTIMPLEMENTED();
}
void GpuJpegDecodeAccelerator::Decode(
mojom::BitstreamBufferPtr input_buffer,
const gfx::Size& coded_size,
mojo::ScopedSharedBufferHandle output_handle,
uint32_t output_buffer_size,
DecodeCallback callback) {
// TODO(c.padhi): see http://crbug.com/699255.
NOTIMPLEMENTED();
}
void GpuJpegDecodeAccelerator::Uninitialize() {
// TODO(c.padhi): see http://crbug.com/699255.
NOTIMPLEMENTED();
}
} // namespace media
......@@ -16,6 +16,7 @@
#include "base/synchronization/waitable_event.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_sender.h"
#include "media/gpu/mojo/jpeg_decoder.mojom.h"
#include "media/video/jpeg_decode_accelerator.h"
namespace base {
......@@ -41,8 +42,11 @@ class GpuJpegDecodeAcceleratorFactoryProvider {
static std::vector<CreateAcceleratorCB> GetAcceleratorFactories();
};
// TODO(c.padhi): Move GpuJpegDecodeAccelerator to media/gpu/mojo, see
// http://crbug.com/699255.
class GpuJpegDecodeAccelerator
: public IPC::Sender,
public mojom::GpuJpegDecodeAccelerator,
public base::SupportsWeakPtr<GpuJpegDecodeAccelerator> {
public:
// |channel| must outlive this object.
......@@ -67,6 +71,15 @@ class GpuJpegDecodeAccelerator
int32_t bitstream_buffer_id,
JpegDecodeAccelerator::Error error);
// mojom::GpuJpegDecodeAccelerator implementation.
void Initialize(InitializeCallback callback) override;
void Decode(mojom::BitstreamBufferPtr input_buffer,
const gfx::Size& coded_size,
mojo::ScopedSharedBufferHandle output_handle,
uint32_t output_buffer_size,
DecodeCallback callback) override;
void Uninitialize() override;
// Function to delegate sending to actual sender.
bool Send(IPC::Message* message) override;
......
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//mojo/public/tools/bindings/mojom.gni")
mojom("jpeg_decoder") {
sources = [
"jpeg_decoder.mojom",
]
deps = [
"//media/mojo/interfaces",
"//mojo/common:common_custom_types",
"//ui/gfx/geometry/mojo",
]
}
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module media.mojom;
import "media/mojo/interfaces/media_types.mojom";
import "mojo/common/time.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";
// Decode errors (see media/video/jpeg_decode_accelerator.h).
enum Error {
NO_ERRORS,
INVALID_ARGUMENT,
UNREADABLE_INPUT,
PARSE_JPEG_FAILED,
UNSUPPORTED_JPEG,
PLATFORM_FAILURE,
};
// This defines a mojo transport format for media::BitstreamBuffer (see
// media/base/bitstream_buffer.h).
struct BitstreamBuffer {
int32 id;
handle<shared_buffer> memory_handle;
uint32 size;
uint64 offset;
mojo.common.mojom.TimeDelta timestamp;
string key_id;
string iv;
array<SubsampleEntry> subsamples;
};
// GPU process interface exposed to the browser for decoding JPEG images.
interface GpuJpegDecodeAccelerator {
// Initializes the JPEG decoder. Should be called once per decoder
// construction and before using Decode(). This call returns true if
// initialization is successful.
// TODO(c.padhi): Make this method asynchronous.
[Sync]
Initialize() => (bool success);
// Decodes the given bitstream buffer that contains one JPEG image.
// The image is decoded from shared memory |input_buffer.memory_handle|
// with size |input_buffer.size|. The input buffer is associated with
// |input_buffer.id|and the size of JPEG image is |coded_size|. Decoded I420
// frame data will be put onto shared memory associated with |output_handle|
// with allocated size |output_buffer_size|.
// 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)
=> (int32 bitstream_buffer_id, Error error);
// TODO(c.padhi): This method might not be required, see
// http://crbug.com/699255.
Uninitialize();
};
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