summaryrefslogtreecommitdiffstats
path: root/gfx/layers/ipc/PCanvas.ipdl
blob: 5187e61d23a2560ab6cb7dadec041a6f5692a4c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * vim: sw=2 ts=8 et : */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

include protocol PCanvasManager;
include "mozilla/layers/LayersMessageUtils.h";
include "mozilla/layers/CanvasTranslator.h";

[MoveOnly] using mozilla::CrossProcessSemaphoreHandle from "mozilla/ipc/CrossProcessSemaphore.h";
using mozilla::layers::TextureType from "mozilla/layers/LayersTypes.h";
[MoveOnly] using mozilla::ipc::SharedMemoryBasic::Handle from "mozilla/ipc/SharedMemoryBasic.h";
using mozilla::gfx::BackendType from "mozilla/gfx/Types.h";

namespace mozilla {
namespace layers {

/**
 * PCanvas is the IPDL for recorded Canvas drawing.
 */
[ParentImpl="CanvasTranslator"]
async protocol PCanvas {
  manager PCanvasManager;

parent:
  /**
   * Initialize a CanvasTranslator for a particular TextureType, which
   * translates events from shared memory buffers. aHeaderHandle is a shared
   * memory handle for the control header. aBufferHandles are shared memory
   * handles for the initial buffers for translation. aBufferSize is the size of
   * each aBufferHandles' memory and the default size. aReaderSem and aWriterSem
   * are handles for the semaphores to handle waiting on either side.
   */
  async InitTranslator(TextureType aTextureType, BackendType aBackendType,
                       Handle aHeaderHandle, Handle[] aBufferHandles,
                       uint64_t aBufferSize,
                       CrossProcessSemaphoreHandle aReaderSem,
                       CrossProcessSemaphoreHandle aWriterSem);

  /**
   * Restart the translation from a Stopped state.
   */
  async RestartTranslation();

  /**
   * Adds a new buffer to be translated. The current buffer will be recycled if
   * it is of the default size. The translation will then be restarted.
   */
  async AddBuffer(Handle aBufferHandle, uint64_t aBufferSize);

  /**
   * Sets the shared memory to be used for readback.
   */
  async SetDataSurfaceBuffer(Handle aBufferHandle, uint64_t aBufferSize);

  /**
   * Notify CanvasTranslator it is about to be minimized.
   */
  async ClearCachedResources();

  async __delete__();

child:
  /**
   * Notify that the canvas device used by the translator has changed.
   */
  async NotifyDeviceChanged();

  /**
   * Deactivate remote canvas, which will cause fall back to software.
   */
  async Deactivate();

  /**
   * Block further accelerated canvases from being created, but allow existing
   * canvases to continue processing.
   */
  async BlockCanvas();

  /**
   * Notify that a remote accelerated canvas requires a fallback refresh.
   */
  async NotifyRequiresRefresh(int64_t aTextureId);

  /**
   * Cache the shmem of the framebuffer for snapshotting.
   */
  async SnapshotShmem(int64_t aTextureId, Handle aShmemHandle, uint32_t aShmemSize) returns (bool aSuccess);
};

} // layers
} // mozilla