summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* workspace: Don't crash on invalid argument to meta_workspace_indexwip/smcv/workspace-indexSimon McVittie2022-12-181-0/+1
| | | | | | Mitigates: https://gitlab.gnome.org/GNOME/mutter/-/issues/2559 Mitigates: https://bugs.debian.org/1024438 Signed-off-by: Simon McVittie <smcv@debian.org>
* pointer-lock/wayland: Fix coding styleJonas Ådahl2022-12-181-1/+3
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2772>
* pointer-lock/wayland: Remove unused instance struct fieldJonas Ådahl2022-12-181-1/+0
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2772>
* pointer-lock/wayland: Get compositor from surfaceJonas Ådahl2022-12-181-5/+5
| | | | | | | | This avoids trying to get it from an pointer that was never set to anything. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2558 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2772>
* wayland/gtk-shell: Dereference surface after NULL checkJonas Ådahl2022-12-181-3/+5
| | | | | | Spotted by coverity. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2772>
* clutter: Reduce default clutter_max_render_time_constant_us to 1000Michel Dänzer2022-12-171-1/+1
| | | | | | | | | | | | | Now that dynamic max render time uses a new algorithm and takes dispatch lateness into account, this seems worth a shot. We'll see how it works out in the wild. The net result compared to before these changes is still slightly higher (by ~0.5 ms) minimum latency for me, as measured by weston-presentation-shm. It should be less vulnerable to frame drops though. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2500>
* frame-clock: Simplify dynamic max render time calculationMichel Dänzer2022-12-171-76/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | Store only two values per kind of duration: The short term and long term maximum. The short term maximum is updated in each frame clock dispatch. The long term maximum is updated at most once per second: If the short term maximum is higher, the long term maximum is updated to match it. Otherwise, a fraction of the delta between the two maxima is subtracted from the long term maximum. Compared to the previous algorithm: * The calculcations are simpler. * The calculated max render time has a slow exponential drop-off (by at most a few milliseconds every second) instead of potentially abruptly dropping after as few as 16 frames. This should fix https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4830 since the short term maximum should always include a sample from the clock's second tick. v2: * Use divisor 2 instead of 4. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2500>
* clutter/frame-clock: Use dispatch lateness for dynamic max render timeMichel Dänzer2022-12-171-4/+34
| | | | | | | | | | | | | Dispatch lateness is the difference between when we wanted frame clock dispatch to run and when it actually started running. This can be up to 1ms even under normal circumstances due to process scheduling granularity, or even higher under load. This keeps track of dispatch lateness of the last 16 frame clock dispatches, and incorporates the maximum into the dynamic render time estimate. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2500>
* tests/cogl: Add test checking rgb10 fbo precisionJonas Ådahl2022-12-172-0/+238
| | | | | | | | | | | | | There are two tests; one checks that clearing with a color that cannot be represented using 8 bits per channel doesn't loose precision when painted, then read back using glReadPixels(). Would the texture backing store have 8 bits per channel instead of 10, we'd get a different value back. The other test checks that painting from one fbo to another also doesn't loose that precision. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2461>
* cogl/texture: Add support for sized textures with explicit formatNaveen Kumar2022-12-177-11/+74
| | | | | | | Add API that introduce a method to allocate 2d textures given a passed pixel format (e.g. xrgb210101010). Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2461>
* cogl/driver/gles: Handle reading RGBA1010102 tooJonas Ådahl2022-12-171-0/+7
| | | | | | | This means can read without loosing precision, compared to if we read a texture as rgb8. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2461>
* cogl/framebuffer/gl: Move most read restriction to driversJonas Ådahl2022-12-176-20/+54
| | | | | | | | | | OpenGL requires more hand holding in the driver regarding what pixel memory layouts can be written when calling glReadPixels(), compared to GLES2. Lets move the details of this logic to the corresponding backends, so in the future, the GLES2 backend can be adapted to handle more formats, without placing that logic in the generic layer. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2461>
* cogl/driver/gles: Fix RGB10 GL formatsJonas Ådahl2022-12-171-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | COGL_PIXEL_FORMAT_ABGR_2101010 is defined to mean the 2 A bits are placed in a 32 bit unsigned integer on the bits with highest significance, followed by B on the following 10 bits, and so on, until R on the 10 least significant bits. UNSIGNED_INT_2_10_10_10_REV_EXT is defined to represent color channels as ``` 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ------------------------------------------------------------------------------------- | a | b | g | r | ------------------------------------------------------------------------------------- ``` As can be seen, this matches COGL_PIXEL_FORMAT_ABGR_2101010, meaning that's the format we can directly read and write. In Cogl, when finding the GL formats, we get the tuple with the GL format given the format we pass, but we also get returned "required format" (CoglPixelFormat). This required format represents the format that is required when reading actual pixels from GLES. In GLES, the above mentioned format is the only one supported by the EXT_texture_type_2_10_10_10_REV extension, thus for other types, we need to do the CPU side conversion ourselves. To achieve this, correctly return COGL_PIXEL_FORMAT_ABGR_2101010 as the required format. The internal format should also be GL_RGB10_A2, not GL_RGBA. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2461>
* meta: Move enum definitions to meta-enums.hOlivier Fourdan2022-12-174-394/+393
| | | | | | | | | | Commit bf84b24 created meta-enums.h but it's pretty empty so far, the vast majority of enum definitions is still in common.h. Move the Meta enum definitions to meta-enums.h as one would expect them to be found. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2467>
* tests/wayland: Add test for xdg-foreignJonas Ådahl2022-12-173-0/+271
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2770>
* tests/wayland-client-utils: Add simple toplevel helperJonas Ådahl2022-12-172-0/+112
| | | | | | | | Add a helper to create a toplevel painted with a given color, size and title. It's meant to be "dumb" and have a default size, but respect any configured size. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2770>
* tests/wayland-test-client-utils: Add helper to wait for eventJonas Ådahl2022-12-172-0/+27
| | | | | | Useful for synchronization. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2770>
* wayland/xdg-foreign: Add support for xdg-foreign-v2Jason Francis2022-12-179-67/+496
| | | | | | | | | This replaces the v1 implementation, which is now renamed to legacy-xdg-foreign. Both implementations use the same data structures internally, so that protocol version mismatches between the importer client and exporter client don't fail. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2770>
* build: Update sysprof build optionsChristian Hergert2022-12-172-6/+6
| | | | | | | | | | Sysprof's build options have changed recently. This both bumps the sysprof version and updates the configuration options for the subproject. If now is not a good time to bump this, that is totally fine, but I wanted to give you a MR with the necessary changes all in one. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2428>
* core/selection: Set display on creationRobert Mader2022-12-171-2/+7
| | | | | | | | Otherwise the getter always returns `NULL`. Fixes dd2beae6a86eedbfbd7aaceb638cc505da8338cf Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2768>
* Remove meta_get_display()Jonas Ådahl2022-12-172-31/+1
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* later: Remove old APIJonas Ådahl2022-12-172-64/+0
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* compositor: Enable introspectionJonas Ådahl2022-12-173-7/+12
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* laters: Turn into GObjectJonas Ådahl2022-12-173-15/+39
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* compositor: Don't make internal API publicJonas Ådahl2022-12-178-99/+82
| | | | | | | | | | | | | | | Things like meta_compositor_destroy() and meta_compositor_add_window() isn't intended to be used externally, and if they was, things would probably fall apart rather quickly. MetaCompositor also isn't introspected, meaning things that technically belong to the compositing parts isn't easily available via some object, but much take detours via other objects like MetaDisplay. So move the API intended for internal usage to compositor-private.h, and leave API that is meant to be expose in the public compositor.h. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* Deprecate meta_get_feedback_group_for_display()Jonas Ådahl2022-12-171-0/+1
| | | | | | Callers should replace with meta_compositor_get_feedback_group(). Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* Remove meta_get_backend()Jonas Ådahl2022-12-172-21/+0
| | | | | | It should be retrieved from the context via an ownership chain. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* meta: Remove meta_monitor_manager_get()Jonas Ådahl2022-12-172-18/+0
| | | | | | It has no more users and shouldn't be used. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* wayland: Remove meta_wayland_compositor_get_default()Jonas Ådahl2022-12-172-18/+0
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* Always queue MetaLater via compositor instanceJonas Ådahl2022-12-176-40/+72
| | | | | | | | | | | | | | | The "later" API is used to queue actions in relation to compositing, thus is owned by the MetaCompositor instance. Make users of this functionality get MetaLaters instance from the compositor, and stop using the global meta_later() API. display: Use non-singleton MetaLater API tests: Use non-singleton MetaLater API meta/common: Make docs refer to context aware MetaLater API Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* display: Destroy unmanaged compositor a bit laterJonas Ådahl2022-12-171-2/+2
| | | | | | | This allows for things that want to get some state or manager objects (MetaLaters to be specific) a bit later in the tear down procedures. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* tests: Make tests components have ownership chains as wellJonas Ådahl2022-12-1723-115/+168
| | | | | | | | | | | | | | | | | | | | | | | | This means we can eliminate the use of scattered singletons that isn't added by the tests or the test framework itself. tests: Don't get backend from old singleton getter Either use the ownership chain, or the explicit test context instance pointer. tests/wayland: Pass context to test client constructor So that we can get the Wayland compositor directly from the context. tests: Don't get display from singleton tests/client: Make test client carry a context pointer tests/runner: Have test cases carry a context pointer tests/wayland/test-driver: Get backend from context Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* x11/session: Make state tracking context awareJonas Ådahl2022-12-171-26/+72
| | | | | | | | Instead of passing around state using GINT_TO_POINTER() pass around a state struct that also carries a pointer to the context. This allows avoiding using old singletons for getting a window list. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* x11: Setup and user ownership chainsJonas Ådahl2022-12-174-30/+47
| | | | | | | | | | | On the path towards clear ownership chains and always using them to find other components, do the same for X11 client support paths too. x11-display: Don't get backend from signleton x11/selection: Don't get display from singleton Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* startup-notification/x11: Let the libsn user handle API annoyancesJonas Ådahl2022-12-173-30/+44
| | | | | | | | The API has no concept of user data, and requires the user to some how get an instance without context, i.e. via static globals. Limit this to the file where this is needed. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* compositor: Setup and use ownership chainsJonas Ådahl2022-12-1716-59/+196
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As with the backend commit, this means all objects can reach the MetaContext by walking up the chain, thus can e.g. get the backend from the context, instead of the global singleton. This also is a squashed commit containing: compositor: Get backend via the context The MetaCompositor instance is owned by MetaDisplay, which is owned by MetaContext. Get the backend via that chain of ownership. dnd: Don't get backend from singleton window-actor: Don't get backend from singleton dnd: Don't get Wayland compositor via singleton background: Don't get the monitor manager from the singleton plugins: Don't get backend from singleton This applies to MetaPlugin, it's manager class, and the default plugin. feedback-actor: Pass a compositor pointer when constructing This allows getting to the display. later: Keep a pointer to the manager object This allows using the non-singleton API in idle callbacks. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* compositor: Add API to get feedback groupJonas Ådahl2022-12-172-5/+21
| | | | | | It already had, except it was accessed via the MetaDisplay. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* wayland: Setup and use ownership chainsJonas Ådahl2022-12-1744-202/+635
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As elsewhere, make sure objects that need to have a ownership up to the context, and use this ownership chain to find relevant components, such as the backend or the Wayland compositor object instance. wayland/data-device: Hook up data devices to seats They are tied to a seat - make that connection in struct fields too, so that related objects can get to the context via it. wayland: Don't get Wayland compositor via singleton getter This means via the ownership chain or equivalent. xwayland: Hook up manager to Wayland compositor Same applies to the drag-n-drop struct. xwayland: Make X11 event handling compositor instance aware This avoids finding it via singletons in the callee. xwayland: Don't get Wayland compositor from singleton xwayland: Pass manager when handling dnd event window/xwayland: Don't get Wayland compositor from singleton xwayland/grab-keyboard: Don't get backend from singleton xwayland: Don't get backend from singleton wayland: Always get the backend from the context This means traveling up the ownership chain or equivalent when necessary. wayland: Hook up data devices, offers and sources to the compositor This allows tying them to a context without going through any singletons. wayland: Don't get display from singleton xwayland: Don't get display from singleton tablet: Don't get display from singleton Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* core: Setup and use ownership chainsJonas Ådahl2022-12-1718-97/+243
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As with other parts, make objects have the ability to walk up the ownership chain to the context, to get things like the Wayland compositor or backend instances. Contains these squashed commits: display: Don't get backend from singleton window: Don't get backend from singleton keybindings: Don't get backend from singleton workspace: Don't get backend from singleton display: Don't get Wayland compositor from singleton selection: Add display getter context/main: Get backend directly from the context clipboard-manager: Don't get display from singleton stack-tracker: Don't use singleton MetaLater API startup-notification: Hook up sequences and activations to display This allows using context aware API directly. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* xwayland: Make XSetIOErrorExitHandler() mandatoryJonas Ådahl2022-12-173-33/+15
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* backend: Get 'is-stage-views-scaled' from backendJonas Ådahl2022-12-1720-42/+80
| | | | | | It did, but used the old backend singleton. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* backend: Set up and use ownership chainsJonas Ådahl2022-12-1754-143/+505
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This means objects have an owner, where the chain eventually always leads to a MetaContext. This also means that all objects can find their way to other object instances via the chain, instead of scattered global singletons. This is a squashed commit originally containing the following: cursor-tracker: Don't get backend from singleton idle-manager: Don't get backend from singleton input-device: Pass pointer to backend during construction The backend is needed during construction to get the wacom database. input-mapper: Pass backend when constructing monitor: Don't get backend from singleton monitor-manager: Get backend directly from monitor manager remote: Get backend from manager class For the remote desktop and screen cast implementations, replace getting the backend from singletons with getting it via the manager classes. launcher: Pass backend during construction device-pool: Pass backend during construction Instead of passing the (maybe null) launcher, pass the backend, and get the launcher from there. That way we always have a way to some known context from the device pool. drm-buffer/gbm: Get backend via device pool cursor-renderer: Get backend directly from renderer input-device: Get backend getter input-settings: Add backend construct property and getter input-settings/x11: Don't get backend from singleton renderer: Get backend from renderer itself seat-impl: Add backend getter seat/native: Get backend from instance struct stage-impl: Get backend from stage impl itself x11/xkb-a11y: Don't get backend from singleton backend/x11/nested: Don't get Wayland compositor from singleton crtc: Add backend property Adding a link to the GPU isn't enough; the virtual CRTCs of virtual monitors doesn't have one. cursor-tracker: Don't get display from singleton remote: Don't get display from singleton seat: Don't get display from singleton backend/x11: Don't get display from singleton Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* Make VT switch API explicitly part of the native backendJonas Ådahl2022-12-173-7/+12
| | | | | | It already was, more or less, but make it a bit more in your face. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* monitor-manager: Make config timeout API non-staticJonas Ådahl2022-12-172-4/+7
| | | | | | | | While already cleaning up API, if this should ever be more non-static than a constant, it's better if its a function on the monitor manager instance than something static. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* clutter/input-device: Remove backend propertyJonas Ådahl2022-12-173-26/+0
| | | | | | | | | It will conflict with a MetaInputDevice property that'll have the same name. Wasn't set by the native backend anyway, so probably harmless. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* input-device: Clean up object property setupJonas Ådahl2022-12-171-2/+6
| | | | | | Use the more common PROP_0 approach and make the strings static. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* backend: Sync cursor visibility after startupJonas Ådahl2022-12-171-11/+11
| | | | | | | When the stage is technically shown depends on when the plugin decides to do so, so don't rely on it happening when everything is setup. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* x11-display: Remove init GDK method from public APiJonas Ådahl2022-12-172-9/+0
| | | | Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
* workspace: Sanity check input to activate*()Jonas Ådahl2022-12-171-0/+3
| | | | | | | The passed argument should be a workspace, and it should not have been removed. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2707>
* workspace: Cleanup workspace switch sound functionJonas Ådahl2022-12-171-18/+25
| | | | | | Expand aggressively abbreviated variable names; some style cleanups. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2707>