1
0
Fork 0
Commit graph

682 commits

Author SHA1 Message Date
Jonas Ådahl
d9a0f2a88d monitor-manager: Generate a monitor abstraction from outputs and crtcs
Generate a set of "monitors" abstracting the physical concepts. Each
monitor is built up of one or more outputs; multiple outputs being
tiled monitors. Logical monitors will later be built from these.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
4e812410cc monitor-manager: Move logical monitor into its own file
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
0873e3812b backends: Rename MetaMonitorMode to MetaCrtcMode
The MetaMonitorMode referred to the mode of a CRTC, and with the future
introduction of a MetaMonitor, theh old name would be confusing.
Instead call it what it is.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
7eac28189b monitor-manager: Fix private header guard
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
1650c35e38 monitor-manager: Rename MetaCRTC(Info) to MetaCrtc(Info)
Change to follow the naming convention used everywhere else. This means
changing CRTC to Crtc even though it is an abbreviation.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
f519093f89 monitor-manager: Initialize tiled logical monitor scale
The logical monitor scale were not initialized properly when created
for a tiled monitor. Set it to the scale of the main monitor tile.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
d188949101 backends/x11: Make the X11 backend derivable
Make the X11 backend derivable so that we can base a nested test backend
on it.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:53 +08:00
Jonas Ådahl
d3920ddb67 core: Add private API to override compositor configuration
Add private API for overriding the compositor configuration, i.e. the
compositor type (X11 WM or Wayland compositor) and backend type. This
will make it possible to add a special test backend used by src/tests/.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
bc5077f623 screen: Put xinerama monitor index outside of MetaLogicalMonitor
Put the monitor xinerama index in a separate struct that is attached to
the logical monitor using g_object_set/get_qdata(). Eventually this
should be moved to some "X11 window manager" object, but lets keep it
in MetaScreen until we have such a thing.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
6de3e4a07e Turn MetaLogicalMonitor into a GObject
This will make it easier to move various manually managed data and data
now in MetaLogicalMonitor into GObject QData fields.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
1fb0e8e9bb monitor-manager: Store logical monitors in a GList
Instead of storing the logical monitors in an array and having users
either look up them in the array given an index or iterate using
indices, put it in a GList, and use GList iterators when iterating and
alternative API where array indices were previously used.

This allows for more liberty regarding the type of the logical monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
20b8743f21 monitor-manager: Refactor tiled monitor assembly code
Refactor the tiled monitor assembly code (that constructs a logical
monitor out of tiling information. Part of the reason is to move away
from array based storage, part is to make the code easier to follow,
and part is to separate logical monitor construction from list
manipulation.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
c98bab8327 monitor-manager: Make logical monitor from point API take floats
Change meta_monitor_manager_get_logical_monitor_at() to use floats,
replace users of meta_monitor_manager_get_monitor_at_point() to use the
API that returns a logical monitor and remove the now unused function.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
a422d6fe08 Move logical monitor neighbor API into monitor manager
Move the last piece of monitor grid getter API to the monitor manager
away from MetaScreen. The public facing API are still there, but are
thin wrappers around the MetaMonitorManager API.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
5a8509f895 Move current logical monitor retrieval to the backends
The method used for getting the current logical monitor (the monitor
where the pointer cursor is currently at) depends on the backend type,
so move that logic to the corresponding backends.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
af616c96d4 Move more logical monitor getters from the screen to the monitor manager
Turning a rectangle into a logical monitor also has nothing to do with
the screen (MetaScreen) so move it to MetaMonitorManager which has that
information.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
f5b2d79f3b backends: Use macros for declaring the backend types
https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
d644993a74 MetaBackend: Move fields from MetaBackend into MetaBackendPrivate
Lets prepare for being able to declare the MetaBackend type using
the macro helper.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
2df4ebff47 Put logical monitor grid lookup API in MetaMonitorManager
Don't falsely assume the screen has anything to do with the monitor
grid, and thus move the related API to MetaMonitorManager.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:52 +08:00
Jonas Ådahl
317b734dcc Move cursor tracker ownership to the backend
Let the backend initialize the cursor tracker, and change all call
sites to get the cursor tracker from the backend instead of from the
screen. It wasn't associated with the screen anyway, so the API was
missleading.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Jonas Ådahl
e35ac9be8d cursor-tracker: Don't cache a private pointer to the cursor renderer
This means we don't rely on contruction order any more.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Jonas Ådahl
e659b07c39 MetaMonitorManager: Add API turning monitor index into logical monitor
This is the current equivalent of looking up the logical monitor in the
logical monitor array using the number, but eventually that will be
deprecated, and before that done differently, so add a temporary helper
for the places that has not been ported yet.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Jonas Ådahl
c936056663 MetaMonitorManager: Track primary monitor by pointer instead of index
Instead of keeping an index in an array to keep track of the current
primary logical monitor, just keep a pointer instead.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Jonas Ådahl
e22bbd4b14 MetaScreen: Remove redundant copy of logical monitors array
It was just pointer to the actual list; having to synchronize a list of
logical monitors with the actual monitors managed by the backend is
unnecessary.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Jonas Ådahl
842ff5d6aa Rename MetaMonitorInfo MetaLogicalMonitor
In preparation for further refactorizations, rename the MetaMonitorInfo
struct to MetaLogicalMonitor. Eventually, part of MetaLogicalMonitor
will be split into a MetaMonitor type.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Jonas Ådahl
4177d4f9f4 MetaMonitorManagerKms: Don't leak tile property blob
Also warn when we don't understand the property blob we got.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-01-25 16:28:51 +08:00
Bastien Nocera
9b64e09a24 egl: Fix GCC warning
src/backends/meta-egl.c: In function ‘set_egl_error’:
src/backends/meta-egl.c:144:16: error: format not a string literal and no format arguments [-Werror=format-security]
      error_str);
      ^~~~~~~~~

https://bugzilla.gnome.org/show_bug.cgi?id=777389
2017-01-17 14:22:27 +01:00
Jonas Ådahl
2df35d636e MetaWaylandEglStream: Use EGL_WL_wayland_eglstream instead of fd hack
Use the proposed EGL_WL_wayland_eglstream EGL extension instead of the
file descriptor hack that was used as a temporary solution.

Note that this results in EGL clients will no longer work if they are
running on a Nvidia driver with a version older than 370.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2017-01-03 17:50:03 +08:00
Jonas Ådahl
0a826da330 egl: Add EGL_WL_wayland_eglstream helpers
These are to replace the file descriptor hack currently in use.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2017-01-03 17:50:03 +08:00
Jonas Ådahl
139bed73f8 MetaRendererNative: Remove unnecessary ifdef
https://bugzilla.gnome.org/show_bug.cgi?id=773629
2017-01-03 17:50:03 +08:00
Jonas Ådahl
778f92e170 egl: Use correct proc to meta_egl_stream_consumer_aquire_attrib
It should be eglStreamConsumerAcquireAttribNV and not
eglStreamConsumerAcquireAttribEXT as the EXT variant is not defined in
any extension.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2017-01-03 17:50:03 +08:00
Rui Matos
cfafb0bfca MetaRendererNative: Flush all pending swap notifies on idle
We need to do swap notifications asynchronously from flip events since
these might be processed during swap buffers if we are waiting for the
previous frame's flip to continue with the current.

