Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: content/common/gpu/gpu_messages.h

Issue 1124423008: MJPEG acceleration for video capture using VAAPI, the GPU and IPC part (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mjpeg-1-media
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Multiply-included message file, hence no include guard here, but see below 5 // Multiply-included message file, hence no include guard here, but see below
6 // for a much smaller-than-usual include guard section. 6 // for a much smaller-than-usual include guard section.
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/shared_memory.h" 11 #include "base/memory/shared_memory.h"
12 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 #include "content/common/content_param_traits.h" 13 #include "content/common/content_param_traits.h"
14 #include "content/common/gpu/gpu_memory_uma_stats.h" 14 #include "content/common/gpu/gpu_memory_uma_stats.h"
15 #include "content/common/gpu/gpu_process_launch_causes.h" 15 #include "content/common/gpu/gpu_process_launch_causes.h"
16 #include "content/common/gpu/gpu_result_codes.h" 16 #include "content/common/gpu/gpu_result_codes.h"
17 #include "content/public/common/common_param_traits.h" 17 #include "content/public/common/common_param_traits.h"
18 #include "content/public/common/gpu_memory_stats.h" 18 #include "content/public/common/gpu_memory_stats.h"
19 #include "gpu/command_buffer/common/capabilities.h" 19 #include "gpu/command_buffer/common/capabilities.h"
20 #include "gpu/command_buffer/common/command_buffer.h" 20 #include "gpu/command_buffer/common/command_buffer.h"
21 #include "gpu/command_buffer/common/constants.h" 21 #include "gpu/command_buffer/common/constants.h"
22 #include "gpu/command_buffer/common/gpu_memory_allocation.h" 22 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
23 #include "gpu/command_buffer/common/mailbox.h" 23 #include "gpu/command_buffer/common/mailbox.h"
24 #include "gpu/command_buffer/common/value_state.h" 24 #include "gpu/command_buffer/common/value_state.h"
25 #include "gpu/config/gpu_info.h" 25 #include "gpu/config/gpu_info.h"
26 #include "gpu/ipc/gpu_command_buffer_traits.h" 26 #include "gpu/ipc/gpu_command_buffer_traits.h"
27 #include "ipc/ipc_channel_handle.h" 27 #include "ipc/ipc_channel_handle.h"
28 #include "ipc/ipc_message_macros.h" 28 #include "ipc/ipc_message_macros.h"
29 #include "media/base/video_frame.h" 29 #include "media/base/video_frame.h"
30 #include "media/video/jpeg_decode_accelerator.h"
30 #include "media/video/video_decode_accelerator.h" 31 #include "media/video/video_decode_accelerator.h"
31 #include "media/video/video_encode_accelerator.h" 32 #include "media/video/video_encode_accelerator.h"
32 #include "ui/events/latency_info.h" 33 #include "ui/events/latency_info.h"
33 #include "ui/gfx/geometry/size.h" 34 #include "ui/gfx/geometry/size.h"
34 #include "ui/gfx/gpu_memory_buffer.h" 35 #include "ui/gfx/gpu_memory_buffer.h"
35 #include "ui/gfx/native_widget_types.h" 36 #include "ui/gfx/native_widget_types.h"
36 #include "ui/gl/gpu_preference.h" 37 #include "ui/gl/gpu_preference.h"
37 38
38 #if defined(OS_ANDROID) 39 #if defined(OS_ANDROID)
39 #include "content/common/android/surface_texture_peer.h" 40 #include "content/common/android/surface_texture_peer.h"
(...skipping 10 matching lines...) Expand all
50 content::CREATE_COMMAND_BUFFER_RESULT_LAST) 51 content::CREATE_COMMAND_BUFFER_RESULT_LAST)
51 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference, 52 IPC_ENUM_TRAITS_MAX_VALUE(gfx::GpuPreference,
52 gfx::GpuPreferenceLast) 53 gfx::GpuPreferenceLast)
53 IPC_ENUM_TRAITS_MAX_VALUE(gfx::SurfaceType, 54 IPC_ENUM_TRAITS_MAX_VALUE(gfx::SurfaceType,
54 gfx::SURFACE_TYPE_LAST) 55 gfx::SURFACE_TYPE_LAST)
55 IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff, 56 IPC_ENUM_TRAITS_MAX_VALUE(gpu::MemoryAllocation::PriorityCutoff,
56 gpu::MemoryAllocation::CUTOFF_LAST) 57 gpu::MemoryAllocation::CUTOFF_LAST)
57 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::Error, gpu::error::kErrorLast) 58 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::Error, gpu::error::kErrorLast)
58 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason, 59 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason,
59 gpu::error::kContextLostReasonLast) 60 gpu::error::kContextLostReasonLast)
61 IPC_ENUM_TRAITS_MAX_VALUE(media::JpegDecodeAccelerator::Error,
62 media::JpegDecodeAccelerator::LARGEST_ERROR_ENUM)
60 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error, 63 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error,
61 media::VideoEncodeAccelerator::kErrorMax) 64 media::VideoEncodeAccelerator::kErrorMax)
62 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoFrame::Format, 65 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoFrame::Format,
63 media::VideoFrame::FORMAT_MAX) 66 media::VideoFrame::FORMAT_MAX)
64 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile, 67 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile,
65 media::VIDEO_CODEC_PROFILE_MIN, 68 media::VIDEO_CODEC_PROFILE_MIN,
66 media::VIDEO_CODEC_PROFILE_MAX) 69 media::VIDEO_CODEC_PROFILE_MAX)
67 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult, 70 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult,
68 gpu::kCollectInfoNone, 71 gpu::kCollectInfoNone,
69 gpu::kCollectInfoFatalFailure) 72 gpu::kCollectInfoFatalFailure)
(...skipping 19 matching lines...) Expand all
89 92
90 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) 93 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
91 IPC_STRUCT_MEMBER(int32, surface_id) 94 IPC_STRUCT_MEMBER(int32, surface_id)
92 IPC_STRUCT_MEMBER(uint64, surface_handle) 95 IPC_STRUCT_MEMBER(uint64, surface_handle)
93 IPC_STRUCT_MEMBER(int32, route_id) 96 IPC_STRUCT_MEMBER(int32, route_id)
94 IPC_STRUCT_MEMBER(gfx::Size, size) 97 IPC_STRUCT_MEMBER(gfx::Size, size)
95 IPC_STRUCT_MEMBER(float, scale_factor) 98 IPC_STRUCT_MEMBER(float, scale_factor)
96 IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info) 99 IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info)
97 IPC_STRUCT_END() 100 IPC_STRUCT_END()
98 101
102 IPC_STRUCT_BEGIN(AcceleratedJpegDecoderMsg_Decode_Params)
103 IPC_STRUCT_MEMBER(int32, input_buffer_id)
104 IPC_STRUCT_MEMBER(gfx::Size, coded_size)
105 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, input_buffer_handle)
106 IPC_STRUCT_MEMBER(uint32, input_buffer_size)
107 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, output_video_frame_handle)
108 IPC_STRUCT_MEMBER(uint32, output_buffer_size)
109 IPC_STRUCT_END()
110
99 #if defined(OS_MACOSX) 111 #if defined(OS_MACOSX)
100 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params) 112 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params)
101 // If the browser needs framerate throttling based on GPU back-pressure to be 113 // If the browser needs framerate throttling based on GPU back-pressure to be
102 // disabled (e.g, because the NSView isn't visible but tab capture is active), 114 // disabled (e.g, because the NSView isn't visible but tab capture is active),
103 // then this is set to true. 115 // then this is set to true.
104 IPC_STRUCT_MEMBER(bool, disable_throttling) 116 IPC_STRUCT_MEMBER(bool, disable_throttling)
105 // If the browser is drawing to the screen, this is the CGL renderer ID of 117 // If the browser is drawing to the screen, this is the CGL renderer ID of
106 // the GL context that the brower is using. 118 // the GL context that the brower is using.
107 IPC_STRUCT_MEMBER(int32, renderer_id) 119 IPC_STRUCT_MEMBER(int32, renderer_id)
108 IPC_STRUCT_END() 120 IPC_STRUCT_END()
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // Tells the GPU process to create a new gpu memory buffer. 277 // Tells the GPU process to create a new gpu memory buffer.
266 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer, 278 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer,
267 GpuMsg_CreateGpuMemoryBuffer_Params) 279 GpuMsg_CreateGpuMemoryBuffer_Params)
268 280
269 // Tells the GPU process to destroy buffer. 281 // Tells the GPU process to destroy buffer.
270 IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer, 282 IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer,
271 gfx::GpuMemoryBufferId, /* id */ 283 gfx::GpuMemoryBufferId, /* id */
272 int32, /* client_id */ 284 int32, /* client_id */
273 int32 /* sync_point */) 285 int32 /* sync_point */)
274 286
287 // Create and initialize a hardware jpeg decoder using the specified route_id.
288 // Created decoders should be freed with AcceleratedJpegDecoderMsg_Destroy when
289 // no longer needed.
290 IPC_SYNC_MESSAGE_CONTROL1_1(GpuMsg_CreateJpegDecoder,
291 int32 /* route_id */,
292 bool /* succeeded */)
293
275 // Tells the GPU process to create a context for collecting graphics card 294 // Tells the GPU process to create a context for collecting graphics card
276 // information. 295 // information.
277 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo) 296 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo)
278 297
279 // Tells the GPU process to report video_memory information for the task manager 298 // Tells the GPU process to report video_memory information for the task manager
280 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats) 299 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats)
281 300
282 #if defined(OS_MACOSX) 301 #if defined(OS_MACOSX)
283 // Tells the GPU process that the browser process has handled the swap 302 // Tells the GPU process that the browser process has handled the swap
284 // buffers or post sub-buffer request. 303 // buffers or post sub-buffer request.
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 int32 /* bitstream_buffer_id */, 763 int32 /* bitstream_buffer_id */,
745 uint32 /* payload_size */, 764 uint32 /* payload_size */,
746 bool /* key_frame */) 765 bool /* key_frame */)
747 766
748 // Report error condition. 767 // Report error condition.
749 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError, 768 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError,
750 media::VideoEncodeAccelerator::Error /* error */) 769 media::VideoEncodeAccelerator::Error /* error */)
751 770
752 // Send destroy request to the encoder. 771 // Send destroy request to the encoder.
753 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy) 772 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy)
773
774 //------------------------------------------------------------------------------
775 // Accelerated JPEG Decoder Messages
776 // These messages are sent from the Browser process to GPU process.
777
778 // Decode one JPEG image from shared memory |input_buffer_handle| with size
779 // |input_buffer_size|. The input buffer is associated with |input_buffer_id|
780 // and the size of JPEG image is |coded_size|. Decoded I420 frame data will
781 // be put onto shared memory associated with |output_video_frame_handle|
782 // with size limit |output_buffer_size|.
783 IPC_MESSAGE_ROUTED1(AcceleratedJpegDecoderMsg_Decode,
784 AcceleratedJpegDecoderMsg_Decode_Params)
785
786 // Send destroy request to the decoder.
787 IPC_MESSAGE_ROUTED0(AcceleratedJpegDecoderMsg_Destroy)
788
789 //------------------------------------------------------------------------------
790 // Accelerated JPEG Decoder Host Messages
791 // These messages are sent from the GPU process to Browser process.
792 //
793 // Decoder reports that a video frame is ready.
794 IPC_MESSAGE_ROUTED1(AcceleratedJpegDecoderHostMsg_VideoFrameReady,
795 int32) /* bitstream_buffer_id */
796
797 // Report error condition.
798 IPC_MESSAGE_ROUTED2(AcceleratedJpegDecoderHostMsg_NotifyError,
799 int32, /* bitstream_buffer_id */
800 media::JpegDecodeAccelerator::Error) /* error */
piman 2015/05/18 22:46:19 Can these 2 messages be combined into 1? This is r
kcwu 2015/05/22 19:46:51 It could be. However I prefer keep it aligned with
piman 2015/05/22 22:27:48 I would prefer to keep a single message, it's simp
kcwu 2015/05/25 18:57:16 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698