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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module ui.ozone.mojom;
import "skia/public/mojom/skcolor4f.mojom";
import "mojo/public/mojom/base/version.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/gfx/mojom/accelerated_widget.mojom";
import "ui/gfx/mojom/buffer_types.mojom";
import "ui/gfx/mojom/gpu_fence_handle.mojom";
import "ui/gfx/mojom/swap_result.mojom";
import "ui/gfx/mojom/frame_data.mojom";
import "ui/ozone/platform/wayland/mojom/wayland_overlay_config.mojom";
import "ui/ozone/platform/wayland/mojom/wayland_presentation_info.mojom";
// Implemented by the browser process and used by the GPU.
interface WaylandBufferManagerHost {
// Sets up an associated pipe between the Gpu and Host.
SetWaylandBufferManagerGpu(
pending_associated_remote<WaylandBufferManagerGpu>
buffer_manager_gpu_associated);
// The following two methods are used either for hardware accelerated
// rendering or for the software rendering.
//
// If the hardware accelerated rendering path is taken, this method can be
// used to ask Wayland to create a wl_buffer based on the |dmabuf_fd|
// descriptor. The |size| is the size of the buffer, the |strides|,
// |offsets| and |modifiers| are the descriptions of the drm buffer object.
// The |format| describes the buffer format (check gfx::BufferFormat) in
// fourcc form. The |planes_count| says how many planes the buffer, backed
// by the |file| descriptor has. And the |buffer_id| is a unique id for the
// buffer, which is used to identify imported wl_buffers on the browser
// process side and map them with the buffer objects on the gpu process side.
// The buffer will be associated with an AcceleratedWidget as soon as the
// very first CommitOverlays request comes from viz to browser process.
// If the buffer has been committed at least once, it is not possible to
// reassign it to another AcceleratedWidget.
CreateDmabufBasedBuffer(handle<platform> dmabuf_fd,
gfx.mojom.Size size,
array<uint32> strides,
array<uint32> offsets,
array<uint64> modifiers,
uint32 format,
uint32 planes_count,
uint32 buffer_id);
// If software rendering path is used, this method can be used to ask
// Wayland to create a wl_buffer based on the |shm_fd| descriptor.
// The |length| is the length of the shared memory, |size|
// is the size of buffer and |buffer_id| is the id of the buffer.
// The buffer will be associated with an AcceleratedWidget as soon as the
// very first CommitOverlays request comes from viz to browser process. If
// the buffer has been committed at least once, it is not possible to
// reassign it to another AcceleratedWidget.
CreateShmBasedBuffer(handle<platform> shm_fd,
uint64 length,
gfx.mojom.Size size,
uint32 buffer_id);
// Creates a browser side single pixel wl_buffer that is cleared to a given
// |color| on the Wayland compositor side without any performance penalties
// compared to creation of dmabuf/shm backed buffers cleared to a certain
// color. |color| is a requested color. And |buffer_id| is a unique id for
// the buffer, which is used to identify imported wl_buffers on the browser
// process side and map them with the buffer objects on the gpu process side.
CreateSinglePixelBuffer(skia.mojom.SkColor4f color,
uint32 buffer_id);
// These two methods are independent from the type of rendering.
//
// Destroys a wl_buffer created by WaylandConnection based on the |buffer_id|.
// The |buffer_id| is the unique id of the buffer objects being destroyed on
// the browser process side. Providing wrong |buffer_id| will result in the
// termination of the GPU process.
DestroyBuffer(uint32 buffer_id);
// Send overlay configurations for a frame to a WaylandWindow with the
// following |widget|, |frame_id|, and |overlays|.
[EstimateSize]
CommitOverlays(gfx.mojom.AcceleratedWidget widget,
uint32 frame_id,
gfx.mojom.FrameData data,
array<wl.mojom.WaylandOverlayConfig> overlays);
};
// Implemented by the GPU and used by the browser process.
interface WaylandBufferManagerGpu {
// Initializes the gpu side buffer manager by passing the interface pointer of
// of the WaylandBufferManagerHost that lives in the browser process to it.
// Also supplies the gpu side manager with the supported buffer formats and
// modifiers so that gpu side clients could be aware of supported modifiers
// the Wayland compositor announces. The modifiers may be empty, which means
// modifiers are not supported.
// The browser process may also request the client to reset gbm device
// instance to avoid using zwp_linux_dmabuf protocol by setting
// `supports_dma_buf` to false, which results in using wl_egl_surface in a
// single process mode, and software rendering in a multiple process mode.
// `supports_viewporter` indicates whether the Wayland server implements
// wp_viewporter extension to support cropping and scaling buffers.
// `supports_acquire_fence` indicates whether acquire fences can be submitted
// with buffers for wayland servers to wait on before accessing buffer
// contents.
// `supports_overlays` indicates whether overlays should be used with this
// Wayland compositor.
Initialize(pending_remote<WaylandBufferManagerHost> remote_host,
map<gfx.mojom.BufferFormat,
array<uint64>> buffer_formats_with_modifiers,
bool supports_dma_buf,
bool supports_viewporter,
bool supports_acquire_fence,
bool supports_overlays,
bool supports_single_pixel_buffer);
// Signals about swap completion and presentation.
OnSubmission(gfx.mojom.AcceleratedWidget widget,
uint32 frame_id,
gfx.mojom.SwapResult swap_result,
gfx.mojom.GpuFenceHandle? release_fence_handle,
array<wl.mojom.WaylandPresentationInfo> presentation_infos);
// Usually OnSubmission() piggybacks presentation feedback information. When
// there is pending presentation feedback information but no submission for
// some time, this method is called to flush the presentation feedback
// information.
OnPresentation(gfx.mojom.AcceleratedWidget widget,
array<wl.mojom.WaylandPresentationInfo> presentation_infos);
};
|