This means that we might have more than one swap notification queued
to be delivered when the idle handler runs. In that case we must
deliver all notifications for which we've already seen a flip event.

Failing to do so means that if a new frame, that only swaps buffers on
such a swap notification backlogged Onscreen, is started, when later
we get its flip event, we'd notify only an old frame which would hit
this MetaStageNative's frame_cb() early exit:

  if (global_frame_counter <= presented_frame_counter)
    return;

and we'd never finish the new frame and thus clutter's master clock
would be waiting forever stuck.

https://bugzilla.gnome.org/show_bug.cgi?id=774557
2016-12-07 16:48:22 +01:00
Jonas Ådahl
d9a9844005 MetaRendererNative: Don't requeue flush-swap-notify
When flush-swap-notify is already queued, we might end up trying to
requeue it, for example when handling flip callbacks inside
swap-buffers. Actually queuing it there is harmless, since old frames
will be discarded anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=774923
2016-11-23 18:38:46 +01:00
Jonas Ådahl
227187f1f1 MetaRendererNative: Wait for the last flip callback before flipping
We might still end up in swap-buffer without the previous flip callback
having been invoked. This can happen if there are two monitors, and we
manage to draw before having all monitor flip callbacks invoked.

https://bugzilla.gnome.org/show_bug.cgi?id=774923
2016-11-23 18:38:44 +01:00
Jonas Ådahl
77384ffa9a MetaRendererNative: Let the closure handle queuing flip notification
The queuing that was removed in this commit would be done in the clean
up function of the closure anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=774923
2016-11-23 18:38:43 +01:00
Rui Matos
76b6cc02d6 meta-monitor-config: Initialize MetaConfiguration's properly
We weren't initializing the ref count which means we could either be
leaking or end up using free'd memory.

https://bugzilla.gnome.org/show_bug.cgi?id=774135
2016-11-21 15:34:26 +01:00
Jonas Ådahl
eed4dab0fc wayland: Add support for EGLStream client buffers
This commit adds for a new type of buffer being attached to a Wayland
surface: buffers from an EGLStream. These buffers behave very
differently from regular Wayland buffers; instead of each buffer
reperesenting an actual frame, the same buffer is attached over and
over again, and EGL API is used to switch the content of the OpenGL
texture associated with the buffer attached. It more or less
side-tracks the Wayland buffer handling.

It is implemented by creating a MetaWaylandEglStream object, dealing
with the EGLStream state. The lifetime of the MetaWaylandEglStream is
tied to the texture object (CoglTexture), which is referenced-counted
and owned by both the actors and the MetaWaylandBuffer.

When the buffer is reattached and committed, the EGLStream is triggered
to switch the content of the associated texture to the new content.
This means that one cannot keep old texture content around without
copying, so any feature relying on that will effectively be broken.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
f5bdf75f70 egl: Add vfuncs needed for client EGLStream surfaces
https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
659c987335 egl: Add helpers for importing Wayland buffers as EGLImage's
https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
18b9cf8a85 egl: Allow passing NULL as error
When calling an EGL function is expected to sometimes fail, we might
not care about the error.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
934184e236 MetaRendererNative: Add EGLDevice based rendering support
This commit adds support for using a EGLDevice and EGLStreams for
rendering on top of KMS instead of gbm. It is disabled by default; to
enable it pass --enable-egl-device to configure.

By default gbm is first tried, and if it fails, the EGLDevice path is
tried. If both fails, mutter will terminate just as before.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
b735bdcf2f MetaEgl: Add EGL procs necessary for EGLDevice based rendering
https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
b1597b4291 MetaOnscreenNative: Allocate for real after cogl_framebuffer_allocate
There is no way to pass any backend specific parameters to a
CoglFramebuffer until after it has been allocated by
cogl_framebuffer_allocate() (since this is where the winsys/platform
fields are initialized). This can make it hard to actually allocate
anything, if the platform depends on some backend specific data.

A proper solution would be to refactor the onscreens and framebuffers to
use a GObject based type system instead of the home baked Cogl one, but
that'll be left for another day. For now, allocate in two steps, one to
allocate the backend specific parts (MetaOnscreenNative), and one to
allocate the actual onscreen framebuffer (via
meta_onscreen_native_allocate()).

So far there is nothing that forces this separation, but in the future
there will, for example EGLDevice's need to know about the CRTC in
order to create the EGLSurface.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
faa96444b5 MetaRendererNative: Add helper for getting the next framebuffer id
https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
78c121eb10 egl: Add eglInitialize helper
https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
cb6adc45d1 MetaRendererNative: Warn instead of wait when swapping flip in progress
A swap-buffers should never be issued when we are waiting for a flipped
callback, so instead of trying to handle a situation that sholud never
happen, warn instead.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
59b4b5e9e8 MetaOnscreenNative: Make flip waiting state more generic
Use a boolean to keep track whether a flipped event is pending or not,
and use that instead of looking at the framebuffer id field.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
ad784501a6 backends/native: Don't set discarded framebuffer as current
When a swap failed with EACCES (possibly due to VT switching), don't
mark the framebuffer as 'in use', so that it'll be cleaned up properly
and not set as current.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
68d690225a MetaCursorRendererNative: Fall back to texture when there is no gbm
For when there is no gbm available, for example when using
EGLDevice/EGLStream's, just fall back to the OpenGL texture based
cursor rendering path.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
8f716772c2 cogl: Make platforms set the EGL_SURFACE_TYPE
Cogl has no way to know how to properly set the surface type, so lets
outsource that to the platform layer.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
da21f02eb9 MetaRendererNative: Always use eglGetPlatformDisplay
Drivers may be bad at guessing what is passed to eglGetDisplay, ending
up return non-functioning EGLDisplay's. Using eglGetPlatformDisplay
avoids this issue.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
4ce7d3a772 MetaRendererNative: Log error reason when failing to create gbm device
https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
77b7ecfd04 backends/native: Pass KMS file path to renderer
The KMS file path will later be used for EGLDevice based rendering.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
da1c1d9c22 MetaRendererNative: Use pbuffer surface as dummy surface
Lets use a pbuffer surface as a dummy surface instead of a gbm based
one, so that we don't need to rely on the availability of gbm to create
a dummy surface when there is no need for it.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
f7cd6af9c6 MetaRendererNative: Put gbm initialization in its own function
Separate gbm initialization from general renderer initialization. Do
this even though no other initialization is done for now; later there
will will be other types of rendering mode, initialized in their own
functions.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
678ebbb7f6 MetaRendererNative: Put gbm related things in an anonymous struct
In order to separate gbm related fields from generic ones, put them in
anonymous structs.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
87d6e45da5 MetaEgl: Add eglGetPlatformDisplayEXT helper
Prepare a helper function for the more reliable way to get a platform
display.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
80c61c4b3b MetaEgl: Add EGL extensions support
Add proc symbol loading and helper functions for calling them, dealing
with errors etc. So far no extension symbols are loaded, only the
infrastructure is there.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
4547c6e9f3 MetaLauncher: Remember the KMS file path
Not only keep the KMS fd around, also remember the file path used. This
will later be used when initializing a EGLDevice based renderer.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
cde622b8e1 MetaRendererNative: Get EGLDisplay on init
Use MetaEgl to get the EGLDisplay on initialization; use that when
constructing the Cogl renderer.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
8b810193dd MetaRendererNative: GLib:ify a few Cogl types
In another step getting rid of the duplications introduced by Cogl,
use the equivalent GLib types where Cogl types previously used. While
CoglBool is not a typedef to gboolean, they are both typedefs to int,
and we already use GLib's TRUE/FALSE to set them.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
22f019826c Add EGL abstraction class MetaEgl
Add a MetaEgl meant to deal with EGL. It is intended to be use by EGL
based renderers and handle extension symbols loading, handle errors etc.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Jonas Ådahl
7fa3f41df2 MetaBackendNative: Initialize GError pointer
Initialize the GError pointer used when creating the renderer. If an
error occurs, the error is expected to be NULL, otherwise it'll
misinterpreted as already set.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
2016-11-18 00:00:10 +08:00
Rui Matos
925b1aec64 meta-input-settings-x11: Don't try setting unavailable scroll methods
Since doing so causes BadValue X errors.

