Commit Graph

3177 Commits

Author SHA1 Message Date
Kristian Høgsberg
7c60912cb9 compositor: Make backlight_current int32_t to avoid unsigned overflow
Backlight brightness was wrapping around when decrementing from 0.
2013-05-23 21:00:45 -04:00
Kristian Høgsberg
220819f7b9 compositor-drm: Log failure and which backlight sysfs file we're using 2013-05-23 21:00:45 -04:00
Pekka Paalanen
daaddc6032 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>
2013-05-23 11:16:21 -04:00
Kristian Høgsberg
785e1f34c1 rdp: Update output initialization to new API 2013-05-22 21:54:05 -04:00
Hardening
fe36a13a8f 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
2013-05-22 21:54:00 -04:00
Hardening
c39118be7e 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.
2013-05-22 21:53:58 -04:00
Hardening
827358e0bd 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
2013-05-22 21:53:55 -04:00
Hardening
7d79dcc56d 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.
2013-05-22 21:53:51 -04:00
Hardening
a1ce6cd1bc 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.
2013-05-22 21:53:46 -04:00
Pekka Paalanen
d0cbf18d83 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>
2013-05-22 18:07:30 -04:00
Louis-Francis Ratté-Boulianne
6cd1de33ba 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]
2013-05-22 18:07:30 -04:00
Pekka Paalanen
a402b0567f 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>
2013-05-22 18:07:30 -04:00
Pekka Paalanen
79346ab3a5 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>
2013-05-22 18:07:30 -04:00
Pekka Paalanen
17bd884bff 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>
2013-05-22 18:07:30 -04:00
Pekka Paalanen
e31e053369 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>
2013-05-22 18:06:01 -04:00
Pekka Paalanen
d7265bc4ac 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>
2013-05-22 17:05:45 -04:00
Pekka Paalanen
4fc5dd0099 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>
2013-05-22 16:56:58 -04:00
Pekka Paalanen
7bb6510748 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>
2013-05-22 16:46:43 -04:00
Ander Conselvan de Oliveira
9bdfc48f09 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
2013-05-22 16:39:36 -04:00
Alexander Larsson
d9a7bb75d0 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.
2013-05-22 16:19:59 -04:00
Alexander Larsson
80f9163ad6 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.
2013-05-22 16:19:54 -04:00
Alexander Larsson
4ea9552d05 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.
2013-05-22 16:19:42 -04:00
Alexander Larsson
1f206b4ce4 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.
2013-05-22 16:19:36 -04:00
Alexander Larsson
95289831a1 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
2013-05-22 16:19:01 -04:00
Alexander Larsson
de79dd0485 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.
2013-05-22 16:18:57 -04:00
Alexander Larsson
d68f523f30 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.
2013-05-22 16:18:52 -04:00
Alexander Larsson
c584fa60d4 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.
2013-05-22 16:18:42 -04:00
Alexander Larsson
1818e31001 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.
2013-05-22 16:17:59 -04:00
Alexander Larsson
01441299b1 transformed: Use the scale factor from the output 2013-05-22 16:17:52 -04:00
Alexander Larsson
2aaa8b76cf window: Apply buffer_scale automatically in widget_cairo_create 2013-05-22 16:17:41 -04:00
Alexander Larsson
5e9b652a15 window: allow setting a buffer scale on a window 2013-05-22 16:17:25 -04:00
Alexander Larsson
afd319afce window: Track output scales 2013-05-22 16:17:19 -04:00
Alexander Larsson
fd456fb5e0 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
2013-05-22 16:16:51 -04:00
Alexander Larsson
15901f0377 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
2013-05-22 16:16:47 -04:00
Pekka Paalanen
9777744cda 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>
2013-05-22 14:42:48 -04:00
Kristian Høgsberg
d7ab5b8007 cms-static: Use the right wl_listener for the output hotplug listener 2013-05-22 14:20:42 -04:00
Mun Gwan-gyeong
fe097f95a3 configure.ac: colord version to 0.1.27 2013-05-20 17:29:28 -04:00
Rob Bradford
d33f2b065c weston-launch: Print explanation of why we failed to open the device 2013-05-20 16:55:12 -04:00
Rob Bradford
2f8d9aacfa 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
2013-05-20 16:53:49 -04:00
Pekka Paalanen
419e2bae92 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>
2013-05-20 10:30:58 -04:00
Hardening
eb1e13044f 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.
2013-05-17 16:30:39 -04:00
Quentin Glidic
ff3230952a 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>
2013-05-17 16:23:46 -04:00
Pekka Paalanen
5545320c36 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>
2013-05-17 16:22:24 -04:00
Pekka Paalanen
86c8ca03b5 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>
2013-05-17 16:22:18 -04:00
Pekka Paalanen
5e9bedb8c4 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>
2013-05-17 16:21:59 -04:00
Pekka Paalanen
16abf6a4d4 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>
2013-05-17 16:21:50 -04:00
Pekka Paalanen
beb080ed85 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>
2013-05-17 16:21:14 -04:00
U. Artie Eoff
173ff5326d 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
a50e6e4c50.  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>
2013-05-17 16:04:49 -04:00
Ander Conselvan de Oliveira
1ed73246ed gl-renderer: Compile shaders only when needed
Saves some start up time by not compiling specific shaders until they
are needed.
2013-05-17 11:52:25 -04:00
Dima Ryazanov
f6128fcd6c 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.
2013-05-15 12:15:32 -04:00