The question is which capture route to ship for live streaming and agent eyes. Speed alone does not decide it, so every route now also reports producer CPU and RSS, machine CPU from /proc/stat, the compositor's own CPU, and a per-frame buffer footprint -- all sampled around the measured loop, with an idle control sample so an animating page's cost is not attributed to the capture. The baseline forks a process per frame and spends 95% of each frame waiting, so the interesting finding is not which route is faster but which one leaves the compositor able to do its job: in-process acquisition roughly halves the compositor's per-frame CPU even though the machine saturates either way.
233 lines
8.3 KiB
Python
233 lines
8.3 KiB
Python
# This file has been autogenerated by the pywayland scanner
|
|
|
|
# Copyright © 2008-2011 Kristian Høgsberg
|
|
# Copyright © 2010-2011 Intel Corporation
|
|
# Copyright © 2012-2013 Collabora, Ltd.
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person
|
|
# obtaining a copy of this software and associated documentation files
|
|
# (the "Software"), to deal in the Software without restriction,
|
|
# including without limitation the rights to use, copy, modify, merge,
|
|
# publish, distribute, sublicense, and/or sell copies of the Software,
|
|
# and to permit persons to whom the Software is furnished to do so,
|
|
# subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice (including the
|
|
# next paragraph) shall be included in all copies or substantial
|
|
# portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
# SOFTWARE.
|
|
|
|
from __future__ import annotations
|
|
|
|
import enum
|
|
|
|
from pywayland.protocol_core import (
|
|
Argument,
|
|
ArgumentType,
|
|
Global,
|
|
Interface,
|
|
Proxy,
|
|
Resource,
|
|
)
|
|
|
|
from .wl_surface import WlSurface
|
|
|
|
|
|
class WlSubsurface(Interface):
|
|
"""Sub-surface interface to a :class:`~pywayland.protocol.wayland.WlSurface`
|
|
|
|
An additional interface to a :class:`~pywayland.protocol.wayland.WlSurface`
|
|
object, which has been made a sub-surface. A sub-surface has one parent
|
|
surface. A sub-surface's size and position are not limited to that of the
|
|
parent. Particularly, a sub-surface is not automatically clipped to its
|
|
parent's area.
|
|
|
|
A sub-surface becomes mapped, when a non-NULL
|
|
:class:`~pywayland.protocol.wayland.WlBuffer` is applied and the parent
|
|
surface is mapped. The order of which one happens first is irrelevant. A
|
|
sub-surface is hidden if the parent becomes hidden, or if a NULL
|
|
:class:`~pywayland.protocol.wayland.WlBuffer` is applied. These rules apply
|
|
recursively through the tree of surfaces.
|
|
|
|
A sub-surface can be in one of two modes. The possible modes are
|
|
synchronized and desynchronized, see methods
|
|
:func:`WlSubsurface.set_sync()` and :func:`WlSubsurface.set_desync()`.
|
|
|
|
The main surface can be thought to be always in desynchronized mode, since
|
|
it does not have a parent in the sub-surfaces sense.
|
|
|
|
Even if a sub-surface is in desynchronized mode, it will behave as in
|
|
synchronized mode, if its parent surface behaves as in synchronized mode.
|
|
This rule is applied recursively throughout the tree of surfaces. This
|
|
means, that one can set a sub-surface into synchronized mode, and then
|
|
assume that all its child and grand-child sub-surfaces are synchronized,
|
|
too, without explicitly setting them.
|
|
|
|
If a surface behaves as in synchronized mode, it is effectively
|
|
synchronized, otherwise it is effectively desynchronized.
|
|
|
|
A sub-surface is initially in the synchronized mode.
|
|
|
|
The :class:`WlSubsurface` interface has requests which modify double-
|
|
buffered state of the parent surface (:func:`WlSubsurface.set_position()`,
|
|
.place_above and .place_below).
|
|
|
|
Destroying a sub-surface takes effect immediately. If you need to
|
|
synchronize the removal of a sub-surface to the parent surface update,
|
|
unmap the sub-surface first by attaching a NULL
|
|
:class:`~pywayland.protocol.wayland.WlBuffer`, update parent, and then
|
|
destroy the sub-surface.
|
|
|
|
If the parent :class:`~pywayland.protocol.wayland.WlSurface` object is
|
|
destroyed, the sub-surface is unmapped.
|
|
|
|
A sub-surface never has the keyboard focus of any seat.
|
|
|
|
The :func:`WlSurface.offset()
|
|
<pywayland.protocol.wayland.WlSurface.offset>` request is ignored: clients
|
|
must use set_position instead to move the sub-surface.
|
|
"""
|
|
|
|
name = "wl_subsurface"
|
|
version = 1
|
|
|
|
class error(enum.IntEnum):
|
|
bad_surface = 0
|
|
|
|
|
|
class WlSubsurfaceProxy(Proxy[WlSubsurface]):
|
|
interface = WlSubsurface
|
|
|
|
@WlSubsurface.request()
|
|
def destroy(self) -> None:
|
|
"""Remove sub-surface interface
|
|
|
|
The sub-surface interface is removed from the
|
|
:class:`~pywayland.protocol.wayland.WlSurface` object that was turned
|
|
into a sub-surface with a :func:`WlSubcompositor.get_subsurface()
|
|
<pywayland.protocol.wayland.WlSubcompositor.get_subsurface>` request.
|
|
The wl_surface's association to the parent is deleted. The
|
|
:class:`~pywayland.protocol.wayland.WlSurface` is unmapped immediately.
|
|
"""
|
|
self._marshal(0)
|
|
self._destroy()
|
|
|
|
@WlSubsurface.request(
|
|
Argument(ArgumentType.Int),
|
|
Argument(ArgumentType.Int),
|
|
)
|
|
def set_position(self, x: int, y: int) -> None:
|
|
"""Reposition the sub-surface
|
|
|
|
This sets the position of the sub-surface, relative to the parent
|
|
surface.
|
|
|
|
The sub-surface will be moved so that its origin (top left corner
|
|
pixel) will be at the location x, y of the parent surface coordinate
|
|
system. The coordinates are not restricted to the parent surface area.
|
|
Negative values are allowed.
|
|
|
|
The initial position is 0, 0.
|
|
|
|
Position is double-buffered state on the parent surface, see
|
|
:class:`WlSubsurface` and :func:`WlSurface.commit()
|
|
<pywayland.protocol.wayland.WlSurface.commit>` for more information.
|
|
|
|
:param x:
|
|
x coordinate in the parent surface
|
|
:type x:
|
|
`ArgumentType.Int`
|
|
:param y:
|
|
y coordinate in the parent surface
|
|
:type y:
|
|
`ArgumentType.Int`
|
|
"""
|
|
self._marshal(1, x, y)
|
|
|
|
@WlSubsurface.request(
|
|
Argument(ArgumentType.Object, interface=WlSurface),
|
|
)
|
|
def place_above(self, sibling: WlSurface) -> None:
|
|
"""Restack the sub-surface
|
|
|
|
This sub-surface is taken from the stack, and put back just above the
|
|
reference surface, changing the z-order of the sub-surfaces. The
|
|
reference surface must be one of the sibling surfaces, or the parent
|
|
surface. Using any other surface, including this sub-surface, will
|
|
cause a protocol error.
|
|
|
|
A new sub-surface is initially added as the top-most in the stack of
|
|
its siblings and parent.
|
|
|
|
Z-order is double-buffered state on the parent surface, see
|
|
:class:`WlSubsurface` and :func:`WlSurface.commit()
|
|
<pywayland.protocol.wayland.WlSurface.commit>` for more information.
|
|
|
|
:param sibling:
|
|
the reference surface
|
|
:type sibling:
|
|
:class:`~pywayland.protocol.wayland.WlSurface`
|
|
"""
|
|
self._marshal(2, sibling)
|
|
|
|
@WlSubsurface.request(
|
|
Argument(ArgumentType.Object, interface=WlSurface),
|
|
)
|
|
def place_below(self, sibling: WlSurface) -> None:
|
|
"""Restack the sub-surface
|
|
|
|
The sub-surface is placed just below the reference surface.
|
|
|
|
See :func:`WlSubsurface.place_above()`.
|
|
|
|
:param sibling:
|
|
the reference surface
|
|
:type sibling:
|
|
:class:`~pywayland.protocol.wayland.WlSurface`
|
|
"""
|
|
self._marshal(3, sibling)
|
|
|
|
@WlSubsurface.request()
|
|
def set_sync(self) -> None:
|
|
"""Set sub-surface to synchronized mode
|
|
|
|
Change the commit behaviour of the sub-surface to synchronized mode.
|
|
|
|
See :class:`WlSubsurface` and :func:`WlSurface.commit()
|
|
<pywayland.protocol.wayland.WlSurface.commit>` for more information.
|
|
"""
|
|
self._marshal(4)
|
|
|
|
@WlSubsurface.request()
|
|
def set_desync(self) -> None:
|
|
"""Set sub-surface to desynchronized mode
|
|
|
|
Change the commit behaviour of the sub-surface to desynchronized mode.
|
|
|
|
See :class:`WlSubsurface` and :func:`WlSurface.commit()
|
|
<pywayland.protocol.wayland.WlSurface.commit>` for more information.
|
|
"""
|
|
self._marshal(5)
|
|
|
|
|
|
class WlSubsurfaceResource(Resource):
|
|
interface = WlSubsurface
|
|
|
|
|
|
class WlSubsurfaceGlobal(Global):
|
|
interface = WlSubsurface
|
|
|
|
|
|
WlSubsurface._gen_c()
|
|
WlSubsurface.proxy_class = WlSubsurfaceProxy
|
|
WlSubsurface.resource_class = WlSubsurfaceResource
|
|
WlSubsurface.global_class = WlSubsurfaceGlobal
|