https://bugzilla.gnome.org/show_bug.cgi?id=771744
2016-11-16 13:50:33 +01:00
Carlos Garnacho
ff9753688f backends/x11: Implement tablet settings based on the Wacom driver
This is a stopgap solution until libinput is the fallback driver
handling tablets and pads.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
b35b531f00 backends: extend tablet device checks
The Clutter X11 backend can't drop CLUTTER_PEN_DEVICE and
CLUTTER_ERASER_DEVICE in favor of CLUTTER_TABLET_DEVICE without
losing information (as the driver will create one device for each).
So make MetaInputSettings cater for both sets of device types.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
6257f1195b backends: Remove ToolSettings struct
Its only purpose was caching settings applying to an stylus/tool, this
is now handled through ClutterInputDeviceTool evdev specific API, or
X device properties, so is not needed anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
b252771a8f clutter/evdev: Take over stylus configuration
Stylus configuration (stylus buttons, pressure) was handled
at the very high level, doing the button and pressure translations
right before sending these to wayland clients.

However, it makes more sense to store these settings into the
ClutterInputDeviceTool itself, and have clutter apply the config
at the lower level so 1) the settings actually apply desktop-wide,
not just in clients and 2) X11 and wayland may share similar
configuration paths. The settings are now just applied whenever
the tool enters proximity, in reaction to
ClutterDeviceManager::tool-changed.

This commit moves all handling of these two settings to
the clutter level, and removes the wayland-specific paths

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
cea7d629d9 backends: Add missing pad button-to-keycombo translation
https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
db9d8fcc90 Revert "backends: Use g-s-d settings for tablet configuration"
This reverts commit b52f304f9d.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Rui Matos
2641b364e8 MetaInputSettings: fix two finger preference over edge scrolling logic
Enabling edge scrolling before disabling two finger would result in
edge scrolling not actually being enabled because two finger is still
enabled at the time and we bail out.

This patch moves this logic to common code for both the native and X
backends and fixes it by ensuring that both settings are never set at
the same time and still re-checking if edge scrolling should be
enabled after two finger scrolling gets disabled.

We also simplify the code by not checking for supported/available
settings since the underlying devices will just reject those values
and there isn't anything we can do about it here. It's the UI's job to
only show supported/available settings to users.

https://bugzilla.gnome.org/show_bug.cgi?id=771744
2016-11-02 14:07:13 +01:00
Rui Matos
fb5e591bc9 MetaInputSettingsNative: allow unsetting click and scroll methods
Checking for supported methods isn't needed since libinput will just
error out and do nothing itself if a requested method isn't supported
and, in fact, this logic was preventing the enum values 0 from being
set.

https://bugzilla.gnome.org/show_bug.cgi?id=771744
2016-11-02 14:07:11 +01:00
Ray Strode
d491063110 native: don't call steal_pointer prematurely
commit e2bfaf0751 does this:

g_hash_table_insert (cards,
                     g_udev_device_get_name (parent_device),
                     g_steal_pointer (&parent_device));

The problem is the g_steal_pointer call may happen before the
g_udev_device_get_name call leading to a crash.

This commit does the get_name call on an earlier line

https://bugzilla.gnome.org/show_bug.cgi?id=771442
2016-10-19 15:23:37 -04:00
Ray Strode
e2bfaf0751 native: fail on systems with connectors spread across multiple gpus
We don't support using more than one GPU for output yet, so we should fail
if we encounter that situation, so GDM will fall back to X.

https://bugzilla.gnome.org/show_bug.cgi?id=771442
2016-10-19 13:08:19 -04:00
Ray Strode
f1e1a5ff06 native: shore up matching of card device
Right now we accept any character device that matches the glob card*.

That's fine, but we can be a little more specific by checking that
the devtype is what we expect.

This commit does that.

https://bugzilla.gnome.org/show_bug.cgi?id=771442
2016-10-19 11:21:32 -04:00
Ray Strode
ef2000053a native: only match drm subsystem devices
Despite g_udev_client_new taking a list of subsystems, it doesn't
implicitly filter results to those subsystems.

This commit explicitly adds a subsystem match to make sure sound cards
don't end up in the resulting list of video cards.

https://bugzilla.gnome.org/show_bug.cgi?id=771442
2016-10-19 10:14:13 -04:00
Rui Matos
1d4a5a7520 MetaOnscreenNative: fix mirror mode with stage views
Using the view's MetaMonitorInfo to find all the crtcs which should be
configured to display a given onscreen doesn't work unfortunately. The
association runs only the other way around, i.e. we need to go through
each crtc and find the ones corresponding to our monitor info.

https://bugzilla.gnome.org/show_bug.cgi?id=773115
2016-10-18 14:11:10 +02:00
Rui Matos
8290e1f09a MetaRendererNative: don't call drmModeGetResources()
There's no need to call this and we were leaking the returned memory.

https://bugzilla.gnome.org/show_bug.cgi?id=773116
2016-10-18 14:10:58 +02:00
Rui Matos
89672fad04 MetaMonitorManageKms: plug a GArray leak
https://bugzilla.gnome.org/show_bug.cgi?id=773116
2016-10-18 14:10:55 +02:00
Rui Matos
280e297afe MetaIdleMonitorNative: initialize last event timestamp
If this isn't initialized and an idle watch gets instanced before
meta_idle_monitor_native_reset_idletime() gets called, that idle watch
would get triggered as soon as we hit the main loop.

This was causing gnome-session to go into idle mode at session start
thus making gnome-shell lock the screen.

In the past this bug was being masked by either logind emiting
session active signals or a stray input event making it through at
startup.

https://bugzilla.gnome.org/show_bug.cgi?id=772839
2016-10-17 13:47:20 +02:00
Rui Matos
5261638bfd meta-monitor-config: Look at an output's modes directly when assigning
Going through the global mode pool and then checking if the mode is
available for a given output is pointless work since we can look at
the output's available modes directly.

This implicitly changes how we choose the default mode since, instead
of relying on the sort order of the global modes array, we now rely on
the sort order of the output modes array. Still not ideal, but at
least it makes more sense since the global array is essentially
unsorted.

https://bugzilla.gnome.org/show_bug.cgi?id=772176
2016-10-10 22:37:13 +02:00
Rui Matos
04b75c45f8 MetaMonitorManagerKms: stop taking drmModeModeInfo.vrefresh directly
As in the previous commit, this value already has mode flags baked in
and we can always get the value we need by computing it ourselves.

