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

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: . 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.
piman 2011/06/28 01:19:22 You can make an IPC_STRUCT which implements the pi
Ami GONE FROM CHROMIUM 2011/06/28 21:00:53 Done.
27 typedef std::pair<int32, int32> ReadWriteTokens;
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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 307
299 // Create a surface for offscreen rendering. 308 // Create a surface for offscreen rendering.
300 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_CreateOffscreenSurface, 309 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_CreateOffscreenSurface,
301 gfx::Size, /* size */ 310 gfx::Size, /* size */
302 int /* route_id */) 311 int /* route_id */)
303 312
304 // Destroy a surface by routing id. 313 // Destroy a surface by routing id.
305 IPC_MESSAGE_CONTROL1(GpuChannelMsg_DestroySurface, 314 IPC_MESSAGE_CONTROL1(GpuChannelMsg_DestroySurface,
306 int /* route_id */) 315 int /* route_id */)
307 316
308 // Create hardware video decoder && associate it with the output |decoder_id|; 317 // Create a hardware video decoder; the new route ID is returned through
318 // AcceleratedVideoDecoderHostMsg_CreateDone.
309 // We need this to be control message because we had to map the GpuChannel and 319 // We need this to be control message because we had to map the GpuChannel and
310 // |decoder_id|. 320 // |decoder_id|.
311 IPC_MESSAGE_CONTROL3(GpuChannelMsg_CreateVideoDecoder, 321 IPC_MESSAGE_CONTROL3(GpuChannelMsg_CreateVideoDecoder,
312 int32, /* decoder_id */ 322 int32, /* decoder_host_id */
313 uint32, /* command buffer route id*/ 323 uint32, /* command buffer route id*/
314 std::vector<uint32>) /* configs */ 324 std::vector<uint32>) /* configs */
315 325
316 // Release all resource of the hardware video decoder which was assocaited 326 // Release all resource of the hardware video decoder which was assocaited
317 // with the input |decoder_id|. 327 // with the input |decoder_id|.
318 // TODO(hclam): This message needs to be asynchronous. 328 // TODO(hclam): This message needs to be asynchronous.
319 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyVideoDecoder, 329 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyVideoDecoder,
320 int32 /* decoder_id */) 330 int32 /* decoder_id */)
321 331
322 // Create a TransportTexture corresponding to |host_id|. 332 // Create a TransportTexture corresponding to |host_id|.
323 IPC_MESSAGE_CONTROL2(GpuChannelMsg_CreateTransportTexture, 333 IPC_MESSAGE_CONTROL2(GpuChannelMsg_CreateTransportTexture,
324 int32, /* context_route_id */ 334 int32, /* context_route_id */
325 int32 /* host_id */) 335 int32 /* host_id */)
326 336
327 // Sent from Renderer process to the GPU process to give the texture IDs for
328 // the textures the decoder will use for output.
329 IPC_MESSAGE_CONTROL4(GpuChannelMsg_AssignTexturesToVideoDecoder,
330 int32, /* Decoder ID */
331 std::vector<int32>, /* Picture buffer ID */
332 std::vector<uint32>, /* Texture ID */
333 std::vector<gfx::Size>) /* Size */
334 //------------------------------------------------------------------------------ 337 //------------------------------------------------------------------------------
335 // GPU Command Buffer Messages 338 // GPU Command Buffer Messages
336 // These are messages between a renderer process to the GPU process relating to 339 // These are messages between a renderer process to the GPU process relating to
337 // a single OpenGL context. 340 // a single OpenGL context.
338 // Initialize a command buffer with the given number of command entries. 341 // Initialize a command buffer with the given number of command entries.
339 // Returns the shared memory handle for the command buffer mapped to the 342 // Returns the shared memory handle for the command buffer mapped to the
340 // calling process. 343 // calling process.
341 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_Initialize, 344 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_Initialize,
342 base::SharedMemoryHandle /* ring_buffer */, 345 base::SharedMemoryHandle /* ring_buffer */,
343 int32 /* size */, 346 int32 /* size */,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 // Instruct the renderer to release all generated textures. 459 // Instruct the renderer to release all generated textures.
457 IPC_MESSAGE_ROUTED0(GpuTransportTextureHostMsg_ReleaseTextures) 460 IPC_MESSAGE_ROUTED0(GpuTransportTextureHostMsg_ReleaseTextures)
458 461
459 // Notify a texture has been updated. The texture id is in the client context. 462 // Notify a texture has been updated. The texture id is in the client context.
460 IPC_MESSAGE_ROUTED1(GpuTransportTextureHostMsg_TextureUpdated, 463 IPC_MESSAGE_ROUTED1(GpuTransportTextureHostMsg_TextureUpdated,
461 int /* texture_id */) 464 int /* texture_id */)
462 465
463 //------------------------------------------------------------------------------ 466 //------------------------------------------------------------------------------
464 // Accelerated Video Decoder Messages 467 // Accelerated Video Decoder Messages
465 // These messages are sent from Renderer process to GPU process. 468 // These messages are sent from Renderer process to GPU process.
469 //
470 // Most of these messages defer execution until |tokens.second| is seen (using
471 // |tokens.first| as a wrap-around indicator).
472
466 // Message to query configuration information from the GPU process. 473 // Message to query configuration information from the GPU process.
467 IPC_SYNC_MESSAGE_CONTROL1_1(AcceleratedVideoDecoderMsg_GetConfigs, 474 IPC_SYNC_MESSAGE_CONTROL2_1(AcceleratedVideoDecoderMsg_GetConfigs,
475 ReadWriteTokens, /* tokens: <read,write> */
468 std::vector<uint32>, /* Proto config */ 476 std::vector<uint32>, /* Proto config */
469 std::vector<uint32>) /* Matching configs */ 477 std::vector<uint32>) /* Matching configs */
470 478
471 // Message to initialize the accelerated video decoder. 479 // Message to initialize the accelerated video decoder.
472 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_Initialize, 480 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_Initialize,
481 ReadWriteTokens, /* tokens: <read,write> */
473 std::vector<uint32>) /* Config */ 482 std::vector<uint32>) /* Config */
474 483
475 // Send input buffer for decoding. 484 // Send input buffer for decoding.
476 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_Decode, 485 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderMsg_Decode,
486 ReadWriteTokens, /* tokens: <read,write> */
487 base::SharedMemoryHandle, /* input_buffer_handle */
477 int32, /* bitstream_buffer_id */ 488 int32, /* bitstream_buffer_id */
478 base::SharedMemoryHandle, /* input_buffer_handle */
479 int32) /* size */ 489 int32) /* size */
480 490
491 // Sent from Renderer process to the GPU process to give the texture IDs for
492 // the textures the decoder will use for output. Delays evaluation until
493 // |token.second| is seen.
494 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderMsg_AssignTextures,
495 ReadWriteTokens, /* tokens: <read,write> */
496 std::vector<int32>, /* Picture buffer ID */
497 std::vector<uint32>, /* Texture ID */
498 std::vector<gfx::Size>) /* Size */
499
481 // Sent from Renderer process to the GPU process to give the system memory 500 // Sent from Renderer process to the GPU process to give the system memory
482 // buffers that the decoder will use for output. 501 // buffers that the decoder will use for output.
483 // 502 //
484 // The length of the list of SharedMemoryHandles cannot exceed 503 // The length of the list of SharedMemoryHandles cannot exceed
485 // FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE; see 504 // FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE; see
486 // ipc/file_descriptor_set_posix. 505 // ipc/file_descriptor_set_posix.
487 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_AssignSysmemBuffers, 506 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderMsg_AssignSysmemBuffers,
507 ReadWriteTokens, /* tokens: <read,write> */
488 std::vector<int32>, /* Picture buffer ID */ 508 std::vector<int32>, /* Picture buffer ID */
489 std::vector<base::SharedMemoryHandle>, /* Sysmem buffer */ 509 std::vector<base::SharedMemoryHandle>, /* Sysmem buffer */
490 std::vector<gfx::Size>) /* Size */ 510 std::vector<gfx::Size>) /* Size */
491 511
492 // Send from Renderer process to the GPU process to recycle the given picture 512 // Send from Renderer process to the GPU process to recycle the given picture
493 // buffer for further decoding. 513 // buffer for further decoding.
494 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer, 514 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_ReusePictureBuffer,
515 ReadWriteTokens, /* tokens: <read,write> */
495 int32) /* Picture buffer ID */ 516 int32) /* Picture buffer ID */
496 517
497 // Send flush request to the decoder. 518 // Send flush request to the decoder.
498 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush) 519 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_Flush,
520 ReadWriteTokens) /* tokens: <read,write> */
499 521
500 // Send abort request to the decoder. 522 // Send abort request to the decoder.
501 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Abort) 523 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_Abort,
524 ReadWriteTokens) /* tokens: <read,write> */
502 525
503 // Destroy and release decoder asynchronously. 526 // Destroy and release decoder asynchronously.
504 IPC_SYNC_MESSAGE_CONTROL0_0(AcceleratedVideoDecoderMsg_Destroy) 527 IPC_SYNC_MESSAGE_CONTROL1_0(AcceleratedVideoDecoderMsg_Destroy,
528 ReadWriteTokens) /* tokens: <read,write> */
505 529
506 //------------------------------------------------------------------------------ 530 //------------------------------------------------------------------------------
507 // Accelerated Video Decoder Host Messages 531 // Accelerated Video Decoder Host Messages
508 // These messages are sent from GPU process to Renderer process. 532 // These messages are sent from GPU process to Renderer process.
509 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been 533 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been
510 // created. 534 // created.
511 535
512 // Accelerated video decoder has consumed input buffer from transfer buffer. 536 // Accelerated video decoder has consumed input buffer from transfer buffer.
513 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed, 537 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed,
514 int32) /* Processed buffer ID */ 538 int32) /* Processed buffer ID */
(...skipping 28 matching lines...) Expand all
543 567
544 // Confirm decoder has been aborted. 568 // Confirm decoder has been aborted.
545 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_AbortDone) 569 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_AbortDone)
546 570
547 // Decoder has faced end of stream marker in the stream. 571 // Decoder has faced end of stream marker in the stream.
548 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_EndOfStream) 572 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_EndOfStream)
549 573
550 // Video decoder has encountered an error. 574 // Video decoder has encountered an error.
551 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification, 575 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification,
552 uint32) /* Error ID */ 576 uint32) /* Error ID */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698