1 // Copyright 2016 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Multiply-included message file, hence no include guard here, but see below 6 // for a much smaller-than-usual include guard section. 7 8 #include <stdint.h> 9 10 #include "base/unguessable_token.h" 11 #include "gpu/config/gpu_info.h" 12 #include "gpu/ipc/common/gpu_param_traits_macros.h" 13 #include "ipc/ipc_message_macros.h" 14 #include "ipc/param_traits_macros.h" 15 #include "media/base/overlay_info.h" 16 #include "media/gpu/ipc/common/media_param_traits.h" 17 #include "media/video/video_decode_accelerator.h" 18 #include "ui/gfx/ipc/color/gfx_param_traits.h" 19 #include "ui/gfx/ipc/gfx_param_traits.h" 20 21 #define IPC_MESSAGE_START MediaMsgStart 22 23 IPC_STRUCT_BEGIN(AcceleratedVideoDecoderHostMsg_PictureReady_Params) 24 IPC_STRUCT_MEMBER(int32_t, picture_buffer_id) 25 IPC_STRUCT_MEMBER(int32_t, bitstream_buffer_id) 26 IPC_STRUCT_MEMBER(gfx::Rect, visible_rect) 27 IPC_STRUCT_MEMBER(gfx::ColorSpace, color_space) 28 IPC_STRUCT_MEMBER(bool, allow_overlay) 29 IPC_STRUCT_MEMBER(bool, read_lock_fences_enabled) 30 IPC_STRUCT_MEMBER(bool, size_changed) 31 IPC_STRUCT_MEMBER(bool, surface_texture) 32 IPC_STRUCT_MEMBER(bool, wants_promotion_hint) 33 IPC_STRUCT_END() 34 35 //------------------------------------------------------------------------------ 36 // Utility Messages 37 38 // Sent from Renderer to GPU process to request a token identifying the channel. 39 // These tokens can be used to prove ownership of the channel. The intended use 40 // case is to share the command buffer with MojoMediaApplication. 41 IPC_SYNC_MESSAGE_CONTROL0_1(GpuCommandBufferMsg_GetChannelToken, 42 base::UnguessableToken /* channel_token */) 43 44 //------------------------------------------------------------------------------ 45 // Accelerated Video Decoder Messages 46 // These messages are sent from Renderer process to GPU process. 47 48 // Create and initialize a hardware video decoder using the specified route_id. 49 // Created decoders should be freed with AcceleratedVideoDecoderMsg_Destroy when 50 // no longer needed. 51 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_CreateVideoDecoder, 52 media::VideoDecodeAccelerator::Config /* config */, 53 int32_t /* decoder_route_id */, 54 bool /* succeeded */) 55 56 // Send input buffer for decoding. 57 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_Decode, media::BitstreamBuffer) 58 59 // Give the texture IDs for the textures the decoder will use for output. 60 IPC_MESSAGE_ROUTED2( 61 AcceleratedVideoDecoderMsg_AssignPictureBuffers, 62 std::vector<int32_t>, /* Picture buffer ID */ 63 std::vector<media::PictureBuffer::TextureIds>) /* Texture ID */ 64 65 // Send from Renderer process to the GPU process to recycle the given picture 66 // buffer for further decoding. 67 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer, 68 int32_t) /* Picture buffer ID */ 69 70 // Send flush request to the decoder. 71 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush) 72 73 // Send reset request to the decoder. 74 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Reset) 75 76 // Send overlay info to the decoder. 77 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_SetOverlayInfo, 78 media::OverlayInfo) 79 80 // Send destroy request to the decoder. 81 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Destroy) 82 83 //------------------------------------------------------------------------------ 84 // Accelerated Video Decoder Host Messages 85 // These messages are sent from GPU process to Renderer process. 86 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been 87 // created. 88 89 // Notify the deferred initialization result. 90 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_InitializationComplete, 91 bool) /* success */ 92 93 // Accelerated video decoder has consumed input buffer from transfer buffer. 94 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed, 95 int32_t) /* Processed buffer ID */ 96 97 // Allocate video frames for output of the hardware video decoder. 98 IPC_MESSAGE_ROUTED5(AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers, 99 int32_t, /* Number of video frames to generate */ 100 media::VideoPixelFormat, /* Picture buffer format */ 101 uint32_t, /* Number of textures per frame */ 102 gfx::Size, /* Requested size of buffer */ 103 uint32_t) /* Texture target */ 104 105 // Decoder reports that a picture is ready and buffer does not need to be passed 106 // back to the decoder. 107 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer, 108 int32_t) /* Picture buffer ID */ 109 110 // Decoder reports that a picture is ready. 111 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_PictureReady, 112 AcceleratedVideoDecoderHostMsg_PictureReady_Params) 113 114 // Confirm decoder has been flushed. 115 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone) 116 117 // Confirm decoder has been reset. 118 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone) 119 120 // Video decoder has encountered an error. 121 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification, 122 uint32_t /* Error ID */) 123