The implementation of buffer transformation didn't handle transformed
shm buffers properly. The partial texture upload was broken since the
damage is in surface coordinates that don't necessarily match the
buffer's coordinates. It also wouldn't handle the buffer stride
properly, resulting in incorrect rendering if it didn't match the
buffer's width.
The logic used for converting texture coordinates was generalized and
moved out of the renderer, since this conversion may be useful in other
places, such as the backends.
Implement the wl_surface.set_buffer_transform request. This includes
tracking the double-buffered buffer transformation parameter and making
the gl renderer able to handle transformed buffers.
Move fields current_buffer and buffer_damage out of weston_output into
gl_output_state, since they are actually specific to the renderer.
Also bring back the previous_damage field so that the screenshooter
can get the damage for the previous frame in a renderer independent
way.
This moves the surface color state into gles2-renderer. To do this it
adds two new weston_renderer functions. create_surface to be able to
create per-surface renderer state, and surface_set_color to set the
color of a surface and changes it to a color surface.
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.
When a surface is on a non-primary plane (overlay), we do not need to
keep the GL texture up-to-date, since we are not using it. Avoid calling
glTex(Sub)Image2D in that case, and accumulate the texture damage
separately.
This is especially useful for backends, that can put wl_shm buffers into
overlays.
The empty damage check has to be moved from surface_accumulate_damage()
into gles2_renderer_flush_damage(), because it really needs to check the
accumulated damage, not only the current damage. Otherwise, if a surface
migrates from a plane to the primary plane, and does not have new
damage, the texture would not be updated even for accumulated damage.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
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.
Add a headless backend and a noop renderer, mainly for testing
purposes. Although no rendering is performed with this backend,
this allow some of the code paths inside Weston and shm clients
to be tested without any windowing system or any need for drm
access.
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
Apply wl_surface.frame request only on the next wl_surface.commit
according to the new protocol.
This makes it explicit, which repaint actually triggered the frame
callback, since commit schedules a repaint. Otherwise, something causing
a repaint before a commit could trigger the frame callback too early.
Ensure all demo clients send commit after wl_surface.frame. Note, that
GL apps rely on eglSwapBuffers() sending commit. In toytoolkit, it is
assumed that window_flush() always does a commit.
compositor-wayland assumes renderer->repaint_output does a commit.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Make input region double-buffered as specified in the new protocol.
While doing it, get rid of the undef region code, and instead use a
maximum sized real pixman region. This avoids special-casing regions
that might sometimes be undef.
As the input region is now usable by default instead of undef,
weston_surface_update_transform() does not need to reset the input
region anymore.
weston_surface_attach() no longer resets the input region on surface
size change. Therefore, also weston_seat_update_drag_surface() does not
need to reset it.
Update toytoolkit to set input region before calling wl_surface_commit()
or swapBuffers (which does commit).
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Make wl_surface.set_opaque_region double-buffered as required by the new
protocol. Also, do not reset the opaque region on surface size changes
anymore. Only explicit requests from the client will change the region
now.
In clients, make sure commit happens after setting the opaque region.
Mesa does not need a fix, as it never touches the opaque region.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This change depends on the Wayland commit
"protocol: double-buffered state for wl_surface".
Implement double-buffering of damage in the compositor as required by
the new protocol.
Ensure all Weston demo clients call wl_surface_commit() after
wl_surface_damage().
Mesa does not need a fix for this, as the patch adding
wl_surface_commit() call to Mesa already takes care of damage, too;
Mesa commit: "wayland: use wl_surface_commit()"
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This change depends on the Wayland commit
"protocol: double-buffered state for wl_surface".
Clients are now required to issue wl_surface.commit for the
wl_surface.attach to take effect.
While changing this, change the surface argument to
weston_surface_attach() from wl_surface into weston_surface, for
consistency.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This is a more generic fix for the issue solved in 4f521731 where
damage obscured by overlays could be lost in one of the output buffers
due to rapid move of a surface in an overlay plane.
This changes the renderer so it keeps track of the damage in each
buffer. Every time a new frame is drawn, the damage of the frame is
added to all the buffers and the rendered regions are cleared from
the current buffer's damage.
Have only one text_model_factory instead of one per seat.
This commit also introduces destruction of an input method when the
corresponding seat is removed.
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
We rename it flush_damage() as it's the point where we update our rendering
API source (eg, the gles2 texture) according to the accumulated damage,
if necessary.
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.
Remove weston_surface::opaque_rect completely.
Instead, set the opaque region in xwayland.
Before this patch, black text in xterm was transparent. Now it is not.
However, this patch fixes only a part of the alpha problem. If you apply
full-surface alpha with super+alt+wheel, the problem reappears. This
problem is still due to bad alpha channel contents on xwayland windows.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
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>
Remove the weston_surface::blend attribute, which really meant that the
texture produced valid alpha values. This was used to override the opaque
region for RGBX surfaces, which produce undefined values for alpha.
Instead, compile a new shader especially for RGBX surfaces, that
hardcodes the sampled alpha as 1.0.
Before "compositor: optimize/simplify shaders" there was a 'vec4 opaque'
in the shaders, that would cause part of the texture to be forced to
alpha=1.0. Now that is gone, and we need this replacement.
To test: launch simple-shm, and use the super+alt+mousewheel combination
to make it transparent. It should not show a light cross over the window.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Re-work how the shaders and emitted vertices work. Rather than always
rendering clip-rect sized quads and doing transformation in tex coords
(and requiring the corresponding clipping in frag shader), instead
emit transformed vertices, clipped wrt. dirty region, and use simpler
frag shaders. Also, split the rendering, so blended surfaces with an
opaque region have the opaque region drawn with blend disabled. The
result is considerably fewer pixels drawn with blend enabled, and much
fewer cycles in the frag shader.
This requires having some more complex logic to figure out the vertices
of the shape which forms the intersection of the clip rect and the
transformed surface. Which has perhaps got a few bugs or missing cases,
still (visual glitches in some cases) but at this point more or less is
starting to work. I think it is at least far enough along to get some
initial review.
The result, on small SoC GPU (omap4/pandaboard) on 1920x1080 display,
for simple stuff like moving windows around, I get 60fps (before 30fps
or less), and pushing YUV buffers for hw decoded 1080p video goes from
~6fps to 30fps, with no drop in framerate for transformed/rotated video
surface.
v1: original
v2: check that perpendicular intersect vertex falls within bounds of
transformed surface
v3: update w/ comments and fixes from Pekka Paalanen
v4: fix for full surface alpha from Pekka Paalanen, fix compositor-
wayland build
Signed-off-by: Rob Clark <rob@ti.com>
In cases where the GPU can natively handle certain YUV formats,
eglQueryWaylandBufferWL() can return the value EGL_TEXTURE_EXTERNAL_WL
and the compositor will treat the buffer as a single egl-image-external.
See:
http://www.khronos.org/registry/gles/extensions/OES/OES_EGL_image_external.txt
v1: original
v2: rename EGL_TEXTURE_EXTERNAL_OES -> EGL_TEXTURE_EXTERNAL_WL and query
for the extension
v3: fix build without updated mesa headers, if EGL_TEXTURE_EXTERNAL_WL
#define is missing from older mesa headers.
v4: resend without missing parts
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