https://bugzilla.gnome.org/show_bug.cgi?id=772176
2016-10-10 22:37:11 +02:00
Rui Matos
a50950cf8f MetaMonitorManagerKms: stop accounting for mode flags in refresh rates
This isn't technically needed and, in fact, makes us default to
interlaced modes in some cases which isn't desirable.

Note that X doesn't account for these flags either for its mode
refresh rates.

https://bugzilla.gnome.org/show_bug.cgi?id=772176
2016-10-10 22:36:47 +02:00
Florian Müllner
f1850e0d61 monitor-manager-kms: Fix compiler warning
As the m format specifier doesn't consume any arguments, the number
of varargs currently doesn't match the number of specifiers; the
failed transform may be relevant, so include it in the message
instead of removing the excess argument.
2016-10-08 22:38:26 +02:00
Carlos Garnacho
e3dab70754 backends: Use fallback rotation if native DRM plane rotation failed
Blacklist the HW mode so we fallback gracefully to our own paths.

https://bugzilla.gnome.org/show_bug.cgi?id=772512
2016-10-07 17:19:46 +02:00
Olav Vitters
028157081c Fix string format build error
backends/meta-input-settings.c:1245:27: error: format '%lx' expects
argument of type 'long unsigned int', but argument 3 has type 'guint64
{aka long long unsigned int}' [-Werror=format=]
2016-09-22 21:00:29 +02:00
Carlos Garnacho
3137ddb1a1 backends: Handle tablet settings lookups with no backing libwacom info
Those will be unseen by g-s-d/g-c-c, so no settings will be written on
disk for those. Still, look up an ID correctly in this case instead of
crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=771628
2016-09-19 22:55:30 +02:00
Carlos Garnacho
b52f304f9d backends: Use g-s-d settings for tablet configuration
This is needed to make the wayland backend react to configuration
changes until gnome-control-center is updated to use the
gsettings-desktop-schemas settings.

https://bugzilla.gnome.org/show_bug.cgi?id=771315
2016-09-12 21:51:00 +02:00
Rui Matos
9a076076c0 monitor-manager-kms: Add common modes
Some output devices only advertise their preferred mode even though
they're able to display others too. This means we can include some
common modes in each output's supported list.

This is particularly important for mirroring, since we can only mirror
outputs which are using the same resolution.

https://bugzilla.gnome.org/show_bug.cgi?id=744544
2016-09-12 20:02:03 +02:00
Carlos Garnacho
0f0b25767d backends: Add comment to translators in "Switch monitor" string
Without context it's not clear to what it actually refers to. Add some
context.

https://bugzilla.gnome.org/show_bug.cgi?id=770929
2016-09-12 19:45:09 +02:00
Olivier Fourdan
4c106a9c9b wayland: save/restore numlock state
Save the state on NumLock so that is can be (optionally) restored on
next login.

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=757943
2016-09-09 19:07:10 +02:00
Rui Matos
2c1d3e5b70 cursor-renderer: Add a cursor painted signal
This signal allows interested parties to be notified of a new cursor
frame being painted regardless of whether it's being painted by the
backend directly or if it's a software rendered cursor frame handled
by clutter.

https://bugzilla.gnome.org/show_bug.cgi?id=749913
2016-08-31 20:10:14 +02:00
Jonas Ådahl
262e184fe7 Default to using stage views
Instead of hiding stage views enablement behind MUTTER_STAGE_VIEWS=1,
default to enable it, while making it possible to disable using
MUTTER_STAGE_VIEWS=0 instead.

https://bugzilla.gnome.org/show_bug.cgi?id=770366
2016-08-30 22:56:56 +08:00
Rui Matos
c8f24721c5 monitor-manager-kms: Use the output naming logic used by the X server
Switch to the output naming logic used by the X server's modesetting
driver which, in particular, uses drmModeConnector's connector_type_id
instead of connector_id.

The kernel generates new connector_id's every time there are changes
which means we can't identify the same monitor on the same connector
after an hardware hotplug. Switching to connector_type_id fixes this.

https://bugzilla.gnome.org/show_bug.cgi?id=770338
2016-08-29 15:53:00 +02:00
Rui Matos
7ba803934c monitor-manager-kms: Use the same connector type names as the X server
Switch to the connector type names used by the X server's modesetting
driver which, in particular, fixes DVI-A being labeled DVID.

https://bugzilla.gnome.org/show_bug.cgi?id=770338
2016-08-29 15:52:59 +02:00
Carlos Garnacho
9fb4783957 backends/native: Expose all transform modes in CRTCs
We can only honor this properly in the MUTTER_STAGE_VIEWS=1 case. When using
the legacy view, software implemented transforms are only exposed if there is
only one output, as we can only transform the entire stage there.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:38:06 +02:00
Carlos Garnacho
9e641f623f backends/native: Set offscreen on the transformed MetaRendererViews
The texture is only created if the view is transformed at the software level,
otherwise the texture is NULL, and rendering happens on the onscreen.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:38:06 +02:00
Carlos Garnacho
8065ff5a37 backends/native: Refactor onscreen creation into separate function
And use the right size, regarless of view transform.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:38:05 +02:00
Carlos Garnacho
6ce918661c backends/native: Use framebuffer size on swap_buffers implementation
Instead of ClutterStageView layout, which may be affected by transformations.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:38:05 +02:00
Carlos Garnacho
a72bd1bd29 backends/native: Set transform on MetaRendererViews
Only do this if mutter uses the multiple stage views feature. This
is uneffective at the moment because no back texture is set yet.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:38:05 +02:00
Carlos Garnacho
89854f9244 backends: Add MetaStageView::transform property
This property updates the ClutterStageView pipeline, so the texture is applied
with the corresponding transform.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:38:05 +02:00
Carlos Garnacho
54dc10f890 clutter: Add infrastructure to render ClutterStageViews to offscreen
The offscreen is given through the ::back-buffer property, the ClutterStageView
will set up the the CoglPipeline used to render it back to the "onscreen"
framebuffer.

The pipeline can be altered through the setup_pipeline() vfunc, so ClutterStageView
implementations can alter the default behavior of blitting from offscreen to
onscreen with no transformations.

All getters of "the framebuffer" that were expecting to get an onscreen have
been updated to call the right clutter_stage_view_get_onscreen() function.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:36:45 +02:00
Carlos Garnacho
7baa1d8a8d backends/native: Refactor g_object_set() call
Makes sense to update ::layout inside meta_renderer_native_set_legacy_view_size().

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:11:37 +02:00
Carlos Garnacho
4b4eb3a039 backends/native: Remove unneeded call
The call to _cogl_framebuffer_winsys_update_size() results in no-op here,
as the framebuffer has already the right size when rebuilding the views.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:11:37 +02:00
Carlos Garnacho
92c03e8625 backends/native: Split hw supported CRTC rotation modes
Those will need a separate treatment from the modes that we eventually
support through "software", so split those into a separate enum so we
can can do the right thing when applying the configuration.

Also, add a helper function that returns the transform that the software
fallbacks should perform, which should be "normal" if the rotation is
already handled via hw.

