|
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 include LayersSurfaces; |
|
7 include LayersMessages; |
|
8 include protocol PGrallocBuffer; |
|
9 include protocol PCompositable; |
|
10 include protocol PTexture; |
|
11 include ProtocolTypes; |
|
12 |
|
13 include "mozilla/GfxMessageUtils.h"; |
|
14 |
|
15 using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h"; |
|
16 |
|
17 namespace mozilla { |
|
18 namespace layers { |
|
19 |
|
20 /** |
|
21 * The PImageBridge protocol is used to allow isolated threads or processes to push |
|
22 * frames directly to the compositor thread/process without relying on the main thread |
|
23 * which might be too busy dealing with content script. |
|
24 */ |
|
25 intr protocol PImageBridge |
|
26 { |
|
27 manages PCompositable; |
|
28 manages PGrallocBuffer; |
|
29 manages PTexture; |
|
30 |
|
31 parent: |
|
32 |
|
33 sync Update(CompositableOperation[] ops) returns (EditReply[] reply); |
|
34 async UpdateNoSwap(CompositableOperation[] ops); |
|
35 |
|
36 // Allocates a gralloc buffer that may not suitable to use with |
|
37 // gfxImageSurface but allows hardware decoder to write to the |
|
38 // buffer directly. The format is a enum defined in |
|
39 // system/graphics.h and the usage is the GraphicBuffer usage |
|
40 // flag. See GraphicBuffer.h and gralloc.h. |
|
41 sync PGrallocBuffer(IntSize size, uint32_t format, uint32_t usage) |
|
42 returns (MaybeMagicGrallocBufferHandle handle); |
|
43 |
|
44 // First step of the destruction sequence. This puts ImageBridge |
|
45 // in a state in which it can't send asynchronous messages |
|
46 // so as to not race with the upcomming Stop message and destruction. |
|
47 // In the child side, the Stop message is not sent right after WillStop, |
|
48 // it is scheduled in the ImageBridgeChild's message queue in order to ensure |
|
49 // that all of the messages from the parent side have been received and processed |
|
50 // before sending Stop, and that after Stop returns, there is no message in |
|
51 // flight on any side and we can safely destroy the channel and threads. |
|
52 sync WillStop(); |
|
53 // Second step |
|
54 sync Stop(); |
|
55 |
|
56 sync PCompositable(TextureInfo aInfo) returns (uint64_t id); |
|
57 async PTexture(SurfaceDescriptor aSharedData, uint32_t aTextureFlags); |
|
58 }; |
|
59 |
|
60 |
|
61 } // namespace |
|
62 } // namespace |
|
63 |