From 19acfae06352bab6abff2ff7d13456e02be0b7ad Mon Sep 17 00:00:00 2001 From: fsamuel Date: Mon, 21 Mar 2016 22:38:24 -0700 Subject: gpu_messages.h => gpu/ipc/common This cl moves gpu_messages.h and associated dependencies all to gpu/ipc/common. It turns out that NaCl depends on gpu/ipc/common, and we cannot link skia into NaCl and so I split up gpu/ipc/common into two source_sets in GN and two gypis on GYP: command_buffer_traits and ipc_common_sources (GN) / gpu_ipc_common (GYP). The parts that NaCl needs live in command_buffer_traits and that's what NaCl depends on. Other dependencies that moved are: gpu_param_traits.cc gpu_param_traits.h gpu_param_traits_macros.h gpu_stream_constants.h BUG=595721 CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel Review URL: https://codereview.chromium.org/1809183002 Cr-Commit-Position: refs/heads/master@{#382514} --- gpu/command_buffer/client/BUILD.gn | 8 + gpu/command_buffer/common/BUILD.gn | 2 +- gpu/command_buffer_traits.gypi | 41 ++++++ gpu/gpu.gyp | 45 ++++++ gpu/gpu_ipc_common.gypi | 31 ++-- gpu/gpu_nacl.gyp | 2 +- gpu/ipc/common/BUILD.gn | 49 ++++++- gpu/ipc/common/DEPS | 2 + gpu/ipc/common/gpu_message_generator.cc | 33 +++++ gpu/ipc/common/gpu_message_generator.h | 8 + gpu/ipc/common/gpu_messages.h | 243 +++++++++++++++++++++++++++++++ gpu/ipc/common/gpu_param_traits.cc | 27 ++++ gpu/ipc/common/gpu_param_traits.h | 10 ++ gpu/ipc/common/gpu_param_traits_macros.h | 135 +++++++++++++++++ gpu/ipc/common/gpu_stream_constants.h | 16 ++ gpu/ipc/common/surface_handle.h | 1 + 16 files changed, 632 insertions(+), 21 deletions(-) create mode 100644 gpu/command_buffer_traits.gypi create mode 100644 gpu/ipc/common/gpu_message_generator.cc create mode 100644 gpu/ipc/common/gpu_message_generator.h create mode 100644 gpu/ipc/common/gpu_messages.h create mode 100644 gpu/ipc/common/gpu_param_traits.cc create mode 100644 gpu/ipc/common/gpu_param_traits.h create mode 100644 gpu/ipc/common/gpu_param_traits_macros.h create mode 100644 gpu/ipc/common/gpu_stream_constants.h (limited to 'gpu') diff --git a/gpu/command_buffer/client/BUILD.gn b/gpu/command_buffer/client/BUILD.gn index 759ff87..fb623e3 100644 --- a/gpu/command_buffer/client/BUILD.gn +++ b/gpu/command_buffer/client/BUILD.gn @@ -31,6 +31,14 @@ group("gles2_cmd_helper") { } } +component("client_sources_for_ppapi") { + public_deps = [ + ":client_sources", + ":gles2_implementation", + "//gpu/ipc/common:command_buffer_traits", + ] +} + source_set("client_sources") { visibility = [ "//gpu/*" ] diff --git a/gpu/command_buffer/common/BUILD.gn b/gpu/command_buffer/common/BUILD.gn index ea6d606..5952a94 100644 --- a/gpu/command_buffer/common/BUILD.gn +++ b/gpu/command_buffer/common/BUILD.gn @@ -91,5 +91,5 @@ mojom("interfaces") { ] typemaps = [ "mojo.typemap" ] - typemap_deps = [ "//gpu/ipc/common" ] + typemap_deps = [ "//gpu/ipc/common:command_buffer_traits" ] } diff --git a/gpu/command_buffer_traits.gypi b/gpu/command_buffer_traits.gypi new file mode 100644 index 0000000..2b261f1 --- /dev/null +++ b/gpu/command_buffer_traits.gypi @@ -0,0 +1,41 @@ +# Copyright (c) 2016 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. + +{ + 'dependencies': [ + '../base/base.gyp:base', + '../ipc/ipc.gyp:ipc', + '../third_party/khronos/khronos.gyp:khronos_headers', + ], + 'include_dirs': [ + '..', + ], + 'sources': [ + 'ipc/common/gpu_command_buffer_traits.cc', + 'ipc/common/gpu_command_buffer_traits.h', + 'ipc/common/id_type_traits.h', + 'ipc/common/memory_stats.cc', + 'ipc/common/memory_stats.h', + 'ipc/common/surface_handle.h', + ], + 'conditions': [ + # This section applies to gpu_ipc_win64, used by the NaCl Win64 helper + # (nacl64.exe). + ['nacl_win64_target==1', { + # gpu_ipc_win64 must only link against the 64-bit ipc target. + 'dependencies!': [ + '../base/base.gyp:base', + '../ipc/ipc.gyp:ipc', + ], + }], + ['OS=="android"', { + 'sources': [ + 'ipc/common/android/surface_texture_manager.cc', + 'ipc/common/android/surface_texture_manager.h', + 'ipc/common/android/surface_texture_peer.cc', + 'ipc/common/android/surface_texture_peer.h', + ] + }] + ], +} diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp index 690c329..a72904e 100644 --- a/gpu/gpu.gyp +++ b/gpu/gpu.gyp @@ -595,12 +595,23 @@ 'msvs_disabled_warnings': [4267, ], }, { + # GN version: //gpu/ipc/common:command_buffer_traits + 'target_name': 'command_buffer_traits', + 'type': 'static_library', + 'includes': [ + 'command_buffer_traits.gypi', + ], + }, + { # GN version: //gpu/ipc/common 'target_name': 'gpu_ipc_common', 'type': 'static_library', 'includes': [ 'gpu_ipc_common.gypi', ], + 'dependencies': [ + 'command_buffer_traits', + ], }, { 'target_name': 'gpu_config', @@ -632,6 +643,7 @@ 'command_buffer_client.gypi', 'command_buffer_common.gypi', 'command_buffer_service.gypi', + 'command_buffer_traits.gypi', 'gles2_cmd_helper.gypi', 'gpu_config.gypi', 'gpu_ipc_common.gypi', @@ -687,6 +699,14 @@ ], }, { + # GN version: //gpu/ipc/common:command_buffer_traits + 'target_name': 'command_buffer_traits', + 'type': 'none', + 'dependencies': [ + 'gpu', + ], + }, + { # GN version: //gpu/ipc/common 'target_name': 'gpu_ipc_common', 'type': 'none', @@ -721,12 +741,37 @@ }, }, { + 'target_name': 'command_buffer_traits_win64', + 'type': 'static_library', + 'variables': { + 'nacl_win64_target': 1, + }, + 'includes': [ + 'command_buffer_traits.gypi', + ], + 'dependencies': [ + '../base/base.gyp:base_win64', + '../ipc/ipc.gyp:ipc_win64', + 'command_buffer_common_win64', + ], + 'defines': [ + '<@(nacl_win64_defines)', + 'GPU_IMPLEMENTATION', + ], + 'configurations': { + 'Common_Base': { + 'msvs_target_platform': 'x64', + }, + }, + }, + { 'target_name': 'gpu_ipc_common_win64', 'type': 'static_library', 'variables': { 'nacl_win64_target': 1, }, 'includes': [ + 'command_buffer_traits.gypi', 'gpu_ipc_common.gypi', ], 'dependencies': [ diff --git a/gpu/gpu_ipc_common.gypi b/gpu/gpu_ipc_common.gypi index 2b261f1..8ca557c 100644 --- a/gpu/gpu_ipc_common.gypi +++ b/gpu/gpu_ipc_common.gypi @@ -7,17 +7,26 @@ '../base/base.gyp:base', '../ipc/ipc.gyp:ipc', '../third_party/khronos/khronos.gyp:khronos_headers', + '../ui/base/ui_base.gyp:ui_base', + '../ui/events/events.gyp:events_base', + '../ui/events/events.gyp:events_ipc', + '../ui/gfx/gfx.gyp:gfx_geometry', + '../ui/gfx/ipc/gfx_ipc.gyp:gfx_ipc', + '../ui/gl/gl.gyp:gl', + '../url/url.gyp:url_lib', + '../url/ipc/url_ipc.gyp:url_ipc', ], 'include_dirs': [ '..', ], 'sources': [ - 'ipc/common/gpu_command_buffer_traits.cc', - 'ipc/common/gpu_command_buffer_traits.h', - 'ipc/common/id_type_traits.h', - 'ipc/common/memory_stats.cc', - 'ipc/common/memory_stats.h', - 'ipc/common/surface_handle.h', + "ipc/common/gpu_message_generator.cc", + "ipc/common/gpu_message_generator.h", + "ipc/common/gpu_messages.h", + 'ipc/common/gpu_param_traits.cc', + 'ipc/common/gpu_param_traits.h', + 'ipc/common/gpu_param_traits_macros.h', + "ipc/common/gpu_stream_constants.h", ], 'conditions': [ # This section applies to gpu_ipc_win64, used by the NaCl Win64 helper @@ -29,13 +38,5 @@ '../ipc/ipc.gyp:ipc', ], }], - ['OS=="android"', { - 'sources': [ - 'ipc/common/android/surface_texture_manager.cc', - 'ipc/common/android/surface_texture_manager.h', - 'ipc/common/android/surface_texture_peer.cc', - 'ipc/common/android/surface_texture_peer.h', - ] - }] - ], + ], } diff --git a/gpu/gpu_nacl.gyp b/gpu/gpu_nacl.gyp index 7c8cfc0..faf1cac 100644 --- a/gpu/gpu_nacl.gyp +++ b/gpu/gpu_nacl.gyp @@ -117,7 +117,7 @@ 'build_nonsfi_helper': 1, }, 'includes': [ - 'gpu_ipc_common.gypi', + 'command_buffer_traits.gypi', ], 'dependencies': [ '../base/base_nacl.gyp:base_nacl', diff --git a/gpu/ipc/common/BUILD.gn b/gpu/ipc/common/BUILD.gn index a110524..e5f9aba 100644 --- a/gpu/ipc/common/BUILD.gn +++ b/gpu/ipc/common/BUILD.gn @@ -14,13 +14,51 @@ group("common") { } } -source_set("ipc_common_sources") { +group("command_buffer_traits") { + if (is_component_build) { + public_deps = [ + "//gpu", + ] + } else { + public_deps = [ + ":command_buffer_traits_sources", + ] + } +} + +source_set("command_buffer_traits_sources") { visibility = [ "//gpu/*" ] sources = [ "gpu_command_buffer_traits.cc", "gpu_command_buffer_traits.h", + "gpu_command_buffer_traits_multi.h", "id_type_traits.h", + ] + + configs += [ + "//gpu:gpu_implementation", + "//third_party/khronos:khronos_headers", + ] + + deps = [ + "//base", + "//gpu/command_buffer/common:common_sources", + "//ipc", + ] +} + +source_set("ipc_common_sources") { + visibility = [ "//gpu/*" ] + + sources = [ + "gpu_message_generator.cc", + "gpu_message_generator.h", + "gpu_messages.h", + "gpu_param_traits.cc", + "gpu_param_traits.h", + "gpu_param_traits_macros.h", + "gpu_stream_constants.h", "memory_stats.cc", "memory_stats.h", ] @@ -31,10 +69,15 @@ source_set("ipc_common_sources") { ] deps = [ + ":command_buffer_traits_sources", "//base", "//gpu/command_buffer/common:common_sources", + "//gpu/config:config_sources", "//ipc", - "//ui/gfx:native_widget_types", + "//ui/events/ipc:events_ipc", + "//ui/gfx/ipc", + "//ui/gl", + "//url/ipc:url_ipc", ] if (is_android) { @@ -44,7 +87,5 @@ source_set("ipc_common_sources") { "android/surface_texture_peer.cc", "android/surface_texture_peer.h", ] - - deps += [ "//ui/gl" ] } } diff --git a/gpu/ipc/common/DEPS b/gpu/ipc/common/DEPS index 9634ba4..45e1d3d 100644 --- a/gpu/ipc/common/DEPS +++ b/gpu/ipc/common/DEPS @@ -1,4 +1,6 @@ include_rules = [ "+base", "+ipc", + "+ui/events", + "+ui/base", ] diff --git a/gpu/ipc/common/gpu_message_generator.cc b/gpu/ipc/common/gpu_message_generator.cc new file mode 100644 index 0000000..ab8f489 --- /dev/null +++ b/gpu/ipc/common/gpu_message_generator.cc @@ -0,0 +1,33 @@ +// Copyright 2016 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. + +// Get basic type definitions. +#define IPC_MESSAGE_IMPL +#include "gpu/ipc/common/gpu_message_generator.h" + +// Generate constructors. +#include "ipc/struct_constructor_macros.h" +#include "gpu/ipc/common/gpu_message_generator.h" + +// Generate destructors. +#include "ipc/struct_destructor_macros.h" +#include "gpu/ipc/common/gpu_message_generator.h" + +// Generate param traits write methods. +#include "ipc/param_traits_write_macros.h" +namespace IPC { +#include "gpu/ipc/common/gpu_message_generator.h" +} // namespace IPC + +// Generate param traits read methods. +#include "ipc/param_traits_read_macros.h" +namespace IPC { +#include "gpu/ipc/common/gpu_message_generator.h" +} // namespace IPC + +// Generate param traits log methods. +#include "ipc/param_traits_log_macros.h" +namespace IPC { +#include "gpu/ipc/common/gpu_message_generator.h" +} // namespace IPC diff --git a/gpu/ipc/common/gpu_message_generator.h b/gpu/ipc/common/gpu_message_generator.h new file mode 100644 index 0000000..91c23e0 --- /dev/null +++ b/gpu/ipc/common/gpu_message_generator.h @@ -0,0 +1,8 @@ +// Copyright 2016 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. + +// Multiply-included file, hence no include guard. + +#include "build/build_config.h" +#include "gpu/ipc/common/gpu_messages.h" diff --git a/gpu/ipc/common/gpu_messages.h b/gpu/ipc/common/gpu_messages.h new file mode 100644 index 0000000..00cd334 --- /dev/null +++ b/gpu/ipc/common/gpu_messages.h @@ -0,0 +1,243 @@ +// Copyright (c) 2012 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. + +// Multiply-included message file, hence no include guard here, but see below +// for a much smaller-than-usual include guard section. + +#include + +#include +#include + +#include "base/memory/shared_memory.h" +#include "build/build_config.h" +#include "gpu/command_buffer/common/capabilities.h" +#include "gpu/command_buffer/common/command_buffer.h" +#include "gpu/command_buffer/common/constants.h" +#include "gpu/command_buffer/common/gpu_memory_allocation.h" +#include "gpu/command_buffer/common/mailbox.h" +#include "gpu/command_buffer/common/sync_token.h" +#include "gpu/command_buffer/common/value_state.h" +#include "gpu/config/gpu_info.h" +#include "gpu/gpu_export.h" +#include "gpu/ipc/common/gpu_command_buffer_traits.h" +#include "gpu/ipc/common/gpu_param_traits.h" +#include "gpu/ipc/common/surface_handle.h" +#include "ipc/ipc_channel_handle.h" +#include "ipc/ipc_message_macros.h" +#include "ui/events/ipc/latency_info_param_traits.h" +#include "ui/events/latency_info.h" +#include "ui/gfx/geometry/size.h" +#include "ui/gfx/gpu_memory_buffer.h" +#include "ui/gfx/ipc/gfx_param_traits.h" +#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/swap_result.h" +#include "url/ipc/url_param_traits.h" + +#if defined(OS_ANDROID) +#include "gpu/ipc/common/android/surface_texture_peer.h" +#elif defined(OS_MACOSX) +#include "ui/base/cocoa/remote_layer_api.h" +#include "ui/gfx/mac/io_surface.h" +#endif + +#undef IPC_MESSAGE_EXPORT +#define IPC_MESSAGE_EXPORT GPU_EXPORT + +#define IPC_MESSAGE_START GpuChannelMsgStart + +IPC_STRUCT_BEGIN(GPUCommandBufferConsoleMessage) + IPC_STRUCT_MEMBER(int32_t, id) + IPC_STRUCT_MEMBER(std::string, message) +IPC_STRUCT_END() + +IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig) + IPC_STRUCT_MEMBER(int32_t, share_group_id) + IPC_STRUCT_MEMBER(int32_t, stream_id) + IPC_STRUCT_MEMBER(gpu::GpuStreamPriority, stream_priority) + IPC_STRUCT_MEMBER(std::vector, attribs) + IPC_STRUCT_MEMBER(GURL, active_url) + IPC_STRUCT_MEMBER(gfx::GpuPreference, gpu_preference) +IPC_STRUCT_END() + +IPC_STRUCT_BEGIN(GpuCommandBufferMsg_CreateImage_Params) + IPC_STRUCT_MEMBER(int32_t, id) + IPC_STRUCT_MEMBER(gfx::GpuMemoryBufferHandle, gpu_memory_buffer) + IPC_STRUCT_MEMBER(gfx::Size, size) + IPC_STRUCT_MEMBER(gfx::BufferFormat, format) + IPC_STRUCT_MEMBER(uint32_t, internal_format) + IPC_STRUCT_MEMBER(uint64_t, image_release_count) +IPC_STRUCT_END() + +#if defined(OS_ANDROID) +IPC_STRUCT_BEGIN(GpuStreamTextureMsg_MatrixChanged_Params) + IPC_STRUCT_MEMBER(float, m00) + IPC_STRUCT_MEMBER(float, m01) + IPC_STRUCT_MEMBER(float, m02) + IPC_STRUCT_MEMBER(float, m03) + IPC_STRUCT_MEMBER(float, m10) + IPC_STRUCT_MEMBER(float, m11) + IPC_STRUCT_MEMBER(float, m12) + IPC_STRUCT_MEMBER(float, m13) + IPC_STRUCT_MEMBER(float, m20) + IPC_STRUCT_MEMBER(float, m21) + IPC_STRUCT_MEMBER(float, m22) + IPC_STRUCT_MEMBER(float, m23) + IPC_STRUCT_MEMBER(float, m30) + IPC_STRUCT_MEMBER(float, m31) + IPC_STRUCT_MEMBER(float, m32) + IPC_STRUCT_MEMBER(float, m33) +IPC_STRUCT_END() +#endif + +//------------------------------------------------------------------------------ +// GPU Channel Messages +// These are messages from a renderer process to the GPU process. + +// Tells the GPU process to create a new command buffer. A corresponding +// GpuCommandBufferStub is created. if |surface_handle| is non-null, |size| is +// ignored, and it will render directly to the native surface (only the browser +// process is allowed to create those). Otherwise it will create an offscreen +// backbuffer of dimensions |size|. +IPC_SYNC_MESSAGE_CONTROL4_1(GpuChannelMsg_CreateCommandBuffer, + gpu::SurfaceHandle /* surface_handle */, + gfx::Size /* size */, + GPUCreateCommandBufferConfig /* init_params */, + int32_t /* route_id */, + bool /* succeeded */) + +// The CommandBufferProxy sends this to the GpuCommandBufferStub in its +// destructor, so that the stub deletes the actual CommandBufferService +// object that it's hosting. +IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyCommandBuffer, + int32_t /* instance_id */) + +// Simple NOP message which can be used as fence to ensure all previous sent +// messages have been received. +IPC_SYNC_MESSAGE_CONTROL0_0(GpuChannelMsg_Nop) + +#if defined(OS_ANDROID) +//------------------------------------------------------------------------------ +// Stream Texture Messages +// Tells the GPU process create and send the java surface texture object to +// the renderer process through the binder thread. +IPC_MESSAGE_ROUTED2(GpuStreamTextureMsg_EstablishPeer, + int32_t, /* primary_id */ + int32_t /* secondary_id */) + +// Tells the GPU process to set the size of StreamTexture from the given +// stream Id. +IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_SetSize, gfx::Size /* size */) + +// Tells the service-side instance to start sending frame available +// notifications. +IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_StartListening) + +// Inform the renderer that a new frame is available. +IPC_MESSAGE_ROUTED0(GpuStreamTextureMsg_FrameAvailable) + +// Inform the renderer process that the transform matrix has changed. +IPC_MESSAGE_ROUTED1(GpuStreamTextureMsg_MatrixChanged, + GpuStreamTextureMsg_MatrixChanged_Params /* params */) +#endif + +//------------------------------------------------------------------------------ +// GPU Command Buffer Messages +// These are messages between a renderer process to the GPU process relating to +// a single OpenGL context. +// Initialize a command buffer with the given number of command entries. +// Returns the shared memory handle for the command buffer mapped to the +// calling process. +IPC_SYNC_MESSAGE_ROUTED1_2(GpuCommandBufferMsg_Initialize, + base::SharedMemoryHandle /* shared_state */, + bool /* result */, + gpu::Capabilities /* capabilities */) + +// Sets the shared memory buffer used for commands. +IPC_SYNC_MESSAGE_ROUTED1_0(GpuCommandBufferMsg_SetGetBuffer, + int32_t /* shm_id */) + +// Produces the front buffer into a mailbox. This allows another context to draw +// the output of this context. +IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ProduceFrontBuffer, + gpu::Mailbox /* mailbox */) + +// Wait until the token is in a specific range, inclusive. +IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForTokenInRange, + int32_t /* start */, + int32_t /* end */, + gpu::CommandBuffer::State /* state */) + +// Wait until the get offset is in a specific range, inclusive. +IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_WaitForGetOffsetInRange, + int32_t /* start */, + int32_t /* end */, + gpu::CommandBuffer::State /* state */) + +// Asynchronously synchronize the put and get offsets of both processes. +// Caller passes its current put offset. Current state (including get offset) +// is returned in shared memory. The input latency info for the current +// frame is also sent to the GPU process. +IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_AsyncFlush, + int32_t /* put_offset */, + uint32_t /* flush_count */, + std::vector /* latency_info */) + +// Sent by the GPU process to display messages in the console. +IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_ConsoleMsg, + GPUCommandBufferConsoleMessage /* msg */) + +// Register an existing shared memory transfer buffer. The id that can be +// used to identify the transfer buffer from a command buffer. +IPC_MESSAGE_ROUTED3(GpuCommandBufferMsg_RegisterTransferBuffer, + int32_t /* id */, + base::SharedMemoryHandle /* transfer_buffer */, + uint32_t /* size */) + +// Destroy a previously created transfer buffer. +IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyTransferBuffer, int32_t /* id */) + +// Tells the proxy that there was an error and the command buffer had to be +// destroyed for some reason. +IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_Destroyed, + gpu::error::ContextLostReason, /* reason */ + gpu::error::Error /* error */) + +// Tells the browser that SwapBuffers returned and passes latency info +IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SwapBuffersCompleted, + std::vector /* latency_info */, + gfx::SwapResult /* result */) + +// Tells the browser about updated parameters for vsync alignment. +IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_UpdateVSyncParameters, + base::TimeTicks /* timebase */, + base::TimeDelta /* interval */) + +IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalSyncToken, + gpu::SyncToken /* sync_token */, + uint32_t /* signal_id */) + +// Makes this command buffer signal when a query is reached, by sending +// back a GpuCommandBufferMsg_SignalSyncPointAck message with the same +// signal_id. +IPC_MESSAGE_ROUTED2(GpuCommandBufferMsg_SignalQuery, + uint32_t /* query */, + uint32_t /* signal_id */) + +// Response to SignalSyncPoint, SignalSyncToken, and SignalQuery. +IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_SignalAck, uint32_t /* signal_id */) + +// Create an image from an existing gpu memory buffer. The id that can be +// used to identify the image from a command buffer. +IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_CreateImage, + GpuCommandBufferMsg_CreateImage_Params /* params */) + +// Destroy a previously created image. +IPC_MESSAGE_ROUTED1(GpuCommandBufferMsg_DestroyImage, int32_t /* id */) + +// Attaches an external image stream to the client texture. +IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateStreamTexture, + uint32_t, /* client_texture_id */ + int32_t, /* stream_id */ + bool /* succeeded */) diff --git a/gpu/ipc/common/gpu_param_traits.cc b/gpu/ipc/common/gpu_param_traits.cc new file mode 100644 index 0000000..efc2987 --- /dev/null +++ b/gpu/ipc/common/gpu_param_traits.cc @@ -0,0 +1,27 @@ +// Copyright 2016 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. + +// Get basic type definitions. +#include "gpu/ipc/common/gpu_param_traits.h" + +// Generate param traits write methods. +#include "ipc/param_traits_write_macros.h" +namespace IPC { +#undef GPU_IPC_COMMON_GPU_PARAM_TRAITS_MACROS_H_ +#include "gpu/ipc/common/gpu_param_traits_macros.h" +} // namespace IPC + +// Generate param traits read methods. +#include "ipc/param_traits_read_macros.h" +namespace IPC { +#undef GPU_IPC_COMMON_GPU_PARAM_TRAITS_MACROS_H_ +#include "gpu/ipc/common/gpu_param_traits_macros.h" +} // namespace IPC + +// Generate param traits log methods. +#include "ipc/param_traits_log_macros.h" +namespace IPC { +#undef GPU_IPC_COMMON_GPU_PARAM_TRAITS_MACROS_H_ +#include "gpu/ipc/common/gpu_param_traits_macros.h" +} // namespace IPC diff --git a/gpu/ipc/common/gpu_param_traits.h b/gpu/ipc/common/gpu_param_traits.h new file mode 100644 index 0000000..73f2214 --- /dev/null +++ b/gpu/ipc/common/gpu_param_traits.h @@ -0,0 +1,10 @@ +// Copyright 2016 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. + +#ifndef GPU_IPC_COMMON_GPU_PARAM_TRAITS_H_ +#define GPU_IPC_COMMON_GPU_PARAM_TRAITS_H_ + +#include "gpu/ipc/common/gpu_param_traits_macros.h" + +#endif // GPU_IPC_COMMON_GPU_PARAM_TRAITS_H_ diff --git a/gpu/ipc/common/gpu_param_traits_macros.h b/gpu/ipc/common/gpu_param_traits_macros.h new file mode 100644 index 0000000..52025c0 --- /dev/null +++ b/gpu/ipc/common/gpu_param_traits_macros.h @@ -0,0 +1,135 @@ +// Copyright 2016 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. + +#ifndef GPU_IPC_COMMON_GPU_PARAM_TRAITS_MACROS_H_ +#define GPU_IPC_COMMON_GPU_PARAM_TRAITS_MACROS_H_ + +#include "gpu/command_buffer/common/constants.h" +#include "gpu/command_buffer/common/gpu_memory_allocation.h" +#include "gpu/config/gpu_info.h" +#include "gpu/gpu_export.h" +#include "gpu/ipc/common/gpu_stream_constants.h" +#include "ipc/ipc_message_macros.h" +#include "ui/gfx/gpu_memory_buffer.h" +#include "ui/gfx/ipc/gfx_param_traits.h" +#include "ui/gfx/swap_result.h" +#include "ui/gl/gpu_preference.h" +#include "url/ipc/url_param_traits.h" + +#undef IPC_MESSAGE_EXPORT +#define IPC_MESSAGE_EXPORT GPU_EXPORT + +IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorSupportedProfile) + IPC_STRUCT_TRAITS_MEMBER(profile) + IPC_STRUCT_TRAITS_MEMBER(max_resolution) + IPC_STRUCT_TRAITS_MEMBER(min_resolution) + IPC_STRUCT_TRAITS_MEMBER(encrypted_only) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(gpu::VideoDecodeAcceleratorCapabilities) + IPC_STRUCT_TRAITS_MEMBER(supported_profiles) + IPC_STRUCT_TRAITS_MEMBER(flags) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(gpu::VideoEncodeAcceleratorSupportedProfile) + IPC_STRUCT_TRAITS_MEMBER(profile) + IPC_STRUCT_TRAITS_MEMBER(max_resolution) + IPC_STRUCT_TRAITS_MEMBER(max_framerate_numerator) + IPC_STRUCT_TRAITS_MEMBER(max_framerate_denominator) +IPC_STRUCT_TRAITS_END() + +IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuMemoryBufferType, + gfx::GPU_MEMORY_BUFFER_TYPE_LAST) + +IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferHandle) + IPC_STRUCT_TRAITS_MEMBER(id) + IPC_STRUCT_TRAITS_MEMBER(type) + IPC_STRUCT_TRAITS_MEMBER(handle) + IPC_STRUCT_TRAITS_MEMBER(offset) + IPC_STRUCT_TRAITS_MEMBER(stride) +#if defined(USE_OZONE) + IPC_STRUCT_TRAITS_MEMBER(native_pixmap_handle) +#elif defined(OS_MACOSX) + IPC_STRUCT_TRAITS_MEMBER(mach_port) +#endif +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(gfx::GpuMemoryBufferId) + IPC_STRUCT_TRAITS_MEMBER(id) +IPC_STRUCT_TRAITS_END() + +IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference, gfx::GpuPreferenceLast) +IPC_ENUM_TRAITS_MAX_VALUE(gpu::GpuStreamPriority, gpu::GpuStreamPriority::LAST) +IPC_ENUM_TRAITS_MAX_VALUE(gfx::SwapResult, gfx::SwapResult::SWAP_RESULT_LAST) +IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff, + gpu::MemoryAllocation::CUTOFF_LAST) +IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason, + gpu::error::kContextLostReasonLast) +IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult, + gpu::kCollectInfoNone, + gpu::kCollectInfoFatalFailure) +IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::VideoCodecProfile, + gpu::VIDEO_CODEC_PROFILE_MIN, + gpu::VIDEO_CODEC_PROFILE_MAX) + +IPC_STRUCT_TRAITS_BEGIN(gpu::DxDiagNode) + IPC_STRUCT_TRAITS_MEMBER(values) + IPC_STRUCT_TRAITS_MEMBER(children) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice) + IPC_STRUCT_TRAITS_MEMBER(vendor_id) + IPC_STRUCT_TRAITS_MEMBER(device_id) + IPC_STRUCT_TRAITS_MEMBER(active) + IPC_STRUCT_TRAITS_MEMBER(vendor_string) + IPC_STRUCT_TRAITS_MEMBER(device_string) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo) + IPC_STRUCT_TRAITS_MEMBER(initialization_time) + IPC_STRUCT_TRAITS_MEMBER(optimus) + IPC_STRUCT_TRAITS_MEMBER(amd_switchable) + IPC_STRUCT_TRAITS_MEMBER(lenovo_dcute) + IPC_STRUCT_TRAITS_MEMBER(gpu) + IPC_STRUCT_TRAITS_MEMBER(secondary_gpus) + IPC_STRUCT_TRAITS_MEMBER(adapter_luid) + IPC_STRUCT_TRAITS_MEMBER(driver_vendor) + IPC_STRUCT_TRAITS_MEMBER(driver_version) + IPC_STRUCT_TRAITS_MEMBER(driver_date) + IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version) + IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version) + IPC_STRUCT_TRAITS_MEMBER(max_msaa_samples) + IPC_STRUCT_TRAITS_MEMBER(machine_model_name) + IPC_STRUCT_TRAITS_MEMBER(machine_model_version) + IPC_STRUCT_TRAITS_MEMBER(gl_version) + IPC_STRUCT_TRAITS_MEMBER(gl_vendor) + IPC_STRUCT_TRAITS_MEMBER(gl_renderer) + IPC_STRUCT_TRAITS_MEMBER(gl_extensions) + IPC_STRUCT_TRAITS_MEMBER(gl_ws_vendor) + IPC_STRUCT_TRAITS_MEMBER(gl_ws_version) + IPC_STRUCT_TRAITS_MEMBER(gl_ws_extensions) + IPC_STRUCT_TRAITS_MEMBER(gl_reset_notification_strategy) + IPC_STRUCT_TRAITS_MEMBER(can_lose_context) + IPC_STRUCT_TRAITS_MEMBER(software_rendering) + IPC_STRUCT_TRAITS_MEMBER(direct_rendering) + IPC_STRUCT_TRAITS_MEMBER(sandboxed) + IPC_STRUCT_TRAITS_MEMBER(process_crash_count) + IPC_STRUCT_TRAITS_MEMBER(in_process_gpu) + IPC_STRUCT_TRAITS_MEMBER(basic_info_state) + IPC_STRUCT_TRAITS_MEMBER(context_info_state) +#if defined(OS_WIN) + IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics_info_state) + IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics) +#endif + IPC_STRUCT_TRAITS_MEMBER(video_decode_accelerator_capabilities) + IPC_STRUCT_TRAITS_MEMBER(video_encode_accelerator_supported_profiles) + IPC_STRUCT_TRAITS_MEMBER(jpeg_decode_accelerator_supported) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(gpu::MemoryAllocation) + IPC_STRUCT_TRAITS_MEMBER(bytes_limit_when_visible) + IPC_STRUCT_TRAITS_MEMBER(priority_cutoff_when_visible) +IPC_STRUCT_TRAITS_END() + +#endif // GPU_IPC_COMMON_GPU_PARAM_TRAITS_MACROS_H_ diff --git a/gpu/ipc/common/gpu_stream_constants.h b/gpu/ipc/common/gpu_stream_constants.h new file mode 100644 index 0000000..abab398 --- /dev/null +++ b/gpu/ipc/common/gpu_stream_constants.h @@ -0,0 +1,16 @@ +// Copyright 2015 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. + +#ifndef GPU_IPC_COMMON_GPU_STREAM_CONSTANTS_H_ +#define GPU_IPC_COMMON_GPU_STREAM_CONSTANTS_H_ + +namespace gpu { + +enum class GpuStreamPriority { REAL_TIME, HIGH, NORMAL, LOW, LAST = LOW }; + +enum GpuStreamId { GPU_STREAM_DEFAULT = -1, GPU_STREAM_INVALID = 0 }; + +} // namespace gpu + +#endif // GPU_IPC_COMMON_GPU_STREAM_CONSTANTS_H_ diff --git a/gpu/ipc/common/surface_handle.h b/gpu/ipc/common/surface_handle.h index 917c894..4c951cf 100644 --- a/gpu/ipc/common/surface_handle.h +++ b/gpu/ipc/common/surface_handle.h @@ -5,6 +5,7 @@ #ifndef GPU_IPC_COMMON_SURFACE_HANDLE_H_ #define GPU_IPC_COMMON_SURFACE_HANDLE_H_ +#include "build/build_config.h" #include "ui/gfx/native_widget_types.h" namespace gpu { -- cgit v1.1