The function applying the configuration has been modified to always set
a HW rotation mode (even if normal), when we come to support SW rotation
modes, we'll be relying on a normal transformation, so it will be
necessary to have mixed HW/SW managed transforms.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:09:32 +02:00
Carlos Garnacho
a53ca0d8cf backends: Mark MetaRendererView:info as G_PARAM_STATIC_STRINGS
https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-23 18:14:16 +02:00
Bastien Nocera
c977ba197e backends: Update two-finger scrolling before edge scrolling
As whether edge scrolling is enabled depends on whether two-finger
scrolling is disabled, make sure to update two-finger scrolling first.

Note that this only fixes the problem on startup. Changing the
settings in GSettings directly might cause an inconsistent state, but
the main UI for this setting, gnome-control-center, makes sure to
update two-finger scrolling before edge scrolling.

https://bugzilla.gnome.org/show_bug.cgi?id=769276
2016-08-20 16:00:35 +02:00
Jonas Ådahl
9f6f778589 MetaMonitorManagerKms: Set output scale when assigning crtc
The scale will have been set to 1 no matter what when initializing the
MetaOutput since it at the time didn't have an CRTC assigned to it.
Now, when we assign the CRTC to the output, we need to update the scale.

https://bugzilla.gnome.org/show_bug.cgi?id=769505
2016-08-12 14:58:39 +08:00
Jonas Ådahl
1f657d2c81 monitor-manager: Always set the monitor info scale
https://bugzilla.gnome.org/show_bug.cgi?id=769505
2016-08-12 14:58:39 +08:00
Jonas Ådahl
6940169f46 MetaMonitorManagerKms: Split up read_current() into logical chunks
Instead of reading all the different state in one huge function, split
it up into logical chunks, making it easier to read.

https://bugzilla.gnome.org/show_bug.cgi?id=769505
2016-08-12 14:58:39 +08:00
Carlos Garnacho
1ca57e0923 backends: Prepare for virtual devices
Those have no backing libinput_device, and configuration does not
apply to those.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 11:36:42 +02:00
Jonas Ådahl
6894563667 MetaRendererView: Fix GObject parent
Set ClutterStageViewCogl as parent of MetaRendererView, since that is
the actual parent.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-08-03 11:20:55 +08:00
Jonas Ådahl
9b4e8695f3 MetaRendererX11: Allocate offscreen framebuffers up front
Allocate the offscreen stage view framebuffers up front; otherwise they
may get allocated after the viewport calculated by the stage is set,
which would cause the viewport to be incorrect until recalculated.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-08-03 11:20:55 +08:00
Jonas Ådahl
cc4a65fe94 x11/nested: Only paint monitor stage views when enabled
Only paint the per monitor stage views when enabled, otherwise bad
things happen.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-08-03 11:19:24 +08:00
Jonas Ådahl
53061c7005 MetaInputSettings: Initialize the accel-profile setting
Shouldn't just update them when they change; they also need to be
set when initializing.

https://bugzilla.gnome.org/show_bug.cgi?id=769179
2016-08-03 10:49:22 +08:00
Jonas Ådahl
53e3d0df64 MetaInputSettings: Don't initialize the same setting twice
Two settings were set twice on the same device. Now instead group the
generic update functions together, removing the redundant calls.

https://bugzilla.gnome.org/show_bug.cgi?id=769179
2016-08-03 10:49:22 +08:00
Alberts Muktupāvels
38d61f30dc monitor-config: add missing chain-up for finalize 2016-07-28 19:57:42 +03:00
Jonas Ådahl
23c4ac6c7f settings: Support mouse and trackball accel profile
Support changing the mouse and trackball acceleration profile. This
makes it possible to for example disable pointer acceleration by
choosing the 'flat' profile.

This adds an optional dependency on gudev. Gudev is used by the X11
backend to detect whether a device is a mouse or not. Without gudev
support, the accel profile settings has have effect for mouse devices.

Trackball still uses the "strstr" approach, since udev doesn't support
tagging devices as trackball devices yet.

https://bugzilla.gnome.org/show_bug.cgi?id=769179
2016-07-28 20:13:08 +08:00
Bastien Nocera
cfe5d7429a backends/x11: Add enum for scroll methods
This way the "libinput Scroll Method Enabled" property manipulation
is made clearer.
2016-07-27 19:42:14 +02:00
Bastien Nocera
36cd7177fd backends: Re-add support for edge scrolling with some touchpads
Add support for setting edge-scrolling separately from two-finger
scrolling. We now have 2 separate boolean settings for those, with the
Mouse panel in gnome-control-center allowing to set only one of those at
a time, but nothing precludes both being set in the configuration.

We need to handle:
- two-finger-scrolling-enabled and edge-scrolling-enabled settings both
  being set.
- those 2 settings being change out-of-order
- two-finger-scrolling being set on a device that doesn't support it
- edge-scrolling-enabled on a device that doesn't support it

And the combinations of one touchpad supporting just one of edge
scrolling and two-finger scrolling and another vice-versa.

https://bugzilla.gnome.org/show_bug.cgi?id=768245
2016-07-27 17:17:25 +02:00
Jonas Ådahl
820a6ab406 Gracefully exit with failure if backend creation failed
Instead of continuing eventually crashing with a segmentation fault due
to a missing renderer, make MetaBackend an GInitable, and gracefully
handle the failure to fully create the backend with an EXIT_FAILURE.

https://bugzilla.gnome.org/show_bug.cgi?id=769036
2016-07-23 21:21:31 +08:00
Florian Müllner
fe09a3c4e2 backends: Add missing guards to libwacom calls 2016-07-22 23:20:47 +02:00
Carlos Garnacho
5effde59f6 backends: Implement the "show osd" pad action
Just call back into meta_display_request_show_osd().
2016-07-22 13:31:09 +02:00
Carlos Garnacho
e2ad8700a9 backends: Export function to query the mapped MetaMonitorInfo of a tablet
Or NULL if the tablet is mapped to the full desktop size.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
323c608b0c backends: Export call to retrieve the base GSettings for a tablet 2016-07-22 13:31:09 +02:00
Carlos Garnacho
0efe076a0a backends: Implement "switch monitor" pad button action
This action remaps the tablet to each of the connected monitors,
or to the span of all monitors.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
56632d2ef7 backends: Add function to retrieve the label for a pad button action
As those are specified by settings.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
8e6244238d backends: Add API to trigger actions related to pad buttons
It does nothing at the moment, but can be hooked into MetaWaylandTabletPad
now. For X11, we need to trigger these for the pad events we receive from
the passive pad button grabs.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
f9552bb9c0 backends: Add function to apply pressure sensitivity to tablet tools
A bezier curve is created out of the 2 control points in settings, so
the pressure is made to follow the stablished curve between 0 and 1.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
fbb4c0b831 backends: Add function to retrieve the action mapped to an stylus button
This function will be useful for the wayland implementation, because buttons
are mapped at the time of sending those through the wire.
As x11/wayland implementations differ here, this function will be useful for
the wayland implementation, as the action is handled lat
2016-07-22 13:31:09 +02:00
Carlos Garnacho
d7faab76e0 backends: Perform libwacom checks before applying settings
Some settings make no sense on external tablets, and others make
no sense in display/system-integrated tablets. Perform those checks
so we don't end up with possibly broken configuration.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
b7892ba1c5 backends: Disable keep-aspect and output mapping on relative devices
Those settings make no sense there, so should be made ineffective.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
ab2d2af176 backends: Implement set_tablet_mapping() in native backend
We can now just set the mapping through clutter_input_device_set_mapping()
2016-07-22 13:31:09 +02:00
Carlos Garnacho
73958aeb59 backends: Add private getter for the MetaInputSettings
We will need to fetch information from it at certain places.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
77b33a86b8 backends: Fetch libwacom information for tablets in MetaInputSettings
Given that information defines largely how such devices are to be
configured, it makes sense to have that information at hand. A getter
has been also added for the places where it could be useful, although
it will require HAVE_LIBWACOM checks in callers too.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
f6e471fca4 backends: Add function to lookup the mapping for a given tablet
At least for wayland, this needs implementing within mutter. So add
a function to look this setting up.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
1dd121002f backends: Store mappable devices' info in the hashtable
Instead of as closure data. We will need to store (and query) more
per-device info, so access to this struct is necessary.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
526fdca3fb backends: Map tablets/pads, and wire to configuration vfuncs
With this, the left-handed setting works. The other configuration
vfuncs remain empty stubs, but will be correctly applied when those
are handled.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
220ac7c8f2 backends: Add empty stubs for tablet configuration
Those will be called when configuring tablets.
2016-07-22 13:31:09 +02:00
Thomas Hindoe Paaboel Andersen
125cba7100 backend: simplify assert
We already checked that constraint is non-null.

