With the idle_inhibit optimization, wlsc_compositor_wake() is a no-op if
idle_inhibit > 0.
When the shell is waking up the compositor from SLEEPING state as an
indirect response to input activity, it does not work. The call path is:
notify_key() / notify_button()
wlsc_compositor_idle_inhibit()
wlsc_compositor_activity()
shell->unlock()
send prepare_lock_surface event
idle_inhibit++
and when the desktop-shell client responds to the event:
desktop_shell_set_lock_surface() / desktop_shell_unlock()
wlsc_compositor_wake()
no-op, because idle_inhibit > 0
Fix this by removing the idle_inhibit check from wlsc_compositor_wake().
The optimization did not work for pointer motion while no keys pressed,
anyway, so the performance hit is probably unobservable.
Now the compositor wakes up also on key or button press.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
When compositor enters SLEEPING state, the shell plugin goes locked. If
compositor wakes up itself, it will fade in while the shell may not yet
have a lock surface to show.
Fix this by assigning wake-up to be called from the shell, if the
compositor is SLEEPING. The shell may wait for the lock surface request,
and only then wake up the compositor. The compositor will fade in
directly to the lock screen.
krh: original patch for compositor.c
ppaalanen: integration and shell.c changes
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Pass the correct pointer to free().
This is just a cosmetic change, because 'resource' happens to be the
first member in wlsc_frame_callback.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This is the same as the damage of the top-level surface so just use that.
There's a problem that if we change the stacking, the damage layering breaks,
but that's a problem we already have.
The shell module only needs to deal with attach when it's either the initial
attach or when the attach changes the size of the surface. In case of
initial attach, the shell needs to pick a position for the surface and a
place in the surface stack. We split this case out as a new shell->map
callback. The other case is split into the shell->configure callback,
where the shell may adjust the surface position or reject the new size.
The third parameter of open() is for file-creation modes. File flags are passed
in the second paramater.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Check, that only the desktop-shell client spawned by the compositor
(desktop-shell plugin) is allowed to bind to desktop_shell interface.
Other clients will receive an error like:
wl_display@1.error(desktop_shell@20, 0,
"permission to bind desktop_shell denied")
The error has the proper object id and interface type.
Note: desktop-shell cannot be started manually anymore, it has to be
started by the compositor automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Fork and exec desktop-shell in the compositor. This is a way to create
an authenticated client. Later, the desktop-shell interface will be
reserved for this client only.
For exec to work, the compositor should be started from the
wayland-demos' root directory.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
All the compositors are using GLES2 so check for the appropriate
surfaceless extension.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
The repaint logic breaks when finish_frame is called from the present
callback. Ideally we should throttle to vsync (or even better, the
compositor repaint cycle, but hey, X is X), but this goes a long way.
The drm compositor always creates a 64x64 bo for the cursor image
regardless of the size of the actual cursor. When the fade animation
kicks in it disables the hardware cursor so that it is rendered as a
regular surface. This surface is rendered to a 32x32 region but using
a 64x64 texture so the cursor gets scaled down.
Fix this by making create_cursor_image return the actual size of the
image created to the compositor.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
If the current or pending scanout buffer is destroyed, the client frame
will remain being displayed until something else causes a repaint to be
scheduled.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Without this fix, the dnd demo would make the demo compositor crash in
shell.c:drag_offer() because resource->data is NULL.
Initialise resource->data in shell_create_drag().
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
wlsc_output_repaint may call wlsc_surface_damage indirectly through
wlsc_output_set_cursor. If this happens in the call made from repaint,
one ends up with repaint being called from both idle_repaint and
wlsc_output_finish_frame.
Fix this by setting output->repaint_scheduled to 1 before calling
wlsc_output_repaint in the function repaint.
[krh] Edited to just only clear repaint_scheduled, when we no longer have
a repaint scheduled.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
On repaint, wlsc_output_repaint will replace output->scanout_buffer with
the new front buffer and then output->present() will cause this buffer
to be displayed. When wlsc_output_finish_frame is called, the
compositor will send a release buffer event for output->scanout_buffer
which is actually the front buffer now.
This patch changes this code to release the previous scanout_buffer
instead of the front buffer on wlsc_output_finish_frame.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Move this to a separate function to better accommodate changes in the
following commit.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>