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

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

Issue 1016773002: MJPEG acceleration for video capture using VAAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: support multiple jpeg decoder Created 5 years, 8 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"
40 #endif 41 #endif
41 42
42 #undef IPC_MESSAGE_EXPORT 43 #undef IPC_MESSAGE_EXPORT
43 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT 44 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
44 45
45 #define IPC_MESSAGE_START GpuMsgStart 46 #define IPC_MESSAGE_START GpuMsgStart
46 47
47 IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch, 48 IPC_ENUM_TRAITS_MAX_VALUE(content::CauseForGpuLaunch,
48 content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM - 1) 49 content::CAUSE_FOR_GPU_LAUNCH_MAX_ENUM - 1)
49 IPC_ENUM_TRAITS_MAX_VALUE(content::CreateCommandBufferResult, 50 IPC_ENUM_TRAITS_MAX_VALUE(content::CreateCommandBufferResult,
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::ContextLostReason, 58 IPC_ENUM_TRAITS_MAX_VALUE(gpu::error::ContextLostReason,
58 gpu::error::kContextLostReasonLast) 59 gpu::error::kContextLostReasonLast)
60 IPC_ENUM_TRAITS_MAX_VALUE(media::JpegDecodeAccelerator::Error,
61 media::JpegDecodeAccelerator::LARGEST_ERROR_ENUM)
59 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error, 62 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoEncodeAccelerator::Error,
60 media::VideoEncodeAccelerator::kErrorMax) 63 media::VideoEncodeAccelerator::kErrorMax)
61 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoFrame::Format, 64 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoFrame::Format,
62 media::VideoFrame::FORMAT_MAX) 65 media::VideoFrame::FORMAT_MAX)
63 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile, 66 IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile,
64 media::VIDEO_CODEC_PROFILE_MIN, 67 media::VIDEO_CODEC_PROFILE_MIN,
65 media::VIDEO_CODEC_PROFILE_MAX) 68 media::VIDEO_CODEC_PROFILE_MAX)
66 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult, 69 IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult,
67 gpu::kCollectInfoNone, 70 gpu::kCollectInfoNone,
68 gpu::kCollectInfoFatalFailure) 71 gpu::kCollectInfoFatalFailure)
(...skipping 19 matching lines...) Expand all
88 91
89 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) 92 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)
90 IPC_STRUCT_MEMBER(int32, surface_id) 93 IPC_STRUCT_MEMBER(int32, surface_id)
91 IPC_STRUCT_MEMBER(uint64, surface_handle) 94 IPC_STRUCT_MEMBER(uint64, surface_handle)
92 IPC_STRUCT_MEMBER(int32, route_id) 95 IPC_STRUCT_MEMBER(int32, route_id)
93 IPC_STRUCT_MEMBER(gfx::Size, size) 96 IPC_STRUCT_MEMBER(gfx::Size, size)
94 IPC_STRUCT_MEMBER(float, scale_factor) 97 IPC_STRUCT_MEMBER(float, scale_factor)
95 IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info) 98 IPC_STRUCT_MEMBER(std::vector<ui::LatencyInfo>, latency_info)
96 IPC_STRUCT_END() 99 IPC_STRUCT_END()
97 100
101 IPC_STRUCT_BEGIN(AcceleratedJpegDecoderMsg_Decode_Params)
102 IPC_STRUCT_MEMBER(int32, input_buffer_id)
103 IPC_STRUCT_MEMBER(gfx::Size, coded_size)
104 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, input_buffer_handle)
105 IPC_STRUCT_MEMBER(uint32, input_buffer_size)
106 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, output_video_frame_handle)
107 IPC_STRUCT_MEMBER(uint32, output_buffer_size)
108 IPC_STRUCT_END()
109
98 #if defined(OS_MACOSX) 110 #if defined(OS_MACOSX)
99 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params) 111 IPC_STRUCT_BEGIN(AcceleratedSurfaceMsg_BufferPresented_Params)
100 // If the browser needs framerate throttling based on GPU back-pressure to be 112 // If the browser needs framerate throttling based on GPU back-pressure to be
101 // disabled (e.g, because the NSView isn't visible but tab capture is active), 113 // disabled (e.g, because the NSView isn't visible but tab capture is active),
102 // then this is set to true. 114 // then this is set to true.
103 IPC_STRUCT_MEMBER(bool, disable_throttling) 115 IPC_STRUCT_MEMBER(bool, disable_throttling)
104 // If the browser is drawing to the screen, this is the CGL renderer ID of 116 // If the browser is drawing to the screen, this is the CGL renderer ID of
105 // the GL context that the brower is using. 117 // the GL context that the brower is using.
106 IPC_STRUCT_MEMBER(int32, renderer_id) 118 IPC_STRUCT_MEMBER(int32, renderer_id)
107 IPC_STRUCT_END() 119 IPC_STRUCT_END()
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // Tells the GPU process to create a new gpu memory buffer. 276 // Tells the GPU process to create a new gpu memory buffer.
265 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer, 277 IPC_MESSAGE_CONTROL1(GpuMsg_CreateGpuMemoryBuffer,
266 GpuMsg_CreateGpuMemoryBuffer_Params) 278 GpuMsg_CreateGpuMemoryBuffer_Params)
267 279
268 // Tells the GPU process to destroy buffer. 280 // Tells the GPU process to destroy buffer.
269 IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer, 281 IPC_MESSAGE_CONTROL3(GpuMsg_DestroyGpuMemoryBuffer,
270 gfx::GpuMemoryBufferId, /* id */ 282 gfx::GpuMemoryBufferId, /* id */
271 int32, /* client_id */ 283 int32, /* client_id */
272 int32 /* sync_point */) 284 int32 /* sync_point */)
273 285
286 // Create and initialize a hardware jpeg decoder using the specified route_id.
287 // Created decoders should be freed with AcceleratedJpegDecoderMsg_Destroy when
288 // no longer needed.
289 IPC_SYNC_MESSAGE_CONTROL1_1(GpuMsg_CreateJpegDecoder,
290 int32 /* route_id */,
291 bool /* succeeded */)
292
274 // Tells the GPU process to create a context for collecting graphics card 293 // Tells the GPU process to create a context for collecting graphics card
275 // information. 294 // information.
276 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo) 295 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo)
277 296
278 // Tells the GPU process to report video_memory information for the task manager 297 // Tells the GPU process to report video_memory information for the task manager
279 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats) 298 IPC_MESSAGE_CONTROL0(GpuMsg_GetVideoMemoryUsageStats)
280 299
281 #if defined(OS_MACOSX) 300 #if defined(OS_MACOSX)
282 // Tells the GPU process that the browser process has handled the swap 301 // Tells the GPU process that the browser process has handled the swap
283 // buffers or post sub-buffer request. 302 // buffers or post sub-buffer request.
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 int32 /* bitstream_buffer_id */, 761 int32 /* bitstream_buffer_id */,
743 uint32 /* payload_size */, 762 uint32 /* payload_size */,
744 bool /* key_frame */) 763 bool /* key_frame */)
745 764
746 // Report error condition. 765 // Report error condition.
747 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError, 766 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError,
748 media::VideoEncodeAccelerator::Error /* error */) 767 media::VideoEncodeAccelerator::Error /* error */)
749 768
750 // Send destroy request to the encoder. 769 // Send destroy request to the encoder.
751 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy) 770 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderMsg_Destroy)
771
772 //------------------------------------------------------------------------------
773 // Accelerated JPEG Decoder Messages
774 // These messages are sent from the Browser process to GPU process.
775
776 // Decode one JPEG image from shared memory |input_buffer_handle| with size
777 // |input_buffer_size|. The input buffer is associated with |input_buffer_id|
778 // and the size of JPEG image is |coded_size|. Decoded I420 frame data will
779 // be put onto shared memory associated with |output_video_frame_handle|
780 // with size limit |output_buffer_size|.
781 IPC_MESSAGE_ROUTED1(AcceleratedJpegDecoderMsg_Decode,
782 AcceleratedJpegDecoderMsg_Decode_Params)
783
784 // Send destroy request to the decoder.
785 IPC_MESSAGE_ROUTED0(AcceleratedJpegDecoderMsg_Destroy)
786
787 //------------------------------------------------------------------------------
788 // Accelerated JPEG Decoder Host Messages
789 // These messages are sent from the GPU process to Browser process.
wuchengli 2015/04/24 05:54:24 add a blank line
kcwu 2015/04/30 19:25:41 Done.
790 // Decoder reports that a video frame is ready.
791 IPC_MESSAGE_ROUTED1(AcceleratedJpegDecoderHostMsg_VideoFrameReady,
792 int32) /* Bitstream buffer ID */
wuchengli 2015/04/24 05:54:24 s/Bitstream buffer ID/bitstream_buffer_id/ to be c
kcwu 2015/04/30 19:25:41 Done.
793
794 // Report error condition.
795 IPC_MESSAGE_ROUTED2(AcceleratedJpegDecoderHostMsg_NotifyError,
796 int32_t, /* bitstream_buffer_id */
wuchengli 2015/04/24 05:54:24 s/int32_t/int32/.
kcwu 2015/04/30 19:25:41 Done.
797 media::JpegDecodeAccelerator::Error) /* error */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698