Since the call to drmModeSetPlane() fails with EINVAL if the supplied
fb has an unsupported format (which is the case of ARGB8888), the fb
format needs to be overridden.
Make overlays work when the client uses a buffer with the same
transformation as the output.
In order to calculate the destination rectangle, the same logic in
weston_surface_to_buffer_float() is needed, but with the output
dimensions instead. For that reason, this patch generalizes this
function into weston_transformed_{coord,rect} and moves it to util.c.
The surface functions are then implemented using those.
A client can reliably avoid allocating a second buffer per surface, if
the compositor sends the wl_buffer.release event before the frame
callback. To enable clients' single-buffering, release the wl_buffer
early if possible. Otherwise clients will double-buffer.
Releasing early is not possible, if the backend needs the buffer for
migrating a surface to or from a non-primary weston_plane. In that case,
a new buffer must arrive, before the old can be released. Backends will
indicate this by setting weston_surface:keep_buffer to 1 in
assign_planes().
A proper buffer reference in the backends would be better than the
keep_buffer flag, but that would require a per-surface backend private.
The rpi and DRM backends are updated to set keep_buffer, other backends
do not support planes, so do not have to set it.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
The wl_buffer reference counting API has been inconsistent. You would
manually increment the refcount and register a destroy listener, as
opposed to calling weston_buffer_post_release(), which internally
decremented the refcount, and then removing a list item.
Replace both cases with a single function:
weston_buffer_reference(weston_buffer_reference *ref, wl_buffer *buffer)
Buffer is assigned to ref->buffer, while taking care of all the refcounting
and release posting. You take a reference by passing a non-NULL buffer, and
release a reference by passing NULL as buffer. The function uses an
internal wl_buffer destroy listener, so the pointer gets reset on
destruction automatically.
This is inspired by the pipe_resource_reference() of Mesa, and modified
by krh's suggestion to add struct weston_buffer_reference.
Additionally, when a surface gets destroyed, the associated wl_buffer
will send a release event. Often the buffer is already destroyed on
client side, so the event will be discarded by libwayland-client.
Compositor-drm.c is converted to use weston_buffer_reference.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Backends may move surfaces to different planes, in which case damage is
generated in the primary plane. This damage is usually passed to the
renderer, but in some cases the backend may decide to not render
anything (that's the case when drm compositor scans out a client
buffer). In that case the damage on the primary plane would be
discarded, leading to artifacts later.
This patch makes the backend's responsibility to clear the damage on
the primary plane, so that unrendered damage is kept for as long as
necessary.
This moves the EGLConfig, EGLContext and EGLDisplay fields into
gles2-renderer. It also moves EGLDisplay creation and EGLConfig
selection into gles2-renderer.
This introduces callbacks for output creation and destruction for the
gles2-renderer. This enables the gles2-renderer to have per-output
state. EGL surface creation is now done by the output_create callback
and the EGL surface is stored in the new per-output gles2-renderer
state. On the first output_create call, the gles2-renderer will setup
it's GL context. This is because EGL requires a EGL surface to be able
to use the GL context.
This makes drm_fb_get_from_bo() use drmModeAddFB2() if possible so that
drm_output_prepare_overlay_surface() can use this instead of keeping
track of the fbs and buffers itself.
Let the compositor generic code decide what to do when the buffer goes
away. We still have a valid reference do the bo, so we can still show
the client contents until something else triggers a repaint.
If the sprite is disabled and we're not enabling it on the next frame,
nothing is done in the vblank handler, so there's no need to ask for a
vblank event.
Add the concept of debug key bindings, that are bindings that activate
debug features in the compositor. The bindings are added to a list in
the compositor, but the triggering them is left to the shell.
On the shell side, a global debug key binding is added. When the user
presses mod-shift-space, the shell will invoke the debug bindings based
on the next key press.
This also converts the debug shortcuts for repaint debugging, fan
repaint debugging and the hide overlays shortcut in compositor-drm to
use the new infrastructure.
Pressing ctrl-alt-o will cause the overlays to be hidden, but surfaces
will still be assigned to different planes. This helps with debugging
of repaint culling below surfaces in other planes.
Culling of the repaint of a surface behind an opaque surface on the
same plane was broken by commit 547149a9 [1]. The idea of that commit
is that the damage obscured by an overlay would remain on the primary
plane damage and be repainted when the overlay moved. However, in the
case the two surfaces are on the same plane, the opaque one is not
obscured, so it ends up being repainted.
This commit adds an opaque field to struct weston_plane, that is built
incrementally when accumulating damage. The opaque region of surfaces
on the same plane are removed from the plane's damage, restoring the
previous culling behavior. But since damage behind opaque region of
other planes is maintained, the bug solved in the mentioned commit is
not regressed.
https://bugs.freedesktop.org/show_bug.cgi?id=56537
If we can find a boot_vga PCI GPU, we should prefer it over any other GPU
that is connected to the system. The boot_vga flag tells us that this GPU
is the primary system GPU.
This fixes problems on two-GPU-systems were the wrong GPU is used. It also
fixes systems were DisplayLink GPUs are available with lower IDs than PCI
GPUs (although, this seems unlikely).
Note that udev_enumerate guarantees that the entry-list is sorted. So for
systems that have platform-GPUs, these should almost always be reported
prior to hotpluggable (PCI, USB, ...) GPUs, as the kernel probes them
first.
https://bugs.freedesktop.org/show_bug.cgi?id=56237
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This comment became stale in:
commit 65a11e1039
Author: Kristian Høgsberg <krh@bitplanet.net>
Date: Fri Aug 3 11:30:18 2012 -0400
compositor: Accumulate damage per plane
Now it is just misleading. Remove it.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
If gbm_bo_import does not return a valid buffer for usage of
GBM_BO_USE_SCANOUT don't try and scan out the surface directly.
We've caught the SHM case explicitly earlier - this is to prevent other cases
where the bo cannot be scanned out.
Signed-off-by: Rob Bradford <rob@linux.intel.com>
We move the EGL and GLES2 output repaint code into a new gles2-render.c
file. The eglMakeCurrent, glViewPort, surface loop etc was duplicated
across all backends, but this patch moves it to a new file.
Draw the borders of all the triangles.
v1: original
v2: add keybinding to enable/disable fan debug (super-alt-space),
cycle colors to make it easier to see individual draws, and
redraw undamaged region to clean up previous frames debug
lines
Signed-off-by: Rob Clark <rob@ti.com>
This patch allows rotation and mirroring outputs for x11 and drm backends.
A new 'transform' key can be set in the [output] section. From the protocol:
"The flipped values correspond to an initial flip around a vertical axis
followed by rotation."
The transform key can be one of the following 8 strings:
normal
90
180
270
flipped
flipped-90
flipped-180
flipped-270
Not all hw supports hw cursors. Similar to the case with sprites, if
the driver does not support it, don't keep trying and spamming the log
with error messages.
Signed-off-by: Rob Clark <rob@ti.com>
They can't be imported by gbm, so no point in trying, and segfaulting
in gbm when we try to import (because it tries to deref the buffer as
a wl_drm_buffer).
Signed-off-by: Rob Clark <rob@ti.com>
A call to strcmp() is already made in output_section_done() and
output->config is set appropriately if mode is "off". There is
no need to duplicate that in create_output_for_connector().
As said by krh: "Maybe we should also just call it an evdev_device
instead, shorter [and] not really ambiguous."
[krh: if my typo filled irc is going in a commit message, I'm at least going
to insert the missing words.]
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
evdev_led_update() does not really need the whole list of device at
once, it can be called one device at a time.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
compositor-drm.c: In function 'drm_output_set_cursor':
compositor-drm.c:754:4: warning: too few arguments for format
compositor-drm.c:759:4: warning: too few arguments for format
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>