https://bugzilla.gnome.org/show_bug.cgi?id=769054
2016-07-22 10:44:19 +08:00
Florian Müllner
de1464f88f renderer-native: Adjust to StageView memory handling changes
ClutterStageView now takes ownership of the :framebuffer property,
so we need to release our own reference.
2016-07-20 20:58:20 +02:00
Rui Matos
daf5a112fb meta/boxes: typedef cairo_rectangle_int_t MetaRectangle
They are already effectively interchangeable so this should reduce
pointless casts.

Just like in GDK though, we need to keep the old definition for
instrospection to be able to include the struct's fields.
2016-07-20 14:11:25 +02:00
Jonas Ådahl
e891a8b628 renderer-native: Resize legacy onscreen before panting
By creating a pending gbm/EGL surface pair, only setting it on
swap-buffers, we would draw onto a buffer on the old surface, then swap
the buffer from the new surface, causing the first frame after a
hot-plug always having no content.

This was in the past not very noticable since some non-deterministic but
frequent side effect in gnome-shell caused hot-plugging to always render
two new frames, but after "Introduce regional stage rendering", this
side effect did not occur as often, thus making it more visible.

This commit updates the current gbm/EGL surface pair before painting a
frame, so that when the frame is painted, the surface with the correct
size is used and the buffer from correct surface is swapped.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
aecd98b847 backends/native: Support drawing onto multiple onscreen framebuffers
Add support for drawing the stage using multiple stage views, where
each stage view has its own onscreen framebuffer.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
d7b87799c8 backend: Ensure the backend gets notified of monitor state having changed
Being a listener to a signal, it is inconvenient to enforce order of
execution between different signal listeners. If there are things in
the backend that should be updated before various other signal
handlers, make sure so is done by emitting the signal after having
explicitly notified the backend.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
28a898a22f Use signals instead of onscreen framebuffer frame callbacks
CoglFrameInfo is a frame info container associated with a single
onscreen framebuffer. The clutter stage will eventually support drawing
a stage frame with multiple onscreen framebuffers, thus needs its own
frame info container.

This patch introduces a new stage signal 'presented' and a accompaning
ClutterFrameInfo and adapts the stage windows and past onscreen frame
callbacks users to use the signal and new info container.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
92341e7c30 MetaRendererNative: Make cogl variables obvious via their names
Call a CoglContext "cogl_context", CoglDisplay "cogl_display" and
CoglRenderer "cogl_renderer" so that they won't be confused with
ClutterContext, MetaDisplay and MetaRenderer etc.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
2eb843268a renderer-native: Rename cogl vfunc implementations
Make the cogl vfunc functions have names that are globally
discoverable. Calling the same function in every backend the same name
causes code navigation tools to not function properly. Rename the
affected functions to closer correspond to the style mutter uses.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
44b163e39b renderer-native: Meta:ify a struct
Rename a struct from the old Cogl style to mutter style naming and
conventions.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
566c28bdaf Introduce regional stage rendering
Add support for drawing a stage using multiple framebuffers each making
up one part of the stage. This works by the stage backend
(ClutterStageWindow) providing a list of views which will be for
splitting up the stage in different regions.

