Alexander Larsson [Wed, 29 May 2013 10:01:34 +0000 (12:01 +0200)]
screenshooter: Scale damage by output scale in screen recorder
The damage region is in compositor coords, we need to scale it by
the output scale when using the damage to read output buffer data.
Alexander Larsson [Wed, 29 May 2013 10:01:33 +0000 (12:01 +0200)]
pixman-renderer: Fix read_pixels for screen recorder
The old code had an off-by-one error on the y coordinate
where it says height - (cur_y - y). And it does the vflipping of
the *destination* buffer, whereas what is really needed is to
vflip the whole source buffer. This only affects when you read
out part of the image, such as when using the screen recoder.
Also, instead of doing the flipping manually we just let pixman
handle it.
Alexander Larsson [Wed, 29 May 2013 10:01:32 +0000 (12:01 +0200)]
screenshoter: Make recorder handle PIXMAN_x8r8g8b8
This is what the pixman renderer reports for the read format.
Alexander Larsson [Tue, 28 May 2013 14:23:32 +0000 (16:23 +0200)]
shell: Position DRIVER fullscreen surfaces at origin
When a window is fullscreened with DRIVER method and we succeeded
in changing mode we need to actually move the surface to the
origin of the output, or it won't be used for scanout.
Alexander Larsson [Tue, 28 May 2013 14:23:40 +0000 (16:23 +0200)]
shell: Center window in fullscreen if needed
If modeset fails With DRIVER method, and always with FILL method
we want to center the window.
Alexander Larsson [Tue, 28 May 2013 14:23:39 +0000 (16:23 +0200)]
shell: Always go to original mode when focused window not fullscreen
Right now we only switch mode on activating a fullscreened window.
This has several problems:
* Once you're in fullscreen its hard to switch to a non-fullscreened
window with alt-tab as you stay in the small resolution.
* If you switch from a fullscreened window to a non-fullscreened
window and the fullscreened window is destroyed we will not
restore the original mode (since the window is not
shell_surface_is_top_fullscreen()
* Its hard to reach a different output on the right with the mouse
when the mode is smaller that the original, as there is a "gap"
between the two outputs. So, if you alt-tab to another window
you can not always reach it.
This is somewhat of a sledge hammer, as it means you can't e.g.
focus a non-fullscreen on one output and have a window fullscreened
on another output. However, trying to restore only the outputs
the new window is on is problematic:
* It may later change output
* We want to see all windows anyway during alt-tab
* Can't reach the other windows with the mouse anyway
So, this seems like an ok solution.
Alexander Larsson [Tue, 28 May 2013 14:23:38 +0000 (16:23 +0200)]
shell: Use buffer_scale as output scale on fullscreen DRIVER
It may happen that you e.g. fullscreen a 800x600 surface with
buffer_scale 1 (e.g. a 800x600 buffer) on an output that is
otherwise scale 2. In this case we want to temporarily set
the output scale to 1, as we're really scanning out of a
scale 1 buffer. This causes us to e.g. report the input
positions in the right place, etc.
When we restore the original mode we also restore the original
scale.
Note that the scale change is a purely compositor internal change,
to clients it still looks like the output is scale 2.
Alexander Larsson [Tue, 28 May 2013 14:23:37 +0000 (16:23 +0200)]
compositor: Store original output scale
We want this so we can restore the original mode
with the original size (after having been fullscreen).
Alexander Larsson [Tue, 28 May 2013 14:23:36 +0000 (16:23 +0200)]
compositor: Store modes in physical units
We changed the protocol to always list modes in physical pixel
units (not scaled). And we removed the scaled mode flag. This
just updates the DRM and X11 compositors and the gl and pixman renderers
to handle this.
Alexander Larsson [Tue, 28 May 2013 14:23:35 +0000 (16:23 +0200)]
compositor-x11: Set original mode after current
Otherwise we're pointing the original mode on some uninitialized
value.
Alexander Larsson [Tue, 28 May 2013 14:23:34 +0000 (16:23 +0200)]
fullscreen: Add fullscreen testing client
This lets you try fullscreen in different methods, sizes, scales,
translations, etc. You can verify both output and input (via mouse over
of the rectangles).
Alexander Larsson [Tue, 28 May 2013 14:23:33 +0000 (16:23 +0200)]
input: Fix possible crash in clip_pointer_motion
It was erronously using output->current->height in one
place where it should use output->height. This may cause
it to create an invalid clipped coordinate in case of output
scaling or transform, because the next round "prev" would
end up NULL.
Hardening [Mon, 27 May 2013 21:13:45 +0000 (23:13 +0200)]
Fix name clash in RDP compositor
This patch fixes some name clashes introduced by last patches.
Kristian Høgsberg [Tue, 28 May 2013 19:34:46 +0000 (15:34 -0400)]
config-parser: Add tests for expect behavuor on NULL configs and sections
Mun Gwan-gyeong [Mon, 27 May 2013 15:20:04 +0000 (00:20 +0900)]
config-parser: Avoid null dereference when exiting. (case: weston starts without config file.)
backtrace:
(gdb) bt
#0 0xb7704424 in __kernel_vsyscall ()
#1 0xb757ddde in raise (sig=5) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42
#2 <signal handler called>
#3 weston_config_destroy (config=0x0) at config-parser.c:508
#4 0xb75cbc0e in x11_destroy (ec=0x93506b0) at compositor-x11.c:1473
#5 0x0804e0e9 in main (argc=1, argv=0xbffe5354) at compositor.c:3337
Mun Gwan-gyeong [Mon, 27 May 2013 15:04:26 +0000 (00:04 +0900)]
config-parser: Avoid null dereference when handling config-parser ( when weston starts without config file. )
backtrace:
(gdb) bt
#0 weston_config_next_section (config=0x0, section=0xbfb2b608, name=0xbfb2b618) at config-parser.c:485
#1 0xb75b1371 in x11_compositor_create (config=0x1, argv=0xbfb2ba44, argc=<optimized out>, use_pixman=0, no_input=0, fullscreen=0, display=0xb75b55f9)
at compositor-x11.c:1582
#2 backend_init (display=0x8354490, argc=0xbfb2b9b0, argv=0xbfb2ba44, config=0x0) at compositor-x11.c:1674
#3 0x0804df7b in main (argc=1, argv=0xbfb2ba44) at compositor.c:3289
Alexander Larsson [Fri, 24 May 2013 11:09:43 +0000 (13:09 +0200)]
Convert all scales to int32_t
The type changed in the protocol, so update weston for this.
Kristian Høgsberg [Mon, 27 May 2013 01:48:14 +0000 (21:48 -0400)]
compositor: Parse config file in main(), only keep weston config object
Now that all backends and modules have been converted to the new
config parser API, we don't have to keep the fd around.
Kristian Høgsberg [Mon, 27 May 2013 01:30:14 +0000 (21:30 -0400)]
cms-static: Don't crash on outputs with NULL name
Kristian Høgsberg [Mon, 27 May 2013 01:21:23 +0000 (21:21 -0400)]
compositor-x11: Use new config file parser
With the iterator API we can now convert the X11 backend.
Kristian Høgsberg [Mon, 27 May 2013 00:50:53 +0000 (20:50 -0400)]
config-parser: Add section iterator API
The X backend needs to iterate through all outputs.
Hardening [Sun, 26 May 2013 21:34:00 +0000 (23:34 +0200)]
Don't store FreeRDP file descriptors
Weston don't uses the file descriptors from FreeRDP, there's no need
to store them.
Mun Gwan-gyeong [Fri, 24 May 2013 17:09:13 +0000 (02:09 +0900)]
config-parser: Avoid null dereference when handling config-parser
backtrace:
(gdb) bt
#0 weston_config_get_section (config=0x0, section=0x8062f31 "keyboard", key=0x0, value=0x0)
at config-parser.c:265
#1 0x080535a1 in weston_compositor_init (ec=0x905b690, display=0x9056490, argc=0xbf8bd2f0,
argv=0xbf8bd384, config_fd=-1) at compositor.c:2819
#2 0xb75d72bb in x11_compositor_create (config_fd=-1, argv=0xbf8bd384, argc=<optimized out>,
use_pixman=0, no_input=0, fullscreen=0, display=0x9056490) at compositor-x11.c:1527
#3 backend_init (display=0x9056490, argc=0xbf8bd2f0, argv=0xbf8bd384, config_fd=-1)
at compositor-x11.c:1746
Mun Gwan-gyeong [Fri, 24 May 2013 16:13:09 +0000 (01:13 +0900)]
config-parser-test: fix compile error
Add COMPOSITOR_CFLAGS to Makefile.am
Kristian Høgsberg [Fri, 24 May 2013 01:47:37 +0000 (21:47 -0400)]
shell: Remove input panel debug fprintf
Kristian Høgsberg [Fri, 24 May 2013 01:45:51 +0000 (21:45 -0400)]
text-backend: Use new config parser
Kristian Høgsberg [Fri, 24 May 2013 01:40:56 +0000 (21:40 -0400)]
shell: Use new config parser
Kristian Høgsberg [Thu, 23 May 2013 21:23:15 +0000 (17:23 -0400)]
compositor-drm: Convert to new config parser
Kristian Høgsberg [Thu, 23 May 2013 20:06:56 +0000 (16:06 -0400)]
cms-static: Convert cms-static to use new config parser
Almost half of the logic here was about wrestling the silly config parser
API.
Kristian Høgsberg [Thu, 23 May 2013 19:56:29 +0000 (15:56 -0400)]
compositor: Use new config parser for keyboard options
Kristian Høgsberg [Mon, 1 Apr 2013 16:41:23 +0000 (12:41 -0400)]
Add new config parser
The current config parser, parses the ini file and pulls out the values
specified by the struct config_section passed to parse_config_file() and
then throw the rest away. This means that every place we want to get
info out of the ini file, we have to parse the whole thing again. It's not
a big overhead, but it's also not a convenient API.
This patch adds a parser that parses the ini file to a data structure and
puts that in weston_compositor->config along with API to query comfig
keys from the data structure. The old parser is still available, but
we'll transition to the new approach over the next few commits.
Kristian Høgsberg [Fri, 24 May 2013 00:30:26 +0000 (20:30 -0400)]
compositor: Make backlight_current int32_t to avoid unsigned overflow
Backlight brightness was wrapping around when decrementing from 0.
Kristian Høgsberg [Fri, 24 May 2013 00:29:40 +0000 (20:29 -0400)]
compositor-drm: Log failure and which backlight sysfs file we're using
Pekka Paalanen [Thu, 23 May 2013 10:31:39 +0000 (13:31 +0300)]
compositor-x11: fix default output scale
Default output scale of 256 makes little sense. Actually this is a type
mismatch between wl_fixed and int, probably a leftover from when the
scale factor was proposed as a fixed point number.
Scale 256 probably causes the Window creation to fail, but that actually
leads to a segfault in Mesa libEGL later:
Program received signal SIGSEGV, Segmentation fault.
0 dri2_create_window_surface (drv=0x645060, disp=0x646610, conf=<optimized out>, window=<optimized out>, attrib_list=<optimized out>)
at platform_x11.c:291
291 surf->SwapInterval = 1;
Here 'surf' is NULL.
1 0x00007ffff76c0709 in eglCreateWindowSurface (dpy=0x646610, config=<optimized out>, window=
58720261, attrib_list=0x0) at eglapi.c:534
2 0x0000000000421549 in gl_renderer_output_create (output=0x673ae0, window=
58720261) at gl-renderer.c:1661
3 0x00007ffff41c456b in x11_compositor_create_output (c=0x6388b0, x=0, y=0, width=1024, height=640, fullscreen=0, no_input=0,
configured_name=0x0, transform=0, scale=256) at compositor-x11.c:928
4 0x00007ffff41c5ca0 in x11_compositor_create (display=0x631950, fullscreen=0, no_input=0, use_pixman=0, argc=0x7fffffffda7c,
argv=0x7fffffffdd18, config_fd=14) at compositor-x11.c:1596
5 0x00007ffff41c63db in backend_init (display=0x631950, argc=0x7fffffffda7c, argv=0x7fffffffdd18, config_fd=14) at compositor-x11.c:1746
6 0x000000000040fcb7 in main (argc=1, argv=0x7fffffffdd18) at compositor.c:3293
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: Alexander Larsson <alexl@redhat.com>
Kristian Høgsberg [Thu, 23 May 2013 01:53:09 +0000 (21:53 -0400)]
rdp: Update output initialization to new API
Hardening [Wed, 22 May 2013 21:40:20 +0000 (23:40 +0200)]
rdp: Improve raw surfaces
This patch does miscellanous improvements with raw surfaces:
* some frames markers are sent to identify a single frame made of
multiple surface updates
* we send the dirty sub-rectangles instead of the full bouncing box
* the size of the fragmentation buffer is now honored, so that our big
surface updates don't look like a DoS
* the subtile and image flipping are done in one step (not requiring a
temporary tile)
* we don't care about the size of the dirty region and always use the
preferred codec for surface update
Hardening [Wed, 22 May 2013 21:40:19 +0000 (23:40 +0200)]
rdp: Don't rely on Synchronize packet for first screen refresh
Last FreeRDP don't send Synchronize packets anymore, so send the
first screen refresh when we're "connected". The client cursor is
also disabled during this step.
Hardening [Wed, 22 May 2013 21:40:18 +0000 (23:40 +0200)]
rdp: Fixed codec initialisations
This patch fixes NSC codec initialisation that was not done (an
erronous copy'n paste).
The remoteFx context must be resetted when we go through an activation
sequence
Hardening [Wed, 22 May 2013 21:40:17 +0000 (23:40 +0200)]
rdp: Drop unneeded main_seat
With recent changes in shell.c the fake seat is not required to
start a compositor, this patch removes it.
Hardening [Wed, 22 May 2013 21:40:16 +0000 (23:40 +0200)]
rdp: Fix compilation against FreeRDP and weston
The stream utils of FreeRDP have changed recently, this patch fixes
the compositor compilation against FreeRdp master.
The backend_init() prototype has changed too, this fixes it.
Pekka Paalanen [Wed, 22 May 2013 15:03:12 +0000 (18:03 +0300)]
screenshooter: print info to log
Print the recording info to Weston log, not stderr.
Also fix the frame counter.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Louis-Francis Ratté-Boulianne [Wed, 22 May 2013 15:03:11 +0000 (18:03 +0300)]
toytoolkit: Make the window resizing optimization optional
Whether or not a shm pool is used for resizing is now configurable at
build time (--disable-resize-optimization).
[pq: removed an unnecessary hunk from the patch]
Pekka Paalanen [Wed, 22 May 2013 15:03:10 +0000 (18:03 +0300)]
desktop-shell: new wallpaper mode scale-crop
Scale-crop mode scales the wallpaper to tightly fill the whole output,
but preserving wallpaper aspect ratio. If aspect ratio differs from the
output's, the wallpaper is centered cutting it from top/bottom or
left/right.
Add this to the weston.ini man page, and explain all three modes.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Pekka Paalanen [Wed, 22 May 2013 15:03:09 +0000 (18:03 +0300)]
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Pekka Paalanen [Wed, 22 May 2013 15:03:08 +0000 (18:03 +0300)]
rpi: remove weston_plane support
There is no need to support weston_plane anymore.
The max-planes option is removed as unused.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Pekka Paalanen [Wed, 22 May 2013 15:03:07 +0000 (18:03 +0300)]
rpi: switch to rpi-renderer
Replace the GL renderer with the new rpi-renderer on the Raspberry Pi
backend. This makes Weston on rpi not use EGL or GL anymore, at all.
The weston_plane feature is disabled, since the rpi-renderer does the
same, but better.
Add a command line option to select the output transform. It is not a
weston.ini option for now, since the rpi backend does not read the
configuration file yet. Hopefully that will be done later with some
shared code.
Add the rpi options to 'weston --help' output.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Pekka Paalanen [Wed, 22 May 2013 15:03:06 +0000 (18:03 +0300)]
rpi: add a Dispmanx renderer
Dispmanx is the prorietary display API on the Raspberry Pi, which
provides hardware compositing. Every visible surface is assigned a
Dispmanx element, and the hardware or firmware will do all compositing
onto screen. The API supports translation, scaling, flips, discrete
rotations in 90-degree steps, alpha channel on the surfaces, and
full-surface alpha on top.
Previously, Dispmanx capabilities were used via the weston_plane
mechanism, where surfaces were assigned to planes when possible, and
otherwise transparently falling back to GLESv2 compositing. Because we
have no way to use the same memory buffer as a GL texture and a Dispmanx
resource, we had to prepare for both. In the worst case, that means one GL
texture, and two (double-buffered case) Dispmanx resources, all the size
of a whole surface, for all surfaces. This was eating memory fast. To
make things worse (and less slow), the wl_shm buffer was kept around,
since it was copied to either a texture or a resource as needed. This
caused all clients to need two buffers. In a Dispmanx-only renderer, we
can drop the GL texture, and we can release wl_shm buffer immediately
after the first copy, so clients become effectively single-buffered. So
from the worst case of 5 buffers per surface, we go down to 3 or just
2 (single-buffered Dispmanx element, one wl_shm buffer in the client)
buffers per surface.
As this will replace the GL renderer on rpi, we cannot fall back to the
GLESv2 compositing anymore. We lose arbitrary surface rotation, but we
lose also the GL fallback, which caused glitches.
This patch depends on new RaspberryPi firmware. Older firmware may not
render ARGB surfaces correctly, solid color surfaces maybe cause a
performance hit, and the output may completely fail in case the firmware
does not fall back internal off-line compositing properly as needed.
This new rpi-renderer support surface translation and scaling, but not
rotation or transpose (not even in 90-deg steps). In theory, 90-deg step
surface rotation is possible to support. Output transformations are
supported, but flipped variants do not seem to work right.
As a detail, menus and other surfaces that are simply translated with
respect to another surface caused falling back to the GL renderer. The
rpi-renderer handles them directly.
This patch only adds the new renderer, but does not hook it up into use.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Pekka Paalanen [Wed, 22 May 2013 15:03:05 +0000 (18:03 +0300)]
compositor: add capability CAPTURE_YFLIP
Both GL and pixman renderer (pixman probably only because GL did?)
return the screen capture image as y-flipped, therefore Weston y-flips
it again. However, the future rpi-renderer can produce only right-way-up
(non-flipped) screen captures, and does not need an y-flip.
Add a capability flag for y-flip, which the rpi-renderer will not set,
to get screen captures the right way up.
The wcap recording code needs yet another temporary buffer for the
non-flipped case, since the WCAP format is flipped, and the code
normally overwrites the input image as it compresses it. This becomes
difficult, if the compressor is supposed to flip while processing.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Pekka Paalanen [Wed, 22 May 2013 15:03:04 +0000 (18:03 +0300)]
compositor: add capability flag for arbitrary surface rotation
The upcoming rpi-renderer cannot handle arbitrary rotations. Introduce
Weston capability bits, and add a bit for arbitrary rotation. GL and
Pixman renderers support it.
Shell or any other module must not produce surface transformations with
rotation, if the capability bit is not set. Do not register the surface
rotation binding in desktop shell, if arbitary rotation is not
supported.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Ander Conselvan de Oliveira [Wed, 22 May 2013 19:55:33 +0000 (22:55 +0300)]
weston-launch: Fix failure to exec weston due to initalized argv values
The array of arguments supplied to execv must be NULL terminated. If
unitialized values are used as pointers the exec call may fail with a
EFAULT error ("Bad address").
https://bugs.freedesktop.org/show_bug.cgi?id=64874
Alexander Larsson [Wed, 22 May 2013 12:41:39 +0000 (14:41 +0200)]
compositor-drm: Support output scaling
If you specify e.g. scale=2 in an output section in weston.ini
we scale all modes by that factor.
We also correctly scale cursor positioning, but ATM there is no
scaling of the cursor sprite itself.
Alexander Larsson [Wed, 22 May 2013 12:41:38 +0000 (14:41 +0200)]
compositor-x11: Only repaint the damaged region
Set a clip on the GC when painting the damaged region so that
we don't copy the entire shadow buffer each time.
Alexander Larsson [Wed, 22 May 2013 12:41:37 +0000 (14:41 +0200)]
compositor: Support output/buffer scaling
If you specify e.g. scale=2 in weston.ini an output section for the
X11 backend we automatically upscale all normal surfaces by this
amount. Additionally we respect a buffer_scale set on the buffer to
mean that the buffer is already in a scaled form.
This works with both the gl and the pixman renderer. The non-X
backends compile and work, but don't support changing the output
scale (they do downscale as needed due to buffer_scale though).
This also sends the new "scale" and "done" events on wl_output,
making clients aware of the scale.
Alexander Larsson [Wed, 22 May 2013 12:41:36 +0000 (14:41 +0200)]
pixman-renderer: Fix up transform handling
Rather than storing the shadow_image in the untransformed space
and rotating on copy to hw_buffer we store both on the transformed
space. This means a copy between them is a straight copy, and that
apps supplying correctly transformed surface buffers need not
change them.
We also correctly handle all output transform including the previously
unhandled flipped ones, as well as client supplied buffer_transforms (which
were previously ignored).
We also simplify the actual rendering by just converting any damage
region to output coordinates and set it on a clip and composite
the whole buffer, letting pixman do the rectangle handling. This
means we always do all the transforms, including the surface positioning
as a pixman_image transform. This simplifies the code and sets us up
for handling scaling at a later stage.
The transform looks complicated, but in practice it ends up being
an integer translation almost always, so it will hit the pixman
fastpaths.
Alexander Larsson [Wed, 22 May 2013 12:41:35 +0000 (14:41 +0200)]
transformed: Add keyboard shortcuts to change transform
This makes it easy to test buffer_transform and buffer_scale handling.
left-right: rotate
space: toggle inverse
z: toggle scale between 1 and 2
Alexander Larsson [Wed, 22 May 2013 12:41:34 +0000 (14:41 +0200)]
terminal: Handle output transform
We pick the highest scale of any output the terminal is on, and the
transform from the last one it entered.
Alexander Larsson [Wed, 22 May 2013 12:41:33 +0000 (14:41 +0200)]
window: Add window_get_output_scale()
This lets you find the maximal scale for all the outputs a window
is on, which is useful for picking a buffer_scale.
Alexander Larsson [Wed, 22 May 2013 12:41:32 +0000 (14:41 +0200)]
desktop-shell: Respect output scale and translate
We pick the window scale/tranform based on what the output uses, which means
we can avoid rotations in the compositor, and get sharper rendering
in scaled outputs.
Alexander Larsson [Wed, 22 May 2013 12:41:31 +0000 (14:41 +0200)]
window: Store server_allocation in surface size
We used to just store the buffer size here which is not right if the
surface has a buffer_transform or a buffer_scale. To fix this we pass
the transform and scale into the toysurface prepare and swap calls and
move both the surface to buffer and the buffer to surface size
conversion there.
Without this interactive resize on the top or left sides of a transformed
or scaled surface will not work correctly.
Alexander Larsson [Wed, 22 May 2013 12:41:30 +0000 (14:41 +0200)]
transformed: Use the scale factor from the output
Alexander Larsson [Wed, 22 May 2013 12:41:29 +0000 (14:41 +0200)]
window: Apply buffer_scale automatically in widget_cairo_create
Alexander Larsson [Wed, 22 May 2013 12:41:28 +0000 (14:41 +0200)]
window: allow setting a buffer scale on a window
Alexander Larsson [Wed, 22 May 2013 12:41:27 +0000 (14:41 +0200)]
window: Track output scales
Alexander Larsson [Wed, 22 May 2013 12:41:26 +0000 (14:41 +0200)]
transformed: Rely on transformation in widget_cairo_create
Rather than doing our own transformation handling when drawing we
just rely on the generic code in widget_cairo_create
Alexander Larsson [Wed, 22 May 2013 12:41:25 +0000 (14:41 +0200)]
window: Support transform in widget_cairo_create()
If a buffer_transform it specified in the window we automatically
compensate for it in the cairo_t
Pekka Paalanen [Wed, 22 May 2013 07:20:05 +0000 (10:20 +0300)]
window: avoid a gcc warning in buffer release handler
Apparently some compilers complain about set but not used variables
'available' and 'bufs', but I don't get the warning. Still, separate the
debugging code from shm_surface_buffer_release(), so that we only
compute 'bufs' when it is printed. This should fix the warnings.
The debugging code now prints the shm_surface buffer state before and
after, instead of just after.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Kristian Høgsberg [Tue, 21 May 2013 15:44:22 +0000 (11:44 -0400)]
cms-static: Use the right wl_listener for the output hotplug listener
Mun Gwan-gyeong [Sat, 18 May 2013 12:43:10 +0000 (21:43 +0900)]
configure.ac: colord version to 0.1.27
Rob Bradford [Mon, 20 May 2013 15:55:10 +0000 (16:55 +0100)]
weston-launch: Print explanation of why we failed to open the device
Rob Bradford [Mon, 20 May 2013 11:09:20 +0000 (12:09 +0100)]
shell: End grab if the grabbed shell surface has been destroyed
The shell_grab_start function sets up a destroy notification on the
shell surface such that when the shell surface is destroyed the pointer
on the grab to the shell surface is set to NULL.
We must therefore check whether the shell surface is NULL and end the
grab if it is.
https://bugs.freedesktop.org/show_bug.cgi?id=64689
Pekka Paalanen [Fri, 17 May 2013 13:46:03 +0000 (16:46 +0300)]
protocol: improve sub-surface spec wording
Mention, that sub-surfaces are not clipped to the parent.
Be more accurate on surface commit vs. apply state.
Mention the initial stacking order.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Hardening [Fri, 17 May 2013 16:07:41 +0000 (18:07 +0200)]
Fix surface_pong when a seat doesn't have a pointer
This patch fixes a crash with the surface_pong when one of the
seats doesn't have a pointer. This was the case with the RDP compositor
that use a fake seat with no mouse or keyboard.
Quentin Glidic [Fri, 17 May 2013 14:20:37 +0000 (16:20 +0200)]
weston-launch: Run weston in the user login shell
This patch brings back the user environment from the shell.
In the future, weston-launch could create the Wayland socket earlier, in
which case the user's shell could be used to run Wayland-specific tools
in the new Weston session.
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Pekka Paalanen [Fri, 17 May 2013 13:46:08 +0000 (16:46 +0300)]
protocol: remove an unused sub-surface error code
This was left over from allowing nesting.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Pekka Paalanen [Fri, 17 May 2013 13:46:07 +0000 (16:46 +0300)]
compositor: forbid sub-surface nesting loops
The only way to create a sub-surface loop by recursive nesting is to
make the main surface (which does not have a role) a sub-surface of any
of its sub-surfaces. All other cases should already be cought.
This change checks for that exact case, and sends a protocol error.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Pekka Paalanen [Fri, 17 May 2013 13:46:06 +0000 (16:46 +0300)]
tests: add a sub-surface nesting loop test
It should not be possible to create a loop by nesting sub-surfaces.
Currently Weston fails this test.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Pekka Paalanen [Fri, 17 May 2013 13:46:05 +0000 (16:46 +0300)]
protocol: set_desync should flush
wl_subsurface.set_desync should apply the cached wl_surface state.
Otherwise, the sub-surface may be stuck: a commit on the parent surface,
if desynchronized, will not commit the sub-surface because it is
desynchronized, too. A commit on the sub-surface may not happen, if it
is waiting for the frame callback from the previous commit.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Pekka Paalanen [Fri, 17 May 2013 13:46:04 +0000 (16:46 +0300)]
tests: add sub-surface tree destruction permutations
Add a test for varying the object destruction order in a complex
sub-surface tree.
This test attemps to fuzz the destruction of a sub-surface tree to make
sure the server does not crash on any wl_surface or wl_subsurface
destruction sequence.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
U. Artie Eoff [Fri, 17 May 2013 13:12:50 +0000 (06:12 -0700)]
fix module_init signature in module tests
surface-global-test and surface-test did not get updated to
the new module_init(...) signature when it changed in
a50e6e4c500e3080b8df7ec14c7e42741477a423. Thus, they
failed to compile. Simply running 'make check' shows the
problem. This patch fixes it.
fixes https://bugs.freedesktop.org/show_bug.cgi?id=64691
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Ander Conselvan de Oliveira [Fri, 17 May 2013 11:00:40 +0000 (14:00 +0300)]
gl-renderer: Compile shaders only when needed
Saves some start up time by not compiling specific shaders until they
are needed.
Dima Ryazanov [Tue, 14 May 2013 06:51:11 +0000 (23:51 -0700)]
Fix missing corner resize cursors in Kubuntu (oxy-white theme)
Looks like that theme uses different names. Also, add the correspoding
horizontal and vertical resize cursors, just for consistency.
Richard Hughes [Wed, 15 May 2013 08:17:38 +0000 (09:17 +0100)]
cms-colord: Warn if reading or writing to the FD failed
This also fixes a compile warning when building the tarball.
Richard Hughes [Wed, 15 May 2013 08:17:37 +0000 (09:17 +0100)]
cms-colord: Fix build after the API change 'Honor XDG_CONFIG_DIRS'
Kristian Høgsberg [Wed, 15 May 2013 00:59:02 +0000 (20:59 -0400)]
lock-surface: Set geometry width and height before centering
The subsurface patches changed the center_on_output() behavior a bit.
Instead of using the buffer width and height, it now looks at surface
geometry. In lock_surface_configure() we haven't set up the geometry
when we call center_on_output() so the lock surface would never show
up.
Eduardo Lima (Etrunko) [Tue, 14 May 2013 16:09:31 +0000 (13:09 -0300)]
text: Respawn input method process if it exits
Just the same as it is done in shell.c, if the input method process exits
for any reason, we relaunch it automatically, as it is not possible to
launch a standalone application outside of the weston process.
In v2:
- Proper error message when giving up.
Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
Ossama Othman [Tue, 14 May 2013 16:48:26 +0000 (09:48 -0700)]
config-parser: Honor XDG_CONFIG_DIRS
This set of changes adds support for searching for a given config file
in the directories listed in $XDG_CONFIG_DIRS if it wasn't found in
$XDG_CONFIG_HOME or ~/.config. This allows packages to install custom
config files in /etc/xdg/weston, for example, thus allowing them to
avoid dealing with home directories.
To avoid a TOCTOU race the config file is actually open()ed during the
search. Its file descriptor is returned and stored in the compositor
for later use when performing subsequent config file parses.
Signed-off-by: Ossama Othman <ossama.othman@intel.com>
Ander Conselvan de Oliveira [Tue, 7 May 2013 11:16:59 +0000 (14:16 +0300)]
compositor-drm: Don't page flip before a mode is set
The function drm_output_start_repaint_loop() unconditionally issues a
page flip, even if the crtc for that output has not been enabled yet.
That causes the page flip to fail, and drm_output_repaint() is never
called.
Solve this by bypassing the initial page flip if the output needs a
mode set.
This has the caveat of affecting latency predictability for that first
frame and when a "driver" mode fullscreen surface causes a mode set.
However, on both cases the mode set would take an unpredictable amount
of time anyway.
https://bugs.freedesktop.org/show_bug.cgi?id=63812
https://bugs.freedesktop.org/show_bug.cgi?id=64183
Richard Hughes [Sat, 11 May 2013 08:48:22 +0000 (09:48 +0100)]
Add a colord implementation of a CMS plugin for weston
This allows users to change the assigned display profile in GNOME (using
gnome-control-center) or KDE (using colord-kde) and also allows the profiling
tools to correctly inhibit the calibration state whilst measuring the native
screen response.
U. Artie Eoff [Mon, 13 May 2013 22:55:47 +0000 (15:55 -0700)]
move subsurface-server-protocol.h include out of compositor.h
The subsurface-server-protocol.h header should not be included
by any headers that are part of the SDK since it is not exported.
Otherwise, SDK consumers will break during compilation.
Move this include from compositor.h to compositor.c.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=64537
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Pekka Paalanen [Thu, 25 Apr 2013 10:57:53 +0000 (13:57 +0300)]
window: add DBG code for leaf management and redraws
Aids for debugging and inspecting the algorithms.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Pekka Paalanen [Thu, 25 Apr 2013 10:57:52 +0000 (13:57 +0300)]
window: throttle resizing to the main surface
In case a toytoolkit application manages to schedule resizes constantly,
throttle them to the main surface display.
When resizing, all surfaces are updated synchronously, so it also makes
sense to synchronize on the main surface's frame callback particularly.
Rendering any faster will not make sense.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Pekka Paalanen [Thu, 25 Apr 2013 10:57:51 +0000 (13:57 +0300)]
window: prevent EGL sub-surface deadlock
Mesa's eglSwapBuffers() waits for the frame event from the previous
swapBuffers, before it returns. Apparently eglSwapInterval(), which
should be able to disable the wait, is unimplemented for now.
When a sub-surface contains an EGL widget, and the commit mode is
synchronized, the frame events will not be delivered to EGL until the
parent surface gets committed. Therefore rendering the EGL widget twice
would lead to a deadlock.
When the window is being resized, we need to force a repaint of the EGL
widget, too, to make the whole window consistent. For that, we need to
make sure the frame event from the previous eglSwapBuffers() actually
arrives.
This patch adds an extra wl_surface.commit(parent), when the window is
being resized, which should guarantee, that the previous eglSwapBuffers
gets its event.
To properly handle an EGL widget in a sub-surface, running in its own
thread, the EGL widget's automatic updates should be paused before
sending the extra wl_surface.commit(parent). A natural place for the
pause would be in the widget's resize hook. However, wl_surface.commit
cannot be called right after resize hooks, because it would commit new,
incomplete surface state. Therefore this patch is not enough for
threaded toytoolkit applications. Luckily those do not exist yet.
When eglSwapInterval() gets implemented, this patch should be reverted.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Pekka Paalanen [Thu, 25 Apr 2013 10:57:50 +0000 (13:57 +0300)]
clients: add subsurfaces demo
Add a demo program with:
- a main surface (green)
- a Cairo-image sub-surface (red)
- a raw GLESv2 widget (triangle)
Sub-surface input region is set empty to avoid problems in toytoolkit.
If Cairo links to libGL, then we will end up with also libGLESv2 linked
to subsurfaces program, and both libs getting really used, which leads
to disaster.
Do not build subsurfaces demo, if Cairo links to libGL and cairo-egl is
usable.
The GL rendering loop is not tied to the toytoolkit or the widget, but
runs directly from its own frame callback. Therefore it runs
independent of the rest of the application. This also relies on one of
two things:
- eglSwapInterval(0) is implemented, and therefore eglSwapBuffers never
blocks indefinitely, or
- toytoolkit has a workaround, that guarantees that eglSwapBuffers will
return soon, when we force a repaint on resize.
Otherwise the demo will deadlock.
The code is separated into three sections:
1. The library component, using only EGL, GLESv2, and libwayland-client
APIs, and not aware of any toolkit details of the parent application.
This runs independently until the parent application tells otherwise.
2. The glue code: a toytoolkit application widget, who has its own
rendering machinery.
3. The application written in toytoolkit.
This patch also adds new toytoolkit interfaces:
- widget_get_wl_surface()
- widget_get_last_time()
- widget_input_region_add()
Toytoolkit applications have not had a possibility to change the input
region. The frame widget (decorations) set the input region on its own
when used, otherwise the default input region of everything has been
used. If a window does not have a frame widget, it can now use
widget_input_region_add() to set a custom input region.
These are not window methods, because a widget may lie on a different
wl_surface (sub-surface) than the window.
Changes in v3:
- replace set_commit_mode with set_sync and set_desync
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Pekka Paalanen [Thu, 25 Apr 2013 10:57:49 +0000 (13:57 +0300)]
window: implement per-surface redraws
Add redraw_needed flag to all surfaces, in addition to having one in
window. The window redraw_needed flag is changed to force a redraw of
the whole window, regardless of frame events.
widget_schedule_redraw() now schedules the redraw only for the surface,
where the widget is on. window_schedule_redraw() is equivalent to
scheduling a redraw for all (sub-)surfaces of the window.
We still use only one deferred task for all redraws.
surface_redraw() will skip the redraw, if the window does not force a
redraw and the surface does not need a redraw. It will also skip the
redraw, if the frame callback from the previous redraw has not triggered
yet. When the frame callback later arrives, the redraw task will be
scheduled, if the surface still needs a redraw.
If the window forces a redraw, the redraw is executed even if there is a
pending frame callback. This is for resizing: resizing should trigger a
window repaint, as it really wants to update all surfaces in one go, to
apply possible sub-surface size and position changes. Resizing is the
only thing that makes a window force a redraw.
With this change, subsurfaces demo can avoid repainting the cairo
sub-surface while still animating the GL sub-surface.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Pekka Paalanen [Thu, 25 Apr 2013 10:57:48 +0000 (13:57 +0300)]
window: create sub-surfaces
The new application API window_add_subsurface() will create a plain
widget that is on a new sub-surface.
The sub-surface position is taken from the surface's root widget
allocation. This way widget allocations are always in the main surface
(i.e. window) coordinates. However, Cairo drawing coordinates will now
be different to widget coordinates for sub-surfaces. Cairo coordinates
are fixed by applying a translation in widget_cairo_create(), so that
widget drawing code can simply use the widget allocation as before.
Sub-surfaces are hooked up into resize, window flush, redraw, and
find_widget. Window maintains a list of sub-surfaces in top-first order.
Add a client settable default commit mode, and toggle the mode when
resizing to guarantee in-sync updates of a window and its sub-surfaces.
Changes in v3:
- replaced set_commit_mode with set_sync and set_desync
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Pekka Paalanen [Thu, 25 Apr 2013 10:57:47 +0000 (13:57 +0300)]
window: implement shm triple-buffering
Increase the maximum number of shm "leaves" to three, and rewrite the
leaf release and pick algorithms. The new algorithms hopefully improve
on buffer re-use while freeing unused buffers.
The goal of the new release algorithm is to always leave one free leaf
with storage allocated, so that the next redraw could start straight on
it.
The new leaf picking algorithm will prefer a free leaf that already has
some storage allocated, instead of just picking the first free leaf that
may need to allocate a new buffer.
Triple-buffering is especially for sub-surfaces, where the compositor
may have one wl_buffer busy on screen, and another wl_buffer busy in the
sub-surface cached state due to the synchronized commit mode. To be
able to forcibly repaint at that situation for e.g. resize, we need a
third buffer.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Giulio Camuffo [Thu, 25 Apr 2013 10:57:46 +0000 (13:57 +0300)]
shell: account for the subsurfaces when going fullscreen or maximizing
We must calculate the bounding box of the surface + subsurfaces set and use
that when maximizing the window or going fullscreen.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Giulio Camuffo [Thu, 25 Apr 2013 10:57:45 +0000 (13:57 +0300)]
shell: enable moving and resizing of a surface when clicking on a subsurface
[pq: changed to weston_surface_get_main_surface(), and used a temporary
variable to clean up the expressions.]
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Pekka Paalanen [Thu, 25 Apr 2013 10:57:44 +0000 (13:57 +0300)]
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Pekka Paalanen [Thu, 25 Apr 2013 10:57:43 +0000 (13:57 +0300)]
tests: add sub-surface protocol tests
For testing the protocol behaviour only:
- linking a surface to a parent does not fail
- position and placement requests do not fail
- bad linking and arguments do fail
- passing a surface as a sibling from a different set fails
- different destruction sequences do not crash
- setting a surface as its own parent fails
- nesting succeeds
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>