Commit graph

2990 commits

Author SHA1 Message Date
Kristian Høgsberg 115b0f729c cms-static: Don't crash on outputs with NULL name 2013-05-26 21:30:14 -04:00
Kristian Høgsberg 8f6fcbfc2e compositor-x11: Use new config file parser
With the iterator API we can now convert the X11 backend.
2013-05-26 21:21:28 -04:00
Kristian Høgsberg f73f316248 config-parser: Add section iterator API
The X backend needs to iterate through all outputs.
2013-05-26 20:50:53 -04:00
Hardening b8f03aa20e Don't store FreeRDP file descriptors
Weston don't uses the file descriptors from FreeRDP, there's no need
to store them.
2013-05-26 20:11:13 -04:00
Mun Gwan-gyeong 72a3ab7b85 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
2013-05-26 20:07:47 -04:00
Mun Gwan-gyeong d664196cfb config-parser-test: fix compile error
Add COMPOSITOR_CFLAGS to Makefile.am
2013-05-26 20:04:28 -04:00
Kristian Høgsberg fc10cc0c65 shell: Remove input panel debug fprintf 2013-05-23 21:47:37 -04:00
Kristian Høgsberg 00fd7b82f0 text-backend: Use new config parser 2013-05-23 21:45:51 -04:00
Kristian Høgsberg 673a889fd8 shell: Use new config parser 2013-05-23 21:42:04 -04:00
Kristian Høgsberg a30989a47d compositor-drm: Convert to new config parser 2013-05-23 21:41:59 -04:00
Kristian Høgsberg 7bedae1d44 cms-static: Convert cms-static to use new config parser
Almost half of the logic here was about wrestling the silly config parser
API.
2013-05-23 21:41:50 -04:00
Kristian Høgsberg 6a047915c0 compositor: Use new config parser for keyboard options 2013-05-23 21:41:45 -04:00
Kristian Høgsberg 732747114a 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.
2013-05-23 21:25:42 -04:00
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