Commit Graph

224 Commits

Author SHA1 Message Date
Jan Arne Petersen 674fd1d625 text: Start input method from configuration
Start the input method specified in the weston.ini configuration file.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-27 12:57:39 -05:00
Ander Conselvan de Oliveira 012b4c78c9 compositor: Implement buffer transformation
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.
2012-11-27 11:29:31 -05:00
Ander Conselvan de Oliveira b8fcca915b compositor: Move buffer damage fields from weston_output to gl-renderer
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.
2012-11-16 19:00:03 -05:00
John Kåre Alsaker 30d2b1fd4b Move EGL and GL includes to a gles2-renderer header. 2012-11-13 17:03:47 -05:00
John Kåre Alsaker 320711db0a Move weston_compositor GL and EGL state into gles2-renderer. 2012-11-13 17:03:33 -05:00
John Kåre Alsaker 75cc571839 Move weston_surface GL and EGL state into gles2-renderer. 2012-11-13 17:03:08 -05:00
John Kåre Alsaker 4068414a32 Moved shader state into gles2-renderer. 2012-11-13 17:02:38 -05:00
John Kåre Alsaker 878f44969d compositor: Move surface color state to gles2-renderer.
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.
2012-11-13 17:01:59 -05:00
John Kåre Alsaker f9e710b57c screenshooter: Use the renderer function for reading out pixels
This also changes the compositor's read_format to a pixman format.
2012-11-13 17:01:02 -05:00
John Kåre Alsaker a95b2d6d41 compositor: Add a renderer function to read out pixels 2012-11-13 17:00:06 -05:00
John Kåre Alsaker 4415450ef1 Move compositor-wayland border drawing into gles2-renderer. 2012-11-13 16:59:01 -05:00
John Kåre Alsaker 1b7ad160a3 Move EGLConfig, EGLContext and EGLDisplay fields into gles2-renderer.
This moves the EGLConfig, EGLContext and EGLDisplay fields into
gles2-renderer. It also moves EGLDisplay creation and EGLConfig
selection into gles2-renderer.
2012-11-13 16:56:28 -05:00
John Kåre Alsaker 94659274b4 Move weston_output EGL state 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.
2012-11-13 16:30:27 -05:00
Pekka Paalanen bcdd579a58 gles2: update texture only if needed
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>
2012-11-08 16:56:26 -05:00
Ander Conselvan de Oliveira 27508c2045 gles2: Add a debug binding for highlighting shaded content
Pressing mode-shift-space s will cause the fragment shaders to be
recompiled, adding a green tint to all composited content.
2012-11-08 16:56:25 -05:00
Ander Conselvan de Oliveira c509d2b152 compositor: Add debug key bindings infrastructure
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.
2012-11-08 16:56:25 -05:00
Ander Conselvan de Oliveira 11f8d403a8 Add a headless backend
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.
2012-11-08 16:56:25 -05:00
Ander Conselvan de Oliveira 4bcf3a5fce compositor: Fix culling of repaints behind opaque surfaces
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
2012-10-31 13:37:01 -04:00
Kristian Høgsberg 8c31a4c025 Define our own container_of as well
Don't rely on libwayland-client/server to define this for us.
2012-10-19 23:05:37 -04:00
Kristian Høgsberg 5717b6dbf1 Stop relying on ARRAY_LENGTH being defined in wayland-util.h
Time to break a bad habit.
2012-10-19 17:12:38 -04:00
Pekka Paalanen bc10638cd9 compositor, clients: apply wl_surface.frame on commit
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>
2012-10-10 21:39:11 -04:00
Pekka Paalanen 0cbd3b5059 compositor, clients: double-buffer input region
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>
2012-10-10 21:38:44 -04:00
Pekka Paalanen 512dde8ce9 compositor, clients: double-buffer opaque region
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>
2012-10-10 21:38:40 -04:00
Pekka Paalanen 8e159180cc compositor, clients: make damage double-buffered
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>
2012-10-10 21:38:31 -04:00
Pekka Paalanen 5df44de6a9 compositor: make wl_surface.attach double-buffered
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>
2012-10-10 21:38:00 -04:00
John Kåre Alsaker 490d02a96d weston: Use float instead of GLfloat. 2012-10-04 12:27:21 -04:00
Tiago Vignatti 1d01b01318 compositor: Add kill signal
For now it's being emitted only on the desktop shell kill binding.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-10-04 11:06:37 -04:00
Kristian Høgsberg b9af479f02 compositor: Make weston_surface_assign_output() static
This is now done as part of weston_surface_update_transform().
2012-09-25 14:48:04 -04:00
Ander Conselvan de Oliveira 8ea818fb00 compositor: Generalize output previous damage into per buffer damage
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.
2012-09-14 13:40:08 -04:00
Philipp Brüschweiler b13b9ff90a text: Have only one text_model_factory
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>
2012-09-12 16:33:12 -04:00
Kristian Høgsberg 33a45f5b6d compositor: Drop unused wl_shm field 2012-09-11 14:07:19 -04:00
Kristian Høgsberg b00a9d3cb9 compositor: Make all non-backend modules use module_init() as entry point 2012-09-11 14:06:27 -04:00
Kristian Høgsberg dd1b3f4c1b compositor: Remove unused 'fbo' field from weston_compositor 2012-09-10 20:37:48 -04:00
Kristian Høgsberg 4226385e53 compositor: Destroy gles2 resource for weston_surface in gles2-renderer.c
This moves the last gles2 call out of compositor.c.
2012-09-06 21:59:33 -04:00
Kristian Høgsberg 3a0de88abf compositor: Move unbind_display call into gles2-renderer.c 2012-09-06 21:44:24 -04:00
Kristian Høgsberg fa1be023a2 compositor: Introduce a weston_renderer object
Move the gles2 render functions to vfuncs on the renderer object.
2012-09-06 21:08:13 -04:00
Kristian Høgsberg b7b77e6f8f compositor: Move EGL/GLES2 parts of weston_surface_attach to gles2-renderer.c 2012-09-06 21:08:13 -04:00
Kristian Høgsberg b1fd2d6dd8 compositor: Move update_shm_texture() to gles2-renderer.c
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.
2012-09-06 21:08:13 -04:00
Kristian Høgsberg 25894fc920 compositor: Move gles2 initialization to gles2-renderer.h 2012-09-06 21:08:13 -04:00
Kristian Høgsberg ecf6edec1f compositor: Move surface repaint code to gles2-renderer.c 2012-09-06 21:08:12 -04:00
Kristian Høgsberg d7c172648d compositor: Consolidate output repaint logic
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.
2012-09-06 21:08:12 -04:00
Pekka Paalanen 4f9c07bf11 xwayland: replace opaque_rect, fix an alpha problem
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>
2012-09-04 16:14:29 -04:00
Pekka Paalanen 07c91f8371 compositor: triangle fan debug
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>
2012-08-31 17:52:01 -04:00
Pekka Paalanen 6b5585be0d compositor: specialised fragment shader for RGBX
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>
2012-08-31 17:51:54 -04:00
Rob Clark 0e5a2d0219 compositor: simplify shaders
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>
2012-08-31 17:51:50 -04:00
Rob Clark e3b9591513 compositor: add support for OES_EGL_image_external
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>
2012-08-31 17:51:42 -04:00
Scott Moreau 1bad5db9d6 Implement output transformations.
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
2012-08-29 14:39:13 -04:00
Scott Moreau 243f59f5bb Remove unused enum. 2012-08-16 10:23:54 -04:00
Jan Arne Petersen e829adc514 text: Assign text_model to a wl_seat
Add a wl_seat argument to the activate and deactivate requests of
text_method.

On activation a text_model gets assigned to the input_method of the
wl_seat specified in the activate request.
2012-08-10 13:00:52 -04:00
Kristian Høgsberg cb3eaae9ad compositor: Change notify_* function to take a weston_seat
Fewer indirections and derefs, and it's also more appropriate for a
backend calling into weston core to pass a weston_seat.
2012-08-10 13:00:52 -04:00