A view layout, for now, is a set of rectangles. The stage window (i.e.
stage "backend" will use this information when drawing a frame, using
one framebuffer for each view. The scene graph is adapted to explictly
take a view when painting the stage. It will use this view, its
assigned framebuffer and layout to offset and clip the drawing
accordingly.

This effectively removes any notion of "stage framebuffer", since each
stage now may consist of multiple framebuffers. Therefore, API
involving this has been deprecated and made no-ops; namely
clutter_stage_ensure_context(). Callers are now assumed to either
always use a framebuffer reference explicitly, or push/pop the
framebuffer of a given view where the code has not yet changed to use
the explicit-buffer-using cogl API.

Currently only the nested X11 backend supports this mode fully, and the
per view framebuffers are all offscreen. Upon frame completion, it'll
blit each view's framebuffer onto the onscreen framebuffer before
swapping.

Other backends (X11 CM and native/KMS) are adapted to manage a
full-stage view. The X11 CM backend will continue to use this method,
while the native/KMS backend will be adopted to use multiple view
drawing.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
a465e4c5b8 compositor: Initiate cogl context field on creation
There will only ever be one context; just get it from clutter instead
of waiting for we interact with a framebuffer.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
767e12125b ClutterStageCogl: Let the sub-classes handle the onscreen
In preperation for having allowing drawing onto multiple onscreen
framebuffers, move the onscreen framebuffer handling to the
corresponding winsys dependent backends.

Currently the onscreen framebuffer is still accessed, but, as can seen
by the usage of "legacy" in the accessor name, it should be considered
the legacy method. Eventually only the X11 Compositing Manager backend
will make use of the legacy single onscreen framebuffer API.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
14dbdfe483 Get rid of ClutterStageEglNative
The functionality from ClutterStageEglNative (one function returning
TRUE) was moved to MetaStageWindowNative.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
c3d2352a9e Explicitly create per backend stage windows
Split the stage window implementations into three separate objects: one
for X11 as a compositing manager, one for X11 running as a nested
Wayland compositor, and one for running with the native backend.

The new stage window implementations are only thin shells; this is in
preparation for making the stage windows behave more differently.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
55726e787b backends: Make clutter stage resizing more explicit
The stage resizing was placed in the generic backend, which was only
run on certain configurations (when running nested or using the native
backend). This commits makes the resizing more explicit thus more
obvious.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
8bebb8126c Let MetaMonitorManagerKms handle page flips
This commit completes the move of monitor logic to the monitor
mangager. The renderer now only deals with framebuffers, asking the
monitor manager to do the crtc flip tracking.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
12ef1a5e4b backends/native: Let the monitor manager manage KMS modes
Let MetaMonitorManagerKms manage KMS modes. This lets us pass less
state to MetaRendererNative. Instead let MetaMonitorManager tell the
monitor manager when it should set the mode and with what framebuffer.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
ec1da588cf MetaRendererNative: glib:ify a couple of struct fields
https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
44628bf224 MetaRendererNative: Absorb CoglDisplayKMS
Absorb the CoglDisplayKMS struct into MetaRendererNative. This makes
t so that all KMS interaction and fields are in the same place.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
27ac0b7f27 MetaRendererNative: Absorb CoglRendererKMS
Absorb the CoglRendererKMS struct into MetaRendererNative. The gbm
device initialization is moved earlier so that the renderer fails to
initialize if the gbm device creation failed.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
e420f386d2 Move cogl KMS winsys into the native backend
Move the KMS interaction from cogl into mutter, where most of the other
KMS interaction already takes place. This also removes dead code which
were only excercised when non-mutter callers used the cogl KMS backend.

The cogl KMS API was updated to pass via MetaRendererNative instead of
via the different cogl objects.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
2ceff4ee9b Create cogl renderer in MetaRenderer
Instead of passing around the KMS file descriptor via clutter to cogl,
just make our own clutter backend create the cogl renderer and set the
KSM fd.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
b2a62e6d5a native: Pass KMS fd to renderer
Will be used in a later commit.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
a54042e938 Introduce MetaRenderer
MetaRenderer is meant to be the object responsible for rendering the
scene graph. It will contain the logic related to the cogl winsys
backend, the clutter backend, and the clutter stage window.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
dd1eaeb262 Use correct cogl object types
Use the correct pointer types for cogl objects. This avoids warnings
when including the cogl headers doesn't result in all the cogl types
being typedefs to void.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
f096cc327d launcher: Expose KMS fd
https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
90de521799 Make mutter manage its own clutter backends
Introduce two new clutter backends: MetaClutterBackendX11 and
MetaClutterBackendNative. They are so far only wrap ClutterBackendX11
and ClutterBackendEglNative respectively, but the aim is to move things
from the original clutter backends when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Rui Matos
7f6bcea331 compositor: Handle GL video memory purged errors
Emit a signal so that interested parties can recreate their FBOs and
queue a full scene graph redraw to ensure we don't end up showing
graphical artifacts.

This relies on the GL driver supporting the
NV_robustness_video_memory_purge extension and cogl creating a
suitable GL context. For now we only make use of it with the X backend
since the only driver with which this is useful is NVIDIA.

https://bugzilla.gnome.org/show_bug.cgi?id=739178
2016-06-27 20:23:50 +02:00
Florian Müllner
8d7ae52565 stage: Fix function definition 2016-06-02 16:10:42 +02:00
Rui Matos
1141929bc5 backends: Add flags to MetaMonitorMode
And export them in the DBus API since they're useful for
gnome-control-center.

https://bugzilla.gnome.org/show_bug.cgi?id=763832
2016-05-13 18:44:45 +02:00
Carlos Garnacho
362ab781dd backends: Allow multiple "SW" cursor overlays on the stage
All the upper layers are prepared for multiple onscreen cursors, but
this. All MetaCursorRenderers created would poke the same internal
MetaOverlay in the stage.

This will lead to multiple cursor renderers resorting to the "SW"
rendering paths (as it can be seen with tablet support) to reuse the
same overlay, thus leading to flickering when a different
MetaCursorRenderer takes over the overlay.

Fix this by allowing per-cursor-renderer overlays, their lifetime
is attached to the cursor renderer, so is expected to be tear down
if the relevant device (eg. tablet) disappears.
2016-05-03 18:17:01 +02:00
Carlos Garnacho
b3eb56bb78 backend: Realize cursor on default MetaCursorRenderer paths
The cursor is realized on x11/native subclasses, but not if a base
MetaCursorRenderer is created.
2016-05-03 13:05:06 +02:00
Emmanuele Bassi
5f5d8f4091 Drop local g_autoptr definitions for generated code
Sadly, GLib's autoptr cleanup macros cannot be detected by the C
pre-processor, because they generate a function. This means that we are
forced to bump up the dependency on GLib 2.49, in order to build against
a newer version of gdbus-codegen.
2016-05-03 08:54:46 +01:00
Emmanuele Bassi
aeda556af1 Don't re-define auto cleanup symbols
Starting from GLib 2.49, the gdbus-codegen tool automatically generates
the auto cleanup symbols for the GDBus proxy and skeleton interfaces.

Since we don't depend on a specific version of GLib we need to
conditionally generate the auto cleanup symbols in case an older version
of gdbus-codegen is used when building Mutter.

This commit unbreaks the build under GNOME Continuous, which has been
failing with:

usr/include/glib-2.0/glib/gmacros.h:415:43: error: redefinition of 'glib_autoptr_cleanup_Login1Session'
 #define _GLIB_AUTOPTR_FUNC_NAME(TypeName) glib_autoptr_cleanup_##TypeName
                                           ^
[...]
/usr/include/glib-2.0/glib/gmacros.h:415:43: note: previous definition of 'glib_autoptr_cleanup_Login1Session' was here
./meta-dbus-login1.h:82:1: note: in expansion of macro 'G_DEFINE_AUTOPTR_CLEANUP_FUNC'
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Login1Session, g_object_unref)
 ^
2016-05-03 07:57:55 +01:00
Florian Müllner
ed5c3b39ee monitor-manager: Add get_is_builtin_display_on()
Wrap the existing laptop_display_is_on() method in a public function
that gnome-shell can use to query whether a builtin output is present
and enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=765267
2016-04-21 21:16:16 +02:00
Florian Müllner
b6f11fa8b8 monitor-config: Update laptop heuristics to match GnomeRROutput
gnome-desktop's GnomeRROutput class has heuristics to classify a display
as builtin similar to our own[0]. The two heuristics don't quite match
though, so different core components can end up with a different view
on the current display configuration. Minimize that risk by adding a
couple of rules that bring the two heuristics closer together.

[0] https://git.gnome.org/browse/gnome-desktop/tree/libgnome-desktop/gnome-rr.c#n1674

https://bugzilla.gnome.org/show_bug.cgi?id=765267
2016-04-21 17:36:22 +02:00
Florian Müllner
ab6c008e3e monitor-manager: Expose output_is_laptop() method
We currently duplicate the heuristics of whether an output is considered
a laptop or not. Avoid this by sharing a small helper method.

https://bugzilla.gnome.org/show_bug.cgi?id=765267
2016-04-21 17:36:22 +02:00
Victor Toso
ff312b6958 fix warning due implicit declaration of function
error: implicit declaration of function
  .x = (int)roundf (priv->current_x - (hot_x * texture_scale)),
            ^

