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

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

Issue 7260008: Implement proper synchronization between HW video decode IPC and CommandBuffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing compilation errors from bots. Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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
6 // for a much smaller-than-usual include guard section.
7
5 #include <vector> 8 #include <vector>
6 #include <string> 9 #include <string>
7 10
8
9 #include "base/shared_memory.h" 11 #include "base/shared_memory.h"
10 #include "content/common/common_param_traits.h" 12 #include "content/common/common_param_traits.h"
11 #include "content/common/gpu/gpu_info.h" 13 #include "content/common/gpu/gpu_info.h"
12 #include "content/common/gpu/gpu_process_launch_causes.h" 14 #include "content/common/gpu/gpu_process_launch_causes.h"
13 #include "gpu/command_buffer/common/command_buffer.h" 15 #include "gpu/command_buffer/common/command_buffer.h"
14 #include "gpu/ipc/gpu_command_buffer_traits.h" 16 #include "gpu/ipc/gpu_command_buffer_traits.h"
15 #include "ipc/ipc_channel_handle.h" 17 #include "ipc/ipc_channel_handle.h"
16 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_macros.h"
17 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
18 #include "ui/gfx/size.h" 20 #include "ui/gfx/size.h"
19 // Multiply-included message file, hence no include guard. 21
22 // Singly-included section.
23 #ifndef CONTENT_COMMON_GPU_GPU_MESSAGES_H_
24 #define CONTENT_COMMON_GPU_GPU_MESSAGES_H_
25 // typedef is required because commas confuse IPC_MESSAGE_* macro expansions.
26 // Pair contains: first: last_token_read, second: last_token_written.
27 typedef std::pair<int32, int32> ReadWriteTokens;
scherkus (not reviewing) 2011/06/27 22:54:47 do we have to use std::pair? a struct w/ two fiel
Ami GONE FROM CHROMIUM 2011/06/28 00:06:35 That's true, but comes at the cost of having to de
scherkus (not reviewing) 2011/06/28 01:22:15 If you have an externally declared struct: struct
Ami GONE FROM CHROMIUM 2011/06/28 21:02:32 Done.
28 #endif // CONTENT_COMMON_GPU_GPU_MESSAGES_H_
20 29
21 #define IPC_MESSAGE_START GpuMsgStart 30 #define IPC_MESSAGE_START GpuMsgStart
22 31
23 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig) 32 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig)
24 IPC_STRUCT_MEMBER(std::string, allowed_extensions) 33 IPC_STRUCT_MEMBER(std::string, allowed_extensions)
25 IPC_STRUCT_MEMBER(std::vector<int>, attribs) 34 IPC_STRUCT_MEMBER(std::vector<int>, attribs)
26 IPC_STRUCT_MEMBER(GURL, active_url) 35 IPC_STRUCT_MEMBER(GURL, active_url)
27 IPC_STRUCT_END() 36 IPC_STRUCT_END()
28 37
29 #if defined(OS_MACOSX) 38 #if defined(OS_MACOSX)
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 308
300 // Create a surface for offscreen rendering. 309 // Create a surface for offscreen rendering.
301 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_CreateOffscreenSurface, 310 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_CreateOffscreenSurface,
302 gfx::Size, /* size */ 311 gfx::Size, /* size */
303 int /* route_id */) 312 int /* route_id */)
304 313
305 // Destroy a surface by routing id. 314 // Destroy a surface by routing id.
306 IPC_MESSAGE_CONTROL1(GpuChannelMsg_DestroySurface, 315 IPC_MESSAGE_CONTROL1(GpuChannelMsg_DestroySurface,
307 int /* route_id */) 316 int /* route_id */)
308 317
309 // Create hardware video decoder && associate it with the output |decoder_id|; 318 // Create a hardware video decoder; the new route ID is returned through
319 // AcceleratedVideoDecoderHostMsg_CreateDone.
310 // We need this to be control message because we had to map the GpuChannel and 320 // We need this to be control message because we had to map the GpuChannel and
311 // |decoder_id|. 321 // |decoder_id|.
312 IPC_MESSAGE_CONTROL3(GpuChannelMsg_CreateVideoDecoder, 322 IPC_MESSAGE_CONTROL3(GpuChannelMsg_CreateVideoDecoder,
313 int32, /* decoder_id */ 323 int32, /* decoder_host_id */
314 uint32, /* command buffer route id*/ 324 uint32, /* command buffer route id*/
315 std::vector<uint32>) /* configs */ 325 std::vector<uint32>) /* configs */
316 326
317 // Release all resource of the hardware video decoder which was assocaited 327 // Release all resource of the hardware video decoder which was assocaited
318 // with the input |decoder_id|. 328 // with the input |decoder_id|.
319 // TODO(hclam): This message needs to be asynchronous. 329 // TODO(hclam): This message needs to be asynchronous.
320 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyVideoDecoder, 330 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyVideoDecoder,
321 int32 /* decoder_id */) 331 int32 /* decoder_id */)
322 332
323 // Create a TransportTexture corresponding to |host_id|. 333 // Create a TransportTexture corresponding to |host_id|.
324 IPC_MESSAGE_CONTROL2(GpuChannelMsg_CreateTransportTexture, 334 IPC_MESSAGE_CONTROL2(GpuChannelMsg_CreateTransportTexture,
325 int32, /* context_route_id */ 335 int32, /* context_route_id */
326 int32 /* host_id */) 336 int32 /* host_id */)
327 337
328 // Sent from Renderer process to the GPU process to give the texture IDs for
329 // the textures the decoder will use for output.
330 IPC_MESSAGE_CONTROL4(GpuChannelMsg_AssignTexturesToVideoDecoder,
331 int32, /* Decoder ID */
332 std::vector<int32>, /* Picture buffer ID */
333 std::vector<uint32>, /* Texture ID */
334 std::vector<gfx::Size>) /* Size */
335 //------------------------------------------------------------------------------ 338 //------------------------------------------------------------------------------
336 // GPU Command Buffer Messages 339 // GPU Command Buffer Messages
337 // These are messages between a renderer process to the GPU process relating to 340 // These are messages between a renderer process to the GPU process relating to
338 // a single OpenGL context. 341 // a single OpenGL context.
339 // Initialize a command buffer with the given number of command entries. 342 // Initialize a command buffer with the given number of command entries.
340 // Returns the shared memory handle for the command buffer mapped to the 343 // Returns the shared memory handle for the command buffer mapped to the
341 // calling process. 344 // calling process.
342 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_Initialize, 345 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_Initialize,
343 base::SharedMemoryHandle /* ring_buffer */, 346 base::SharedMemoryHandle /* ring_buffer */,
344 int32 /* size */, 347 int32 /* size */,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // Instruct the renderer to release all generated textures. 460 // Instruct the renderer to release all generated textures.
458 IPC_MESSAGE_ROUTED0(GpuTransportTextureHostMsg_ReleaseTextures) 461 IPC_MESSAGE_ROUTED0(GpuTransportTextureHostMsg_ReleaseTextures)
459 462
460 // Notify a texture has been updated. The texture id is in the client context. 463 // Notify a texture has been updated. The texture id is in the client context.
461 IPC_MESSAGE_ROUTED1(GpuTransportTextureHostMsg_TextureUpdated, 464 IPC_MESSAGE_ROUTED1(GpuTransportTextureHostMsg_TextureUpdated,
462 int /* texture_id */) 465 int /* texture_id */)
463 466
464 //------------------------------------------------------------------------------ 467 //------------------------------------------------------------------------------
465 // Accelerated Video Decoder Messages 468 // Accelerated Video Decoder Messages
466 // These messages are sent from Renderer process to GPU process. 469 // These messages are sent from Renderer process to GPU process.
470 //
471 // Most of these messages defer execution until |tokens.second| is seen (using
472 // |tokens.first| as a wrap-around indicator).
473
467 // Message to query configuration information from the GPU process. 474 // Message to query configuration information from the GPU process.
468 IPC_SYNC_MESSAGE_CONTROL1_1(AcceleratedVideoDecoderMsg_GetConfigs, 475 IPC_SYNC_MESSAGE_CONTROL2_1(AcceleratedVideoDecoderMsg_GetConfigs,
476 ReadWriteTokens, /* tokens: <read,write> */
469 std::vector<uint32>, /* Proto config */ 477 std::vector<uint32>, /* Proto config */
470 std::vector<uint32>) /* Matching configs */ 478 std::vector<uint32>) /* Matching configs */
471 479
472 // Message to initialize the accelerated video decoder. 480 // Message to initialize the accelerated video decoder.
473 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_Initialize, 481 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_Initialize,
482 ReadWriteTokens, /* tokens: <read,write> */
474 std::vector<uint32>) /* Config */ 483 std::vector<uint32>) /* Config */
475 484
476 // Send input buffer for decoding. 485 // Send input buffer for decoding.
477 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_Decode, 486 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderMsg_Decode,
487 ReadWriteTokens, /* tokens: <read,write> */
488 base::SharedMemoryHandle, /* input_buffer_handle */
478 int32, /* bitstream_buffer_id */ 489 int32, /* bitstream_buffer_id */
479 base::SharedMemoryHandle, /* input_buffer_handle */
480 int32) /* size */ 490 int32) /* size */
481 491
492 // Sent from Renderer process to the GPU process to give the texture IDs for
493 // the textures the decoder will use for output. Delays evaluation until
494 // |token.second| is seen.
495 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderMsg_AssignTextures,
496 ReadWriteTokens, /* tokens: <read,write> */
497 std::vector<int32>, /* Picture buffer ID */
498 std::vector<uint32>, /* Texture ID */
499 std::vector<gfx::Size>) /* Size */
500
482 // Sent from Renderer process to the GPU process to give the system memory 501 // Sent from Renderer process to the GPU process to give the system memory
483 // buffers that the decoder will use for output. 502 // buffers that the decoder will use for output.
484 // 503 //
485 // The length of the list of SharedMemoryHandles cannot exceed 504 // The length of the list of SharedMemoryHandles cannot exceed
486 // FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE; see 505 // FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE; see
487 // ipc/file_descriptor_set_posix. 506 // ipc/file_descriptor_set_posix.
488 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_AssignSysmemBuffers, 507 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderMsg_AssignSysmemBuffers,
508 ReadWriteTokens, /* tokens: <read,write> */
489 std::vector<int32>, /* Picture buffer ID */ 509 std::vector<int32>, /* Picture buffer ID */
490 std::vector<base::SharedMemoryHandle>, /* Sysmem buffer */ 510 std::vector<base::SharedMemoryHandle>, /* Sysmem buffer */
491 std::vector<gfx::Size>) /* Size */ 511 std::vector<gfx::Size>) /* Size */
492 512
493 // Send from Renderer process to the GPU process to recycle the given picture 513 // Send from Renderer process to the GPU process to recycle the given picture
494 // buffer for further decoding. 514 // buffer for further decoding.
495 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer, 515 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_ReusePictureBuffer,
516 ReadWriteTokens, /* tokens: <read,write> */
496 int32) /* Picture buffer ID */ 517 int32) /* Picture buffer ID */
497 518
498 // Send flush request to the decoder. 519 // Send flush request to the decoder.
499 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush) 520 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_Flush,
521 ReadWriteTokens) /* tokens: <read,write> */
500 522
501 // Send abort request to the decoder. 523 // Send abort request to the decoder.
502 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Abort) 524 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_Abort,
525 ReadWriteTokens) /* tokens: <read,write> */
503 526
504 // Destroy and release decoder asynchronously. 527 // Destroy and release decoder asynchronously.
505 IPC_SYNC_MESSAGE_CONTROL0_0(AcceleratedVideoDecoderMsg_Destroy) 528 IPC_SYNC_MESSAGE_CONTROL1_0(AcceleratedVideoDecoderMsg_Destroy,
529 ReadWriteTokens) /* tokens: <read,write> */
506 530
507 //------------------------------------------------------------------------------ 531 //------------------------------------------------------------------------------
508 // Accelerated Video Decoder Host Messages 532 // Accelerated Video Decoder Host Messages
509 // These messages are sent from GPU process to Renderer process. 533 // These messages are sent from GPU process to Renderer process.
510 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been 534 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been
511 // created. 535 // created.
512 536
513 // Accelerated video decoder has consumed input buffer from transfer buffer. 537 // Accelerated video decoder has consumed input buffer from transfer buffer.
514 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed, 538 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed,
515 int32) /* Processed buffer ID */ 539 int32) /* Processed buffer ID */
(...skipping 28 matching lines...) Expand all
544 568
545 // Confirm decoder has been aborted. 569 // Confirm decoder has been aborted.
546 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_AbortDone) 570 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_AbortDone)
547 571
548 // Decoder has faced end of stream marker in the stream. 572 // Decoder has faced end of stream marker in the stream.
549 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_EndOfStream) 573 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_EndOfStream)
550 574
551 // Video decoder has encountered an error. 575 // Video decoder has encountered an error.
552 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification, 576 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification,
553 uint32) /* Error ID */ 577 uint32) /* Error ID */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698