https://bugzilla.gnome.org/show_bug.cgi?id=765252
2016-04-20 09:22:52 +02:00
Florian Müllner
8842bdfb11 Do not skip CoglError parameters
While CoglError is a define to GError, it doesn't follow the convention
of ignoring errors when NULL is passed, but rather treats the error as
fatal :-(
That's clearly unwanted for a compositor, so make sure to always pass
an error parameter where a runtime error is possible (i.e. any CoglError
that is not a malformed blend string).

https://bugzilla.gnome.org/show_bug.cgi?id=765058
2016-04-15 17:22:24 +02:00
Florian Müllner
bdc72dd9d7 Do not try to unref NULL CoglObjects
https://bugzilla.gnome.org/show_bug.cgi?id=765058
2016-04-15 17:21:22 +02:00
Rui Matos
8587f0e80d monitor-config: Handle invalid previous configurations
The previous configuration might not apply because the number of
enabled outputs when trying to apply it might have changed. This isn't
a bug so we shouldn't assert. Instead, we can handle it by falling
back as we would if we didn't have a previous configuration to start
with.

https://bugzilla.gnome.org/show_bug.cgi?id=764286
2016-04-13 18:16:36 +02:00
Rui Matos
8b801aac77 Handle meta_screen_get_monitor_for_point() returning NULL
On the X11 backend we don't track the pointer position in
priv->current_x/y which remain set to zero. That means we never set
the clutter stage cursor if point 0,0 isn't covered by any monitor
since we return early.

Commit 4bebc5e5fa introduced this to
avoid crashing on the prepare-at handlers when the cursor position
doesn't fall inside any monitor area but we can handle that higher up
in the stack. In that case, the sprite's scale doesn't matter since
the cursor won't be shown anyway so we can skip setting it.

https://bugzilla.gnome.org/show_bug.cgi?id=763159
2016-03-10 16:01:54 +01:00
Carlos Garnacho
741dd674f6 backends: rate-filter the emission of MetaBackend::last-device-changed signal
It indirectly triggers expensive operations in gnome-shell
(js/ui/keyboard.js), which turns out too expensive if we happen to operate
the shell simultaneously with 2 devices that will trigger the operations
there.

So just rate limit the signal emission, defer to an idle and just emit
the last device gotten. Worst that will happen is that we may possibly
emit the signal on the same device consecutively.

https://bugzilla.gnome.org/show_bug.cgi?id=753527
2016-02-26 16:19:15 +01:00
Jonas Ådahl
9611661154 native: Don't wait for a new input event to wrap the pointer
If we rely on getting back an input event with the warped pointer
coordinates, we might draw a frame with the old coordinates if we warp
during the paint phase. Avoid that by moving the cursor immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
495c89401a Implement support for the wp_pointer_constraints protocol
The wp_pointer_constraints protocol is a protocol which enables clients
to manipulate the behavior of the pointer cursor associated with a seat.

Currently available constraints are locking the pointer to a static
position, and confining the pointer to a given region.

Currently locking is fully implemented, and confining is implemented for
rectangular confinement regions.

What else is lacking is less troublesome semantics for enabling the lock
or confinement; currently the only requirement implemented is that the
window that appears focused is the one that may aquire the lock.

This means that a pointer could be 'stolen' by creating a new window that
receives active focus, or when using focus-follows-mouse, a pointer
passes a window that has requested a lock. This semantics can be changed
and the protocol itself allows any semantics as seems fit.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
525644059d native: Update to new constrain callback API
https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
f0f638d2bd Move out generic math parts out of the native barrier implementation
In order to reuse some vector math for pointer confinement, move out
those parts to its own file, introducing the types old types
"MetaVector2" and "MetaLine2" outside of meta-barrier-native.c, as well
as introducing MetaBorder which is a line, with a blocking direction.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
5b0eabec51 wayland: Implement support for wp_relative_pointer
Add support for sending relative pointer motion deltas to clients who
request such events by creating wp_relative_pointer objects via
wp_relative_pointer_manager.

This currently implements the unstable version 1 from wayland-protocols.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:47 +08:00
Rui Matos
55eef2deb3 cursor-renderer-native: Re-use cogl's gbm device
Instancing a gbm device without initializing EGL with it means that it
won't be able to import wl_drm buffers. Instead, let's re-use cogl's
gbm device which is already properly initialized.

https://bugzilla.gnome.org/show_bug.cgi?id=761557
2016-02-04 18:22:05 +01:00
Rui Matos
3cdcd3e9c1 meta-launcher: Use g_auto* macros
This fixes a couple of minor memory leaks.

https://bugzilla.gnome.org/show_bug.cgi?id=760670
2016-01-25 13:59:53 +01:00
Rui Matos
ac8fe2d9b2 cursor-tracker: Port to GdkSeat API 2016-01-21 14:07:50 +01:00
Marek Chalupa
e7a88dc6b2 meta-launcher: don't call g_object_unref() on NULL
g_object_unref() was called no matter what we got for value

https://bugzilla.gnome.org/show_bug.cgi?id=760670
2016-01-21 14:06:41 +01:00
Rui Matos
5e57af6286 idle-monitor-native: Don't leak user active watches
This fixes an issue analogous to bug 760330 for the X11 backend,
except on this backend we wouldn't crash accessing free'd memory.

Instead we're leaking watches since we steal them from the hash table
which means that when they're removed in
_meta_idle_monitor_watch_fire() they're no longer there and thus
they're never free'd.

https://bugzilla.gnome.org/show_bug.cgi?id=760476
2016-01-11 11:23:54 -05:00
Ray Strode
42b3a34f7b idle-monitor-xsync: fix crash if watch callback removes different watch
Right now the XSync based idle monitoring code, will fetch all active
watches into a list, and then call their watch callbacks one by one
as necessary.  If one watch callback invalidates another watch, the
list will contain free'd memory.

This commit makes sure to consult the hash table after ever call
of a watch callback, to ensure mutter never looks at freed memory.

Fixes crash reported on IRC by Laine Stump with his synergy setup.

https://bugzilla.gnome.org/show_bug.cgi?id=760330
2016-01-11 11:23:39 -05:00
Rui Matos
19d814c887 cursor-renderer-native: Avoid a crash if we fail to allocate a gbm bo
https://bugzilla.gnome.org/show_bug.cgi?id=758613
2016-01-11 14:31:42 +01:00
Jasper St. Pierre
9ebe3419c3 monitor-manager-xrandr: Don't query legacy properties
This never could have worked -- the Atom name it was querying was a root
window property, not an output property.
2016-01-09 18:06:18 -08:00
Rui Matos
9385c835b8 native: Don't leak DRM plane resources 2016-01-07 19:42:19 +01:00
Carlos Garnacho
efef0c993b native: Implement DRM-based crtc rotation
We can know the rotation modes supported by the driver, so
export these as our supported modes, and ensure these modes
are honored on the CRTC primary plane upon apply_configuration().

It is worth noting however that not all hardware will be
capable of supporting all rotation modes (in fact, most of
them won't). A driver independent solution should be in
place to back up the rotation modes unsupported by the
drivers, so this is still a partial solution.

The cursor renderer has also been changed to default to
software-based rendering anytime the cursor enters a
rotated CRTC. Another solution would be actually rotating
the DRM cursor planes, but then it requires applying rotation on
these per-CRTC, and actually transforming the pointer position by
the output matrix. This brings marginal gains, so we use the
"sw" rendered cursor, which will be transformed together with
the primary plane.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-01-07 17:03:44 +01:00
Bastien Nocera
996aeaef41 backends: Fix cut'n'paste error in click method setting
GDesktopTouchpadScrollMethod was used instead of GDesktopTouchpadClickMethod
which became visible now that the former has been removed from
gsettings-desktop-schemas.

https://bugzilla.gnome.org/show_bug.cgi?id=759304
2015-12-15 14:41:51 +01:00
Bastien Nocera
a27b2597b9 backends: Force 2-finger scroll by default if available
When the touchpad is two-finger scrolling capable, always enable it.

When the touchpad only supports edge scrolling (usually older devices, and
usually smaller devices), allow disabling the edge scrolling.

This requires a newer gsettings-desktop-schemas as the scroll-method key
was removed, and the edge-scroll-enabled key added.

https://bugzilla.gnome.org/show_bug.cgi?id=759304
2015-12-15 14:38:23 +01:00