Compare commits

..

122 Commits

Author SHA1 Message Date
Carlos Garnacho
d7f799bfaf core: Only trigger MetaWorkspace::window-* on toplevel window types
Popups and other override-redirect windows are irrelevant to all listeners
of MetaWorkspace::window-*. Ignoring those windows will namely result in
less activity on ShellWindowTracker, less ShellApp::windows-changed
signal emissions and less AppMenuButton updates.

Reduces gnome-shell CPU activity while typing on the Epiphany addressbar,
as the pop up animation there results in a number of xdg_popup being
created and destroyed.

https://gitlab.gnome.org/GNOME/mutter/issues/556
2019-07-24 23:40:21 +02:00
Carlos Garnacho
09bab98b1e core: Avoid consecutive workspace changes in window construction
We first set the workspace to the transient-for parent's, and then
try to set on the current workspace. If both happen, we double the
work on adding/removing it from the workspace, and everything that
happens in result.

Should reduce some activity while typing on the Epiphany address
bar, as the animation results in a number of xdg_popup being created
and destroyed to handle the animation.

https://gitlab.gnome.org/GNOME/mutter/issues/556
2019-07-24 21:06:50 +02:00
Carlos Garnacho
aee8bfce3f core: Only notify on MetaWindow::user-time on actual changes
If the timestamp is the same, it doesn't make sense to update and we
don't do so. So it doesn't make sense to notify on the property either.

https://gitlab.gnome.org/GNOME/mutter/issues/556
2019-07-24 13:55:53 +02:00
Florian Müllner
92868182c9 build: Bump API version automatically each development cycle
Since the API version was added, we've bumped it at some point late-ish in
the cycle when enough changes had accumulated (but way after the first ABI
break). Automate that process by computing the API version automatically
from the project version:
With this commit, the new API version will be 5 for the remaining 3.33.x
releases and all 3.34.x stable versions; 3.35.1 will then bump it to 6 and
so forth.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/696
2019-07-23 22:37:54 +02:00
Florian Müllner
08a3cbfc6c clutter: Force an allocation on clone source if necessary
Since commit 0eab73dc, actors are only allocated when they are actually
visible. While this generally works well, it breaks - because of *course*
it does - ClutterClones when the clone source (or any of its ancestors)
is hidden.

Force an allocation in that case to allow the clone's paint to work as
intended.

https://gitlab.gnome.org/GNOME/mutter/issues/683
2019-07-23 01:38:38 +00:00
Iain Lane
59fb26cb00 cogl/tests: Only install run-tests.sh when building installed tests
This is a script for installed tests; leave it out otherwise.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/694
2019-07-22 22:07:39 +01:00
Florian Müllner
87c734cef9 cleanup: Really stop using G_TYPE_INSTANCE_GET_PRIVATE()
Commit 4259cfd4c6 missed some occurences, move those to the generated
get_instance_private() functions as well.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/691
2019-07-22 09:48:29 +00:00
Florian Müllner
c755fb6995 clutter-tests: Fix macro definitions
FOO_OBJECT() macros should cast to the corresponding instance type,
not the class.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/691
2019-07-22 09:48:29 +00:00
Mark Blakeney
e9cc220c8e x11: Remove benign warning for older X clients
The default configuration of libinput-gestures utility invokes wmctrl to
switch between desktops. It uses wmctrl because this works on both Xorg
and Wayland (via XWayland). Unfortunately, this generates the following
warning message every time, in both Xorg and Wayland desktops:

"Received a NET_CURRENT_DESKTOP message from a broken (outdated) client
who sent a 0 timestamp"

The desktop switch still works fine. The tiny code change here removes
this specific warning because, as the prefacing code comment originally
said and still says, older clients can validly pass a 0 time value so
why complain about that?

I also refactored the "if (workspace)" code slightly to avoid the double
test of the workspace value.

This is submitted for MR
https://gitlab.gnome.org/GNOME/mutter/merge_requests/671.
2019-07-22 07:31:41 +00:00
Rafael Fontenelle
92f210039e Update Brazilian Portuguese translation 2019-07-22 04:44:31 +00:00
Asier Sarasua Garmendia
aef393efd0 Update Basque translation 2019-07-21 18:41:30 +00:00
Florian Müllner
6836317e41 Bump version to 3.33.4
Update NEWS.
2019-07-20 14:27:14 +02:00
Jonas Ådahl
61e51cdef6 dma-buf: Mark DMA-BUF textures as paint-only
Reading pixels directly from a texture imported from a DMA-BUF EGLImage
may result compressed textures to be transferred into non-compressed
texture. This may have side effects causing it to be rendered
incorrectly in subsequent paints.

Avoid this by passing the no-get-data flag to the texture creator
function, eventually causing mutter to use an intermediate offscreen
framebuffer when reading pixels from such textures.

https://bugs.freedesktop.org/show_bug.cgi?id=111140
https://gitlab.freedesktop.org/xorg/xserver/issues/545

https://gitlab.gnome.org/GNOME/mutter/merge_requests/687
2019-07-18 14:09:22 +00:00
Jonas Ådahl
7868ab761f cogl/texture: Add EGLImage texture import flags
The flags are 'none', and 'no-get-data' meaning get_data() is not
supported.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/687
2019-07-18 14:09:22 +00:00
Jonas Ådahl
e6c8939c30 cogl/texture: Make is_get_data_supported() a bool on the texture
Comparing the gl target is not enough. More on that later.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/687
2019-07-18 14:09:22 +00:00
Olivier Fourdan
ac5d9ec558 keybindings: Do not grab the locate-pointer key if unnecessary
On X11, mutter needs to keep a grab on the locate-pointer key to be able
to trigger the functionality time the corresponding key combo is
pressed.

However, doing so may have side effects on other X11 clients that would
want to have a grab on the same key.

Make sure we only actually grab the key combo for "locate-pointer" only
when the feature is actually enabled, so that having the locate pointer
feature turned off (the default) would not cause side effects on other
X11 clients that might want to use the same key for their own use.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/647
2019-07-18 13:10:32 +00:00
Olivier Fourdan
9c8ff5dbe8 keybindings: Mark "locate-pointer" key as "no-auto-grab"
Mark the keybinding for locate-pointer as "no-auto-grab" so we don't
automatically redo the grab.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/685
2019-07-18 13:10:32 +00:00
Olivier Fourdan
7738316dff keybindings: Mark the "overlay" key as "no-auto-grab"
Mark the keybinding for overlay as "no-auto-grab" to skip it in
`change_binding_keygrabs()` so we don't automatically redo the grab.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/685
2019-07-18 13:10:32 +00:00
Olivier Fourdan
1c3d8defb5 keybindings: Add "no-auto-grab" type
Some special modifiers (typically "Control_L" used for locate-pointer in
mutter/gnome-shell or "Super_L" for overlay) must be handled separately
from the rest of the key bindings.

Add a new flag `META_KEY_BINDING_NO_AUTO_GRAB` so we can tell when
dealing with that special keybinding which should not be grabbed
automatically like the rest of the keybindings, and skip those when
changing the grabs of all keybindings.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/685
2019-07-18 13:10:32 +00:00
Olivier Fourdan
b2ae03c428 keybindings: Fix indentation
Small cleanup of indentation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/685
2019-07-18 13:10:32 +00:00
Olivier Fourdan
456698c814 keybindings: Remove unneeded forward declaration
The functions `grab_key_bindings()` and `ungrab_key_bindings()` are not
used before their actual definition, there is no need to have a forward
declaration for those.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/685
2019-07-18 13:10:32 +00:00
Florian Müllner
9189b7b512 clutter: Stop using GParameter
The type has been deprecated, so stop using it. The easiest replacement
would be to add our own struct, but considering that separate name/value
arrays are easier to free (g_auto!) and we already do the split in one
place, go that route.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/689
2019-07-18 11:01:09 +02:00
Florian Müllner
4259cfd4c6 cleanup: Don't use G_TYPE_INSTANCE_GET_PRIVATE()
It has been deprecated in favor of the get_instance_private() function
generated by the G_ADD_PRIVATE() macro.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/689
2019-07-18 11:01:09 +02:00
Florian Müllner
4fdefb5b2e cleanup: Don't use g_memmove()
Glib stopped providing any fallback implementations on systems without
memmove() all the way back in 2013. Since then, the symbol is a simple
macro around memmove(); use that function directly now that glib added
a deprecation warning.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/689
2019-07-18 11:01:09 +02:00
Marco Trevisan (Treviño)
5ca0ef078d window-x11: Focus a window in the active workspace as take-focus fallback
Starting with commit 2db94e2e we try to focus a fallback default focus window
if no take-focus window candidate gets the input focus when we request it and
we limit the focus candidates to the current window's workspace.

However, if the window is unmanaging, the workspace might be unset, and we could
end up in deferencing a NULL pointer causing a crash.

So, in case the window's workspace is unset, just use the currently active
workspace for the display.

Closes https://gitlab.gnome.org/GNOME/mutter/issues/687

https://gitlab.gnome.org/GNOME/mutter/merge_requests/688
2019-07-18 10:09:45 +02:00
Daniel van Vugt
a5265365dd background: Reload when GPU memory is invalidated
Fixes corrupt background wallpaper when resuming from suspend on the
Nvidia driver.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1084

https://gitlab.gnome.org/GNOME/mutter/merge_requests/600
2019-07-16 16:24:41 +08:00
Robert Mader
62f576e15b events: Use new API to get MetaWindow from ClutterActor
The new API supports Wayland subsurfaces and is probably better placed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/604
2019-07-13 15:32:19 +02:00
Robert Mader
73bc3c4426 window-actor: Add API to get a MetaWindowActor from a ClutterActor
Make it so it returns the closest ancestry MetaWindowActor if it
is a MetaSurfaceActor.
We need this for Wayland subsurfaces, so we can support actions like
Meta+Drag on them.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/604
2019-07-13 15:32:01 +02:00
Robert Mader
57772e5850 workspace-manager: Fix a documentation warning
Pure comment should not start with two stars. Fixes a GIR creation warning
introduced in 8038eaa99f.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/683
2019-07-12 22:01:27 +02:00
Carlos Garnacho
7c8baf8ed9 compositor: Drop meta_get_overlay_window()
This is no longer necessary outside of mutter, nor used internally.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/680
2019-07-11 10:56:53 +02:00
Carlos Garnacho
0e3c062406 dnd: Use composite_overlay_window directly
Saves us from using MetaCompositor API, at a point where it might not
be initialized yet. Use the same window directly, since we already
have it handy.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/672
2019-07-11 10:56:47 +02:00
Jonas Dreßler
4bc7425332 wayland/pointer: Remove duplicate include
https://gitlab.gnome.org/GNOME/mutter/merge_requests/448
2019-07-10 12:39:06 +00:00
Jonas Dreßler
a2a8f0cdaa wayland/pointer: Set focus to NULL when the cursor is hidden
This is important when using a touchscreen or stylus instead of a mouse
or touchpad. If the cursor only gets hidden and the focus stays the
same, the window will still send hover events to the UI element under
the cursor causing unexpected distractions while interacting with the
touchscreen.

Fix this by emitting a visibility-changed signal from the cursor tracker
which then triggers a focus surface sync and always set the focus
surface to NULL when it's synced while the cursor is hidden.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/448
2019-07-10 12:39:06 +00:00
Jonas Dreßler
faa7b2d4e5 cursor-tracker: Add API to get whether the pointer is visible
Allow checking whether the pointer is visible without accessing the
trackers internal is_showing property. While we don't need this just yet
for reading the visibility inside meta-wayland-pointer, it's useful when
implementing the logic to remove Clutter's focus when the cursor goes
hidden later.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/448
2019-07-10 12:39:06 +00:00
Pekka Paalanen
a95644dbdc renderer/native: Debug for primary copy mode
COPY_MODE_PRIMARY has two paths, automatically chosen. For debugging purposes,
e.g. why is my DisplayLink screen slowing down the whole desktop, it will be
useful to know which copy path is taken. Debug prints are added to both when
the primary GPU copy succeeds the first time and when it fails the first time.

This is not the full truth, because theoretically the success/failure could
change every frame, but we don't want to spam the logs (even in debug mode)
every frame. In practise, it should be rare for the success or failure to ever
change. Hence, saying what happened on the first time is enough. This does
indicate if it ever changes even once, too, so we know if that unexpected thing
happens.

The debug prints are per secondary GPU since there could be several.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
720f363241 renderer/native: Add tracing for 2nd GPU copies
These traces allow seeing how long the copy operations stall in libmutter, and
which copy operations actually get used.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
3794df608c renderer/native: Use primary GPU to copy
When the preferred path META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU cannot
be used, as is the case for e.g. DisplayLink devices which do not actually have
a GPU, try to use the primary GPU for the copying before falling back to
read-pixels which is a CPU copy.

When the primary GPU copy works, it should be a significant performance win
over the CPU copy by avoiding stalling libmutter for the duration.

This also renames META_SHARED_FRAMEBUFFER_COPY_MODE_* because the new names are
more accurate. While the secondary GPU copy is always a GPU copy, the primary
copy might be either a CPU or a GPU copy.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
2c893beff1 renderer/native: Add meta_dumb_buffer_ensure_dmabuf_fd
Follow-up work will use this in an attempt to use the primary GPU to
copy into secondary GPU dumb buffers.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
a3c425ad89 wayland/dma-buf: Use meta_egl_create_dmabuf_image
Use the new helper instead of open-coding practically the same.

No behavioral changes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
1d144486d1 wayland/dma-buf: Fix offset, stride types
These parameters are uint32_t in the Wayland protocol so make them uint32_t
here as well.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
9cd3b07472 egl: Introduce meta_egl_create_dmabuf_image
This bit of code was more or less duplicated in meta-renderer-native-gles3.c
and meta-wayland-dma-buf.c. Start consolidating the two implementations by
moving the *-gles3.c function into meta-egl.c and generalizing it so it could
also accommodate the meta-wayland-dma-buf.c usage.

The workaround in the *-gles3.c implementation is moved to the caller. It is
the caller's responsibility to check for the existence of the appropriate EGL
extensions.

Commit 6f59e4858e worked around the lack of
EGL_EXT_image_dma_buf_import_modifiers with the assumption that if the modifier
is linear, there is no need to pass it into EGL. The problem is that not
passing a modifier explicitly to EGL invokes implementation-defined behaviour,
so we should not have that workaround in meta-egl.c.

This patch intends to be pure refactoring, no behavioral changes. The one
change is the addition of g_assert to catch overwriting arbitrary memory.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
6061abbf90 cogl: Expose cogl_blit_framebuffer
The function will be used in copying from a primary GPU framebuffer to a
secondary GPU framebuffer using the primary GPU specifically when the
secondary GPU is not render-capable.

To allow falling back in case glBlitFramebuffer cannot be used, add boolean
return value, and GError argument for debugging purposes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
55c084e6e1 cogl: Rename feature OFFSCREEN_BLIT to BLIT_FRAMEBUFFER
The feature is not limited to offscreen framebuffer blits anymore since
"cogl: Allow glBlitFramebuffer between onscreen/offscreen".

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
45289b3d65 cogl: Allow glBlitFramebuffer between onscreen/offscreen
Depends on "cogl: Replace ANGLE with GLES3 and NV framebuffer_blit"

Allow blitting between onscreen and offscreen framebuffers by doing the y-flip
as necessary. This was not possible with ANGLE, but now with ANGLE gone,
glBlitFramebuffer supports flipping the copied image.

This will be useful in follow-up work to copy from onscreen primary GPU
framebuffer to an offscreen secondary GPU framebuffer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
6df34eb4b7 cogl: Relax formats on glBlitFramebuffer
Depends on: "cogl: Replace ANGLE with GLES3 and NV framebuffer_blit"

As a possible ANGLE implementation is not longer limiting the pixel format
matching, lift the requirement of having the same pixel format.

We still cannot do a premult <-> non-premult conversion during a blit, so guard
against that.

This will be useful in follow-up work to copy from onscreen primary GPU
framebuffer to an offscreen secondary GPU framebuffer if the formats do not
match exactly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
3e68c9e8fa cogl: Replace ANGLE with GLES3 and NV framebuffer_blit
ANGLE extensions are only provided by Google's Almost Native Graphics Layer
Engine (ANGLE) implementation. Therefore they do not seem too useful for
Mutter.

The reason to drop GL_ANGLE_framebuffer_blit support is that it has more
limitations compared to the glBlitFramebuffer in GL_EXT_framebuffer_blit,
GL_NV_framebuffer_bit, OpenGL 3.0 and OpenGL ES 3.0. Most importantly, the
ANGLE version cannot flip the image while copying, which limits
_cogl_blit_framebuffer to only off-screen <-> off-screen copies. Follow-up work
will need off-screen <-> on-screen copies.

Instead of adding yet more capability flags to Cogl, dropping ANGLE support
seems appropriate.

The NV extension is added to the list of glBlitFramebuffer providers because it
provides the same support as ANGLE and more.

Likewise OpenGL ES 3.0 is added to the list of glBlitFramebuffer providers
because e.g. Mesa GLES implementation usually provides it and that makes it
widely available, again surpassing the ANGLE supported features.

Follow-up patches will lift some of the Cogl assumptions of what
glBlitFramebuffer cannot do.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
fc0ce11fcd cogl: Fix doc for _cogl_blit_framebuffer
Commit 38921701e5 added explicit source and
destination parameters. Fix the documentation to match.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Pekka Paalanen
c08a24bb40 cogl: Remove unused OFFSCREEN_BLIT feature flag
This named constant is never used anywhere.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
Carlos Garnacho
78560b8426 core: Use source device on ::accelerator-activated
Using the master device, as we did, won't yield the expected result when
looking up the device node (it comes NULL as this is a virtual device).
Use the slave device, as the g-s-d machinery essentially expects.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/678
2019-07-08 16:30:16 +02:00
Carlos Garnacho
0eab73dc2e clutter: Defer actor allocations till shown
Currently nothing in the clutter machinery prevents hidden portions
of the actor tree from calling queue_relayout() (and having it fully
honored).

But that allocation should not be necessary till the actor is shown,
and one of the things we do on show() is queueing a relayout/redraw
after flagging the actor as visible.

We can simply defer clutter_actor_allocate() calls till that show()
call, and leave the needs_allocate and other flags set so we ensure
the allocation is properly set then.

This should cut down some needless operations when invisible portions
of the actor tree change indirectly due to user interaction, or due
to background activity.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/677
2019-07-08 13:21:40 +00:00
Carlos Garnacho
dd8c8e82f2 core: Emit ::accelerator-activated with a ClutterInputDevice argument
The device ID is kind of pointless on Wayland, so it might be better to
stick to something that works for both backends. Passing the device here
allows the higher layers to pick.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/676
2019-07-08 10:31:11 +00:00
Marco Trevisan (Treviño)
62f4e0501f stack: Style and introspection doc fixes
https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:46:52 +02:00
Marco Trevisan (Treviño)
6d8293a422 window-x11: Use any focusable window as fallback delayed focus window
As per commit f71151a5 we focus an input window if no take-focus-window accepts
it. This might lead to an infinite loop if there are various focusable but
non-input windows in the stack.

When the current focus window is unmanaging and we're trying to focus a
WM_TAKE_FOCUS window, we intent to give the focus to the first focusable input
window in the stack.

However, if an application (such as the Java ones) only uses non-input
WM_TAKE_FOCUS windows, are not requesting these ones to get the focus. This
might lead to a state where no window is focused, or a wrong one is.

So, instead of only focus the first eventually input window available, try to
request to all the take-focus windows that are in the stack between the
destroyed one and the first input one to acquire the input focus.
Use a queue to keep track of those windows, that is passed around stealing
ownership, while we protect for unmanaged queued windows.

Also, reduce the default timeout value, as the previous one might lead to an
excessive long wait.

Added metatests verifying these situations.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/660
https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:46:52 +02:00
Marco Trevisan (Treviño)
b80250e483 tests: Add "accept_take_focus" command
When used it setups an X11 event monitor that replies to WM_TAKE_FOCUS
ClientMessage's with a XSetInputFocus request.

It can only be used by x11 clients on windows that have WM_TAKE_FOCUS atom set
and that does not accept input.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:21:17 +02:00
Marco Trevisan (Treviño)
bd0f1bd338 test-client: Add x11 events GSource handler
When using gtk under X11 some WM related events are always filtered and not
delivered when using the gdk Window filters.

So, add a new one with higher priority than the GTK events one so that we can
pick those events before than Gtk itself.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:21:17 +02:00
Marco Trevisan (Treviño)
2439255f32 stack: Add a function to get a sorted list of focus candidates
Use a static function if a window can be the default focus window, and use such
function to return a filtered list of the stack.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:21:17 +02:00
Marco Trevisan (Treviño)
c327b2df95 window-x11: Accept any focusable window as fallback focus
As per commit f71151a5 we were ignoring WM_TAKE_FOCUS-only windows as focus
targets, however this might end-up in an infinite loop if there are multiple
non-input windows stacked.

So, accept any focusable window as fallback focus target even if it's a
take-focus one (that might not reply to the request).

Added a stacking test to verify this.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/660
https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:21:17 +02:00
Marco Trevisan (Treviño)
9aee47daa9 window-x11: Don't double-check for unmanaging windows
When looking for the best fallback focus window, we ignore it if it is in the
unmanaging state, but meta_stack_get_default_focus_window() does this is check
for us already.

So, ignore the redundant test.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:21:17 +02:00
Marco Trevisan (Treviño)
ecf7e53206 metatest: Dispatch the destruction instead of sleeping after it
https://gitlab.gnome.org/GNOME/mutter/merge_requests/669/
2019-07-08 11:21:17 +02:00
Adam Bieńkowski
8038eaa99f workspace-manager: Add API to reorder workspaces
https://gitlab.gnome.org/GNOME/mutter/merge_requests/670
2019-07-08 08:25:54 +00:00
Kukuh Syafaat
9bcb50fa09 Update Indonesian translation 2019-07-08 08:13:00 +00:00
Emmanuele Bassi
c17af6c794 Add fallback for semi-private symbols in Pango
Pango dropped the PANGO_ENABLE_BACKEND and PANGO_ENABLE_ENGINE symbols,
so we need to add our own defines to avoid breaking the build.

https://gitlab.gnome.org/GNOME/mutter/issues/667
2019-07-07 10:37:51 +01:00
Georges Basile Stavracas Neto
4a184d74d5 monitor-manager: Don't notify unchanged power save mode
Since 4cae9b5b11, and indirectly before that as well, the
MetaMonitorManager::power-save-mode-changed is emitted even
when the power save mode didn't actually change.

On Wayland, this causes a mode set and therefore a stuttering.
It became more proeminent with the transactional KMS code.

Only emit 'power-save-mode-changed' when the power save mode
actually changed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/674
2019-07-06 20:23:57 -03:00
Carlos Garnacho
1f133b3ed2 compositor: Add MetaDnD private function to initialize XDND
We need to set XdndAware and XdndProxy on the stage window if running
a X11 compositor, this is not necessary on wayland.

Takes over gnome-shell code doing this initialization.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/667
2019-07-04 12:24:57 +00:00
Marco Trevisan (Treviño)
84616bef27 window: Allow grab if the display focus is unset
As per commit 040de396b, we don't try to grab when shortcuts are inhibited,

However, this uses the focus window assuming that it is always set, while this
might not be the case in some scenarios (like when unsetting the focus before
requesting take-focus-window to acquire the input).

So allow the button grab even if the focus window is not set for the display

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/663
https://gitlab.gnome.org/GNOME/mutter/merge_requests/668
2019-07-03 18:13:25 +02:00
Olivier Fourdan
040de396b2 window: Don't use button grab modifiers with inhibit shortcuts
On Wayland, if a client issues a inhibit-shortcut request, the Wayland
compositor will disable its own shortcuts.

We should also disable the default handler for the button grab modifier
so that button events with the window grab modifiers pressed are not
caught by the compositor but are forwarded to the client surface.

That also fixes the same issue with Xwayland applications issuing grabs,
as those end up being emulated like shortcut inhibition.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/642
2019-07-03 10:36:34 +02:00
Florian Müllner
5a4bc15d0b workspace-manager: Expose layout properties
gnome-shell hardcodes a vertical one-column workspace layout, and
while not supporting arbitrary grids is very much by design, it
currently doesn't have a choice: We simply don't expose the workspace
layout we use.

Change that to allow gnome-shell to be a bit more flexible with the
workspace layouts it supports.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/618
2019-07-02 20:31:57 +02:00
Daniel van Vugt
01e20a6ba9 compositor: Don't emit size-changed when only position changes
Waking up gnome-shell and triggering JavaScript listeners of
`size-changed` every time a window was only moved was wasting a lot
of CPU.

This cuts the CPU requirement for dragging windows by around 22%.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/568
2019-07-02 15:19:03 +08:00
Georges Basile Stavracas Neto
b0b1ff36ae clutter/main: Simplify thead lock handling
Now that there are only the default thread functions in
place, we don't need to store them.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:35 -03:00
Georges Basile Stavracas Neto
5ed9abd51a clutter/main: Remove the rest of deprecated functions
https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:33 -03:00
Georges Basile Stavracas Neto
65c5260312 clutter/main: Remove deprecated input device functions
https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:30 -03:00
Georges Basile Stavracas Neto
7d9674149f clutter/main: Remove various deprecated thread functions
https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:28 -03:00
Georges Basile Stavracas Neto
25376b3b3c clutter/main: Remove clutter_get_show_fps
https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:25 -03:00
Georges Basile Stavracas Neto
b86a67c80a clutter/main: Remove clutter_redraw
https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:22 -03:00
Georges Basile Stavracas Neto
7419ab7de5 clutter/main: Remove ClutterFontFlags and family
More unused code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:19 -03:00
Georges Basile Stavracas Neto
6b853ffdbd clutter/main: Remove clutter_clear_glyph_cache
Deprecated and unused.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:16 -03:00
Georges Basile Stavracas Neto
ad220fc025 clutter/main: Remote global motion event handling
Clutter has two motion event toggles: one in the global context, and
one per stage. The global one is deprecated, and currently unused.

Remove the global motion event handling.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:13 -03:00
Georges Basile Stavracas Neto
5bd85ef7e5 clutter/main: Remove shader stack
It is private to Clutter, and also unused by Clutter.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:09 -03:00
Fabio Tomat
73f83f1ab6 Update Friulian translation 2019-07-01 19:07:08 +00:00
Jonas Ådahl
5cb6286436 kms-impl-device: Fail up front if we can't retrieve DRM resources
If we can't retrieve the drm resources, instead of segfaulting later on,
treat it as an error, and let the error handler up the stack handle it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/665
2019-07-01 11:56:08 +02:00
Jonas Ådahl
1c25b75571 kms-impl-device: Fail if we can't enable universal planes
We currently don't handle the lack of DRM_CLIENT_CAP_UNIVERSAL_PLANES
KMS capability. Fail constructing a device that can't handle this up
front, so later made assumptions, such as presence of a primary plane,
are actually valid.

If we want to support lack of said capability, the required planes need
to be emulated by a dummy MetaKmsPlane object.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/665
2019-07-01 11:55:47 +02:00
Jonas Ådahl
f2f4af0d50 window-actor: Make it clearer that the surface actor doesn't change
The way code was structured made it easy to misunderstand things as the
surface actor of a window actor could change over time. So is not the
case, however, the intention of the corresponding "update" function was
so that a surface actor could be assigned to a window actor as soon as
the X11 window was associated with its corresponding wl_surface, if the
window in question came from Xwayland.

Restructure the code and internal API a bit to make it clear that a
window actor only once gets a surface actor assigned to it, and that it
after that point never changes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/659
2019-06-28 21:08:23 +02:00
Jonas Ådahl
a8f8bc563e window-actor: Always chain up to parent's dispose vfunc
Our early out shouldn't mean we early out from the parents dispose
function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/659
2019-06-28 21:07:33 +02:00
Jonas Ådahl
46248748a9 window-actor/wayland: Don't set set_surface_actor vfunc
It's implemented by the parent class anyway, so we don't need our empty
call-parent implementation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/659
2019-06-28 21:07:33 +02:00
Jonas Ådahl
da7372a2fa window-actor/x11: Fix include macros
Was missing "config.h" and associated header was not on top.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/659
2019-06-28 21:07:33 +02:00
Marco Trevisan (Treviño)
de97b54595 surface-actor-x11: Bind the surface actor resources to window actor life
X11 actors need to release the server data (pixmap and damage) before the
display is closed.
During the close phase all the windows are unmanaged and this causes the window
actors to be removed from the compositor, unsetting their actor surface.

However, in case a window is animating the surface might not be destroyed until
the animation is completed and a reference to it kept around by gjs in the shell
case. By the way, per commit 7718e67f all window actors (even the animating
ones) are destroyed before the display is closed, but this is not true for the
child surface, because the parent window will just unref it, leaving it around
if reffed somewhere else. This is fine for wayland surfaces, but not for X11
ones which are bound to server-side pixmaps.

So, connect to the parent MetaWindowActor "destroy" signal, releasing the x11
resources that implies detaching the pixmap (unsetting the texture) and removing
the damages.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/629
https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:47 +02:00
Marco Trevisan (Treviño)
d7d97f2477 surface-actor-x11: Assign X11 Display only if we have resources
free_damage and detach_pixmap functions are called inside dispose and an object
can be disposed multiple times, even when the display is already closed.

So, don't try to deference a possibly null-pointer, assigning the xdisplay too
early, as if the X11 related resources have been unset, the server might not be
open anymore. In fact, we assume that if we have a damage or a pixmap set,
the display is still open.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:47 +02:00
Marco Trevisan (Treviño)
7776941b89 window-actor: Set actor as compositor private in window before the surface
In MetaWindowActor creation we're setting the compositor private (i.e. the
window actor itself) of a window before creating the surface actor, and so
passing to the it a window without its compositor side set.

Since the surface actor might use the parent actor, set this before updating
the surface.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:46 +02:00
Marco Trevisan (Treviño)
4061c8384b window-actor: Use vfunc to set the surface actor
As per commit 80e3c1d set_surface_actor has been added, meant to do different
things depending on the backend, like connecting to signals under X11.

However, the vfunc isn't ever used, making the X11 surfaces not to react to
repaint-scheduled signal.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:46 +02:00
Marco Trevisan (Treviño)
b850f5a732 compositor: Use direct access to disconnect top window actor signal
Everytime the top window changes we connect/disconnect to the actor's destroy
signal, although as explained in commit ba8f5a11 this might be slower in case
the window actor has many other signal connections.

So, just track this using an ID.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:46 +02:00
Marco Trevisan (Treviño)
7645c51c54 compositor: Only disconnect/connect top-window signals if it changed
If the stack changed but the top window didn't, there's no need to disconnect
the signal and connect it again.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:45 +02:00
Marco Trevisan (Treviño)
f1837b785b compositor: Replace tabs with spaces
Some old code was still using tabs instead of spaces, so replace the leftover
tabs with 8 spaces each.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:45 +02:00
Piotr Drąg
22978b9d07 Update POTFILES.in 2019-06-28 19:10:39 +02:00
Georges Basile Stavracas Neto
1206879a20 kms-plane: Include <drm_fourcc.h>
Instead of including <drm/drm_fourcc.h>. This is the
only file that includes the drm_fourcc.h header like
this, and it happened to break the build locally.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/663
2019-06-28 13:25:15 -03:00
Jonas Ådahl
dc5925b7d1 kms-plane: Restore adding format fallbacks
There were fallbacks in place in case IN_FORMATS didn't yield any usable
formats: the formats in the drmModePlane struct, and a hard coded array.
The lack of these fallbacks in place could result in a segfault as code
using the supported plane formats assumed there were at least something
in there.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/662
2019-06-28 14:21:11 +00:00
Olivier Fourdan
b138006bb7 wayland/xdg-output: Add xdg-output v2 support
xdg-output v2 adds the output name and description events, add siupports
for these in mutter.

https://gitlab.gnome.org/GNOME/mutter/issues/645
2019-06-28 11:19:22 +02:00
Olivier Fourdan
bca08c2c4e monitor-manager: Use meta_monitor_get_display_name() API
Use the new monitor's `meta_monitor_get_display_name()` instead of
rebuilding the display name for each DBUS request.

https://gitlab.gnome.org/GNOME/mutter/issues/645
2019-06-28 11:19:22 +02:00
Olivier Fourdan
6541d49fe7 monitor: Add display name
The display name is being used by the monitor manager to expose to name
to the DBUS API.

It is being rebuilt each time, so instead build the displa yname once
for the monitor and keep it around, with an API to retrieve it, so that
we can reuse it in preparation of xdg-output v2 support.

https://gitlab.gnome.org/GNOME/mutter/issues/645
2019-06-28 11:19:22 +02:00
Olivier Fourdan
c3c6668343 monitor-manager: Add get_vendor_name API
The monitor manager keeps the list of PnP Ids, add a new API to get the
vendor name from a given PnP ID.

https://gitlab.gnome.org/GNOME/mutter/issues/645
2019-06-28 11:19:22 +02:00
Jonas Ådahl
70de90ebce renderer/native: Discard page flip retries when rebuilding views
Rebuilding views means we don't care to retry page flip attempts for
previous views, especially since connectors may have been disconnected,
making a page flip retry hit an assert a flipped CRTC has connectors
associated with it.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/619

https://gitlab.gnome.org/GNOME/mutter/merge_requests/630
2019-06-27 19:08:01 +02:00
Jonas Ådahl
0756fd4636 renderer/native: Queue mode reset from new rebuild_views vfunc
Simplify the call site a bit and make the native renderer know it should
queue mode reset itself when views have been rebuilt. This is done
partly due to more things needing to be dealt with after views have been
rebuilt.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/630
2019-06-27 19:08:01 +02:00
Jonas Ådahl
8c339dac3e renderer/native: Remove left-over function declarations
There are no callers and no definitions of these.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/630
2019-06-27 19:07:57 +02:00
Florian Müllner
06a7c22bcd ci: Test building without native backend support
Nobody from the core team tests that configuration, so some non-guarded
includes regularly sneak in. Avoid those build breakages by adding a
corresponding job to the CI pipeline.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/637
2019-06-27 15:50:11 +00:00
Florian Müllner
ca88826ce9 remote-desktop-session: Remove unnecessary include
The class doesn't actually use the native backend, so remove it
to avoid build errors when the backend is disabled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/637
2019-06-27 15:50:11 +00:00
Jonas Ådahl
7229a07b6c window-actor: Remove left-over parent field
The commit

commit 60f7ff3a69
Author: Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
Date:   Fri Dec 21 18:12:49 2018 -0200

    window-actor: Turn into a derivable class

made the previous instance struct a instance private struct, but didn't
remove the parent field. Since it's unused, there is no point in keeping
it around, so lets drop it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/658
2019-06-27 15:07:47 +02:00
Olivier Fourdan
85f4772a4f backend/native: Fix compiler warning w/out EGL device
When building without EGL device support, the following compiler warning
is seen:

```
  src/backends/native/meta-renderer-native.c:2637:20: warning: unused
  variable ‘cogl_renderer_egl’ [-Wunused-variable]
```

Fix the warning by placing the relevant variable declarations within the
`#ifdef HAVE_EGL_DEVICE/#endif` statement.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/656
2019-06-27 10:21:26 +02:00
Robert Mader
f2fb3945d1 wayland/surface: Post error on invalid scale
To follow the spec and make faulty clients fail hard.

https://gitlab.freedesktop.org/wayland/wayland/blob/master/protocol/wayland.xml#L1618

https://gitlab.gnome.org/GNOME/mutter/merge_requests/647
2019-06-26 21:02:46 +02:00
Daniel van Vugt
d7d75dd8e7 cogl-trace: Include cogl-trace.h even when not tracing
Public functions in C should be declared before they are defined, and
often compilers warn you if you haven't:

```
../cogl/cogl/cogl-trace.c:237:1: warning: no previous prototype for
‘cogl_set_tracing_enabled_on_thread_with_fd’ [-Wmissing-prototypes]
 cogl_set_tracing_enabled_on_thread_with_fd (void       *data,
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../cogl/cogl/cogl-trace.c:245:1: warning: no previous prototype for
‘cogl_set_tracing_enabled_on_thread’ [-Wmissing-prototypes]
 cogl_set_tracing_enabled_on_thread (void       *data,
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../cogl/cogl/cogl-trace.c:253:1: warning: no previous prototype for
‘cogl_set_tracing_disabled_on_thread’ [-Wmissing-prototypes]
 cogl_set_tracing_disabled_on_thread (void *data)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

In this case the function declarations were not included because
`HAVE_TRACING` isn't defined. But we should still include `cogl-trace.h`
because it handles the case of `HAVE_TRACING` not being defined and
correctly still declares the functions defined in `cogl-trace.c`.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/650
2019-06-26 16:36:05 +00:00
Jonas Ådahl
54fe0d311d ci/Dockerfile: Add mesa crash fix
This applies 'egl/x11: calloc dri2_surf so it's properly zeroed' to
mesa-19.0.7, as it fixes a crash introduced by 'egl/dri: flesh out and
use dri2_create_drawable()' included in 19.0.6.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/648
2019-06-26 18:26:52 +02:00
Jonas Ådahl
fefac75e96 ci/Dockerfile: Add commands for regenerating
Instead of either figuring out themself, or looking at the commit that
added the file, just make life easier by providing the commands for
rebuilding and pushing as a comment in the Dockerfile itself.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/648
2019-06-26 18:26:50 +02:00
Florian Müllner
5e46940332 ci: Drop old gsettings-desktop-schemas package versions
Since we switched to F30, the base system provides newer versions than
the ones specified (although since 3.33.3 not new enough).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/648
2019-06-25 17:43:34 +02:00
Florian Müllner
1767672375 Bump version to 3.33.3
Update NEWS.
2019-06-24 19:37:43 +02:00
Florian Müllner
6fc4cd3c0c build: Bump gsettings-desktop-schemas requirement 2019-06-24 19:33:30 +02:00
Florian Müllner
feb9d129db window-x11: Fix typo 2019-06-24 19:33:30 +02:00
Carlos Garnacho
2b519cba36 backends: Move numlock persistence handling here
We used to have wayland-specific paths for this in src/wayland, now we
have ClutterKeymap that we can rely on in order to do state tracking,
and can do this all on src/backend domain.

This accomodates the feature in common code, so will work on both
Wayland and X11.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/590
2019-06-24 18:24:57 +02:00
Carlos Garnacho
832fc798d5 backends: Add missing code to restore NumLock state on X11
It's not be called to any practical effect yet in this backend, but will
do soon.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/590
2019-06-24 17:12:14 +02:00
Florian Müllner
bd0743a421 ci: Install sysprof dependency from copr
The currently used package links are outdated. Instead of updating them
to the current release number, rely on copr repos having a higher priority
than system repos and simply specify the package name.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/644
2019-06-24 14:35:46 +00:00
Jonas Ådahl
20731887f2 monitor-manager/dummy: Fix name of mode debug env var
It provides ways to configure the modes, not the actual monitors.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/529
2019-06-24 13:49:52 +00:00
Jonas Ådahl
980d9b1042 monitor-manager/dummy: Make modes env var override the defaults
So that one can effectively change the default resolution.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/529
2019-06-24 13:49:52 +00:00
Corentin Noël
bd7704f9e1 meta: Make MetaBackgroundGroup derivable
https://gitlab.gnome.org/GNOME/mutter/merge_requests/640
2019-06-24 13:49:31 +00:00
Jonas Ådahl
68f18f1fe9 monitor-manager/kms: Use KMS abstraction to get and set CRTC gamma
Still doesn't synchronize with frame drawing, but no point in doing that
until gamma is managed by mutter itself and not gnome-settings-daemon.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/634
2019-06-24 13:36:10 +00:00
Jonas Ådahl
c655166398 kms-impl/simple: Removing extra semi colon
https://gitlab.gnome.org/GNOME/mutter/merge_requests/634
2019-06-24 13:36:10 +00:00
166 changed files with 3398 additions and 5460 deletions

View File

@@ -28,6 +28,20 @@ build-mutter:
- merge_requests - merge_requests
- /^.*$/ - /^.*$/
build-without-native-backend:
stage: build
script:
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false --werror --prefix /usr
- ninja -C build
- ninja -C build install
artifacts:
expire_in: 1 day
paths:
- build
only:
- merge_requests
- /^.*$/
test-mutter: test-mutter:
stage: test stage: test
dependencies: dependencies:

View File

@@ -1,21 +1,31 @@
# Rebuild and push with
#
# cd .gitlab-ci/
# docker build -t registry.gitlab.gnome.org/gnome/mutter/master:v2 .
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v2
#
FROM fedora:30 FROM fedora:30
RUN dnf -y update && dnf -y upgrade && \ RUN dnf -y update && dnf -y upgrade && \
dnf install -y 'dnf-command(builddep)' && \ dnf install -y 'dnf-command(builddep)' && \
dnf install -y 'dnf-command(copr)' && \ dnf install -y 'dnf-command(copr)' && \
dnf copr enable -y fmuellner/gnome-shell-ci && \ dnf copr enable -y fmuellner/gnome-shell-ci && \
dnf copr enable -y jadahl/mutter-ci && \
dnf copr enable -y hergertme/sysprof-3 && \
dnf builddep -y mutter && \ dnf builddep -y mutter && \
# Until Fedora catches up with meson build-deps # Until Fedora catches up with meson build-deps
dnf install -y meson xorg-x11-server-Xorg gnome-settings-daemon-devel egl-wayland-devel xorg-x11-server-Xwayland && \ dnf install -y meson xorg-x11-server-Xorg gnome-settings-daemon-devel egl-wayland-devel xorg-x11-server-Xwayland && \
# Until Fedora catches up with mesa bug fixes
dnf upgrade -y mesa-dri-drivers mesa-libEGL && \
# For running unit tests # For running unit tests
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs && \ dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs && \
# Unpackaged versions dnf install -y sysprof-devel && \
dnf install -y https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00834984-gsettings-desktop-schemas/gsettings-desktop-schemas-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00834984-gsettings-desktop-schemas/gsettings-desktop-schemas-devel-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm && \
dnf install -y https://copr-be.cloud.fedoraproject.org/results/hergertme/sysprof-3/fedora-30-x86_64/00917385-sysprof/libsysprof-ui-3.33.2-1.fc30.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/hergertme/sysprof-3/fedora-30-x86_64/00917385-sysprof/sysprof-cli-3.33.2-1.fc30.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/hergertme/sysprof-3/fedora-30-x86_64/00917385-sysprof/sysprof-3.33.2-1.fc30.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/hergertme/sysprof-3/fedora-30-x86_64/00917385-sysprof/sysprof-devel-3.33.2-1.fc30.x86_64.rpm && \
dnf install -y intltool redhat-rpm-config make && \ dnf install -y intltool redhat-rpm-config make && \

66
NEWS
View File

@@ -1,3 +1,69 @@
3.33.4
======
* Discard page flip retries on hotplug [Jonas; !630]
* Add xdg-output v2 support [Olivier; #645]
* Restore DRM format fallbacks [Jonas; !662]
* Don't emit ::size-changed when only position changed [Daniel; !568]
* Expose workspace layout properties [Florian; !618]
* Don't use grab modifiers when shortcuts are inhibited [Olivier; #642]
* Fix stuttering due to unchanged power save mode notifications [Georges; !674]
* Add API to reorder workspaces [Adam; !670]
* Make picking a new focus window more reliable [Marco; !669]
* Defer actor allocation till shown [Carlos; !677]
* Try to use primary GPU for copy instead of glReadPixels [Pekka; !615]
* Unset pointer focus when the cursor is hidden [Jonas D.; !448]
* Fix modifier-drag on wayland subsurfaces [Robert; !604]
* Fix background corruption on Nvidia after resuming from suspend [Daniel; !600]
* Only grab the locate-pointer key when necessary [Olivier; !685, #647]
* Misc. bug fixes and cleanups [Florian, Jonas, Daniel, Robert, Olivier,
Georges, Marco, Carlos, Emmanuele; !648, !650, !647, !656, !658, !637,
!663, !660, !659, !665, !666, !668, !667, #667, !676, !678, #672, !680,
!683, !688, !689, !687]
Contributors:
Jonas Ådahl, Emmanuele Bassi, Adam Bieńkowski, Piotr Drąg, Jonas Dreßler,
Olivier Fourdan, Carlos Garnacho, Robert Mader, Florian Müllner,
Georges Basile Stavracas Neto, Pekka Paalanen, Marco Trevisan (Treviño),
Daniel van Vugt
Translators:
Fabio Tomat [fur], Kukuh Syafaat [id]
3.33.3
======
* Prepare for running Xwayland on demand [Carlos; !420]
* Fix text selection color rendering [Florian; #494]
* Fix black shadows when using fractional scaling [Robert; #609]
* Honor startup sequence workspace on wayland [Carlos; gnome-shell#674]
* Only emit 'grab-op-end` signal after dropping grabs [Marco; !596]
* Add a Sysprof-based profiler [Jonas, Georges; !197, !603]
* Relax "xwayland-allow-grabs" setting [Olivier; #597]
* Implement locate-pointer accessibility feature [Olivier; !453]
* Implement mouse accessibility [Olivier; !512]
* Consolidate frame throttling [Daniel, Georges; !363]
* Fix setting blank cursor under wayland [Jonas; #630]
* Pixel-align OpenGL cursors [Jonas; !610]
* Handle returning from fullscreen/maximization better [Jonas; !621]
* Improve screencast support on multi-monitor systems [Georges; !623]
* Fix running X11 applications with sudo under wayland [Hans; #643]
* Implement toggle-keys notification [Olivier; #637]
* Add initial KMS transactional support [Jonas; !525]
* Improve finding new focus window when the old one is closed [Marco; #308]
* Misc. bug fixes and cleanups [Jonas, Carlos, Marco, Florian, Pekka, Robert,
Douglas, Georges, Daniel, Emil, Niels, Hans, Olivier, Ting-Wei, Corentin;
!591, #398, !592, !581, !597, !598, !593, !497, #591, !545, gtk#1675, !601,
#568, !564, !605, !609, !115, !214, !611, !617, !616, !619, !624, !622, !627,
!628, !629, !632, !633, !631, !636, !639, !638, !634, !640, !529, !644, !590]
Contributors:
Jonas Ådahl, Piotr Drąg, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
Niels De Graef, Ting-Wei Lan, Robert Mader, Florian Müllner,
Georges Basile Stavracas Neto, Corentin Noël, Pekka Paalanen, Douglas R. Reno,
Marco Trevisan (Treviño), Emil Velikov, Daniel van Vugt
Translators:
Balázs Úr [hu], Daniel Mustieles [es], Nathan Follens [nl], Goran Vidović [hr]
3.33.2 3.33.2
====== ======
* Fix rendering lag on Xorg [Daniel; !520, !281] * Fix rendering lag on Xorg [Daniel; !520, !281]

View File

@@ -10107,6 +10107,9 @@ clutter_actor_allocate (ClutterActor *self,
return; return;
} }
if (!clutter_actor_is_visible (self))
return;
priv = self->priv; priv = self->priv;
old_allocation = priv->allocation; old_allocation = priv->allocation;

View File

@@ -252,6 +252,13 @@ clutter_clone_allocate (ClutterActor *self,
if (priv->clone_source == NULL) if (priv->clone_source == NULL)
return; return;
/* ClutterActor delays allocating until the actor is shown; however
* we cannot paint it correctly in that case, so force an allocation.
*/
if (clutter_actor_get_parent (priv->clone_source) != NULL &&
!clutter_actor_has_allocation (priv->clone_source))
clutter_actor_allocate_preferred_size (priv->clone_source, flags);
#if 0 #if 0
/* XXX - this is wrong: ClutterClone cannot clone unparented /* XXX - this is wrong: ClutterClone cannot clone unparented
* actors, as it will break all invariants * actors, as it will break all invariants

View File

@@ -17,7 +17,6 @@
#include "deprecated/clutter-container.h" #include "deprecated/clutter-container.h"
#include "deprecated/clutter-group.h" #include "deprecated/clutter-group.h"
#include "deprecated/clutter-keysyms.h" #include "deprecated/clutter-keysyms.h"
#include "deprecated/clutter-main.h"
#include "deprecated/clutter-rectangle.h" #include "deprecated/clutter-rectangle.h"
#include "deprecated/clutter-stage-manager.h" #include "deprecated/clutter-stage-manager.h"
#include "deprecated/clutter-stage.h" #include "deprecated/clutter-stage.h"

View File

@@ -277,24 +277,6 @@ typedef enum
CLUTTER_ANIMATION_LAST CLUTTER_ANIMATION_LAST
} ClutterAnimationMode; } ClutterAnimationMode;
/**
* ClutterFontFlags:
* @CLUTTER_FONT_MIPMAPPING: Set to use mipmaps for the glyph cache textures.
* @CLUTTER_FONT_HINTING: Set to enable hinting on the glyphs.
*
* Runtime flags to change the font quality. To be used with
* clutter_set_font_flags().
*
* Since: 1.0
*
* Deprecated: 1.22: Use #cairo_font_options_t instead
*/
typedef enum /*< prefix=CLUTTER_FONT >*/
{
CLUTTER_FONT_MIPMAPPING = (1 << 0),
CLUTTER_FONT_HINTING = (1 << 1)
} ClutterFontFlags;
/** /**
* ClutterTextDirection: * ClutterTextDirection:
* @CLUTTER_TEXT_DIRECTION_DEFAULT: Use the default setting, as returned * @CLUTTER_TEXT_DIRECTION_DEFAULT: Use the default setting, as returned

View File

@@ -85,8 +85,6 @@ G_LOCK_DEFINE_STATIC (ClutterCntx);
/* main lock and locking/unlocking functions */ /* main lock and locking/unlocking functions */
static GMutex clutter_threads_mutex; static GMutex clutter_threads_mutex;
static GCallback clutter_threads_lock = NULL;
static GCallback clutter_threads_unlock = NULL;
/* command line options */ /* command line options */
static gboolean clutter_is_initialized = FALSE; static gboolean clutter_is_initialized = FALSE;
@@ -146,38 +144,10 @@ static const GDebugKey clutter_paint_debug_keys[] = {
{ "damage-region", CLUTTER_DEBUG_PAINT_DAMAGE_REGION }, { "damage-region", CLUTTER_DEBUG_PAINT_DAMAGE_REGION },
}; };
static void
clutter_threads_impl_lock (void)
{
g_mutex_lock (&clutter_threads_mutex);
}
static void
clutter_threads_impl_unlock (void)
{
/* we need to trylock here, in case the lock hasn't been acquired; on
* various systems trying to release a mutex that hasn't been acquired
* will cause a run-time error. trylock() will either fail, in which
* case we can release the lock we own; or it will succeeds, in which
* case we need to release the lock we just acquired. so we ignore the
* returned value.
*
* see: https://bugs.gnome.org/679439
*/
g_mutex_trylock (&clutter_threads_mutex);
g_mutex_unlock (&clutter_threads_mutex);
}
static inline void static inline void
clutter_threads_init_default (void) clutter_threads_init_default (void)
{ {
g_mutex_init (&clutter_threads_mutex); g_mutex_init (&clutter_threads_mutex);
if (clutter_threads_lock == NULL)
clutter_threads_lock = clutter_threads_impl_lock;
if (clutter_threads_unlock == NULL)
clutter_threads_unlock = clutter_threads_impl_unlock;
} }
#define ENVIRONMENT_GROUP "Environment" #define ENVIRONMENT_GROUP "Environment"
@@ -383,28 +353,6 @@ clutter_config_read (void)
g_free (config_path); g_free (config_path);
} }
/**
* clutter_get_show_fps:
*
* Returns whether Clutter should print out the frames per second on the
* console. You can enable this setting either using the
* <literal>CLUTTER_SHOW_FPS</literal> environment variable or passing
* the <literal>--clutter-show-fps</literal> command line argument. *
*
* Return value: %TRUE if Clutter should show the FPS.
*
* Since: 0.4
*
* Deprecated: 1.10: This function does not do anything. Use the environment
* variable or the configuration file to determine whether Clutter should
* print out the FPS counter on the console.
*/
gboolean
clutter_get_show_fps (void)
{
return FALSE;
}
gboolean gboolean
_clutter_context_get_show_fps (void) _clutter_context_get_show_fps (void)
{ {
@@ -453,86 +401,6 @@ clutter_disable_accessibility (void)
clutter_enable_accessibility = FALSE; clutter_enable_accessibility = FALSE;
} }
/**
* clutter_redraw:
*
* Forces a redraw of the entire stage. Applications should never use this
* function, but queue a redraw using clutter_actor_queue_redraw().
*
* This function should only be used by libraries integrating Clutter from
* within another toolkit.
*
* Deprecated: 1.10: Use clutter_stage_ensure_redraw() instead.
*/
void
clutter_redraw (ClutterStage *stage)
{
g_return_if_fail (CLUTTER_IS_STAGE (stage));
clutter_stage_ensure_redraw (stage);
}
/**
* clutter_set_motion_events_enabled:
* @enable: %TRUE to enable per-actor motion events
*
* Sets whether per-actor motion events should be enabled or not on
* all #ClutterStage<!-- -->s managed by Clutter.
*
* If @enable is %FALSE the following events will not work:
*
* - ClutterActor::motion-event, except on the #ClutterStage
* - ClutterActor::enter-event
* - ClutterActor::leave-event
*
* Since: 0.6
*
* Deprecated: 1.8: Use clutter_stage_set_motion_events_enabled() instead.
*/
void
clutter_set_motion_events_enabled (gboolean enable)
{
ClutterStageManager *stage_manager;
ClutterMainContext *context;
const GSList *l;
enable = !!enable;
context = _clutter_context_get_default ();
if (context->motion_events_per_actor == enable)
return;
/* store the flag for later query and for newly created stages */
context->motion_events_per_actor = enable;
/* propagate the change to all stages */
stage_manager = clutter_stage_manager_get_default ();
for (l = clutter_stage_manager_peek_stages (stage_manager);
l != NULL;
l = l->next)
{
clutter_stage_set_motion_events_enabled (l->data, enable);
}
}
/**
* clutter_get_motion_events_enabled:
*
* Gets whether the per-actor motion events are enabled.
*
* Return value: %TRUE if the motion events are enabled
*
* Since: 0.6
*
* Deprecated: 1.8: Use clutter_stage_get_motion_events_enabled() instead.
*/
gboolean
clutter_get_motion_events_enabled (void)
{
return _clutter_context_get_motion_events_enabled ();
}
void void
_clutter_id_to_color (guint id_, _clutter_id_to_color (guint id_,
ClutterColor *col) ClutterColor *col)
@@ -784,69 +652,6 @@ clutter_main (void)
clutter_main_loop_level--; clutter_main_loop_level--;
} }
/**
* clutter_threads_init:
*
* Initialises the Clutter threading mechanism, so that Clutter API can be
* called by multiple threads, using clutter_threads_enter() and
* clutter_threads_leave() to mark the critical sections.
*
* You must call g_thread_init() before this function.
*
* This function must be called before clutter_init().
*
* It is safe to call this function multiple times.
*
* Since: 0.4
*
* Deprecated: 1.10: This function does not do anything. Threading support
* is initialized when Clutter is initialized.
*/
void
clutter_threads_init (void)
{
}
/**
* clutter_threads_set_lock_functions: (skip)
* @enter_fn: function called when aquiring the Clutter main lock
* @leave_fn: function called when releasing the Clutter main lock
*
* Allows the application to replace the standard method that
* Clutter uses to protect its data structures. Normally, Clutter
* creates a single #GMutex that is locked by clutter_threads_enter(),
* and released by clutter_threads_leave(); using this function an
* application provides, instead, a function @enter_fn that is
* called by clutter_threads_enter() and a function @leave_fn that is
* called by clutter_threads_leave().
*
* The functions must provide at least same locking functionality
* as the default implementation, but can also do extra application
* specific processing.
*
* As an example, consider an application that has its own recursive
* lock that when held, holds the Clutter lock as well. When Clutter
* unlocks the Clutter lock when entering a recursive main loop, the
* application must temporarily release its lock as well.
*
* Most threaded Clutter apps won't need to use this method.
*
* This method must be called before clutter_init(), and cannot
* be called multiple times.
*
* Since: 0.4
*/
void
clutter_threads_set_lock_functions (GCallback enter_fn,
GCallback leave_fn)
{
g_return_if_fail (clutter_threads_lock == NULL &&
clutter_threads_unlock == NULL);
clutter_threads_lock = enter_fn;
clutter_threads_unlock = leave_fn;
}
gboolean gboolean
_clutter_threads_dispatch (gpointer data) _clutter_threads_dispatch (gpointer data)
{ {
@@ -903,17 +708,11 @@ _clutter_threads_dispatch_free (gpointer data)
* SafeClosure *closure = data; * SafeClosure *closure = data;
* gboolean res = FALSE; * gboolean res = FALSE;
* *
* // mark the critical section //
*
* clutter_threads_enter();
*
* // the callback does not need to acquire the Clutter * // the callback does not need to acquire the Clutter
* / lock itself, as it is held by the this proxy handler * / lock itself, as it is held by the this proxy handler
* // * //
* res = closure->callback (closure->data); * res = closure->callback (closure->data);
* *
* clutter_threads_leave();
*
* return res; * return res;
* } * }
* static gulong * static gulong
@@ -1093,69 +892,23 @@ clutter_threads_add_timeout (guint interval,
void void
_clutter_threads_acquire_lock (void) _clutter_threads_acquire_lock (void)
{ {
if (clutter_threads_lock != NULL) g_mutex_lock (&clutter_threads_mutex);
(* clutter_threads_lock) ();
} }
void void
_clutter_threads_release_lock (void) _clutter_threads_release_lock (void)
{ {
if (clutter_threads_unlock != NULL) /* we need to trylock here, in case the lock hasn't been acquired; on
(* clutter_threads_unlock) (); * various systems trying to release a mutex that hasn't been acquired
} * will cause a run-time error. trylock() will either fail, in which
* case we can release the lock we own; or it will succeeds, in which
/** * case we need to release the lock we just acquired. so we ignore the
* clutter_threads_enter: * returned value.
* *
* Locks the Clutter thread lock. * see: https://bugs.gnome.org/679439
* */
* Since: 0.4 g_mutex_trylock (&clutter_threads_mutex);
* g_mutex_unlock (&clutter_threads_mutex);
* Deprecated: 1.12: This function should not be used by application
* code; marking critical sections is not portable on various
* platforms. Instead of acquiring the Clutter lock, schedule UI
* updates from the main loop using clutter_threads_add_idle() or
* clutter_threads_add_timeout().
*/
void
clutter_threads_enter (void)
{
_clutter_threads_acquire_lock ();
}
/**
* clutter_threads_leave:
*
* Unlocks the Clutter thread lock.
*
* Since: 0.4
*
* Deprecated: 1.12: This function should not be used by application
* code; marking critical sections is not portable on various
* platforms. Instead of acquiring the Clutter lock, schedule UI
* updates from the main loop using clutter_threads_add_idle() or
* clutter_threads_add_timeout().
*/
void
clutter_threads_leave (void)
{
_clutter_threads_release_lock ();
}
/**
* clutter_get_debug_enabled:
*
* Check if Clutter has debugging enabled.
*
* Return value: %FALSE
*
* Deprecated: 1.10: This function does not do anything.
*/
gboolean
clutter_get_debug_enabled (void)
{
return FALSE;
} }
void void
@@ -1205,7 +958,6 @@ clutter_context_get_default_unlocked (void)
ctx->settings = clutter_settings_get_default (); ctx->settings = clutter_settings_get_default ();
_clutter_settings_set_backend (ctx->settings, ctx->backend); _clutter_settings_set_backend (ctx->settings, ctx->backend);
ctx->motion_events_per_actor = TRUE;
ctx->last_repaint_id = 1; ctx->last_repaint_id = 1;
} }
@@ -1226,36 +978,6 @@ _clutter_context_get_default (void)
return retval; return retval;
} }
/**
* clutter_get_timestamp:
*
* Returns the approximate number of microseconds passed since Clutter was
* intialised.
*
* This function shdould not be used by application code.
*
* The output of this function depends on whether Clutter was configured to
* enable its debugging code paths, so it's less useful than intended.
*
* Since Clutter 1.10, this function is an alias to g_get_monotonic_time()
* if Clutter was configured to enable the debugging code paths.
*
* Return value: Number of microseconds since clutter_init() was called, or
* zero if Clutter was not configured with debugging code paths.
*
* Deprecated: 1.10: Use #GTimer or g_get_monotonic_time() for a proper
* timing source
*/
gulong
clutter_get_timestamp (void)
{
#ifdef CLUTTER_ENABLE_DEBUG
return (gulong) g_get_monotonic_time ();
#else
return 0L;
#endif
}
static gboolean static gboolean
clutter_arg_direction_cb (const char *key, clutter_arg_direction_cb (const char *key,
const char *value, const char *value,
@@ -2658,24 +2380,6 @@ clutter_get_default_frame_rate (void)
return context->frame_rate; return context->frame_rate;
} }
/**
* clutter_set_default_frame_rate:
* @frames_per_sec: the new default frame rate
*
* Sets the default frame rate. This frame rate will be used to limit
* the number of frames drawn if Clutter is not able to synchronize
* with the vertical refresh rate of the display. When synchronization
* is possible, this value is ignored.
*
* Since: 0.6
*
* Deprecated: 1.10: This function does not do anything any more.
*/
void
clutter_set_default_frame_rate (guint frames_per_sec)
{
}
static void static void
on_grab_actor_destroy (ClutterActor *actor, on_grab_actor_destroy (ClutterActor *actor,
ClutterInputDevice *device) ClutterInputDevice *device)
@@ -2890,57 +2594,6 @@ clutter_input_device_get_grabbed_actor (ClutterInputDevice *device)
return NULL; return NULL;
} }
/**
* clutter_grab_pointer_for_device:
* @actor: a #ClutterActor
* @id_: a device id, or -1
*
* Grabs all the pointer events coming from the device @id for @actor.
*
* If @id is -1 then this function is equivalent to clutter_grab_pointer().
*
* Since: 0.8
*
* Deprecated: 1.10: Use clutter_input_device_grab() instead.
*/
void
clutter_grab_pointer_for_device (ClutterActor *actor,
gint id_)
{
ClutterDeviceManager *manager;
ClutterInputDevice *dev;
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
/* essentially a global grab */
if (id_ == -1)
{
if (actor == NULL)
clutter_ungrab_pointer ();
else
clutter_grab_pointer (actor);
return;
}
manager = clutter_device_manager_get_default ();
if (manager == NULL)
return;
dev = clutter_device_manager_get_device (manager, id_);
if (dev == NULL)
return;
if (dev->device_type != CLUTTER_POINTER_DEVICE)
return;
if (actor == NULL)
clutter_input_device_ungrab (dev);
else
clutter_input_device_grab (dev, actor);
}
/** /**
* clutter_ungrab_pointer: * clutter_ungrab_pointer:
* *
@@ -2954,32 +2607,6 @@ clutter_ungrab_pointer (void)
clutter_grab_pointer (NULL); clutter_grab_pointer (NULL);
} }
/**
* clutter_ungrab_pointer_for_device:
* @id_: a device id
*
* Removes an existing grab of the pointer events for device @id_.
*
* Since: 0.8
*
* Deprecated: 1.10: Use clutter_input_device_ungrab() instead.
*/
void
clutter_ungrab_pointer_for_device (gint id_)
{
ClutterDeviceManager *manager;
ClutterInputDevice *device;
manager = clutter_device_manager_get_default ();
if (manager == NULL)
return;
device = clutter_device_manager_get_device (manager, id_);
if (device != NULL)
clutter_input_device_ungrab (device);
}
/** /**
* clutter_get_pointer_grab: * clutter_get_pointer_grab:
* *
@@ -3079,170 +2706,6 @@ clutter_get_keyboard_grab (void)
return context->keyboard_grab_actor; return context->keyboard_grab_actor;
} }
/**
* clutter_clear_glyph_cache:
*
* Clears the internal cache of glyphs used by the Pango
* renderer. This will free up some memory and GL texture
* resources. The cache will be automatically refilled as more text is
* drawn.
*
* Since: 0.8
*
* Deprecated: 1.10: Use clutter_get_font_map() and
* cogl_pango_font_map_clear_glyph_cache() instead.
*/
void
clutter_clear_glyph_cache (void)
{
CoglPangoFontMap *font_map;
font_map = clutter_context_get_pango_fontmap ();
cogl_pango_font_map_clear_glyph_cache (font_map);
}
/**
* clutter_set_font_flags:
* @flags: The new flags
*
* Sets the font quality options for subsequent text rendering
* operations.
*
* Using mipmapped textures will improve the quality for scaled down
* text but will use more texture memory.
*
* Enabling hinting improves text quality for static text but may
* introduce some artifacts if the text is animated.
*
* Since: 1.0
*
* Deprecated: 1.10: Use clutter_backend_set_font_options() and the
* #cairo_font_option_t API.
*/
void
clutter_set_font_flags (ClutterFontFlags flags)
{
CoglPangoFontMap *font_map;
ClutterFontFlags old_flags, changed_flags;
const cairo_font_options_t *font_options;
cairo_font_options_t *new_font_options;
cairo_hint_style_t hint_style;
gboolean use_mipmapping;
ClutterBackend *backend;
backend = clutter_get_default_backend ();
font_map = clutter_context_get_pango_fontmap ();
font_options = clutter_backend_get_font_options (backend);
old_flags = 0;
if (cogl_pango_font_map_get_use_mipmapping (font_map))
old_flags |= CLUTTER_FONT_MIPMAPPING;
hint_style = cairo_font_options_get_hint_style (font_options);
if (hint_style != CAIRO_HINT_STYLE_DEFAULT &&
hint_style != CAIRO_HINT_STYLE_NONE)
old_flags |= CLUTTER_FONT_HINTING;
if (old_flags == flags)
return;
new_font_options = cairo_font_options_copy (font_options);
/* Only set the font options that have actually changed so we don't
override a detailed setting from the backend */
changed_flags = old_flags ^ flags;
if ((changed_flags & CLUTTER_FONT_MIPMAPPING))
{
use_mipmapping = (changed_flags & CLUTTER_FONT_MIPMAPPING) != 0;
cogl_pango_font_map_set_use_mipmapping (font_map, use_mipmapping);
}
if ((changed_flags & CLUTTER_FONT_HINTING))
{
hint_style = (flags & CLUTTER_FONT_HINTING)
? CAIRO_HINT_STYLE_FULL
: CAIRO_HINT_STYLE_NONE;
cairo_font_options_set_hint_style (new_font_options, hint_style);
}
clutter_backend_set_font_options (backend, new_font_options);
cairo_font_options_destroy (new_font_options);
}
/**
* clutter_get_font_flags:
*
* Gets the current font flags for rendering text. See
* clutter_set_font_flags().
*
* Return value: The font flags
*
* Since: 1.0
*
* Deprecated: 1.10: Use clutter_backend_get_font_options() and the
* #cairo_font_options_t API.
*/
ClutterFontFlags
clutter_get_font_flags (void)
{
CoglPangoFontMap *font_map = NULL;
const cairo_font_options_t *font_options;
ClutterFontFlags flags = 0;
cairo_hint_style_t hint_style;
font_map = clutter_context_get_pango_fontmap ();
if (cogl_pango_font_map_get_use_mipmapping (font_map))
flags |= CLUTTER_FONT_MIPMAPPING;
font_options =
clutter_backend_get_font_options (clutter_get_default_backend ());
hint_style = cairo_font_options_get_hint_style (font_options);
if (hint_style != CAIRO_HINT_STYLE_DEFAULT &&
hint_style != CAIRO_HINT_STYLE_NONE)
flags |= CLUTTER_FONT_HINTING;
return flags;
}
/**
* clutter_get_input_device_for_id:
* @id_: the unique id for a device
*
* Retrieves the #ClutterInputDevice from its @id_. This is a convenience
* wrapper for clutter_device_manager_get_device() and it is functionally
* equivalent to:
*
* |[
* ClutterDeviceManager *manager;
* ClutterInputDevice *device;
*
* manager = clutter_device_manager_get_default ();
* device = clutter_device_manager_get_device (manager, id);
* ]|
*
* Return value: (transfer none): a #ClutterInputDevice, or %NULL
*
* Since: 0.8
*
* Deprecated: 1.10: Use clutter_device_manager_get_device() instead.
*/
ClutterInputDevice *
clutter_get_input_device_for_id (gint id_)
{
ClutterDeviceManager *manager;
manager = clutter_device_manager_get_default ();
if (manager == NULL)
return NULL;
return clutter_device_manager_get_device (manager, id_);
}
/** /**
* clutter_get_font_map: * clutter_get_font_map:
* *
@@ -3577,43 +3040,6 @@ _clutter_context_get_pick_mode (void)
return context->pick_mode; return context->pick_mode;
} }
void
_clutter_context_push_shader_stack (ClutterActor *actor)
{
ClutterMainContext *context = _clutter_context_get_default ();
context->shaders = g_slist_prepend (context->shaders, actor);
}
ClutterActor *
_clutter_context_peek_shader_stack (void)
{
ClutterMainContext *context = _clutter_context_get_default ();
if (context->shaders != NULL)
return context->shaders->data;
return NULL;
}
ClutterActor *
_clutter_context_pop_shader_stack (ClutterActor *actor)
{
ClutterMainContext *context = _clutter_context_get_default ();
context->shaders = g_slist_remove (context->shaders, actor);
return _clutter_context_peek_shader_stack ();
}
gboolean
_clutter_context_get_motion_events_enabled (void)
{
ClutterMainContext *context = _clutter_context_get_default ();
return context->motion_events_per_actor;
}
/** /**
* clutter_check_windowing_backend: * clutter_check_windowing_backend:
* @backend_type: the name of the backend to check * @backend_type: the name of the backend to check

View File

@@ -117,9 +117,6 @@ void clutter_disable_accessibility (void);
/* Threading functions */ /* Threading functions */
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_threads_set_lock_functions (GCallback enter_fn,
GCallback leave_fn);
CLUTTER_EXPORT
guint clutter_threads_add_idle (GSourceFunc func, guint clutter_threads_add_idle (GSourceFunc func,
gpointer data); gpointer data);
CLUTTER_EXPORT CLUTTER_EXPORT

View File

@@ -146,9 +146,6 @@ struct _ClutterMainContext
ClutterActor *pointer_grab_actor; ClutterActor *pointer_grab_actor;
ClutterActor *keyboard_grab_actor; ClutterActor *keyboard_grab_actor;
/* stack of actors with shaders during paint */
GSList *shaders;
/* fb bit masks for col<->id mapping in picking */ /* fb bit masks for col<->id mapping in picking */
gint fb_r_mask; gint fb_r_mask;
gint fb_g_mask; gint fb_g_mask;
@@ -173,7 +170,6 @@ struct _ClutterMainContext
/* boolean flags */ /* boolean flags */
guint is_initialized : 1; guint is_initialized : 1;
guint motion_events_per_actor : 1;
guint defer_display_setup : 1; guint defer_display_setup : 1;
guint options_parsed : 1; guint options_parsed : 1;
guint show_fps : 1; guint show_fps : 1;
@@ -198,10 +194,6 @@ void _clutter_context_lock (void);
void _clutter_context_unlock (void); void _clutter_context_unlock (void);
gboolean _clutter_context_is_initialized (void); gboolean _clutter_context_is_initialized (void);
ClutterPickMode _clutter_context_get_pick_mode (void); ClutterPickMode _clutter_context_get_pick_mode (void);
void _clutter_context_push_shader_stack (ClutterActor *actor);
ClutterActor * _clutter_context_pop_shader_stack (ClutterActor *actor);
ClutterActor * _clutter_context_peek_shader_stack (void);
gboolean _clutter_context_get_motion_events_enabled (void);
gboolean _clutter_context_get_show_fps (void); gboolean _clutter_context_get_show_fps (void);
gboolean _clutter_feature_init (GError **error); gboolean _clutter_feature_init (GError **error);

View File

@@ -1636,14 +1636,17 @@ clutter_script_translate_parameters (ClutterScript *script,
GObject *object, GObject *object,
const gchar *name, const gchar *name,
GList *properties, GList *properties,
GArray **params) GPtrArray **param_names,
GArray **param_values)
{ {
ClutterScriptable *scriptable = NULL; ClutterScriptable *scriptable = NULL;
ClutterScriptableIface *iface = NULL; ClutterScriptableIface *iface = NULL;
GList *l, *unparsed; GList *l, *unparsed;
gboolean parse_custom = FALSE; gboolean parse_custom = FALSE;
*params = g_array_new (FALSE, FALSE, sizeof (GParameter)); *param_names = g_ptr_array_new_with_free_func (g_free);
*param_values = g_array_new (FALSE, FALSE, sizeof (GValue));
g_array_set_clear_func (*param_values, (GDestroyNotify) g_value_unset);
if (CLUTTER_IS_SCRIPTABLE (object)) if (CLUTTER_IS_SCRIPTABLE (object))
{ {
@@ -1659,7 +1662,7 @@ clutter_script_translate_parameters (ClutterScript *script,
for (l = properties; l != NULL; l = l->next) for (l = properties; l != NULL; l = l->next)
{ {
PropertyInfo *pinfo = l->data; PropertyInfo *pinfo = l->data;
GParameter param = { NULL }; GValue value = G_VALUE_INIT;
gboolean res = FALSE; gboolean res = FALSE;
if (pinfo->is_child || pinfo->is_layout) if (pinfo->is_child || pinfo->is_layout)
@@ -1676,12 +1679,12 @@ clutter_script_translate_parameters (ClutterScript *script,
pinfo->name); pinfo->name);
if (parse_custom) if (parse_custom)
res = iface->parse_custom_node (scriptable, script, &param.value, res = iface->parse_custom_node (scriptable, script, &value,
pinfo->name, pinfo->name,
pinfo->node); pinfo->node);
if (!res) if (!res)
res = _clutter_script_parse_node (script, &param.value, res = _clutter_script_parse_node (script, &value,
pinfo->name, pinfo->name,
pinfo->node, pinfo->node,
pinfo->pspec); pinfo->pspec);
@@ -1693,9 +1696,8 @@ clutter_script_translate_parameters (ClutterScript *script,
continue; continue;
} }
param.name = g_strdup (pinfo->name); g_ptr_array_add (*param_names, g_strdup (pinfo->name));
g_array_append_val (*param_values, value);
g_array_append_val (*params, param);
property_info_free (pinfo); property_info_free (pinfo);
} }
@@ -1710,7 +1712,8 @@ clutter_script_construct_parameters (ClutterScript *script,
GType gtype, GType gtype,
const gchar *name, const gchar *name,
GList *properties, GList *properties,
GArray **construct_params) GPtrArray **construct_param_names,
GArray **construct_param_values)
{ {
GObjectClass *klass; GObjectClass *klass;
GList *l, *unparsed; GList *l, *unparsed;
@@ -1718,14 +1721,17 @@ clutter_script_construct_parameters (ClutterScript *script,
klass = g_type_class_ref (gtype); klass = g_type_class_ref (gtype);
g_assert (klass != NULL); g_assert (klass != NULL);
*construct_params = g_array_new (FALSE, FALSE, sizeof (GParameter)); *construct_param_names = g_ptr_array_new_with_free_func (g_free);
*construct_param_values = g_array_new (FALSE, FALSE, sizeof (GValue));
g_array_set_clear_func (*construct_param_values,
(GDestroyNotify) g_value_unset);
unparsed = NULL; unparsed = NULL;
for (l = properties; l != NULL; l = l->next) for (l = properties; l != NULL; l = l->next)
{ {
PropertyInfo *pinfo = l->data; PropertyInfo *pinfo = l->data;
GParameter param = { NULL }; GValue value = G_VALUE_INIT;
GParamSpec *pspec = NULL; GParamSpec *pspec = NULL;
/* we allow custom property names for classes, so if we /* we allow custom property names for classes, so if we
@@ -1749,9 +1755,7 @@ clutter_script_construct_parameters (ClutterScript *script,
continue; continue;
} }
param.name = g_strdup (pinfo->name); if (!_clutter_script_parse_node (script, &value,
if (!_clutter_script_parse_node (script, &param.value,
pinfo->name, pinfo->name,
pinfo->node, pinfo->node,
pinfo->pspec)) pinfo->pspec))
@@ -1760,7 +1764,8 @@ clutter_script_construct_parameters (ClutterScript *script,
continue; continue;
} }
g_array_append_val (*construct_params, param); g_ptr_array_add (*construct_param_names, g_strdup (pinfo->name));
g_array_append_val (*construct_param_values, value);
property_info_free (pinfo); property_info_free (pinfo);
} }
@@ -2087,7 +2092,8 @@ _clutter_script_apply_properties (ClutterScript *script,
gboolean set_custom_property = FALSE; gboolean set_custom_property = FALSE;
GObject *object = oinfo->object; GObject *object = oinfo->object;
GList *properties; GList *properties;
GArray *params; g_autoptr (GPtrArray) param_names = NULL;
g_autoptr (GArray) param_values = NULL;
guint i; guint i;
if (!oinfo->has_unresolved) if (!oinfo->has_unresolved)
@@ -2111,34 +2117,31 @@ _clutter_script_apply_properties (ClutterScript *script,
object, object,
oinfo->id, oinfo->id,
properties, properties,
&params); &param_names,
&param_values);
/* consume all the properties we could translate in this pass */ /* consume all the properties we could translate in this pass */
for (i = 0; i < params->len; i++) for (i = 0; i < param_names->len; i++)
{ {
GParameter *param = &g_array_index (params, GParameter, i); char *name = g_ptr_array_index (param_names, i);
GValue *value = &g_array_index (param_values, GValue, i);
CLUTTER_NOTE (SCRIPT, CLUTTER_NOTE (SCRIPT,
"Setting %s property '%s' (type:%s) to object '%s' (id:%s)", "Setting %s property '%s' (type:%s) to object '%s' (id:%s)",
set_custom_property ? "custom" : "regular", set_custom_property ? "custom" : "regular",
param->name, name,
g_type_name (G_VALUE_TYPE (&param->value)), g_type_name (G_VALUE_TYPE (value)),
g_type_name (oinfo->gtype), g_type_name (oinfo->gtype),
oinfo->id); oinfo->id);
if (set_custom_property) if (set_custom_property)
iface->set_custom_property (scriptable, script, iface->set_custom_property (scriptable, script,
param->name, name,
&param->value); value);
else else
g_object_set_property (object, param->name, &param->value); g_object_set_property (object, name, value);
g_free ((gchar *) param->name);
g_value_unset (&param->value);
} }
g_array_free (params, TRUE);
_clutter_script_check_unresolved (script, oinfo); _clutter_script_check_unresolved (script, oinfo);
} }
@@ -2146,8 +2149,8 @@ void
_clutter_script_construct_object (ClutterScript *script, _clutter_script_construct_object (ClutterScript *script,
ObjectInfo *oinfo) ObjectInfo *oinfo)
{ {
GArray *params = NULL; g_autoptr (GPtrArray) param_names = NULL;
guint i; g_autoptr (GArray) param_values = NULL;
/* we have completely updated the object */ /* we have completely updated the object */
if (oinfo->object != NULL) if (oinfo->object != NULL)
@@ -2190,25 +2193,14 @@ _clutter_script_construct_object (ClutterScript *script,
oinfo->gtype, oinfo->gtype,
oinfo->id, oinfo->id,
properties, properties,
&params); &param_names,
&param_values);
default_stage = clutter_stage_manager_get_default_stage (manager); default_stage = clutter_stage_manager_get_default_stage (manager);
oinfo->object = G_OBJECT (default_stage); oinfo->object = G_OBJECT (default_stage);
for (i = 0; i < params->len; i++)
{
GParameter *param = &g_array_index (params, GParameter, i);
g_free ((gchar *) param->name);
g_value_unset (&param->value);
}
g_array_free (params, TRUE);
} }
else else
{ {
g_autoptr (GPtrArray) param_names = NULL;
GArray *param_values;
GList *properties = oinfo->properties; GList *properties = oinfo->properties;
/* every other object: first, we get the construction parameters */ /* every other object: first, we get the construction parameters */
@@ -2217,22 +2209,11 @@ _clutter_script_construct_object (ClutterScript *script,
oinfo->gtype, oinfo->gtype,
oinfo->id, oinfo->id,
properties, properties,
&params); &param_names,
&param_values);
/* Convert GParameter → (GStrv, GValue[]) */
param_names = g_ptr_array_sized_new (params->len);
param_values = g_array_sized_new (TRUE, FALSE, sizeof (GValue), params->len);
for (i = 0; i < params->len; i++)
{
GParameter *param = &g_array_index (params, GParameter, i);
g_ptr_array_add (param_names, (gchar *) param->name);
g_array_append_val (param_values, param->value);
}
g_ptr_array_add (param_names, NULL);
oinfo->object = g_object_new_with_properties (oinfo->gtype, oinfo->object = g_object_new_with_properties (oinfo->gtype,
params->len, param_names->len,
(const gchar **) param_names->pdata, (const gchar **) param_names->pdata,
(const GValue *) param_values->data); (const GValue *) param_values->data);
@@ -2241,17 +2222,6 @@ _clutter_script_construct_object (ClutterScript *script,
* else too or only by this ClutterScript object. * else too or only by this ClutterScript object.
*/ */
g_object_ref_sink (oinfo->object); g_object_ref_sink (oinfo->object);
for (i = 0; i < params->len; i++)
{
GParameter *param = &g_array_index (params, GParameter, i);
g_free ((gchar *) param->name);
g_value_unset (&param->value);
}
g_array_free (param_values, FALSE);
g_array_free (params, TRUE);
} }
g_assert (oinfo->object != NULL); g_assert (oinfo->object != NULL);

View File

@@ -263,8 +263,6 @@ enum
static GParamSpec *obj_props[PROP_LAST]; static GParamSpec *obj_props[PROP_LAST];
#define CLUTTER_SCRIPT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_SCRIPT, ClutterScriptPrivate))
struct _ClutterScriptPrivate struct _ClutterScriptPrivate
{ {
GHashTable *objects; GHashTable *objects;
@@ -377,7 +375,7 @@ object_info_free (gpointer data)
static void static void
clutter_script_finalize (GObject *gobject) clutter_script_finalize (GObject *gobject)
{ {
ClutterScriptPrivate *priv = CLUTTER_SCRIPT_GET_PRIVATE (gobject); ClutterScriptPrivate *priv = CLUTTER_SCRIPT (gobject)->priv;
g_object_unref (priv->parser); g_object_unref (priv->parser);
g_hash_table_destroy (priv->objects); g_hash_table_destroy (priv->objects);

View File

@@ -2240,14 +2240,7 @@ clutter_stage_init (ClutterStage *self)
priv->throttle_motion_events = TRUE; priv->throttle_motion_events = TRUE;
priv->min_size_changed = FALSE; priv->min_size_changed = FALSE;
priv->sync_delay = -1; priv->sync_delay = -1;
priv->motion_events_enabled = TRUE;
/* XXX - we need to keep the invariant that calling
* clutter_set_motion_event_enabled() before the stage creation
* will cause motion event delivery to be disabled on any newly
* created stage. this can go away when we break API and remove
* deprecated functions.
*/
priv->motion_events_enabled = _clutter_context_get_motion_events_enabled ();
clutter_actor_set_background_color (CLUTTER_ACTOR (self), clutter_actor_set_background_color (CLUTTER_ACTOR (self),
&default_stage_color); &default_stage_color);

View File

@@ -171,7 +171,7 @@ clutter_text_buffer_normal_insert_text (ClutterTextBuffer *buffer,
/* Actual text insertion */ /* Actual text insertion */
at = g_utf8_offset_to_pointer (pv->normal_text, position) - pv->normal_text; at = g_utf8_offset_to_pointer (pv->normal_text, position) - pv->normal_text;
g_memmove (pv->normal_text + at + n_bytes, pv->normal_text + at, pv->normal_text_bytes - at); memmove (pv->normal_text + at + n_bytes, pv->normal_text + at, pv->normal_text_bytes - at);
memcpy (pv->normal_text + at, chars, n_bytes); memcpy (pv->normal_text + at, chars, n_bytes);
/* Book keeping */ /* Book keeping */
@@ -201,7 +201,7 @@ clutter_text_buffer_normal_delete_text (ClutterTextBuffer *buffer,
start = g_utf8_offset_to_pointer (pv->normal_text, position) - pv->normal_text; start = g_utf8_offset_to_pointer (pv->normal_text, position) - pv->normal_text;
end = g_utf8_offset_to_pointer (pv->normal_text, position + n_chars) - pv->normal_text; end = g_utf8_offset_to_pointer (pv->normal_text, position + n_chars) - pv->normal_text;
g_memmove (pv->normal_text + start, pv->normal_text + end, pv->normal_text_bytes + 1 - end); memmove (pv->normal_text + start, pv->normal_text + end, pv->normal_text_bytes + 1 - end);
pv->normal_text_chars -= n_chars; pv->normal_text_chars -= n_chars;
pv->normal_text_bytes -= (end - start); pv->normal_text_bytes -= (end - start);

View File

@@ -1,85 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2011 Intel Corp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_MAIN_DEPRECATED_H__
#define __CLUTTER_MAIN_DEPRECATED_H__
#include <clutter/clutter-types.h>
#include <clutter/clutter-input-device.h>
G_BEGIN_DECLS
CLUTTER_DEPRECATED
void clutter_threads_init (void);
CLUTTER_DEPRECATED
void clutter_threads_enter (void);
CLUTTER_DEPRECATED
void clutter_threads_leave (void);
CLUTTER_DEPRECATED_FOR(clutter_stage_set_motion_events_enabled)
void clutter_set_motion_events_enabled (gboolean enable);
CLUTTER_DEPRECATED_FOR(clutter_stage_get_motion_events_enabled)
gboolean clutter_get_motion_events_enabled (void);
CLUTTER_DEPRECATED_FOR(clutter_stage_ensure_redraw)
void clutter_redraw (ClutterStage *stage);
CLUTTER_DEPRECATED_FOR(cogl_pango_font_map_clear_glyph_cache)
void clutter_clear_glyph_cache (void);
CLUTTER_DEPRECATED_FOR(clutter_backend_set_font_options)
void clutter_set_font_flags (ClutterFontFlags flags);
CLUTTER_DEPRECATED_FOR(clutter_backend_get_font_options)
ClutterFontFlags clutter_get_font_flags (void);
CLUTTER_DEPRECATED_FOR(clutter_device_manager_get_device)
ClutterInputDevice * clutter_get_input_device_for_id (gint id_);
CLUTTER_DEPRECATED_FOR(clutter_input_device_grab)
void clutter_grab_pointer_for_device (ClutterActor *actor,
gint id_);
CLUTTER_DEPRECATED_FOR(clutter_input_device_ungrab)
void clutter_ungrab_pointer_for_device (gint id_);
CLUTTER_DEPRECATED
void clutter_set_default_frame_rate (guint frames_per_sec);
CLUTTER_DEPRECATED
gulong clutter_get_timestamp (void);
CLUTTER_DEPRECATED
gboolean clutter_get_debug_enabled (void);
CLUTTER_DEPRECATED
gboolean clutter_get_show_fps (void);
G_END_DECLS
#endif /* __CLUTTER_MAIN_DEPRECATED_H__ */

View File

@@ -234,7 +234,6 @@ clutter_deprecated_headers = [
'deprecated/clutter-container.h', 'deprecated/clutter-container.h',
'deprecated/clutter-group.h', 'deprecated/clutter-group.h',
'deprecated/clutter-keysyms.h', 'deprecated/clutter-keysyms.h',
'deprecated/clutter-main.h',
'deprecated/clutter-rectangle.h', 'deprecated/clutter-rectangle.h',
'deprecated/clutter-stage-manager.h', 'deprecated/clutter-stage-manager.h',
'deprecated/clutter-stage.h', 'deprecated/clutter-stage.h',

View File

@@ -13,7 +13,7 @@ G_BEGIN_DECLS
#define TEST_COGLBOX(obj) \ #define TEST_COGLBOX(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
TEST_TYPE_COGLBOX, TestCoglboxClass)) TEST_TYPE_COGLBOX, TestCoglbox))
#define TEST_COGLBOX_CLASS(klass) \ #define TEST_COGLBOX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \ (G_TYPE_CHECK_CLASS_CAST ((klass), \
@@ -77,7 +77,7 @@ struct _TestCoglboxPrivate
G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR); G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR);
#define TEST_COGLBOX_GET_PRIVATE(obj) \ #define TEST_COGLBOX_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), TEST_TYPE_COGLBOX, TestCoglboxPrivate)) (test_coglbox_get_instance_private (TEST_COGLBOX ((obj))))
/* Coglbox implementation /* Coglbox implementation
*--------------------------------------------------*/ *--------------------------------------------------*/

View File

@@ -13,7 +13,7 @@ G_BEGIN_DECLS
#define TEST_COGLBOX(obj) \ #define TEST_COGLBOX(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
TEST_TYPE_COGLBOX, TestCoglboxClass)) TEST_TYPE_COGLBOX, TestCoglbox))
#define TEST_COGLBOX_CLASS(klass) \ #define TEST_COGLBOX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \ (G_TYPE_CHECK_CLASS_CAST ((klass), \
@@ -76,7 +76,7 @@ struct _TestCoglboxPrivate
G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR); G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR);
#define TEST_COGLBOX_GET_PRIVATE(obj) \ #define TEST_COGLBOX_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), TEST_TYPE_COGLBOX, TestCoglboxPrivate)) (test_coglbox_get_instance_private (TEST_COGLBOX ((obj))))
/* Coglbox implementation /* Coglbox implementation
*--------------------------------------------------*/ *--------------------------------------------------*/
@@ -173,7 +173,7 @@ test_coglbox_init (TestCoglbox *self)
priv->cogl_tex_id[3] = priv->cogl_tex_id[3] =
cogl_texture_new_from_file (file, cogl_texture_new_from_file (file,
COGL_TEXTURE_NONE, COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_G_8,
NULL); NULL);
g_free (file); g_free (file);

View File

@@ -13,7 +13,7 @@ G_BEGIN_DECLS
#define TEST_COGLBOX(obj) \ #define TEST_COGLBOX(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
TEST_TYPE_COGLBOX, TestCoglboxClass)) TEST_TYPE_COGLBOX, TestCoglbox))
#define TEST_COGLBOX_CLASS(klass) \ #define TEST_COGLBOX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \ (G_TYPE_CHECK_CLASS_CAST ((klass), \
@@ -78,7 +78,7 @@ struct _TestCoglboxPrivate
G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR); G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR);
#define TEST_COGLBOX_GET_PRIVATE(obj) \ #define TEST_COGLBOX_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), TEST_TYPE_COGLBOX, TestCoglboxPrivate)) ((TestCoglboxPrivate *)test_coglbox_get_instance_private (TEST_COGLBOX ((obj))))
/* Coglbox implementation /* Coglbox implementation
*--------------------------------------------------*/ *--------------------------------------------------*/

View File

@@ -14,7 +14,7 @@ G_BEGIN_DECLS
#define TEST_COGLBOX(obj) \ #define TEST_COGLBOX(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
TEST_TYPE_COGLBOX, TestCoglboxClass)) TEST_TYPE_COGLBOX, TestCoglbox))
#define TEST_COGLBOX_CLASS(klass) \ #define TEST_COGLBOX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \ (G_TYPE_CHECK_CLASS_CAST ((klass), \
@@ -77,7 +77,7 @@ struct _TestCoglboxPrivate
G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR); G_DEFINE_TYPE_WITH_PRIVATE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR);
#define TEST_COGLBOX_GET_PRIVATE(obj) \ #define TEST_COGLBOX_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), TEST_TYPE_COGLBOX, TestCoglboxPrivate)) (test_coglbox_get_instance_private (TEST_COGLBOX ((obj))))
/* Coglbox implementation /* Coglbox implementation
*--------------------------------------------------*/ *--------------------------------------------------*/

View File

@@ -146,9 +146,7 @@ test_texture_async_main (int argc, char *argv[])
task, path, task, path,
cleanup_task); cleanup_task);
clutter_threads_enter ();
clutter_main (); clutter_main ();
clutter_threads_leave ();
g_free (path); g_free (path);

View File

@@ -39,6 +39,13 @@
#define PANGO_ENABLE_BACKEND 1 #define PANGO_ENABLE_BACKEND 1
#endif #endif
#ifndef PANGO_UNKNOWN_GLYPH_WIDTH
#define PANGO_UNKNOWN_GLYPH_WIDTH 10
#endif
#ifndef PANGO_UNKNOWN_GLYPH_HEIGHT
#define PANGO_UNKNOWN_GLYPH_HEIGHT 14
#endif
#include <pango/pango-fontmap.h> #include <pango/pango-fontmap.h>
#include <pango/pangocairo.h> #include <pango/pangocairo.h>
#include <pango/pango-renderer.h> #include <pango/pango-renderer.h>

View File

@@ -937,12 +937,12 @@ cogl_atlas_texture_new_from_data (CoglContext *ctx,
CoglBitmap *bmp; CoglBitmap *bmp;
CoglAtlasTexture *atlas_tex; CoglAtlasTexture *atlas_tex;
g_return_val_if_fail (cogl_pixel_format_get_n_planes (format) == 1, NULL); g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL);
g_return_val_if_fail (data != NULL, NULL); g_return_val_if_fail (data != NULL, NULL);
/* Rowstride from width if not given */ /* Rowstride from width if not given */
if (rowstride == 0) if (rowstride == 0)
rowstride = width * cogl_pixel_format_get_bytes_per_pixel_simple (format); rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
/* Wrap the data into a bitmap */ /* Wrap the data into a bitmap */
bmp = cogl_bitmap_new_for_data (ctx, bmp = cogl_bitmap_new_for_data (ctx,

View File

@@ -193,7 +193,7 @@ _cogl_atlas_get_initial_size (CoglPixelFormat format,
initial minimum size. If the format is only 1 byte per pixel we initial minimum size. If the format is only 1 byte per pixel we
can use 1024x1024, otherwise we'll assume it will take 4 bytes can use 1024x1024, otherwise we'll assume it will take 4 bytes
per pixel and use 512x512. */ per pixel and use 512x512. */
if (cogl_pixel_format_get_bytes_per_pixel_simple (format) == 1) if (_cogl_pixel_format_get_bytes_per_pixel (format) == 1)
size = 1024; size = 1024;
else else
size = 512; size = 512;
@@ -291,9 +291,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
{ {
uint8_t *clear_data; uint8_t *clear_data;
CoglBitmap *clear_bmp; CoglBitmap *clear_bmp;
int bpp; int bpp = _cogl_pixel_format_get_bytes_per_pixel (atlas->texture_format);
bpp = cogl_pixel_format_get_bytes_per_pixel_simple (atlas->texture_format);
/* Create a buffer of zeroes to initially clear the texture */ /* Create a buffer of zeroes to initially clear the texture */
clear_data = g_malloc0 (width * height * bpp); clear_data = g_malloc0 (width * height * bpp);

View File

@@ -320,37 +320,7 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format)
case COGL_PIXEL_FORMAT_DEPTH_32: case COGL_PIXEL_FORMAT_DEPTH_32:
case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
case COGL_PIXEL_FORMAT_ANY: case COGL_PIXEL_FORMAT_ANY:
/* No support for YUV or multi-plane formats */
case COGL_PIXEL_FORMAT_YUV: case COGL_PIXEL_FORMAT_YUV:
case COGL_PIXEL_FORMAT_YUYV:
case COGL_PIXEL_FORMAT_YVYU:
case COGL_PIXEL_FORMAT_UYVY:
case COGL_PIXEL_FORMAT_VYUY:
case COGL_PIXEL_FORMAT_AYUV:
case COGL_PIXEL_FORMAT_XRGB8888_A8:
case COGL_PIXEL_FORMAT_XBGR8888_A8:
case COGL_PIXEL_FORMAT_RGBX8888_A8:
case COGL_PIXEL_FORMAT_BGRX8888_A8:
case COGL_PIXEL_FORMAT_RGB888_A8:
case COGL_PIXEL_FORMAT_BGR888_A8:
case COGL_PIXEL_FORMAT_RGB565_A8:
case COGL_PIXEL_FORMAT_BGR565_A8:
case COGL_PIXEL_FORMAT_NV12:
case COGL_PIXEL_FORMAT_NV21:
case COGL_PIXEL_FORMAT_NV16:
case COGL_PIXEL_FORMAT_NV61:
case COGL_PIXEL_FORMAT_NV24:
case COGL_PIXEL_FORMAT_NV42:
case COGL_PIXEL_FORMAT_YUV410:
case COGL_PIXEL_FORMAT_YVU410:
case COGL_PIXEL_FORMAT_YUV411:
case COGL_PIXEL_FORMAT_YVU411:
case COGL_PIXEL_FORMAT_YUV420:
case COGL_PIXEL_FORMAT_YVU420:
case COGL_PIXEL_FORMAT_YUV422:
case COGL_PIXEL_FORMAT_YVU422:
case COGL_PIXEL_FORMAT_YUV444:
case COGL_PIXEL_FORMAT_YVU444:
g_assert_not_reached (); g_assert_not_reached ();
case COGL_PIXEL_FORMAT_A_8: case COGL_PIXEL_FORMAT_A_8:
@@ -358,7 +328,7 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format)
case COGL_PIXEL_FORMAT_RGB_565: case COGL_PIXEL_FORMAT_RGB_565:
case COGL_PIXEL_FORMAT_RGBA_4444: case COGL_PIXEL_FORMAT_RGBA_4444:
case COGL_PIXEL_FORMAT_RGBA_5551: case COGL_PIXEL_FORMAT_RGBA_5551:
case COGL_PIXEL_FORMAT_R_8: case COGL_PIXEL_FORMAT_G_8:
case COGL_PIXEL_FORMAT_RGB_888: case COGL_PIXEL_FORMAT_RGB_888:
case COGL_PIXEL_FORMAT_BGR_888: case COGL_PIXEL_FORMAT_BGR_888:
case COGL_PIXEL_FORMAT_RGBA_8888: case COGL_PIXEL_FORMAT_RGBA_8888:

View File

@@ -65,16 +65,21 @@ G_PASTE (_cogl_unpack_a_8_, component_size) (const uint8_t *src,
} }
inline static void inline static void
G_PASTE (_cogl_unpack_r_8_, component_size) (const uint8_t *src, G_PASTE (_cogl_unpack_g_8_, component_size) (const uint8_t *src,
component_type *dst, component_type *dst,
int width) int width)
{ {
/* FIXME: I'm not sure if this is right. It looks like Nvidia and
Mesa handle luminance textures differently. Maybe we should
consider just removing luminance textures for Cogl 2.0 because
they have been removed in GL 3.0 */
while (width-- > 0) while (width-- > 0)
{ {
dst[0] = UNPACK_BYTE (*src); component_type v = UNPACK_BYTE (src[0]);
dst[1] = 0; dst[0] = v;
dst[2] = 0; dst[1] = v;
dst[3] = 0; dst[2] = v;
dst[3] = UNPACK_BYTE (255);
dst += 4; dst += 4;
src++; src++;
} }
@@ -336,8 +341,8 @@ G_PASTE (_cogl_unpack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_A_8: case COGL_PIXEL_FORMAT_A_8:
G_PASTE (_cogl_unpack_a_8_, component_size) (src, dst, width); G_PASTE (_cogl_unpack_a_8_, component_size) (src, dst, width);
break; break;
case COGL_PIXEL_FORMAT_R_8: case COGL_PIXEL_FORMAT_G_8:
G_PASTE (_cogl_unpack_r_8_, component_size) (src, dst, width); G_PASTE (_cogl_unpack_g_8_, component_size) (src, dst, width);
break; break;
case COGL_PIXEL_FORMAT_RG_88: case COGL_PIXEL_FORMAT_RG_88:
G_PASTE (_cogl_unpack_rg_88_, component_size) (src, dst, width); G_PASTE (_cogl_unpack_rg_88_, component_size) (src, dst, width);
@@ -395,37 +400,7 @@ G_PASTE (_cogl_unpack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_DEPTH_32: case COGL_PIXEL_FORMAT_DEPTH_32:
case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
case COGL_PIXEL_FORMAT_ANY: case COGL_PIXEL_FORMAT_ANY:
/* No support for YUV or multi-plane formats */
case COGL_PIXEL_FORMAT_YUV: case COGL_PIXEL_FORMAT_YUV:
case COGL_PIXEL_FORMAT_YUYV:
case COGL_PIXEL_FORMAT_YVYU:
case COGL_PIXEL_FORMAT_UYVY:
case COGL_PIXEL_FORMAT_VYUY:
case COGL_PIXEL_FORMAT_AYUV:
case COGL_PIXEL_FORMAT_XRGB8888_A8:
case COGL_PIXEL_FORMAT_XBGR8888_A8:
case COGL_PIXEL_FORMAT_RGBX8888_A8:
case COGL_PIXEL_FORMAT_BGRX8888_A8:
case COGL_PIXEL_FORMAT_RGB888_A8:
case COGL_PIXEL_FORMAT_BGR888_A8:
case COGL_PIXEL_FORMAT_RGB565_A8:
case COGL_PIXEL_FORMAT_BGR565_A8:
case COGL_PIXEL_FORMAT_NV12:
case COGL_PIXEL_FORMAT_NV21:
case COGL_PIXEL_FORMAT_NV16:
case COGL_PIXEL_FORMAT_NV61:
case COGL_PIXEL_FORMAT_NV24:
case COGL_PIXEL_FORMAT_NV42:
case COGL_PIXEL_FORMAT_YUV410:
case COGL_PIXEL_FORMAT_YVU410:
case COGL_PIXEL_FORMAT_YUV411:
case COGL_PIXEL_FORMAT_YVU411:
case COGL_PIXEL_FORMAT_YUV420:
case COGL_PIXEL_FORMAT_YVU420:
case COGL_PIXEL_FORMAT_YUV422:
case COGL_PIXEL_FORMAT_YVU422:
case COGL_PIXEL_FORMAT_YUV444:
case COGL_PIXEL_FORMAT_YVU444:
g_assert_not_reached (); g_assert_not_reached ();
} }
} }
@@ -458,13 +433,18 @@ G_PASTE (_cogl_pack_a_8_, component_size) (const component_type *src,
} }
inline static void inline static void
G_PASTE (_cogl_pack_r_8_, component_size) (const component_type *src, G_PASTE (_cogl_pack_g_8_, component_size) (const component_type *src,
uint8_t *dst, uint8_t *dst,
int width) int width)
{ {
/* FIXME: I'm not sure if this is right. It looks like Nvidia and
Mesa handle luminance textures differently. Maybe we should
consider just removing luminance textures for Cogl 2.0 because
they have been removed in GL 3.0 */
while (width-- > 0) while (width-- > 0)
{ {
*dst = PACK_BYTE (src[0]); component_type v = (src[0] + src[1] + src[2]) / 3;
*dst = PACK_BYTE (v);
src += 4; src += 4;
dst++; dst++;
} }
@@ -722,8 +702,8 @@ G_PASTE (_cogl_pack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_A_8: case COGL_PIXEL_FORMAT_A_8:
G_PASTE (_cogl_pack_a_8_, component_size) (src, dst, width); G_PASTE (_cogl_pack_a_8_, component_size) (src, dst, width);
break; break;
case COGL_PIXEL_FORMAT_R_8: case COGL_PIXEL_FORMAT_G_8:
G_PASTE (_cogl_pack_r_8_, component_size) (src, dst, width); G_PASTE (_cogl_pack_g_8_, component_size) (src, dst, width);
break; break;
case COGL_PIXEL_FORMAT_RG_88: case COGL_PIXEL_FORMAT_RG_88:
G_PASTE (_cogl_pack_rg_88_, component_size) (src, dst, width); G_PASTE (_cogl_pack_rg_88_, component_size) (src, dst, width);
@@ -781,37 +761,7 @@ G_PASTE (_cogl_pack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_DEPTH_32: case COGL_PIXEL_FORMAT_DEPTH_32:
case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
case COGL_PIXEL_FORMAT_ANY: case COGL_PIXEL_FORMAT_ANY:
/* No support for YUV or multi-plane formats */
case COGL_PIXEL_FORMAT_YUV: case COGL_PIXEL_FORMAT_YUV:
case COGL_PIXEL_FORMAT_YUYV:
case COGL_PIXEL_FORMAT_YVYU:
case COGL_PIXEL_FORMAT_UYVY:
case COGL_PIXEL_FORMAT_VYUY:
case COGL_PIXEL_FORMAT_AYUV:
case COGL_PIXEL_FORMAT_XRGB8888_A8:
case COGL_PIXEL_FORMAT_XBGR8888_A8:
case COGL_PIXEL_FORMAT_RGBX8888_A8:
case COGL_PIXEL_FORMAT_BGRX8888_A8:
case COGL_PIXEL_FORMAT_RGB888_A8:
case COGL_PIXEL_FORMAT_BGR888_A8:
case COGL_PIXEL_FORMAT_RGB565_A8:
case COGL_PIXEL_FORMAT_BGR565_A8:
case COGL_PIXEL_FORMAT_NV12:
case COGL_PIXEL_FORMAT_NV21:
case COGL_PIXEL_FORMAT_NV16:
case COGL_PIXEL_FORMAT_NV61:
case COGL_PIXEL_FORMAT_NV24:
case COGL_PIXEL_FORMAT_NV42:
case COGL_PIXEL_FORMAT_YUV410:
case COGL_PIXEL_FORMAT_YVU410:
case COGL_PIXEL_FORMAT_YUV411:
case COGL_PIXEL_FORMAT_YVU411:
case COGL_PIXEL_FORMAT_YUV420:
case COGL_PIXEL_FORMAT_YVU420:
case COGL_PIXEL_FORMAT_YUV422:
case COGL_PIXEL_FORMAT_YVU422:
case COGL_PIXEL_FORMAT_YUV444:
case COGL_PIXEL_FORMAT_YVU444:
g_assert_not_reached (); g_assert_not_reached ();
} }
} }

View File

@@ -136,7 +136,7 @@ _cogl_bitmap_copy_subregion (CoglBitmap *src,
(dst->format & ~COGL_PREMULT_BIT), (dst->format & ~COGL_PREMULT_BIT),
FALSE); FALSE);
bpp = cogl_pixel_format_get_bytes_per_pixel_simple (src->format); bpp = _cogl_pixel_format_get_bytes_per_pixel (src->format);
if ((srcdata = _cogl_bitmap_map (src, COGL_BUFFER_ACCESS_READ, 0, error))) if ((srcdata = _cogl_bitmap_map (src, COGL_BUFFER_ACCESS_READ, 0, error)))
{ {
@@ -186,7 +186,7 @@ cogl_bitmap_new_for_data (CoglContext *context,
/* Rowstride from width if not given */ /* Rowstride from width if not given */
if (rowstride == 0) if (rowstride == 0)
rowstride = width * cogl_pixel_format_get_bytes_per_pixel_simple (format); rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
bmp = g_slice_new (CoglBitmap); bmp = g_slice_new (CoglBitmap);
bmp->context = context; bmp->context = context;
@@ -211,7 +211,7 @@ _cogl_bitmap_new_with_malloc_buffer (CoglContext *context,
GError **error) GError **error)
{ {
static CoglUserDataKey bitmap_free_key; static CoglUserDataKey bitmap_free_key;
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (format); int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
int rowstride = ((width * bpp) + 3) & ~3; int rowstride = ((width * bpp) + 3) & ~3;
uint8_t *data = g_try_malloc (rowstride * height); uint8_t *data = g_try_malloc (rowstride * height);
CoglBitmap *bitmap; CoglBitmap *bitmap;
@@ -308,7 +308,7 @@ cogl_bitmap_new_with_size (CoglContext *context,
/* for now we fallback to cogl_pixel_buffer_new, later, we could ask /* for now we fallback to cogl_pixel_buffer_new, later, we could ask
* libdrm a tiled buffer for instance */ * libdrm a tiled buffer for instance */
rowstride = width * cogl_pixel_format_get_bytes_per_pixel_simple (format); rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
pixel_buffer = pixel_buffer =
cogl_pixel_buffer_new (context, cogl_pixel_buffer_new (context,

View File

@@ -4,6 +4,7 @@
* A Low Level GPU Graphics and Utilities API * A Low Level GPU Graphics and Utilities API
* *
* Copyright (C) 2011 Intel Corporation. * Copyright (C) 2011 Intel Corporation.
* Copyright (C) 2019 DisplayLink (UK) Ltd.
* *
* Permission is hereby granted, free of charge, to any person * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation
@@ -152,11 +153,12 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data)
CoglFramebuffer *dst_fb, *src_fb; CoglFramebuffer *dst_fb, *src_fb;
GError *ignore_error = NULL; GError *ignore_error = NULL;
/* We can only blit between FBOs if both textures are the same /* We can only blit between FBOs if both textures have the same
format and the blit framebuffer extension is supported */ premult convention and the blit framebuffer extension is
if ((_cogl_texture_get_format (data->src_tex) & ~COGL_A_BIT) != supported. */
(_cogl_texture_get_format (data->dst_tex) & ~COGL_A_BIT) || if ((_cogl_texture_get_format (data->src_tex) & COGL_PREMULT_BIT) !=
!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT)) (_cogl_texture_get_format (data->dst_tex) & COGL_PREMULT_BIT) ||
!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER))
return FALSE; return FALSE;
dst_offscreen = _cogl_offscreen_new_with_texture_full dst_offscreen = _cogl_offscreen_new_with_texture_full
@@ -205,11 +207,12 @@ _cogl_blit_framebuffer_blit (CoglBlitData *data,
int width, int width,
int height) int height)
{ {
_cogl_blit_framebuffer (data->src_fb, cogl_blit_framebuffer (data->src_fb,
data->dest_fb, data->dest_fb,
src_x, src_y, src_x, src_y,
dst_x, dst_y, dst_x, dst_y,
width, height); width, height,
NULL);
} }
static void static void
@@ -273,7 +276,7 @@ static gboolean
_cogl_blit_get_tex_data_begin (CoglBlitData *data) _cogl_blit_get_tex_data_begin (CoglBlitData *data)
{ {
data->format = _cogl_texture_get_format (data->src_tex); data->format = _cogl_texture_get_format (data->src_tex);
data->bpp = cogl_pixel_format_get_bytes_per_pixel_simple (data->format); data->bpp = _cogl_pixel_format_get_bytes_per_pixel (data->format);
data->image_data = g_malloc (data->bpp * data->src_width * data->image_data = g_malloc (data->bpp * data->src_width *
data->src_height); data->src_height);

View File

@@ -4,6 +4,7 @@
* A Low Level GPU Graphics and Utilities API * A Low Level GPU Graphics and Utilities API
* *
* Copyright (C) 2007,2008,2009 Intel Corporation. * Copyright (C) 2007,2008,2009 Intel Corporation.
* Copyright (C) 2019 DisplayLink (UK) Ltd.
* *
* Permission is hereby granted, free of charge, to any person * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation
@@ -363,63 +364,6 @@ void
_cogl_push_framebuffers (CoglFramebuffer *draw_buffer, _cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
CoglFramebuffer *read_buffer); CoglFramebuffer *read_buffer);
/*
* _cogl_blit_framebuffer:
* @src: The source #CoglFramebuffer
* @dest: The destination #CoglFramebuffer
* @src_x: Source x position
* @src_y: Source y position
* @dst_x: Destination x position
* @dst_y: Destination y position
* @width: Width of region to copy
* @height: Height of region to copy
*
* This blits a region of the color buffer of the current draw buffer
* to the current read buffer. The draw and read buffers can be set up
* using _cogl_push_framebuffers(). This function should only be
* called if the COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT feature is
* advertised. The two buffers must both be offscreen and have the
* same format.
*
* Note that this function differs a lot from the glBlitFramebuffer
* function provided by the GL_EXT_framebuffer_blit extension. Notably
* it doesn't support having different sizes for the source and
* destination rectangle. This isn't supported by the corresponding
* GL_ANGLE_framebuffer_blit extension on GLES2.0 and it doesn't seem
* like a particularly useful feature. If the application wanted to
* scale the results it may make more sense to draw a primitive
* instead.
*
* We can only really support blitting between two offscreen buffers
* for this function on GLES2.0. This is because we effectively render
* upside down to offscreen buffers to maintain Cogl's representation
* of the texture coordinate system where 0,0 is the top left of the
* texture. If we were to blit from an offscreen to an onscreen buffer
* then we would need to mirror the blit along the x-axis but the GLES
* extension does not support this.
*
* The GL function is documented to be affected by the scissor. This
* function therefore ensure that an empty clip stack is flushed
* before performing the blit which means the scissor is effectively
* ignored.
*
* The function also doesn't support specifying the buffers to copy
* and instead only the color buffer is copied. When copying the depth
* or stencil buffers the extension on GLES2.0 only supports copying
* the full buffer which would be awkward to document with this
* API. If we wanted to support that feature it may be better to have
* a separate function to copy the entire buffer for a given mask.
*/
void
_cogl_blit_framebuffer (CoglFramebuffer *src,
CoglFramebuffer *dest,
int src_x,
int src_y,
int dst_x,
int dst_y,
int width,
int height);
void void
_cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer); _cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer);

View File

@@ -4,6 +4,7 @@
* A Low Level GPU Graphics and Utilities API * A Low Level GPU Graphics and Utilities API
* *
* Copyright (C) 2007,2008,2009,2012 Intel Corporation. * Copyright (C) 2007,2008,2009,2012 Intel Corporation.
* Copyright (C) 2019 DisplayLink (UK) Ltd.
* *
* Permission is hereby granted, free of charge, to any person * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation
@@ -1315,7 +1316,7 @@ cogl_framebuffer_read_pixels (CoglFramebuffer *framebuffer,
CoglPixelFormat format, CoglPixelFormat format,
uint8_t *pixels) uint8_t *pixels)
{ {
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (format); int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
CoglBitmap *bitmap; CoglBitmap *bitmap;
gboolean ret; gboolean ret;
@@ -1340,28 +1341,38 @@ cogl_framebuffer_read_pixels (CoglFramebuffer *framebuffer,
return ret; return ret;
} }
void gboolean
_cogl_blit_framebuffer (CoglFramebuffer *src, cogl_blit_framebuffer (CoglFramebuffer *src,
CoglFramebuffer *dest, CoglFramebuffer *dest,
int src_x, int src_x,
int src_y, int src_y,
int dst_x, int dst_x,
int dst_y, int dst_y,
int width, int width,
int height) int height,
GError **error)
{ {
CoglContext *ctx = src->context; CoglContext *ctx = src->context;
int src_x1, src_y1, src_x2, src_y2;
int dst_x1, dst_y1, dst_x2, dst_y2;
g_return_if_fail (_cogl_has_private_feature if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER))
(ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT)); {
g_set_error_literal (error, COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Cogl BLIT_FRAMEBUFFER is not supported by the system.");
return FALSE;
}
/* We can only support blitting between offscreen buffers because /* The buffers must use the same premult convention */
otherwise we would need to mirror the image and GLES2.0 doesn't if ((src->internal_format & COGL_PREMULT_BIT) !=
support this */ (dest->internal_format & COGL_PREMULT_BIT))
g_return_if_fail (cogl_is_offscreen (src)); {
g_return_if_fail (cogl_is_offscreen (dest)); g_set_error_literal (error, COGL_SYSTEM_ERROR,
/* The buffers must be the same format */ COGL_SYSTEM_ERROR_UNSUPPORTED,
g_return_if_fail (src->internal_format == dest->internal_format); "cogl_blit_framebuffer premult mismatch.");
return FALSE;
}
/* Make sure the current framebuffers are bound. We explicitly avoid /* Make sure the current framebuffers are bound. We explicitly avoid
flushing the clip state so we can bind our own empty state */ flushing the clip state so we can bind our own empty state */
@@ -1382,12 +1393,45 @@ _cogl_blit_framebuffer (CoglFramebuffer *src,
* as changed */ * as changed */
ctx->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP; ctx->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP;
ctx->glBlitFramebuffer (src_x, src_y, /* Offscreens we do the normal way, onscreens need an y-flip. Even if
src_x + width, src_y + height, * we consider offscreens to be rendered upside-down, the offscreen
dst_x, dst_y, * orientation is in this function's API. */
dst_x + width, dst_y + height, if (cogl_is_offscreen (src))
{
src_x1 = src_x;
src_y1 = src_y;
src_x2 = src_x + width;
src_y2 = src_y + height;
}
else
{
src_x1 = src_x;
src_y1 = cogl_framebuffer_get_height (src) - src_y;
src_x2 = src_x + width;
src_y2 = src_y1 - height;
}
if (cogl_is_offscreen (dest))
{
dst_x1 = dst_x;
dst_y1 = dst_y;
dst_x2 = dst_x + width;
dst_y2 = dst_y + height;
}
else
{
dst_x1 = dst_x;
dst_y1 = cogl_framebuffer_get_height (dest) - dst_y;
dst_x2 = dst_x + width;
dst_y2 = dst_y1 - height;
}
ctx->glBlitFramebuffer (src_x1, src_y1, src_x2, src_y2,
dst_x1, dst_y1, dst_x2, dst_y2,
GL_COLOR_BUFFER_BIT, GL_COLOR_BUFFER_BIT,
GL_NEAREST); GL_NEAREST);
return TRUE;
} }
void void

View File

@@ -3,7 +3,8 @@
* *
* A Low Level GPU Graphics and Utilities API * A Low Level GPU Graphics and Utilities API
* *
* Copyright (C) 2011 Intel Corporation. * Copyright (C) 2007,2008,2009,2011 Intel Corporation.
* Copyright (C) 2019 DisplayLink (UK) Ltd.
* *
* Permission is hereby granted, free of charge, to any person * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation
@@ -1797,6 +1798,69 @@ typedef enum /*< prefix=COGL_FRAMEBUFFER_ERROR >*/
gboolean gboolean
cogl_is_framebuffer (void *object); cogl_is_framebuffer (void *object);
/**
* cogl_blit_framebuffer:
* @src: The source #CoglFramebuffer
* @dest: The destination #CoglFramebuffer
* @src_x: Source x position
* @src_y: Source y position
* @dst_x: Destination x position
* @dst_y: Destination y position
* @width: Width of region to copy
* @height: Height of region to copy
* @error: optional error object
*
* @return FALSE for an immediately detected error, TRUE otherwise.
*
* This blits a region of the color buffer of the source buffer
* to the destination buffer. This function should only be
* called if the COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER feature is
* advertised.
*
* The source and destination rectangles are defined in offscreen
* framebuffer orientation. When copying between an offscreen and
* onscreen framebuffers, the image is y-flipped accordingly.
*
* The two buffers must have the same value types (e.g. floating-point,
* unsigned int, signed int, or fixed-point), but color formats do not
* need to match. This limitation comes from OpenGL ES 3.0 definition
* of glBlitFramebuffer.
*
* Note that this function differs a lot from the glBlitFramebuffer
* function provided by the GL_EXT_framebuffer_blit extension. Notably
* it doesn't support having different sizes for the source and
* destination rectangle. This doesn't seem
* like a particularly useful feature. If the application wanted to
* scale the results it may make more sense to draw a primitive
* instead.
*
* The GL function is documented to be affected by the scissor. This
* function therefore ensure that an empty clip stack is flushed
* before performing the blit which means the scissor is effectively
* ignored.
*
* The function also doesn't support specifying the buffers to copy
* and instead only the color buffer is copied. When copying the depth
* or stencil buffers the extension on GLES2.0 only supports copying
* the full buffer which would be awkward to document with this
* API. If we wanted to support that feature it may be better to have
* a separate function to copy the entire buffer for a given mask.
*
* The @c error argument is optional, it can be NULL. If it is not NULL
* and this function returns FALSE, an error object with a code from
* COGL_SYSTEM_ERROR will be created.
*/
gboolean
cogl_blit_framebuffer (CoglFramebuffer *src,
CoglFramebuffer *dest,
int src_x,
int src_y,
int dst_x,
int dst_y,
int width,
int height,
GError **error);
G_END_DECLS G_END_DECLS
#endif /* __COGL_FRAMEBUFFER_H */ #endif /* __COGL_FRAMEBUFFER_H */

View File

@@ -297,8 +297,8 @@ copy_flipped_texture (CoglGLES2Context *gles2_ctx,
internal_format = COGL_PIXEL_FORMAT_A_8; internal_format = COGL_PIXEL_FORMAT_A_8;
break; break;
case GL_RED: case GL_LUMINANCE:
internal_format = COGL_PIXEL_FORMAT_R_8; internal_format = COGL_PIXEL_FORMAT_G_8;
break; break;
default: default:

View File

@@ -1,157 +0,0 @@
/*
* Authored By Niels De Graef <niels.degraef@barco.com>
*
* Copyright (C) 2018 Barco NV
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "cogl-config.h"
#include "cogl-object-private.h"
#include "cogl-multi-plane-texture.h"
#include "cogl-gtype-private.h"
#include "cogl-texture-private.h"
#include "cogl-texture-2d-sliced.h"
struct _CoglMultiPlaneTexture
{
CoglObject _parent;
CoglPixelFormat format;
uint8_t n_planes;
CoglTexture **planes;
};
static void
_cogl_multi_plane_texture_free (CoglMultiPlaneTexture *self);
COGL_OBJECT_DEFINE (MultiPlaneTexture, multi_plane_texture);
COGL_GTYPE_DEFINE_CLASS (MultiPlaneTexture, multi_plane_texture);
CoglPixelFormat
cogl_multi_plane_texture_get_format (CoglMultiPlaneTexture *self)
{
return self->format;
}
uint8_t
cogl_multi_plane_texture_get_n_planes (CoglMultiPlaneTexture *self)
{
return self->n_planes;
}
CoglTexture *
cogl_multi_plane_texture_get_plane (CoglMultiPlaneTexture *self, guint index)
{
g_return_val_if_fail (self->n_planes > 0, NULL);
g_return_val_if_fail (index < self->n_planes, NULL);
return self->planes[index];
}
CoglTexture **
cogl_multi_plane_texture_get_planes (CoglMultiPlaneTexture *self)
{
return self->planes;
}
guint
cogl_multi_plane_texture_get_width (CoglMultiPlaneTexture *self)
{
g_return_val_if_fail (self->n_planes > 0, 0);
return cogl_texture_get_width (self->planes[0]);
}
guint
cogl_multi_plane_texture_get_height (CoglMultiPlaneTexture *self)
{
g_return_val_if_fail (self->n_planes > 0, 0);
return cogl_texture_get_height (self->planes[0]);
}
static void
_cogl_multi_plane_texture_free (CoglMultiPlaneTexture *self)
{
uint8_t i = 0;
for (i = 0; i < self->n_planes; i++)
cogl_object_unref (self->planes[i]);
g_free (self->planes);
}
CoglMultiPlaneTexture *
cogl_multi_plane_texture_new (CoglPixelFormat format,
CoglTexture **planes, uint8_t n_planes)
{
CoglMultiPlaneTexture *self = g_slice_new0 (CoglMultiPlaneTexture);
_cogl_multi_plane_texture_object_new (self);
self->format = format;
self->n_planes = n_planes;
self->planes = planes;
return self;
}
CoglMultiPlaneTexture *
cogl_multi_plane_texture_new_single_plane (CoglPixelFormat format,
CoglTexture *plane)
{
CoglMultiPlaneTexture *self = g_slice_new0 (CoglMultiPlaneTexture);
_cogl_multi_plane_texture_object_new (self);
self->format = format;
self->n_planes = 1;
self->planes = g_malloc (sizeof (CoglTexture *));
self->planes[0] = plane;
return self;
}
char *
cogl_multi_plane_texture_to_string (CoglMultiPlaneTexture *self)
{
g_autoptr(GString) str = NULL;
g_autofree char *ret = NULL;
uint8_t i;
str = g_string_new ("");
g_string_append_printf (str, "CoglMultiPlaneTexture (%p) {\n", self);
g_string_append_printf (str, " .format = %s;\n", cogl_pixel_format_to_string (self->format));
g_string_append_printf (str, " .n_planes = %u;\n", self->n_planes);
g_string_append (str, " .planes = {\n");
for (i = 0; i < self->n_planes; i++)
{
CoglTexture *plane = self->planes[i];
g_string_append_printf (str, " (%p) { .format = %s },\n",
plane,
cogl_pixel_format_to_string (_cogl_texture_get_format (plane)));
}
g_string_append (str, " }\n");
g_string_append (str, "}");
ret = g_string_free (g_steal_pointer (&str), FALSE);
return g_steal_pointer (&ret);
}

View File

@@ -1,187 +0,0 @@
/*
* Authored By Niels De Graef <niels.degraef@barco.com>
*
* Copyright (C) 2018 Barco NV
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef __COGL_MULTI_PLANE_TEXTURE_H__
#define __COGL_MULTI_PLANE_TEXTURE_H__
#include "cogl/cogl-texture.h"
G_BEGIN_DECLS
/**
* SECTION:cogl-multi-plane-texture
* @title: CoglMultiPlaneTexture
* @short_description: A non-primitive texture that can have multiple planes.
*
* #CoglMultiPlaneTexture allows one to deal with non-trivial formats that
* have multiple planes, requires subsampling and/or aren't in RGB. A common
* example of this are decoded video frames, which often use something in the
* YUV colorspace, combined with subsampling.
*
* The basic idea of a #CoglMultiPlaneTexture is the following:
* - Each plane is represented by a separate #CoglTexture. That means that you
* should add each of these planes as a layer to your CoglPipeline.
* - When dealing with a color space that is not RGB, you can ask the
* #CoglMultiPlaneTexture to create a shader for you that does the conversion
* in the GPU.
* - In case you need to deal with memory access in a format with subsampling,
* you can use cogl_multi_plane_texture_get_width() and its analogous version
* for the height to get the correct size of the texture.
*/
typedef struct _CoglMultiPlaneTexture CoglMultiPlaneTexture;
#define COGL_MULTI_PLANE_TEXTURE(tex) ((CoglMultiPlaneTexture *) tex)
/**
* cogl_multi_plane_texture_get_gtype:
*
* Returns: a #GType that can be used with the GLib type system.
*/
GType cogl_multi_plane_texture_get_gtype (void);
/**
* cogl_is_multi_plane_texture:
* @object: A #CoglObject pointer
*
* Gets whether the given @object references an existing CoglMultiPlaneTexture.
*
* Return value: %TRUE if the @object references a #CoglMultiPlaneTexture,
* %FALSE otherwise
*/
gboolean
cogl_is_multi_plane_texture (void *object);
/**
* cogl_multi_plane_texture_new:
* @format: The format of the #CoglMultiPlaneTexture
* @planes: (transfer full): The actual planes of the texture
* @n_planes: The number of planes
*
* Creates a #CoglMultiPlaneTexture with the given @format. Each of the
* #CoglTexture<!-- -->s represents a plane.
*
* Returns: (transfer full): A new #CoglMultiPlaneTexture. Use
* cogl_object_unref() when you're done with it.
*/
CoglMultiPlaneTexture * cogl_multi_plane_texture_new (CoglPixelFormat format,
CoglTexture **planes,
uint8_t n_planes);
/**
* cogl_multi_plane_texture_new_single_plane:
* @format: The format of the #CoglMultiPlaneTexture
* @plane: (transfer full): The actual planes of the texture
*
* Creates a #CoglMultiPlaneTexture for a "simple" texture, i.e. with only one
* plane.
*
* Returns: (transfer full): A new #CoglMultiPlaneTexture. Use
* cogl_object_unref() when you're done with it.
*/
CoglMultiPlaneTexture * cogl_multi_plane_texture_new_single_plane (CoglPixelFormat format,
CoglTexture *plane);
/**
* cogl_multi_plane_texture_get_format:
* @self: a #CoglMultiPlaneTexture
*
* Returns the pixel format that is used by this texture.
*
* Returns: The pixel format that is used by this #CoglMultiPlaneTexture.
*/
CoglPixelFormat cogl_multi_plane_texture_get_format (CoglMultiPlaneTexture *self);
/**
* cogl_multi_plane_texture_get_n_planes:
* @self: a #CoglMultiPlaneTexture
*
* Returns the number of planes for this texture. Note that this is entirely
* dependent on the #CoglPixelFormat that is used. For example, simple RGB
* textures will have a single plane, while some more convoluted formats like
* NV12 and YUV 4:4:4 can have 2 and 3 planes respectively.
*
* Returns: The number of planes in this #CoglMultiPlaneTexture.
*/
uint8_t cogl_multi_plane_texture_get_n_planes (CoglMultiPlaneTexture *self);
/**
* cogl_multi_plane_texture_get_plane:
* @self: a #CoglMultiPlaneTexture
* @index: the index of the plane
*
* Returns the n'th plane of the #CoglMultiPlaneTexture. Note that it is a
* programming error to use with an index larger than
* cogl_multi_plane_texture_get_n_planes().
*
* Returns: (transfer none): The plane at the given @index.
*/
CoglTexture * cogl_multi_plane_texture_get_plane (CoglMultiPlaneTexture *self,
guint index);
/**
* cogl_multi_plane_texture_get_planes:
* @self: a #CoglMultiPlaneTexture
*
* Returns all planes of the #CoglMultiPlaneTexture.
*
* Returns: (transfer none): The planes of this texture.
*/
CoglTexture ** cogl_multi_plane_texture_get_planes (CoglMultiPlaneTexture *self);
/**
* cogl_multi_plane_texture_get_width:
* @self: a #CoglMultiPlaneTexture
*
* Returns the width of the #CoglMultiPlaneTexture. Prefer this over calling
* cogl_texture_get_width() on one of the textures, as that might give a
* different size when dealing with subsampling.
*
* Returns: The width of the texture.
*/
guint cogl_multi_plane_texture_get_width (CoglMultiPlaneTexture *self);
/**
* cogl_multi_plane_texture_get_height:
* @self: a #CoglMultiPlaneTexture
*
* Returns the height of the #CoglMultiPlaneTexture. Prefer this over calling
* cogl_texture_get_height() on one of the textures, as that might give a
* different size when dealing with subsampling.
*
* Returns: The height of the texture.
*/
guint cogl_multi_plane_texture_get_height (CoglMultiPlaneTexture *self);
/**
* cogl_multi_plane_texture_to_string:
* @self: a #CoglMultiPlaneTexture
*
* Returns a string representation of @self, useful for debugging purposes.
*
* Returns: (transfer full): A string representation of @self. Use g_free() when
* done with it.
*/
char * cogl_multi_plane_texture_to_string (CoglMultiPlaneTexture *self);
G_END_DECLS
#endif

View File

@@ -1,182 +0,0 @@
/*
* Authored By Niels De Graef <niels.degraef@barco.com>
*
* Copyright (C) 2018 Barco NV
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "cogl-config.h"
#include "cogl-object-private.h"
#include "cogl-gtype-private.h"
#include "cogl-pixel-format-conversion.h"
#include "cogl-snippet.h"
#include "cogl-pipeline-layer-state.h"
#include "cogl-pipeline-state.h"
#define _COGL_YUV_TO_RGBA(res, y, u, v) \
"vec4 " res ";\n" \
res ".r = (" y ") + 1.59765625 * (" v ");\n" \
res ".g = (" y ") - 0.390625 * (" u ") - 0.8125 * (" v ");\n" \
res ".b = (" y ") + 2.015625 * (" u ");\n" \
res ".a = 1.0;\n"
/* Shader for a single YUV plane */
static const char yuv_to_rgba_shader[] =
"vec4\n"
"cogl_yuv_to_rgba (vec2 UV)\n"
"{\n"
" vec4 orig_color = texture2D(cogl_sampler0, UV);\n"
" float y = 1.16438356 * (orig_color.r - 0.0625);\n"
" float u = orig_color.g - 0.5;\n"
" float v = orig_color.b - 0.5;\n"
_COGL_YUV_TO_RGBA ("color", "y", "u", "v")
" return color;\n"
"}\n";
/* Shader for 1 Y-plane and 1 UV-plane */
static const char y_uv_to_rgba_shader[] =
"vec4\n"
"cogl_y_uv_to_rgba (vec2 UV)\n"
"{\n"
" float y = 1.1640625 * (texture2D (cogl_sampler0, UV).x - 0.0625);\n"
" vec2 uv = texture2D (cogl_sampler1, UV).rg;\n"
" uv -= 0.5;\n"
" float u = uv.x;\n"
" float v = uv.y;\n"
_COGL_YUV_TO_RGBA ("color", "y", "u", "v")
" return color;\n"
"}\n";
/* Shader for 1 Y-plane, 1 U-plane and 1 V-plane */
static const char y_u_v_to_rgba_shader[] =
"vec4\n"
"cogl_y_u_v_to_rgba (vec2 UV)\n"
"{\n"
" float y = 1.16438356 * (texture2D(cogl_sampler0, UV).x - 0.0625);\n"
" float u = texture2D(cogl_sampler1, UV).x - 0.5;\n"
" float v = texture2D(cogl_sampler2, UV).x - 0.5;\n"
_COGL_YUV_TO_RGBA ("color", "y", "u", "v")
" return color;\n"
"}\n";
struct _CoglPixelFormatConversion
{
CoglObject _parent;
CoglSnippet *vertex_declaration_snippet;
CoglSnippet *fragment_declaration_snippet;
CoglSnippet *fragment_execution_snippet;
};
static void
_cogl_pixel_format_conversion_free (CoglPixelFormatConversion *self);
COGL_OBJECT_DEFINE (PixelFormatConversion, pixel_format_conversion);
COGL_GTYPE_DEFINE_CLASS (PixelFormatConversion, pixel_format_conversion);
void
cogl_pixel_format_conversion_attach_to_pipeline (CoglPixelFormatConversion *self,
CoglPipeline *pipeline,
gint layer)
{
cogl_pipeline_add_snippet (pipeline, self->fragment_declaration_snippet);
cogl_pipeline_add_snippet (pipeline, self->vertex_declaration_snippet);
cogl_pipeline_add_layer_snippet (pipeline,
layer,
self->fragment_execution_snippet);
}
static gboolean
get_cogl_snippets (CoglPixelFormat format,
CoglSnippet **vertex_snippet_out,
CoglSnippet **fragment_snippet_out,
CoglSnippet **layer_snippet_out)
{
const char *global_hook;
const char *layer_hook;
switch (format)
{
case COGL_PIXEL_FORMAT_AYUV:
global_hook = yuv_to_rgba_shader;
layer_hook = "cogl_layer = cogl_yuv_to_rgba(cogl_tex_coord0_in.st);\n";
break;
case COGL_PIXEL_FORMAT_NV12:
/* XXX are we using Y_UV or Y_xUxV? Maybe check for RG support? */
global_hook = y_uv_to_rgba_shader;
layer_hook = "cogl_layer = cogl_y_uv_to_rgba(cogl_tex_coord0_in.st);\n";
break;
case COGL_PIXEL_FORMAT_YUV444:
case COGL_PIXEL_FORMAT_YUV422:
global_hook = y_u_v_to_rgba_shader;
layer_hook = "cogl_layer = cogl_y_u_v_to_rgba(cogl_tex_coord0_in.st);\n";
break;
default:
*vertex_snippet_out = NULL;
*fragment_snippet_out = NULL;
*layer_snippet_out = NULL;
return FALSE;
}
*vertex_snippet_out = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX_GLOBALS,
global_hook,
NULL);
*fragment_snippet_out = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT_GLOBALS,
global_hook,
NULL);
*layer_snippet_out = cogl_snippet_new (COGL_SNIPPET_HOOK_LAYER_FRAGMENT,
NULL,
layer_hook);
return TRUE;
}
static void
_cogl_pixel_format_conversion_free (CoglPixelFormatConversion *self)
{
cogl_clear_object (&self->vertex_declaration_snippet);
cogl_clear_object (&self->fragment_declaration_snippet);
cogl_clear_object (&self->fragment_execution_snippet);
}
CoglPixelFormatConversion *
cogl_pixel_format_conversion_new (CoglPixelFormat format)
{
CoglPixelFormatConversion *self;
CoglSnippet *vertex_declaration_snippet;
CoglSnippet *fragment_declaration_snippet;
CoglSnippet *fragment_execution_snippet;
if (!get_cogl_snippets (format,
&vertex_declaration_snippet,
&fragment_declaration_snippet,
&fragment_execution_snippet))
return NULL;
self = g_slice_new0 (CoglPixelFormatConversion);
_cogl_pixel_format_conversion_object_new (self);
self->vertex_declaration_snippet = vertex_declaration_snippet;
self->fragment_declaration_snippet = fragment_declaration_snippet;
self->fragment_execution_snippet = fragment_execution_snippet;
return self;
}

View File

@@ -1,92 +0,0 @@
/*
* Authored By Niels De Graef <niels.degraef@barco.com>
*
* Copyright (C) 2018 Barco NV
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef __COGL_PIXEL_FORMAT_CONVERSION_H__
#define __COGL_PIXEL_FORMAT_CONVERSION_H__
#include "cogl/cogl-types.h"
#include "cogl/cogl-pipeline.h"
G_BEGIN_DECLS
/**
* SECTION:cogl-color-space-conversion
* @title: CoglPixelFormatConversion
* @short_description: A collection of snippets to handle pixel_format conversion
*
* In some use cases, one might generate non-RGBA textures (e.g. YUV), which is
* problematic if you then have to composite them in to an RGBA framebuffer. In
* comes #CoglPixelFormatConversion, which you can attach to a #CoglPipeline to
* do this all for you. Internally, it consists of nothing more than a
* collection of #CoglSnippets which do the right thing for you.
*/
typedef struct _CoglPixelFormatConversion CoglPixelFormatConversion;
#define COGL_PIXEL_FORMAT_CONVERSION(ptr) ((CoglPixelFormatConversion *) ptr)
/**
* cogl_multiplane_texture_get_gtype:
*
* Returns: a #GType that can be used with the GLib type system.
*/
GType cogl_pixel_format_conversion_get_gtype (void);
/*
* cogl_is_pixel_format_conversion:
* @object: A #CoglObject pointer
*
* Gets whether the given @object references an existing
* CoglPixelFormatConversion.
*
* Return value: %TRUE if the @object references a #CoglPixelFormatConversion,
* %FALSE otherwise
*/
gboolean
cogl_is_pixel_format_conversion (void *object);
/**
* cogl_pixel_format_conversion_new:
* @format: The input format
*
* Creates a #CoglPixelFormatConversion to convert the given @formatro RGBA. If
* no such conversion is needed, it will return %NULL.
*
* Returns: (transfer full) (nullable): A new #CoglPixelFormatConversion, or
* %NULL if none is needed.
*/
CoglPixelFormatConversion * cogl_pixel_format_conversion_new (CoglPixelFormat format);
/**
* cogl_pixel_format_conversion_attach_to_pipeline:
* @self: The #CoglPixelFormatConversion you want to add
* @pipeline: The #CoglPipeline which needs the color conversion
* @layer: The layer you want to perform the color space conversion at
*
* Adds color conversion to the given @pipeline at the given @layer.
*/
void cogl_pixel_format_conversion_attach_to_pipeline (CoglPixelFormatConversion *self,
CoglPipeline *pipeline,
int layer);
G_END_DECLS
#endif

View File

@@ -35,667 +35,241 @@
#include <stdlib.h> #include <stdlib.h>
#include "cogl-pixel-format.h" #include "cogl-pixel-format.h"
#include "cogl-texture.h"
/* An entry to map CoglPixelFormats to their respective properties */ /* An entry to map CoglPixelFormats to their respective properties */
typedef struct _CoglPixelFormatInfo typedef struct _CoglPixelFormatInfo
{ {
CoglPixelFormat cogl_format; CoglPixelFormat cogl_format;
const char *format_str; const char *format_str;
int aligned; /* Is aligned? (bool; -1 if n/a) */ int bpp; /* Bytes per pixel */
uint8_t n_planes; int aligned; /* Aligned components? (-1 if n/a) */
/* Per plane-information */
uint8_t bpp[COGL_PIXEL_FORMAT_MAX_PLANES]; /* Bytes per pixel */
uint8_t hsub[COGL_PIXEL_FORMAT_MAX_PLANES]; /* horizontal subsampling */
uint8_t vsub[COGL_PIXEL_FORMAT_MAX_PLANES]; /* vertical subsampling */
CoglPixelFormat subformats[COGL_PIXEL_FORMAT_MAX_PLANES]; /* how to upload to GL */
} CoglPixelFormatInfo; } CoglPixelFormatInfo;
static const CoglPixelFormatInfo format_info_table[] = { static const CoglPixelFormatInfo format_info_table[] = {
{ {
.cogl_format = COGL_PIXEL_FORMAT_ANY, .cogl_format = COGL_PIXEL_FORMAT_ANY,
.format_str = "ANY", .format_str = "ANY",
.n_planes = 0, .bpp = 0,
.aligned = -1, .aligned = -1
.bpp = { 0 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_ANY }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_A_8, .cogl_format = COGL_PIXEL_FORMAT_A_8,
.format_str = "A_8", .format_str = "A_8",
.n_planes = 1, .bpp = 1,
.aligned = 1, .aligned = 1
.bpp = { 1 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_A_8 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_RGB_565, .cogl_format = COGL_PIXEL_FORMAT_RGB_565,
.format_str = "RGB_565", .format_str = "RGB_565",
.n_planes = 1, .bpp = 2,
.aligned = 0, .aligned = 0
.bpp = { 2 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGB_565 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_RGBA_4444, .cogl_format = COGL_PIXEL_FORMAT_RGBA_4444,
.format_str = "RGBA_4444", .format_str = "RGBA_4444",
.n_planes = 1, .bpp = 2,
.aligned = 0, .aligned = 0
.bpp = { 2 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGBA_4444 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_RGBA_5551, .cogl_format = COGL_PIXEL_FORMAT_RGBA_5551,
.format_str = "RGBA_5551", .format_str = "RGBA_5551",
.n_planes = 1, .bpp = 2,
.aligned = 0, .aligned = 0
.bpp = { 2 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGBA_5551 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_YUV, .cogl_format = COGL_PIXEL_FORMAT_YUV,
.format_str = "YUV", .format_str = "YUV",
.n_planes = 1, .bpp = 0,
.aligned = -1, .aligned = -1
.bpp = { 0 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_YUV }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_R_8, .cogl_format = COGL_PIXEL_FORMAT_G_8,
.format_str = "R_8", .format_str = "G_8",
.n_planes = 1, .bpp = 1,
.aligned = 1, .aligned = 1
.bpp = { 1 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_RG_88, .cogl_format = COGL_PIXEL_FORMAT_RG_88,
.format_str = "RG_88", .format_str = "RG_88",
.n_planes = 1, .bpp = 2,
.aligned = 1, .aligned = 1
.bpp = { 2 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RG_88 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_RGB_888, .cogl_format = COGL_PIXEL_FORMAT_RGB_888,
.format_str = "RGB_888", .format_str = "RGB_888",
.n_planes = 1, .bpp = 3,
.aligned = 1, .aligned = 1
.bpp = { 3 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGB_888 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_BGR_888, .cogl_format = COGL_PIXEL_FORMAT_BGR_888,
.format_str = "BGR_888", .format_str = "BGR_888",
.n_planes = 1, .bpp = 3,
.aligned = 1, .aligned = 1
.bpp = { 3 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_BGR_888 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_RGBA_8888, .cogl_format = COGL_PIXEL_FORMAT_RGBA_8888,
.format_str = "RGBA_8888", .format_str = "RGBA_8888",
.n_planes = 1, .bpp = 4,
.aligned = 1, .aligned = 1
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGBA_8888 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_BGRA_8888, .cogl_format = COGL_PIXEL_FORMAT_BGRA_8888,
.format_str = "BGRA_8888", .format_str = "BGRA_8888",
.n_planes = 1, .bpp = 4,
.aligned = 1, .aligned = 1
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_BGRA_8888 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_ARGB_8888, .cogl_format = COGL_PIXEL_FORMAT_ARGB_8888,
.format_str = "ARGB_8888", .format_str = "ARGB_8888",
.n_planes = 1, .bpp = 4,
.aligned = 1, .aligned = 1
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_ARGB_8888 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_ABGR_8888, .cogl_format = COGL_PIXEL_FORMAT_ABGR_8888,
.format_str = "ABGR_8888", .format_str = "ABGR_8888",
.n_planes = 1, .bpp = 4,
.aligned = 1, .aligned = 1
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_ABGR_8888 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_RGBA_1010102, .cogl_format = COGL_PIXEL_FORMAT_RGBA_1010102,
.format_str = "RGBA_1010102", .format_str = "RGBA_1010102",
.n_planes = 1, .bpp = 4,
.aligned = 0, .aligned = 0
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGBA_1010102 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_BGRA_1010102, .cogl_format = COGL_PIXEL_FORMAT_BGRA_1010102,
.format_str = "BGRA_1010102", .format_str = "BGRA_1010102",
.n_planes = 1, .bpp = 4,
.aligned = 0, .aligned = 0
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_BGRA_1010102 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010, .cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010,
.format_str = "ARGB_2101010", .format_str = "ARGB_2101010",
.n_planes = 1, .bpp = 4,
.aligned = 0, .aligned = 0
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_ARGB_2101010 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_ABGR_2101010, .cogl_format = COGL_PIXEL_FORMAT_ABGR_2101010,
.format_str = "ABGR_2101010", .format_str = "ABGR_2101010",
.n_planes = 1, .bpp = 4,
.aligned = 0, .aligned = 0
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_ABGR_2101010 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE, .cogl_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE,
.format_str = "RGBA_8888_PRE", .format_str = "RGBA_8888_PRE",
.n_planes = 1, .bpp = 4,
.aligned = 1, .aligned = 1
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGBA_8888_PRE }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_BGRA_8888_PRE, .cogl_format = COGL_PIXEL_FORMAT_BGRA_8888_PRE,
.format_str = "BGRA_8888_PRE", .format_str = "BGRA_8888_PRE",
.n_planes = 1, .bpp = 4,
.aligned = 1, .aligned = 1
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_BGRA_8888_PRE }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_ARGB_8888_PRE, .cogl_format = COGL_PIXEL_FORMAT_ARGB_8888_PRE,
.format_str = "ARGB_8888_PRE", .format_str = "ARGB_8888_PRE",
.n_planes = 1, .bpp = 4,
.aligned = 1, .aligned = 1
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_ARGB_8888_PRE }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_ABGR_8888_PRE, .cogl_format = COGL_PIXEL_FORMAT_ABGR_8888_PRE,
.format_str = "ABGR_8888_PRE", .format_str = "ABGR_8888_PRE",
.n_planes = 1, .bpp = 4,
.aligned = 1, .aligned = 1
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_ABGR_8888_PRE }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_RGBA_4444_PRE, .cogl_format = COGL_PIXEL_FORMAT_RGBA_4444_PRE,
.format_str = "RGBA_4444_PRE", .format_str = "RGBA_4444_PRE",
.n_planes = 1, .bpp = 2,
.aligned = 0, .aligned = 0
.bpp = { 2 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGBA_4444_PRE }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_RGBA_5551_PRE, .cogl_format = COGL_PIXEL_FORMAT_RGBA_5551_PRE,
.format_str = "RGBA_5551_PRE", .format_str = "RGBA_5551_PRE",
.n_planes = 1, .bpp = 2,
.aligned = 0, .aligned = 0
.bpp = { 2 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGBA_5551_PRE }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_RGBA_1010102_PRE, .cogl_format = COGL_PIXEL_FORMAT_RGBA_1010102_PRE,
.format_str = "RGBA_1010102_PRE", .format_str = "RGBA_1010102_PRE",
.n_planes = 1, .bpp = 4,
.aligned = 0, .aligned = 0
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGBA_1010102_PRE }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_BGRA_1010102_PRE, .cogl_format = COGL_PIXEL_FORMAT_BGRA_1010102_PRE,
.format_str = "BGRA_1010102_PRE", .format_str = "BGRA_1010102_PRE",
.n_planes = 1, .bpp = 4,
.aligned = 0, .aligned = 0
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_BGRA_1010102_PRE }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010_PRE, .cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010_PRE,
.format_str = "ARGB_2101010_PRE", .format_str = "ARGB_2101010_PRE",
.n_planes = 1, .bpp = 4,
.aligned = 0, .aligned = 0
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_ARGB_2101010_PRE }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_ABGR_2101010_PRE, .cogl_format = COGL_PIXEL_FORMAT_ABGR_2101010_PRE,
.format_str = "ABGR_2101010_PRE", .format_str = "ABGR_2101010_PRE",
.n_planes = 1, .bpp = 4,
.aligned = 0, .aligned = 0
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_ABGR_2101010_PRE }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_DEPTH_16, .cogl_format = COGL_PIXEL_FORMAT_DEPTH_16,
.format_str = "DEPTH_16", .format_str = "DEPTH_16",
.n_planes = 1, .bpp = 2,
.aligned = 1, .aligned = 1
.bpp = { 2 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_DEPTH_16 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_DEPTH_32, .cogl_format = COGL_PIXEL_FORMAT_DEPTH_32,
.format_str = "DEPTH_32", .format_str = "DEPTH_32",
.n_planes = 1, .bpp = 4,
.aligned = 1, .aligned = 1
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_DEPTH_32 }
}, },
{ {
.cogl_format = COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8, .cogl_format = COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8,
.format_str = "DEPTH_24_STENCIL_8", .format_str = "DEPTH_24_STENCIL_8",
.n_planes = 1, .bpp = 4,
.aligned = 1, .aligned = 1
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8 }
},
/* Packed YUV */
{
.cogl_format = COGL_PIXEL_FORMAT_YUYV,
.format_str = "YUYV",
.n_planes = 2,
.aligned = 0,
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_YUYV, COGL_PIXEL_FORMAT_YUYV }
},
{
.cogl_format = COGL_PIXEL_FORMAT_YVYU,
.format_str = "YVYU",
.n_planes = 2,
.aligned = 0,
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_YVYU, COGL_PIXEL_FORMAT_YVYU }
},
{
.cogl_format = COGL_PIXEL_FORMAT_UYVY,
.format_str = "UYVY",
.n_planes = 2,
.aligned = 0,
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_UYVY, COGL_PIXEL_FORMAT_UYVY }
},
{
.cogl_format = COGL_PIXEL_FORMAT_VYUY,
.format_str = "VYUY",
.n_planes = 2,
.aligned = 0,
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_VYUY, COGL_PIXEL_FORMAT_VYUY }
},
{
.cogl_format = COGL_PIXEL_FORMAT_AYUV,
.format_str = "AYUV",
.n_planes = 2,
.aligned = 0,
.bpp = { 4 },
.hsub = { 1, 0, 0, 0 },
.vsub = { 1, 0, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_AYUV, COGL_PIXEL_FORMAT_AYUV }
},
/* 2 plane RGB + A */
{
.cogl_format = COGL_PIXEL_FORMAT_XRGB8888_A8,
.format_str = "XRGB8888_A8",
.n_planes = 2,
.aligned = 0,
.bpp = { 4, 1 },
.hsub = { 1, 1, 0, 0 },
.vsub = { 1, 1, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_ARGB_8888, COGL_PIXEL_FORMAT_A_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_XBGR8888_A8,
.format_str = "XBGR8888_A8",
.n_planes = 2,
.aligned = 0,
.bpp = { 4, 1 },
.hsub = { 1, 1, 0, 0 },
.vsub = { 1, 1, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_ABGR_8888, COGL_PIXEL_FORMAT_A_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_RGBX8888_A8,
.format_str = "RGBX8888_A8",
.n_planes = 2,
.aligned = 0,
.bpp = { 4, 1 },
.hsub = { 1, 1, 0, 0 },
.vsub = { 1, 1, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGBA_8888, COGL_PIXEL_FORMAT_A_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_BGRX8888_A8,
.format_str = "BGRX8888_A8",
.n_planes = 2,
.aligned = 0,
.bpp = { 4, 1 },
.hsub = { 1, 1, 0, 0 },
.vsub = { 1, 1, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_BGRA_8888, COGL_PIXEL_FORMAT_A_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_RGB888_A8,
.format_str = "RGB888_A8",
.n_planes = 2,
.aligned = 0,
.bpp = { 3, 1 },
.hsub = { 1, 1, 0, 0 },
.vsub = { 1, 1, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGB_888, COGL_PIXEL_FORMAT_A_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_BGR888_A8,
.format_str = "BGR888_A8",
.n_planes = 2,
.aligned = 0,
.bpp = { 3, 1 },
.hsub = { 1, 1, 0, 0 },
.vsub = { 1, 1, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_BGR_888, COGL_PIXEL_FORMAT_A_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_RGB565_A8,
.format_str = "RGB565_A8",
.n_planes = 2,
.aligned = 0,
.bpp = { 2, 1 },
.hsub = { 1, 1, 0, 0 },
.vsub = { 1, 1, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGB_565, COGL_PIXEL_FORMAT_A_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_BGR565_A8,
.format_str = "BGR565_A8",
.n_planes = 2,
.aligned = 0,
.bpp = { 2, 1 },
.hsub = { 1, 1, 0, 0 },
.vsub = { 1, 1, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_RGB_565, COGL_PIXEL_FORMAT_A_8 }
},
/* 2 plane YUV */
{
.cogl_format = COGL_PIXEL_FORMAT_NV12,
.format_str = "NV12",
.n_planes = 2,
.aligned = 0,
.bpp = { 1, 2 },
.hsub = { 1, 2, 0, 0 },
.vsub = { 1, 2, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_RG_88 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_NV21,
.format_str = "NV21",
.n_planes = 2,
.aligned = 0,
.bpp = { 1, 2 },
.hsub = { 1, 2, 0, 0 },
.vsub = { 1, 2, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_RG_88 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_NV16,
.format_str = "NV16",
.n_planes = 2,
.aligned = 0,
.bpp = { 1, 2 },
.hsub = { 1, 2, 0, 0 },
.vsub = { 1, 1, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_RG_88 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_NV61,
.format_str = "NV61",
.n_planes = 2,
.aligned = 0,
.bpp = { 1, 2 },
.hsub = { 1, 2, 0, 0 },
.vsub = { 1, 1, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_RG_88 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_NV24,
.format_str = "NV24",
.n_planes = 2,
.aligned = 0,
.bpp = { 1, 2 },
.hsub = { 1, 1, 0, 0 },
.vsub = { 1, 1, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_RG_88 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_NV42,
.format_str = "NV42",
.n_planes = 2,
.aligned = 0,
.bpp = { 1, 2 },
.hsub = { 1, 1, 0, 0 },
.vsub = { 1, 1, 0, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_RG_88 }
},
/* 3 plane YUV */
{
.cogl_format = COGL_PIXEL_FORMAT_YUV410,
.format_str = "YUV410",
.n_planes = 3,
.aligned = 0,
.bpp = { 1, 1, 1 },
.hsub = { 1, 4, 4, 0 },
.vsub = { 1, 4, 4, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_YVU410,
.format_str = "YVU410",
.n_planes = 3,
.aligned = 0,
.bpp = { 1, 1, 1 },
.hsub = { 1, 4, 4, 0 },
.vsub = { 1, 4, 4, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_YUV411,
.format_str = "YUV411",
.n_planes = 3,
.aligned = 0,
.bpp = { 1, 1, 1 },
.hsub = { 1, 4, 4, 0 },
.vsub = { 1, 1, 1, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_YVU411,
.format_str = "YVU411",
.n_planes = 3,
.aligned = 0,
.bpp = { 1, 1, 1 },
.hsub = { 1, 4, 4, 0 },
.vsub = { 1, 1, 1, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_YUV420,
.format_str = "YUV420",
.n_planes = 3,
.aligned = 0,
.bpp = { 1, 1, 1 },
.hsub = { 1, 2, 2, 0 },
.vsub = { 1, 2, 2, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_YVU420,
.format_str = "YVU420",
.n_planes = 3,
.aligned = 0,
.bpp = { 1, 1, 1 },
.hsub = { 1, 2, 2, 0 },
.vsub = { 1, 2, 2, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_YUV422,
.format_str = "YUV422",
.n_planes = 3,
.aligned = 0,
.bpp = { 1, 1, 1 },
.hsub = { 1, 2, 2, 0 },
.vsub = { 1, 1, 1, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_YVU422,
.format_str = "YVU422",
.n_planes = 3,
.aligned = 0,
.bpp = { 1, 1, 1 },
.hsub = { 1, 2, 2, 0 },
.vsub = { 1, 1, 1, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_YUV444,
.format_str = "YUV444",
.n_planes = 3,
.aligned = 0,
.bpp = { 1, 1, 1 },
.hsub = { 1, 1, 1, 0 },
.vsub = { 1, 1, 1, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8 }
},
{
.cogl_format = COGL_PIXEL_FORMAT_YVU444,
.format_str = "YVU444",
.n_planes = 3,
.aligned = 0,
.bpp = { 1, 1, 1 },
.hsub = { 1, 1, 1, 0 },
.vsub = { 1, 1, 1, 0 },
.subformats = { COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8, COGL_PIXEL_FORMAT_R_8 }
}, },
}; };
uint8_t /*
cogl_pixel_format_get_bytes_per_pixel_simple (CoglPixelFormat format) * Returns the number of bytes-per-pixel of a given format. The bpp
* can be extracted from the least significant nibble of the pixel
* format (see CoglPixelFormat).
*
* The mapping is the following (see discussion on bug #660188):
*
* 0 = undefined
* 1, 8 = 1 bpp (e.g. A_8, G_8)
* 2 = 3 bpp, aligned (e.g. 888)
* 3 = 4 bpp, aligned (e.g. 8888)
* 4-6 = 2 bpp, not aligned (e.g. 565, 4444, 5551)
* 7 = undefined yuv
* 9 = 2 bpp, aligned
* 10 = undefined
* 11 = undefined
* 12 = 3 bpp, not aligned
* 13 = 4 bpp, not aligned (e.g. 2101010)
* 14-15 = undefined
*/
int
_cogl_pixel_format_get_bytes_per_pixel (CoglPixelFormat format)
{ {
size_t i; size_t i;
for (i = 0; i < G_N_ELEMENTS (format_info_table); i++) for (i = 0; i < G_N_ELEMENTS (format_info_table); i++)
{ {
if (format_info_table[i].cogl_format == format) if (format_info_table[i].cogl_format == format)
{ return format_info_table[i].bpp;
g_return_val_if_fail (format_info_table[i].n_planes == 1, 0);
return format_info_table[i].bpp[0];
}
}
g_assert_not_reached ();
}
void
cogl_pixel_format_get_bytes_per_pixel (CoglPixelFormat format, uint8_t *bpp_out)
{
size_t i, j;
for (i = 0; i < G_N_ELEMENTS (format_info_table); i++)
{
if (format_info_table[i].cogl_format != format)
continue;
for (j = 0; j < format_info_table[i].n_planes; j++)
bpp_out[j] = format_info_table[i].bpp[j];
return;
} }
g_assert_not_reached (); g_assert_not_reached ();
} }
/* Note: this also refers to the mapping defined above for /* Note: this also refers to the mapping defined above for
* cogl_pixel_format_get_bytes_per_pixel() */ * _cogl_pixel_format_get_bytes_per_pixel() */
gboolean gboolean
_cogl_pixel_format_is_endian_dependant (CoglPixelFormat format) _cogl_pixel_format_is_endian_dependant (CoglPixelFormat format)
{ {
@@ -721,44 +295,6 @@ _cogl_pixel_format_is_endian_dependant (CoglPixelFormat format)
return aligned; return aligned;
} }
uint8_t
cogl_pixel_format_get_n_planes (CoglPixelFormat format)
{
size_t i;
for (i = 0; i < G_N_ELEMENTS (format_info_table); i++)
{
if (format_info_table[i].cogl_format == format)
return format_info_table[i].n_planes;
}
g_assert_not_reached ();
}
void
cogl_pixel_format_get_subsampling_factors (CoglPixelFormat format,
uint8_t *horizontal_factors,
uint8_t *vertical_factors)
{
size_t i, j;
for (i = 0; i < G_N_ELEMENTS (format_info_table); i++)
{
if (format_info_table[i].cogl_format != format)
continue;
for (j = 0; j < format_info_table[i].n_planes; j++)
{
horizontal_factors[j] = format_info_table[i].hsub[j];
vertical_factors[j] = format_info_table[i].vsub[j];
}
return;
}
g_assert_not_reached ();
}
const char * const char *
cogl_pixel_format_to_string (CoglPixelFormat format) cogl_pixel_format_to_string (CoglPixelFormat format)
{ {
@@ -772,51 +308,3 @@ cogl_pixel_format_to_string (CoglPixelFormat format)
g_assert_not_reached (); g_assert_not_reached ();
} }
void
cogl_pixel_format_get_subformats (CoglPixelFormat format,
CoglPixelFormat *formats_out)
{
size_t i, j;
for (i = 0; i < G_N_ELEMENTS (format_info_table); i++)
{
if (format_info_table[i].cogl_format != format)
continue;
for (j = 0; j < format_info_table[i].n_planes; j++)
formats_out[j] = format_info_table[i].subformats[j];
return;
}
g_assert_not_reached ();
}
void
cogl_pixel_format_get_cogl_components (CoglPixelFormat format,
guint *components_out)
{
switch (format)
{
case COGL_PIXEL_FORMAT_NV12:
components_out[0] = COGL_TEXTURE_COMPONENTS_R;
components_out[1] = COGL_TEXTURE_COMPONENTS_RG;
break;
case COGL_PIXEL_FORMAT_NV21:
components_out[0] = COGL_TEXTURE_COMPONENTS_R;
components_out[1] = COGL_TEXTURE_COMPONENTS_RG;
break;
case COGL_PIXEL_FORMAT_YUV422:
components_out[0] = COGL_TEXTURE_COMPONENTS_R;
components_out[1] = COGL_TEXTURE_COMPONENTS_R;
components_out[2] = COGL_TEXTURE_COMPONENTS_R;
break;
case COGL_PIXEL_FORMAT_YUV444:
components_out[0] = COGL_TEXTURE_COMPONENTS_R;
components_out[1] = COGL_TEXTURE_COMPONENTS_R;
components_out[2] = COGL_TEXTURE_COMPONENTS_R;
break;
default:
components_out[0] = COGL_TEXTURE_COMPONENTS_RGBA;
}
}

View File

@@ -95,7 +95,7 @@ G_BEGIN_DECLS
* The mapping is the following (see discussion on bug #660188): * The mapping is the following (see discussion on bug #660188):
* *
* 0 = undefined * 0 = undefined
* 1, 8 = 1 bpp (e.g. A_8, R_8) * 1, 8 = 1 bpp (e.g. A_8, G_8)
* 2 = 3 bpp, aligned (e.g. 888) * 2 = 3 bpp, aligned (e.g. 888)
* 3 = 4 bpp, aligned (e.g. 8888) * 3 = 4 bpp, aligned (e.g. 8888)
* 4-6 = 2 bpp, not aligned (e.g. 565, 4444, 5551) * 4-6 = 2 bpp, not aligned (e.g. 565, 4444, 5551)
@@ -145,8 +145,8 @@ G_BEGIN_DECLS
* @COGL_PIXEL_FORMAT_RGB_565: RGB, 16 bits * @COGL_PIXEL_FORMAT_RGB_565: RGB, 16 bits
* @COGL_PIXEL_FORMAT_RGBA_4444: RGBA, 16 bits * @COGL_PIXEL_FORMAT_RGBA_4444: RGBA, 16 bits
* @COGL_PIXEL_FORMAT_RGBA_5551: RGBA, 16 bits * @COGL_PIXEL_FORMAT_RGBA_5551: RGBA, 16 bits
* @COGL_PIXEL_FORMAT_YUV: Obsolete. See the other YUV-based formats. * @COGL_PIXEL_FORMAT_YUV: Not currently supported
* @COGL_PIXEL_FORMAT_R_8: Single red component, 8 bits * @COGL_PIXEL_FORMAT_G_8: Single luminance component
* @COGL_PIXEL_FORMAT_RGB_888: RGB, 24 bits * @COGL_PIXEL_FORMAT_RGB_888: RGB, 24 bits
* @COGL_PIXEL_FORMAT_BGR_888: BGR, 24 bits * @COGL_PIXEL_FORMAT_BGR_888: BGR, 24 bits
* @COGL_PIXEL_FORMAT_RGBA_8888: RGBA, 32 bits * @COGL_PIXEL_FORMAT_RGBA_8888: RGBA, 32 bits
@@ -167,35 +167,6 @@ G_BEGIN_DECLS
* @COGL_PIXEL_FORMAT_BGRA_1010102_PRE: Premultiplied BGRA, 32 bits, 10 bpc * @COGL_PIXEL_FORMAT_BGRA_1010102_PRE: Premultiplied BGRA, 32 bits, 10 bpc
* @COGL_PIXEL_FORMAT_ARGB_2101010_PRE: Premultiplied ARGB, 32 bits, 10 bpc * @COGL_PIXEL_FORMAT_ARGB_2101010_PRE: Premultiplied ARGB, 32 bits, 10 bpc
* @COGL_PIXEL_FORMAT_ABGR_2101010_PRE: Premultiplied ABGR, 32 bits, 10 bpc * @COGL_PIXEL_FORMAT_ABGR_2101010_PRE: Premultiplied ABGR, 32 bits, 10 bpc
* @COGL_PIXEL_FORMAT_YUYV: YUYV, 32 bits, 16 bpc (Y), 8 bpc (U & V)
* @COGL_PIXEL_FORMAT_YVYU: YVYU, 32 bits, 16 bpc (Y), 8 bpc (V & U)
* @COGL_PIXEL_FORMAT_UYVY: UYVY, 32 bits, 16 bpc (Y), 8 bpc (V & U)
* @COGL_PIXEL_FORMAT_VYUY: VYUV, 32 bits, 16 bpc (Y), 8 bpc (V & U)
* @COGL_PIXEL_FORMAT_AYUV: AYUV, 32 bits, 8 bpc
* @COGL_PIXEL_FORMAT_XRGB8888_A8: 2 planes: 1 RGB-plane (64-bit), 1 alpha-plane
* @COGL_PIXEL_FORMAT_XBGR8888_A8: 2 planes: 1 BGR-plane (64-bit), 1 alpha-plane
* @COGL_PIXEL_FORMAT_RGBX8888_A8: 2 planes: 1 RGB-plane (64-bit), 1 alpha-plane
* @COGL_PIXEL_FORMAT_BGRX8888_A8: 2 planes: 1 BGR-plane (64-bit), 1 alpha-plane
* @COGL_PIXEL_FORMAT_RGB888_A8: 2 planes: 1 RGB-plane (32-bit), 1 alpha-plane
* @COGL_PIXEL_FORMAT_BGR888_A8: 2 planes: 1 BGR-plane (32-bit), 1 alpha-plane
* @COGL_PIXEL_FORMAT_RGB565_A8: 2 planes: 1 RGB-plane (16-bit), 1 alpha-plane
* @COGL_PIXEL_FORMAT_BGR565_A8: 2 planes: 1 BGR-plane (16-bit), 1 alpha-plane
* @COGL_PIXEL_FORMAT_NV12: 2 planes: 1 Y-plane, 1 UV-plane (2x2 subsampled)
* @COGL_PIXEL_FORMAT_NV21: 2 planes: 1 Y-plane, 1 VU-plane (2x2 subsampled)
* @COGL_PIXEL_FORMAT_NV16: 2 planes: 1 Y-plane, 1 UV-plane (2x1 subsampled)
* @COGL_PIXEL_FORMAT_NV61: 2 planes: 1 Y-plane, 1 VU-plane (2x1 subsampled)
* @COGL_PIXEL_FORMAT_NV24: 2 planes: 1 Y-plane, 1 UV-plane
* @COGL_PIXEL_FORMAT_NV42: 2 planes: 1 Y-plane, 1 VU-plane
* @COGL_PIXEL_FORMAT_YUV410: 3 planes: 1 Y-plane, 1 U-plane (4x4 subsampled), 1 V-plane (4x4 subsampled)
* @COGL_PIXEL_FORMAT_YVU410: 3 planes: 1 Y-plane, 1 V-plane (4x4 subsampled), 1 U-plane (4x4 subsampled)
* @COGL_PIXEL_FORMAT_YUV411: 3 planes: 1 Y-plane, 1 U-plane (4x1 subsampled), 1 V-plane (4x1 subsampled)
* @COGL_PIXEL_FORMAT_YVU411: 3 planes: 1 Y-plane, 1 V-plane (4x1 subsampled), 1 U-plane (4x1 subsampled)
* @COGL_PIXEL_FORMAT_YUV420: 3 planes: 1 Y-plane, 1 U-plane (2x2 subsampled), 1 V-plane (2x2 subsampled)
* @COGL_PIXEL_FORMAT_YVU420: 3 planes: 1 Y-plane, 1 V-plane (2x2 subsampled), 1 U-plane (2x2 subsampled)
* @COGL_PIXEL_FORMAT_YUV422: 3 planes: 1 Y-plane, 1 U-plane (2x1 subsampled), 1 V-plane (2x1 subsampled)
* @COGL_PIXEL_FORMAT_YVU422: 3 planes: 1 Y-plane, 1 V-plane (2x1 subsampled), 1 U-plane (2x1 subsampled)
* @COGL_PIXEL_FORMAT_YUV444: 3 planes: 1 Y-plane, 1 U-plane, 1 V-plane
* @COGL_PIXEL_FORMAT_YVU444: 3 planes: 1 Y-plane, 1 V-plane, 1 U-plane
* *
* Pixel formats used by Cogl. For the formats with a byte per * Pixel formats used by Cogl. For the formats with a byte per
* component, the order of the components specify the order in * component, the order of the components specify the order in
@@ -227,7 +198,7 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
COGL_PIXEL_FORMAT_RGBA_4444 = 5 | COGL_A_BIT, COGL_PIXEL_FORMAT_RGBA_4444 = 5 | COGL_A_BIT,
COGL_PIXEL_FORMAT_RGBA_5551 = 6 | COGL_A_BIT, COGL_PIXEL_FORMAT_RGBA_5551 = 6 | COGL_A_BIT,
COGL_PIXEL_FORMAT_YUV = 7, COGL_PIXEL_FORMAT_YUV = 7,
COGL_PIXEL_FORMAT_R_8 = 8, COGL_PIXEL_FORMAT_G_8 = 8,
COGL_PIXEL_FORMAT_RG_88 = 9, COGL_PIXEL_FORMAT_RG_88 = 9,
@@ -259,83 +230,20 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
COGL_PIXEL_FORMAT_DEPTH_16 = (9 | COGL_DEPTH_BIT), COGL_PIXEL_FORMAT_DEPTH_16 = (9 | COGL_DEPTH_BIT),
COGL_PIXEL_FORMAT_DEPTH_32 = (3 | COGL_DEPTH_BIT), COGL_PIXEL_FORMAT_DEPTH_32 = (3 | COGL_DEPTH_BIT),
COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8 = (3 | COGL_DEPTH_BIT | COGL_STENCIL_BIT), COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8 = (3 | COGL_DEPTH_BIT | COGL_STENCIL_BIT)
/* From here on out, we simply enumerate with sequential values in the most
* significant enum byte. See the comments above if you want to know why. */
/* The following list is basically synced with Linux's <drm_fourcc.h> */
/* Packed YUV */
COGL_PIXEL_FORMAT_YUYV = (1 << 24),
COGL_PIXEL_FORMAT_YVYU = (2 << 24),
COGL_PIXEL_FORMAT_UYVY = (3 << 24),
COGL_PIXEL_FORMAT_VYUY = (4 << 24),
COGL_PIXEL_FORMAT_AYUV = (5 << 24),
/* 2 plane RGB + A */
COGL_PIXEL_FORMAT_XRGB8888_A8 = ( 6 << 24),
COGL_PIXEL_FORMAT_XBGR8888_A8 = ( 7 << 24),
COGL_PIXEL_FORMAT_RGBX8888_A8 = ( 8 << 24),
COGL_PIXEL_FORMAT_BGRX8888_A8 = ( 9 << 24),
COGL_PIXEL_FORMAT_RGB888_A8 = (10 << 24),
COGL_PIXEL_FORMAT_BGR888_A8 = (11 << 24),
COGL_PIXEL_FORMAT_RGB565_A8 = (12 << 24),
COGL_PIXEL_FORMAT_BGR565_A8 = (13 << 24),
/* 2 plane YUV */
COGL_PIXEL_FORMAT_NV12 = (14 << 24),
COGL_PIXEL_FORMAT_NV21 = (15 << 24),
COGL_PIXEL_FORMAT_NV16 = (16 << 24),
COGL_PIXEL_FORMAT_NV61 = (17 << 24),
COGL_PIXEL_FORMAT_NV24 = (18 << 24),
COGL_PIXEL_FORMAT_NV42 = (19 << 24),
/* 3 plane YUV */
COGL_PIXEL_FORMAT_YUV410 = (20 << 24),
COGL_PIXEL_FORMAT_YVU410 = (21 << 24),
COGL_PIXEL_FORMAT_YUV411 = (22 << 24),
COGL_PIXEL_FORMAT_YVU411 = (23 << 24),
COGL_PIXEL_FORMAT_YUV420 = (24 << 24),
COGL_PIXEL_FORMAT_YVU420 = (25 << 24),
COGL_PIXEL_FORMAT_YUV422 = (26 << 24),
COGL_PIXEL_FORMAT_YVU422 = (27 << 24),
COGL_PIXEL_FORMAT_YUV444 = (28 << 24),
COGL_PIXEL_FORMAT_YVU444 = (29 << 24)
} CoglPixelFormat; } CoglPixelFormat;
/**
* COGL_PIXEL_FORMAT_MAX_PLANES:
*
* The maximum number of planes
*/
#define COGL_PIXEL_FORMAT_MAX_PLANES (4)
/* /*
* cogl_pixel_format_get_bytes_per_pixel: * _cogl_pixel_format_get_bytes_per_pixel:
* @format: a #CoglPixelFormat
* @bpp_out: (inout): A buffer that will be filled with the bytes-per-pixel for each
* plane
*
* Queries how many bytes a pixel of the given @format takes in each plane.
*
* Returns: The no. of bytes in one pixel of the given single-plane @format.
*/
void
cogl_pixel_format_get_bytes_per_pixel (CoglPixelFormat format,
uint8_t *bpp_out);
/*
* cogl_pixel_format_get_bytes_per_pixel_simple:
* @format: a #CoglPixelFormat * @format: a #CoglPixelFormat
* *
* Queries how many bytes a pixel of the given @format takes. * Queries how many bytes a pixel of the given @format takes.
* *
* Returns: The no. of bytes in one pixel of the given single-plane @format. * Return value: The number of bytes taken for a pixel of the given
* @format.
*/ */
uint8_t int
cogl_pixel_format_get_bytes_per_pixel_simple (CoglPixelFormat format); _cogl_pixel_format_get_bytes_per_pixel (CoglPixelFormat format);
/* /*
* _cogl_pixel_format_has_aligned_components: * _cogl_pixel_format_has_aligned_components:
@@ -376,26 +284,6 @@ _cogl_pixel_format_is_endian_dependant (CoglPixelFormat format);
#define COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT(format) \ #define COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT(format) \
(((format) & COGL_A_BIT) && (format) != COGL_PIXEL_FORMAT_A_8) (((format) & COGL_A_BIT) && (format) != COGL_PIXEL_FORMAT_A_8)
/**
* cogl_pixel_format_get_n_planes:
* @format: The format for which to get the number of planes
*
* Returns the number of planes the given CoglPixelFormat specifies.
*/
uint8_t
cogl_pixel_format_get_n_planes (CoglPixelFormat format);
/**
* cogl_pixel_format_get_subsampling_factors:
* @format: The format to get the subsampling factors from.
*
* Returns the subsampling in both the horizontal as the vertical direction.
*/
void
cogl_pixel_format_get_subsampling_factors (CoglPixelFormat format,
uint8_t *horizontal_factors,
uint8_t *vertical_factors);
/** /**
* cogl_pixel_format_to_string: * cogl_pixel_format_to_string:
* @format: a #CoglPixelFormat * @format: a #CoglPixelFormat
@@ -407,14 +295,6 @@ cogl_pixel_format_get_subsampling_factors (CoglPixelFormat format,
const char * const char *
cogl_pixel_format_to_string (CoglPixelFormat format); cogl_pixel_format_to_string (CoglPixelFormat format);
void
cogl_pixel_format_get_subformats (CoglPixelFormat format,
CoglPixelFormat *formats_out);
void
cogl_pixel_format_get_cogl_components (CoglPixelFormat format,
guint *components_out);
G_END_DECLS G_END_DECLS
#endif /* __COGL_PIXEL_FORMAT_H__ */ #endif /* __COGL_PIXEL_FORMAT_H__ */

View File

@@ -42,7 +42,7 @@ typedef enum
{ {
COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE, COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE,
COGL_PRIVATE_FEATURE_MESA_PACK_INVERT, COGL_PRIVATE_FEATURE_MESA_PACK_INVERT,
COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER,
COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES, COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES,
COGL_PRIVATE_FEATURE_PBOS, COGL_PRIVATE_FEATURE_PBOS,
COGL_PRIVATE_FEATURE_VBOS, COGL_PRIVATE_FEATURE_VBOS,

View File

@@ -47,6 +47,7 @@ struct _CoglTexture2D
gboolean auto_mipmap; gboolean auto_mipmap;
gboolean mipmaps_dirty; gboolean mipmaps_dirty;
gboolean is_foreign; gboolean is_foreign;
gboolean is_get_data_supported;
/* TODO: factor out these OpenGL specific members into some form /* TODO: factor out these OpenGL specific members into some form
* of driver private state. */ * of driver private state. */

View File

@@ -163,7 +163,7 @@ _cogl_texture_2d_sliced_allocate_waste_buffer (CoglTexture2DSliced *tex_2ds,
tex_2ds->slice_y_spans->len - 1); tex_2ds->slice_y_spans->len - 1);
if (last_x_span->waste > 0 || last_y_span->waste > 0) if (last_x_span->waste > 0 || last_y_span->waste > 0)
{ {
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (format); int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
CoglSpan *first_x_span CoglSpan *first_x_span
= &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0); = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
CoglSpan *first_y_span CoglSpan *first_y_span
@@ -209,7 +209,7 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds,
{ {
int bmp_rowstride = cogl_bitmap_get_rowstride (source_bmp); int bmp_rowstride = cogl_bitmap_get_rowstride (source_bmp);
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (source_format); int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
uint8_t *bmp_data; uint8_t *bmp_data;
const uint8_t *src; const uint8_t *src;
uint8_t *dst; uint8_t *dst;
@@ -972,7 +972,7 @@ cogl_texture_2d_sliced_new_from_data (CoglContext *ctx,
/* Rowstride from width if not given */ /* Rowstride from width if not given */
if (rowstride == 0) if (rowstride == 0)
rowstride = width * cogl_pixel_format_get_bytes_per_pixel_simple (format); rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
/* Wrap the data into a bitmap */ /* Wrap the data into a bitmap */
bmp = cogl_bitmap_new_for_data (ctx, bmp = cogl_bitmap_new_for_data (ctx,

View File

@@ -106,6 +106,7 @@ _cogl_texture_2d_create_base (CoglContext *ctx,
tex_2d->mipmaps_dirty = TRUE; tex_2d->mipmaps_dirty = TRUE;
tex_2d->auto_mipmap = TRUE; tex_2d->auto_mipmap = TRUE;
tex_2d->is_get_data_supported = TRUE;
tex_2d->gl_target = GL_TEXTURE_2D; tex_2d->gl_target = GL_TEXTURE_2D;
@@ -207,7 +208,7 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
/* Rowstride from width if not given */ /* Rowstride from width if not given */
if (rowstride == 0) if (rowstride == 0)
rowstride = width * cogl_pixel_format_get_bytes_per_pixel_simple (format); rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
/* Wrap the data into a bitmap */ /* Wrap the data into a bitmap */
bmp = cogl_bitmap_new_for_data (ctx, bmp = cogl_bitmap_new_for_data (ctx,
@@ -239,8 +240,8 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
int width, int width,
int height, int height,
CoglPixelFormat format, CoglPixelFormat format,
CoglTextureComponents components,
EGLImageKHR image, EGLImageKHR image,
CoglEglImageFlags flags,
GError **error) GError **error)
{ {
CoglTextureLoader *loader; CoglTextureLoader *loader;
@@ -261,12 +262,10 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
loader->src.egl_image.width = width; loader->src.egl_image.width = width;
loader->src.egl_image.height = height; loader->src.egl_image.height = height;
loader->src.egl_image.format = format; loader->src.egl_image.format = format;
loader->src.egl_image.flags = flags;
tex = _cogl_texture_2d_create_base (ctx, width, height, format, loader); tex = _cogl_texture_2d_create_base (ctx, width, height, format, loader);
/* Make sure we've set the right components before allocating */
cogl_texture_set_components (COGL_TEXTURE (tex), components);
if (!cogl_texture_allocate (COGL_TEXTURE (tex), error)) if (!cogl_texture_allocate (COGL_TEXTURE (tex), error))
{ {
cogl_object_unref (tex); cogl_object_unref (tex);

View File

@@ -60,6 +60,12 @@ G_BEGIN_DECLS
typedef struct _CoglTexture2D CoglTexture2D; typedef struct _CoglTexture2D CoglTexture2D;
#define COGL_TEXTURE_2D(X) ((CoglTexture2D *)X) #define COGL_TEXTURE_2D(X) ((CoglTexture2D *)X)
typedef enum _CoglEglImageFlags
{
COGL_EGL_IMAGE_FLAG_NONE = 0,
COGL_EGL_IMAGE_FLAG_NO_GET_DATA = 1 << 0,
} CoglEglImageFlags;
/** /**
* cogl_texture_2d_get_gtype: * cogl_texture_2d_get_gtype:
* *
@@ -218,8 +224,8 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
int width, int width,
int height, int height,
CoglPixelFormat format, CoglPixelFormat format,
CoglTextureComponents components,
EGLImageKHR image, EGLImageKHR image,
CoglEglImageFlags flags,
GError **error); GError **error);
typedef gboolean (*CoglTexture2DEGLImageExternalAlloc) (CoglTexture2D *tex_2d, typedef gboolean (*CoglTexture2DEGLImageExternalAlloc) (CoglTexture2D *tex_2d,

View File

@@ -182,6 +182,7 @@ typedef struct _CoglTextureLoader
int width; int width;
int height; int height;
CoglPixelFormat format; CoglPixelFormat format;
CoglEglImageFlags flags;
} egl_image; } egl_image;
#endif #endif
#if defined (COGL_HAS_EGL_SUPPORT) #if defined (COGL_HAS_EGL_SUPPORT)

View File

@@ -430,14 +430,10 @@ _cogl_texture_set_region (CoglTexture *texture,
gboolean ret; gboolean ret;
g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, FALSE); g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, FALSE);
g_return_val_if_fail (cogl_pixel_format_get_n_planes (format) == 1, FALSE);
/* Rowstride from width if none specified */ /* Rowstride from width if none specified */
if (rowstride == 0) if (rowstride == 0)
{ rowstride = _cogl_pixel_format_get_bytes_per_pixel (format) * width;
uint8_t bpp = cogl_pixel_format_get_bytes_per_pixel_simple (format);
rowstride = bpp * width;
}
/* Init source bitmap */ /* Init source bitmap */
source_bmp = cogl_bitmap_new_for_data (ctx, source_bmp = cogl_bitmap_new_for_data (ctx,
@@ -475,7 +471,7 @@ cogl_texture_set_region (CoglTexture *texture,
{ {
GError *ignore_error = NULL; GError *ignore_error = NULL;
const uint8_t *first_pixel; const uint8_t *first_pixel;
int bytes_per_pixel = cogl_pixel_format_get_bytes_per_pixel_simple (format); int bytes_per_pixel = _cogl_pixel_format_get_bytes_per_pixel (format);
gboolean status; gboolean status;
/* Rowstride from width if none specified */ /* Rowstride from width if none specified */
@@ -613,7 +609,7 @@ get_texture_bits_via_copy (CoglTexture *texture,
full_tex_width = cogl_texture_get_width (texture); full_tex_width = cogl_texture_get_width (texture);
full_tex_height = cogl_texture_get_height (texture); full_tex_height = cogl_texture_get_height (texture);
bpp = cogl_pixel_format_get_bytes_per_pixel_simple (dst_format); bpp = _cogl_pixel_format_get_bytes_per_pixel (dst_format);
full_rowstride = bpp * full_tex_width; full_rowstride = bpp * full_tex_width;
full_bits = g_malloc (full_rowstride * full_tex_height); full_bits = g_malloc (full_rowstride * full_tex_height);
@@ -662,7 +658,7 @@ texture_get_cb (CoglTexture *subtexture,
CoglTextureGetData *tg_data = user_data; CoglTextureGetData *tg_data = user_data;
CoglTexture *meta_texture = tg_data->meta_texture; CoglTexture *meta_texture = tg_data->meta_texture;
CoglPixelFormat closest_format = cogl_bitmap_get_format (tg_data->target_bmp); CoglPixelFormat closest_format = cogl_bitmap_get_format (tg_data->target_bmp);
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (closest_format); int bpp = _cogl_pixel_format_get_bytes_per_pixel (closest_format);
unsigned int rowstride = cogl_bitmap_get_rowstride (tg_data->target_bmp); unsigned int rowstride = cogl_bitmap_get_rowstride (tg_data->target_bmp);
int subtexture_width = cogl_texture_get_width (subtexture); int subtexture_width = cogl_texture_get_width (subtexture);
int subtexture_height = cogl_texture_get_height (subtexture); int subtexture_height = cogl_texture_get_height (subtexture);
@@ -752,7 +748,7 @@ cogl_texture_get_data (CoglTexture *texture,
tex_height = cogl_texture_get_height (texture); tex_height = cogl_texture_get_height (texture);
/* Rowstride from texture width if none specified */ /* Rowstride from texture width if none specified */
bpp = cogl_pixel_format_get_bytes_per_pixel_simple (format); bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
if (rowstride == 0) if (rowstride == 0)
rowstride = tex_width * bpp; rowstride = tex_width * bpp;
@@ -1107,11 +1103,6 @@ _cogl_texture_set_internal_format (CoglTexture *texture,
texture->components = COGL_TEXTURE_COMPONENTS_A; texture->components = COGL_TEXTURE_COMPONENTS_A;
return; return;
} }
else if (internal_format == COGL_PIXEL_FORMAT_R_8)
{
texture->components = COGL_TEXTURE_COMPONENTS_R;
return;
}
else if (internal_format == COGL_PIXEL_FORMAT_RG_88) else if (internal_format == COGL_PIXEL_FORMAT_RG_88)
{ {
texture->components = COGL_TEXTURE_COMPONENTS_RG; texture->components = COGL_TEXTURE_COMPONENTS_RG;
@@ -1158,8 +1149,6 @@ _cogl_texture_determine_internal_format (CoglTexture *texture,
} }
case COGL_TEXTURE_COMPONENTS_A: case COGL_TEXTURE_COMPONENTS_A:
return COGL_PIXEL_FORMAT_A_8; return COGL_PIXEL_FORMAT_A_8;
case COGL_TEXTURE_COMPONENTS_R:
return COGL_PIXEL_FORMAT_R_8;
case COGL_TEXTURE_COMPONENTS_RG: case COGL_TEXTURE_COMPONENTS_RG:
return COGL_PIXEL_FORMAT_RG_88; return COGL_PIXEL_FORMAT_RG_88;
case COGL_TEXTURE_COMPONENTS_RGB: case COGL_TEXTURE_COMPONENTS_RGB:

View File

@@ -139,7 +139,6 @@ cogl_is_texture (void *object);
typedef enum _CoglTextureComponents typedef enum _CoglTextureComponents
{ {
COGL_TEXTURE_COMPONENTS_A = 1, COGL_TEXTURE_COMPONENTS_A = 1,
COGL_TEXTURE_COMPONENTS_R,
COGL_TEXTURE_COMPONENTS_RG, COGL_TEXTURE_COMPONENTS_RG,
COGL_TEXTURE_COMPONENTS_RGB, COGL_TEXTURE_COMPONENTS_RGB,
COGL_TEXTURE_COMPONENTS_RGBA, COGL_TEXTURE_COMPONENTS_RGBA,

View File

@@ -18,10 +18,10 @@
#include "cogl-config.h" #include "cogl-config.h"
#ifdef HAVE_TRACING
#include "cogl/cogl-trace.h" #include "cogl/cogl-trace.h"
#ifdef HAVE_TRACING
#include <sysprof-capture.h> #include <sysprof-capture.h>
#include <syscall.h> #include <syscall.h>
#include <sys/types.h> #include <sys/types.h>

View File

@@ -153,7 +153,6 @@ typedef struct _CoglTextureVertex CoglTextureVertex;
* @COGL_FEATURE_TEXTURE_READ_PIXELS: glReadPixels() support * @COGL_FEATURE_TEXTURE_READ_PIXELS: glReadPixels() support
* @COGL_FEATURE_OFFSCREEN: FBO support * @COGL_FEATURE_OFFSCREEN: FBO support
* @COGL_FEATURE_OFFSCREEN_MULTISAMPLE: Multisample support on FBOs * @COGL_FEATURE_OFFSCREEN_MULTISAMPLE: Multisample support on FBOs
* @COGL_FEATURE_OFFSCREEN_BLIT: Blit support on FBOs
* @COGL_FEATURE_FOUR_CLIP_PLANES: At least 4 clip planes available * @COGL_FEATURE_FOUR_CLIP_PLANES: At least 4 clip planes available
* @COGL_FEATURE_STENCIL_BUFFER: Stencil buffer support * @COGL_FEATURE_STENCIL_BUFFER: Stencil buffer support
* @COGL_FEATURE_VBOS: VBO support * @COGL_FEATURE_VBOS: VBO support
@@ -181,7 +180,6 @@ typedef enum
COGL_FEATURE_TEXTURE_READ_PIXELS = (1 << 4), COGL_FEATURE_TEXTURE_READ_PIXELS = (1 << 4),
COGL_FEATURE_OFFSCREEN = (1 << 6), COGL_FEATURE_OFFSCREEN = (1 << 6),
COGL_FEATURE_OFFSCREEN_MULTISAMPLE = (1 << 7), COGL_FEATURE_OFFSCREEN_MULTISAMPLE = (1 << 7),
COGL_FEATURE_OFFSCREEN_BLIT = (1 << 8),
COGL_FEATURE_FOUR_CLIP_PLANES = (1 << 9), COGL_FEATURE_FOUR_CLIP_PLANES = (1 << 9),
COGL_FEATURE_STENCIL_BUFFER = (1 << 10), COGL_FEATURE_STENCIL_BUFFER = (1 << 10),
COGL_FEATURE_VBOS = (1 << 11), COGL_FEATURE_VBOS = (1 << 11),

View File

@@ -330,7 +330,7 @@ cogl_read_pixels (int x,
CoglPixelFormat format, CoglPixelFormat format,
uint8_t *pixels) uint8_t *pixels)
{ {
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (format); int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
CoglBitmap *bitmap; CoglBitmap *bitmap;
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);

View File

@@ -59,7 +59,6 @@
#include <cogl/cogl1-context.h> #include <cogl/cogl1-context.h>
#include <cogl/cogl-bitmap.h> #include <cogl/cogl-bitmap.h>
#include <cogl/cogl-color.h> #include <cogl/cogl-color.h>
#include <cogl/cogl-pixel-format-conversion.h>
#include <cogl/cogl-matrix.h> #include <cogl/cogl-matrix.h>
#include <cogl/cogl-matrix-stack.h> #include <cogl/cogl-matrix-stack.h>
#include <cogl/cogl-offscreen.h> #include <cogl/cogl-offscreen.h>
@@ -109,7 +108,6 @@
#include <cogl/cogl-sub-texture.h> #include <cogl/cogl-sub-texture.h>
#include <cogl/cogl-atlas-texture.h> #include <cogl/cogl-atlas-texture.h>
#include <cogl/cogl-meta-texture.h> #include <cogl/cogl-meta-texture.h>
#include <cogl/cogl-multi-plane-texture.h>
#include <cogl/cogl-primitive-texture.h> #include <cogl/cogl-primitive-texture.h>
#include <cogl/cogl-index-buffer.h> #include <cogl/cogl-index-buffer.h>
#include <cogl/cogl-attribute-buffer.h> #include <cogl/cogl-attribute-buffer.h>

View File

@@ -148,7 +148,7 @@ _cogl_texture_new_from_data (CoglContext *ctx,
/* Rowstride from width if not given */ /* Rowstride from width if not given */
if (rowstride == 0) if (rowstride == 0)
rowstride = width * cogl_pixel_format_get_bytes_per_pixel_simple (format); rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
/* Wrap the data into a bitmap */ /* Wrap the data into a bitmap */
bmp = cogl_bitmap_new_for_data (ctx, bmp = cogl_bitmap_new_for_data (ctx,

View File

@@ -385,12 +385,9 @@ _cogl_framebuffer_gl_flush_state (CoglFramebuffer *draw_buffer,
else else
{ {
/* NB: Currently we only take advantage of binding separate /* NB: Currently we only take advantage of binding separate
* read/write buffers for offscreen framebuffer blit * read/write buffers for framebuffer blit purposes. */
* purposes. */
g_return_if_fail (_cogl_has_private_feature g_return_if_fail (_cogl_has_private_feature
(ctx, COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT)); (ctx, COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER));
g_return_if_fail (draw_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN);
g_return_if_fail (read_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN);
_cogl_framebuffer_gl_bind (draw_buffer, GL_DRAW_FRAMEBUFFER); _cogl_framebuffer_gl_bind (draw_buffer, GL_DRAW_FRAMEBUFFER);
_cogl_framebuffer_gl_bind (read_buffer, GL_READ_FRAMEBUFFER); _cogl_framebuffer_gl_bind (read_buffer, GL_READ_FRAMEBUFFER);
@@ -1303,7 +1300,7 @@ _cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
if (!tmp_bmp) if (!tmp_bmp)
goto EXIT; goto EXIT;
bpp = cogl_pixel_format_get_bytes_per_pixel_simple (read_format); bpp = _cogl_pixel_format_get_bytes_per_pixel (read_format);
rowstride = cogl_bitmap_get_rowstride (tmp_bmp); rowstride = cogl_bitmap_get_rowstride (tmp_bmp);
ctx->texture_driver->prep_gl_for_pixels_download (ctx, ctx->texture_driver->prep_gl_for_pixels_download (ctx,
@@ -1360,7 +1357,7 @@ _cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
else else
shared_bmp = cogl_object_ref (bitmap); shared_bmp = cogl_object_ref (bitmap);
bpp = cogl_pixel_format_get_bytes_per_pixel_simple (bmp_format); bpp = _cogl_pixel_format_get_bytes_per_pixel (bmp_format);
ctx->texture_driver->prep_gl_for_pixels_download (ctx, ctx->texture_driver->prep_gl_for_pixels_download (ctx,
rowstride, rowstride,

View File

@@ -250,7 +250,7 @@ allocate_from_bitmap (CoglTexture2D *tex_2d,
if (data) if (data)
{ {
memcpy (tex_2d->first_pixel.data, data, memcpy (tex_2d->first_pixel.data, data,
cogl_pixel_format_get_bytes_per_pixel_simple (format)); _cogl_pixel_format_get_bytes_per_pixel (format));
_cogl_bitmap_unmap (upload_bmp); _cogl_bitmap_unmap (upload_bmp);
} }
else else
@@ -259,7 +259,7 @@ allocate_from_bitmap (CoglTexture2D *tex_2d,
"glGenerateMipmap fallback"); "glGenerateMipmap fallback");
g_error_free (ignore); g_error_free (ignore);
memset (tex_2d->first_pixel.data, 0, memset (tex_2d->first_pixel.data, 0,
cogl_pixel_format_get_bytes_per_pixel_simple (format)); _cogl_pixel_format_get_bytes_per_pixel (format));
} }
} }
@@ -320,6 +320,8 @@ allocate_from_egl_image (CoglTexture2D *tex_2d,
} }
tex_2d->internal_format = internal_format; tex_2d->internal_format = internal_format;
tex_2d->is_get_data_supported =
!(loader->src.egl_image.flags & COGL_EGL_IMAGE_FLAG_NO_GET_DATA);
_cogl_texture_set_allocated (tex, _cogl_texture_set_allocated (tex,
internal_format, internal_format,
@@ -508,6 +510,7 @@ allocate_custom_egl_image_external (CoglTexture2D *tex_2d,
tex_2d->internal_format = internal_format; tex_2d->internal_format = internal_format;
tex_2d->gl_target = GL_TEXTURE_EXTERNAL_OES; tex_2d->gl_target = GL_TEXTURE_EXTERNAL_OES;
tex_2d->is_get_data_supported = FALSE;
return TRUE; return TRUE;
} }
@@ -789,7 +792,7 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
uint8_t *data = uint8_t *data =
_cogl_bitmap_map (upload_bmp, COGL_BUFFER_ACCESS_READ, 0, &ignore); _cogl_bitmap_map (upload_bmp, COGL_BUFFER_ACCESS_READ, 0, &ignore);
CoglPixelFormat bpp = CoglPixelFormat bpp =
cogl_pixel_format_get_bytes_per_pixel_simple (upload_format); _cogl_pixel_format_get_bytes_per_pixel (upload_format);
tex_2d->first_pixel.gl_format = gl_format; tex_2d->first_pixel.gl_format = gl_format;
tex_2d->first_pixel.gl_type = gl_type; tex_2d->first_pixel.gl_type = gl_type;
@@ -834,10 +837,7 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
gboolean gboolean
_cogl_texture_2d_gl_is_get_data_supported (CoglTexture2D *tex_2d) _cogl_texture_2d_gl_is_get_data_supported (CoglTexture2D *tex_2d)
{ {
if (tex_2d->gl_target == GL_TEXTURE_EXTERNAL_OES) return tex_2d->is_get_data_supported;
return FALSE;
else
return TRUE;
} }
void void
@@ -852,7 +852,7 @@ _cogl_texture_2d_gl_get_data (CoglTexture2D *tex_2d,
GLenum gl_format; GLenum gl_format;
GLenum gl_type; GLenum gl_type;
bpp = cogl_pixel_format_get_bytes_per_pixel_simple (format); bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
ctx->driver_vtable->pixel_format_to_gl (ctx, ctx->driver_vtable->pixel_format_to_gl (ctx,
format, format,

View File

@@ -58,11 +58,18 @@ _cogl_driver_pixel_format_from_gl_internal (CoglContext *context,
{ {
case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8:
case GL_ALPHA12: case GL_ALPHA16: case GL_ALPHA12: case GL_ALPHA16:
/* Cogl only supports one single-component texture so if we have
* ended up with a red texture then it is probably being used as
* a component-alpha texture */
case GL_RED:
*out_format = COGL_PIXEL_FORMAT_A_8; *out_format = COGL_PIXEL_FORMAT_A_8;
return TRUE; return TRUE;
case GL_RED: case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8:
*out_format = COGL_PIXEL_FORMAT_R_8; case GL_LUMINANCE12: case GL_LUMINANCE16:
*out_format = COGL_PIXEL_FORMAT_G_8;
return TRUE; return TRUE;
case GL_RG: case GL_RG:
@@ -119,9 +126,9 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
} }
gltype = GL_UNSIGNED_BYTE; gltype = GL_UNSIGNED_BYTE;
break; break;
case COGL_PIXEL_FORMAT_R_8: case COGL_PIXEL_FORMAT_G_8:
glintformat = GL_RED; glintformat = GL_LUMINANCE;
glformat = GL_RED; glformat = GL_LUMINANCE;
gltype = GL_UNSIGNED_BYTE; gltype = GL_UNSIGNED_BYTE;
break; break;
@@ -260,37 +267,7 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
break; break;
case COGL_PIXEL_FORMAT_ANY: case COGL_PIXEL_FORMAT_ANY:
/* No support for YUV or multi-plane formats */
case COGL_PIXEL_FORMAT_YUV: case COGL_PIXEL_FORMAT_YUV:
case COGL_PIXEL_FORMAT_YUYV:
case COGL_PIXEL_FORMAT_YVYU:
case COGL_PIXEL_FORMAT_UYVY:
case COGL_PIXEL_FORMAT_VYUY:
case COGL_PIXEL_FORMAT_AYUV:
case COGL_PIXEL_FORMAT_XRGB8888_A8:
case COGL_PIXEL_FORMAT_XBGR8888_A8:
case COGL_PIXEL_FORMAT_RGBX8888_A8:
case COGL_PIXEL_FORMAT_BGRX8888_A8:
case COGL_PIXEL_FORMAT_RGB888_A8:
case COGL_PIXEL_FORMAT_BGR888_A8:
case COGL_PIXEL_FORMAT_RGB565_A8:
case COGL_PIXEL_FORMAT_BGR565_A8:
case COGL_PIXEL_FORMAT_NV12:
case COGL_PIXEL_FORMAT_NV21:
case COGL_PIXEL_FORMAT_NV16:
case COGL_PIXEL_FORMAT_NV61:
case COGL_PIXEL_FORMAT_NV24:
case COGL_PIXEL_FORMAT_NV42:
case COGL_PIXEL_FORMAT_YUV410:
case COGL_PIXEL_FORMAT_YVU410:
case COGL_PIXEL_FORMAT_YUV411:
case COGL_PIXEL_FORMAT_YVU411:
case COGL_PIXEL_FORMAT_YUV420:
case COGL_PIXEL_FORMAT_YVU420:
case COGL_PIXEL_FORMAT_YUV422:
case COGL_PIXEL_FORMAT_YVU422:
case COGL_PIXEL_FORMAT_YUV444:
case COGL_PIXEL_FORMAT_YVU444:
g_assert_not_reached (); g_assert_not_reached ();
break; break;
} }
@@ -444,7 +421,7 @@ _cogl_driver_update_features (CoglContext *ctx,
if (ctx->glBlitFramebuffer) if (ctx->glBlitFramebuffer)
COGL_FLAGS_SET (private_features, COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT, TRUE); COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER, TRUE);
if (ctx->glRenderbufferStorageMultisampleIMG) if (ctx->glRenderbufferStorageMultisampleIMG)
{ {

View File

@@ -196,7 +196,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx,
GLuint gl_handle; GLuint gl_handle;
uint8_t *data; uint8_t *data;
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (source_format); int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
gboolean status = TRUE; gboolean status = TRUE;
GError *internal_error = NULL; GError *internal_error = NULL;
int level_width; int level_width;
@@ -302,7 +302,7 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx,
{ {
uint8_t *data; uint8_t *data;
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (source_format); int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
gboolean status = TRUE; gboolean status = TRUE;
GError *internal_error = NULL; GError *internal_error = NULL;

View File

@@ -86,18 +86,9 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
glformat = GL_ALPHA; glformat = GL_ALPHA;
gltype = GL_UNSIGNED_BYTE; gltype = GL_UNSIGNED_BYTE;
break; break;
case COGL_PIXEL_FORMAT_G_8:
case COGL_PIXEL_FORMAT_R_8: glintformat = GL_LUMINANCE;
if (cogl_has_feature (context, COGL_FEATURE_ID_TEXTURE_RG)) glformat = GL_LUMINANCE;
{
glintformat = GL_RED;
glformat = GL_R8;
}
else
{
glintformat = GL_LUMINANCE;
glformat = GL_LUMINANCE;
}
gltype = GL_UNSIGNED_BYTE; gltype = GL_UNSIGNED_BYTE;
break; break;
@@ -207,37 +198,7 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
break; break;
case COGL_PIXEL_FORMAT_ANY: case COGL_PIXEL_FORMAT_ANY:
/* No support for YUV or multi-plane formats */
case COGL_PIXEL_FORMAT_YUV: case COGL_PIXEL_FORMAT_YUV:
case COGL_PIXEL_FORMAT_YUYV:
case COGL_PIXEL_FORMAT_YVYU:
case COGL_PIXEL_FORMAT_UYVY:
case COGL_PIXEL_FORMAT_VYUY:
case COGL_PIXEL_FORMAT_AYUV:
case COGL_PIXEL_FORMAT_XRGB8888_A8:
case COGL_PIXEL_FORMAT_XBGR8888_A8:
case COGL_PIXEL_FORMAT_RGBX8888_A8:
case COGL_PIXEL_FORMAT_BGRX8888_A8:
case COGL_PIXEL_FORMAT_RGB888_A8:
case COGL_PIXEL_FORMAT_BGR888_A8:
case COGL_PIXEL_FORMAT_RGB565_A8:
case COGL_PIXEL_FORMAT_BGR565_A8:
case COGL_PIXEL_FORMAT_NV12:
case COGL_PIXEL_FORMAT_NV21:
case COGL_PIXEL_FORMAT_NV16:
case COGL_PIXEL_FORMAT_NV61:
case COGL_PIXEL_FORMAT_NV24:
case COGL_PIXEL_FORMAT_NV42:
case COGL_PIXEL_FORMAT_YUV410:
case COGL_PIXEL_FORMAT_YVU410:
case COGL_PIXEL_FORMAT_YUV411:
case COGL_PIXEL_FORMAT_YVU411:
case COGL_PIXEL_FORMAT_YUV420:
case COGL_PIXEL_FORMAT_YVU420:
case COGL_PIXEL_FORMAT_YUV422:
case COGL_PIXEL_FORMAT_YVU422:
case COGL_PIXEL_FORMAT_YUV444:
case COGL_PIXEL_FORMAT_YVU444:
g_assert_not_reached (); g_assert_not_reached ();
break; break;
} }
@@ -369,7 +330,7 @@ _cogl_driver_update_features (CoglContext *context,
if (context->glBlitFramebuffer) if (context->glBlitFramebuffer)
COGL_FLAGS_SET (private_features, COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT, TRUE); COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER, TRUE);
if (_cogl_check_extension ("GL_OES_element_index_uint", gl_extensions)) if (_cogl_check_extension ("GL_OES_element_index_uint", gl_extensions))
{ {

View File

@@ -96,16 +96,6 @@ _cogl_texture_driver_gen (CoglContext *ctx,
g_assert_not_reached(); g_assert_not_reached();
} }
/* GL-ES doesn't have GL_RED, so swizzle the alpha into a red component */
if (internal_format == COGL_PIXEL_FORMAT_R_8)
{
static const GLint alpha_swizzle[] = { GL_ALPHA, GL_ZERO, GL_ZERO, GL_ZERO };
GE( ctx, glTexParameteriv (gl_target,
GL_TEXTURE_SWIZZLE_RGBA,
alpha_swizzle) );
}
return tex; return tex;
} }
@@ -162,7 +152,7 @@ prepare_bitmap_alignment_for_upload (CoglContext *ctx,
GError **error) GError **error)
{ {
CoglPixelFormat format = cogl_bitmap_get_format (src_bmp); CoglPixelFormat format = cogl_bitmap_get_format (src_bmp);
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (format); int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
int src_rowstride = cogl_bitmap_get_rowstride (src_bmp); int src_rowstride = cogl_bitmap_get_rowstride (src_bmp);
int width = cogl_bitmap_get_width (src_bmp); int width = cogl_bitmap_get_width (src_bmp);
int alignment = 1; int alignment = 1;
@@ -205,7 +195,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx,
GLuint gl_handle; GLuint gl_handle;
uint8_t *data; uint8_t *data;
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (source_format); int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
CoglBitmap *slice_bmp; CoglBitmap *slice_bmp;
int rowstride; int rowstride;
gboolean status = TRUE; gboolean status = TRUE;
@@ -347,7 +337,7 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx,
GError **error) GError **error)
{ {
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (source_format); int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
int rowstride; int rowstride;
int bmp_width = cogl_bitmap_get_width (source_bmp); int bmp_width = cogl_bitmap_get_width (source_bmp);
int bmp_height = cogl_bitmap_get_height (source_bmp); int bmp_height = cogl_bitmap_get_height (source_bmp);

View File

@@ -4,6 +4,7 @@
* A Low Level GPU Graphics and Utilities API * A Low Level GPU Graphics and Utilities API
* *
* Copyright (C) 2009, 2011 Intel Corporation. * Copyright (C) 2009, 2011 Intel Corporation.
* Copyright (C) 2019 DisplayLink (UK) Ltd.
* *
* Permission is hereby granted, free of charge, to any person * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation
@@ -111,8 +112,8 @@ COGL_EXT_END ()
COGL_EXT_BEGIN (offscreen_blit, 3, 0, COGL_EXT_BEGIN (offscreen_blit, 3, 0,
0, /* not in either GLES */ COGL_EXT_IN_GLES3,
"EXT\0ANGLE\0", "EXT\0NV\0",
"framebuffer_blit\0") "framebuffer_blit\0")
COGL_EXT_FUNCTION (void, glBlitFramebuffer, COGL_EXT_FUNCTION (void, glBlitFramebuffer,
(GLint srcX0, (GLint srcX0,

View File

@@ -42,6 +42,7 @@ global:
_cogl_framebuffer_winsys_update_size; _cogl_framebuffer_winsys_update_size;
_cogl_winsys_egl_make_current; _cogl_winsys_egl_make_current;
_cogl_winsys_egl_ensure_current; _cogl_winsys_egl_ensure_current;
_cogl_pixel_format_get_bytes_per_pixel*;
_cogl_system_error_quark; _cogl_system_error_quark;
_cogl_util_next_p2; _cogl_util_next_p2;
@unit_tests_symbols@ @unit_tests_symbols@

View File

@@ -82,7 +82,6 @@ cogl_headers = [
'cogl-color.h', 'cogl-color.h',
'cogl-framebuffer.h', 'cogl-framebuffer.h',
'cogl-matrix.h', 'cogl-matrix.h',
'cogl-multi-plane-texture.h',
'cogl-object.h', 'cogl-object.h',
'cogl-offscreen.h', 'cogl-offscreen.h',
'cogl-onscreen.h', 'cogl-onscreen.h',
@@ -90,7 +89,6 @@ cogl_headers = [
'cogl-pipeline-state.h', 'cogl-pipeline-state.h',
'cogl-pipeline-layer-state.h', 'cogl-pipeline-layer-state.h',
'cogl-pixel-format.h', 'cogl-pixel-format.h',
'cogl-pixel-format-conversion.h',
'cogl-primitives.h', 'cogl-primitives.h',
'cogl-texture.h', 'cogl-texture.h',
'cogl-texture-2d.h', 'cogl-texture-2d.h',
@@ -251,11 +249,10 @@ cogl_sources = [
'cogl-bitmap-pixbuf.c', 'cogl-bitmap-pixbuf.c',
'cogl-clip-stack.h', 'cogl-clip-stack.h',
'cogl-clip-stack.c', 'cogl-clip-stack.c',
'cogl-feature-private.h',
'cogl-feature-private.c',
'cogl-color-private.h', 'cogl-color-private.h',
'cogl-color.c', 'cogl-color.c',
'cogl-pixel-format-conversion.c',
'cogl-feature-private.c',
'cogl-feature-private.h',
'cogl-buffer-private.h', 'cogl-buffer-private.h',
'cogl-buffer.c', 'cogl-buffer.c',
'cogl-pixel-buffer-private.h', 'cogl-pixel-buffer-private.h',
@@ -323,7 +320,6 @@ cogl_sources = [
'cogl-atlas-texture-private.h', 'cogl-atlas-texture-private.h',
'cogl-atlas-texture.c', 'cogl-atlas-texture.c',
'cogl-meta-texture.c', 'cogl-meta-texture.c',
'cogl-multi-plane-texture.c',
'cogl-primitive-texture.c', 'cogl-primitive-texture.c',
'cogl-blit.h', 'cogl-blit.h',
'cogl-blit.c', 'cogl-blit.c',

View File

@@ -730,7 +730,7 @@ _cogl_texture_pixmap_x11_update_image_texture (CoglTexturePixmapX11 *tex_pixmap)
image->bits_per_pixel, image->bits_per_pixel,
image->byte_order == LSBFirst); image->byte_order == LSBFirst);
bpp = cogl_pixel_format_get_bytes_per_pixel_simple (image_format); bpp = _cogl_pixel_format_get_bytes_per_pixel (image_format);
offset = image->bytes_per_line * src_y + bpp * src_x; offset = image->bytes_per_line * src_y + bpp * src_x;
_cogl_texture_set_region (tex_pixmap->tex, _cogl_texture_set_region (tex_pixmap->tex,

View File

@@ -800,8 +800,8 @@ _cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap)
tex->width, tex->width,
tex->height, tex->height,
texture_format, texture_format,
COGL_TEXTURE_COMPONENTS_RGBA,
egl_tex_pixmap->image, egl_tex_pixmap->image,
COGL_EGL_IMAGE_FLAG_NONE,
NULL)); NULL));
tex_pixmap->winsys = egl_tex_pixmap; tex_pixmap->winsys = egl_tex_pixmap;

View File

@@ -173,7 +173,12 @@ test_read_texture_formats (void)
test_read_byte (tex_2d, COGL_PIXEL_FORMAT_A_8, 0x78); test_read_byte (tex_2d, COGL_PIXEL_FORMAT_A_8, 0x78);
test_read_byte (tex_2d, COGL_PIXEL_FORMAT_R_8, 0x12); #if 0
/* I'm not sure what's the right value to put here because Nvidia
and Mesa seem to behave differently so one of them must be
wrong. */
test_read_byte (tex_2d, COGL_PIXEL_FORMAT_G_8, 0x9c);
#endif
/* We should always be able to read into an RG buffer regardless of /* We should always be able to read into an RG buffer regardless of
* whether RG textures are supported because Cogl will do the * whether RG textures are supported because Cogl will do the

View File

@@ -135,7 +135,12 @@ void
test_write_texture_formats (void) test_write_texture_formats (void)
{ {
test_write_byte (test_ctx, COGL_PIXEL_FORMAT_A_8, 0x34, 0x00000034); test_write_byte (test_ctx, COGL_PIXEL_FORMAT_A_8, 0x34, 0x00000034);
test_write_byte (test_ctx, COGL_PIXEL_FORMAT_R_8, 0x34, 0x34000000); #if 0
/* I'm not sure what's the right value to put here because Nvidia
and Mesa seem to behave differently so one of them must be
wrong. */
test_write_byte (test_ctx, COGL_PIXEL_FORMAT_G_8, 0x34, 0x340000ff);
#endif
/* We should always be able to read from an RG buffer regardless of /* We should always be able to read from an RG buffer regardless of
* whether RG textures are supported because Cogl will do the * whether RG textures are supported because Cogl will do the

View File

@@ -6,7 +6,9 @@ cdata.set('HAVE_GLES2', have_gles2.to_int())
cogl_installed_tests_libexecdir = join_paths( cogl_installed_tests_libexecdir = join_paths(
mutter_installed_tests_libexecdir, 'cogl', 'conform') mutter_installed_tests_libexecdir, 'cogl', 'conform')
install_data('run-tests.sh', install_dir: cogl_installed_tests_libexecdir) if have_installed_tests
install_data('run-tests.sh', install_dir: cogl_installed_tests_libexecdir)
endif
cogl_config_env = configure_file( cogl_config_env = configure_file(
input: 'config.env.in', input: 'config.env.in',

View File

@@ -1,12 +1,17 @@
project('mutter', 'c', project('mutter', 'c',
version: '3.33.2', version: '3.33.4',
meson_version: '>= 0.50.0', meson_version: '>= 0.50.0',
license: 'GPLv2+' license: 'GPLv2+'
) )
mutter_plugin_api_version = '3' mutter_plugin_api_version = '3'
libmutter_api_version = '4' split_version = meson.project_version().split('.')
# Automatically increase API version each development cycle,
# starting with 0 in 3.23.x
api_version = (split_version[1].to_int() - 23) / 2
libmutter_api_version = '@0@'.format(api_version)
# generic version requirements # generic version requirements
fribidi_req = '>= 1.0.0' fribidi_req = '>= 1.0.0'
@@ -18,7 +23,7 @@ uprof_req = '>= 0.3'
pango_req = '>= 1.2.0' pango_req = '>= 1.2.0'
cairo_req = '>= 1.10.0' cairo_req = '>= 1.10.0'
pangocairo_req = '>= 1.20' pangocairo_req = '>= 1.20'
gsettings_desktop_schemas_req = '>= 3.31.0' gsettings_desktop_schemas_req = '>= 3.33.0'
json_glib_req = '>= 0.12.0' json_glib_req = '>= 0.12.0'
upower_glib_req = '>= 0.99.0' upower_glib_req = '>= 0.99.0'
xcomposite_req = '>= 0.4' xcomposite_req = '>= 0.4'

View File

@@ -8,6 +8,7 @@ data/mutter.desktop.in
data/org.gnome.mutter.gschema.xml.in data/org.gnome.mutter.gschema.xml.in
data/org.gnome.mutter.wayland.gschema.xml.in data/org.gnome.mutter.wayland.gschema.xml.in
src/backends/meta-input-settings.c src/backends/meta-input-settings.c
src/backends/meta-monitor.c
src/backends/meta-monitor-manager.c src/backends/meta-monitor-manager.c
src/backends/meta-profiler.c src/backends/meta-profiler.c
src/compositor/compositor.c src/compositor/compositor.c

1514
po/eu.po

File diff suppressed because it is too large Load Diff

102
po/fur.po
View File

@@ -7,15 +7,15 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: mutter master\n" "Project-Id-Version: mutter master\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
"POT-Creation-Date: 2019-05-03 17:25+0000\n" "POT-Creation-Date: 2019-06-28 19:41+0000\n"
"PO-Revision-Date: 2019-05-03 19:39+0200\n" "PO-Revision-Date: 2019-07-01 21:01+0200\n"
"Last-Translator: Fabio Tomat <f.t.public@gmail.com>\n" "Last-Translator: Fabio Tomat <f.t.public@gmail.com>\n"
"Language-Team: Friulian <fur@li.org>\n" "Language-Team: Friulian <fur@li.org>\n"
"Language: fur\n" "Language: fur\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.2.1\n" "X-Generator: Poedit 2.2.3\n"
#: data/50-mutter-navigation.xml:6 #: data/50-mutter-navigation.xml:6
msgid "Navigation" msgid "Navigation"
@@ -391,7 +391,9 @@ msgid ""
"proof. Currently possible keywords: • “scale-monitor-framebuffer” — makes " "proof. Currently possible keywords: • “scale-monitor-framebuffer” — makes "
"mutter default to layout logical monitors in a logical pixel coordinate " "mutter default to layout logical monitors in a logical pixel coordinate "
"space, while scaling monitor framebuffers instead of window content, to " "space, while scaling monitor framebuffers instead of window content, to "
"manage HiDPI monitors. Does not require a restart." "manage HiDPI monitors. Does not require a restart. • “rt-scheduler” — makes "
"mutter request a low priority real-time scheduling. The executable or user "
"must have CAP_SYS_NICE. Requires a restart."
msgstr "" msgstr ""
"Par abilitâ lis funzionalitâts sperimentâls, zonte la peraule clâf de " "Par abilitâ lis funzionalitâts sperimentâls, zonte la peraule clâf de "
"funzionalitât ae liste. Il fat che la funzionalitât e vedi bisugne di tornâ " "funzionalitât ae liste. Il fat che la funzionalitât e vedi bisugne di tornâ "
@@ -402,21 +404,32 @@ msgstr ""
"“scale-monitor-framebuffer” — al rint come predefinît par mutter, la " "“scale-monitor-framebuffer” — al rint come predefinît par mutter, la "
"disposizion logjiche dai visôrs intun spazi logjic di coordenadis di pixel, " "disposizion logjiche dai visôrs intun spazi logjic di coordenadis di pixel, "
"in plui si fâs il scjalâ dai framebuffer dai visôrs invezit che il contignût " "in plui si fâs il scjalâ dai framebuffer dai visôrs invezit che il contignût "
"dal barcon; dut chest par gjestî i visôrs HiDPI. Nol covente tornâ a inviâ." "dal barcon; dut chest par gjestî i visôrs HiDPI. Nol covente tornâ a inviâ. "
"• “rt-scheduler” — al fâs in mût che mutter al domandi une programazion in "
"timp reâl a prioritât basse. L'eseguibil o l'utent a scugnin vê "
"CAP_SYS_NICE. Al covente tornâ a inviâ."
#: data/org.gnome.mutter.gschema.xml.in:141 #: data/org.gnome.mutter.gschema.xml.in:132
msgid "Modifier to use to locate the pointer"
msgstr "Modificadôr di doprâ par localizâ il pontadôr"
#: data/org.gnome.mutter.gschema.xml.in:133
msgid "This key will initiate the “locate pointer” action."
msgstr "Cheste clâf e inizializerâ la azion “localize pontadôr”."
#: data/org.gnome.mutter.gschema.xml.in:153
msgid "Select window from tab popup" msgid "Select window from tab popup"
msgstr "Selezione barcon dal tab popup" msgstr "Selezione barcon dal tab popup"
#: data/org.gnome.mutter.gschema.xml.in:146 #: data/org.gnome.mutter.gschema.xml.in:158
msgid "Cancel tab popup" msgid "Cancel tab popup"
msgstr "Anule tab popup" msgstr "Anule tab popup"
#: data/org.gnome.mutter.gschema.xml.in:151 #: data/org.gnome.mutter.gschema.xml.in:163
msgid "Switch monitor configurations" msgid "Switch monitor configurations"
msgstr "Cambie configurazions visôr" msgstr "Cambie configurazions visôr"
#: data/org.gnome.mutter.gschema.xml.in:156 #: data/org.gnome.mutter.gschema.xml.in:168
msgid "Rotates the built-in monitor configuration" msgid "Rotates the built-in monitor configuration"
msgstr "Al volte la configurazion dal visôr integrât" msgstr "Al volte la configurazion dal visôr integrât"
@@ -473,29 +486,37 @@ msgid "Re-enable shortcuts"
msgstr "Torne abilite lis scurtis" msgstr "Torne abilite lis scurtis"
#: data/org.gnome.mutter.wayland.gschema.xml.in:64 #: data/org.gnome.mutter.wayland.gschema.xml.in:64
msgid "Allow grabs with Xwayland" msgid "Allow X11 grabs to lock keyboard focus with Xwayland"
msgstr "Permet cjapadis di control cun Xwayland" msgstr ""
"Permet aes cjapadis di control cun X11 di blocâ la focalizazion de tastiere "
"cun Xwayland"
#: data/org.gnome.mutter.wayland.gschema.xml.in:65 #: data/org.gnome.mutter.wayland.gschema.xml.in:65
#, fuzzy
msgid "" msgid ""
"Allow keyboard grabs issued by X11 applications running in Xwayland to be " "Allow all keyboard events to be routed to X11 “override redirect” windows "
"taken into account. For a X11 grab to be taken into account under Wayland, " "with a grab when running in Xwayland. This option is to support X11 clients "
"the client must also either send a specific X11 ClientMessage to the root " "which map an “override redirect” window (which do not receive keyboard "
"window or be among the applications white-listed in key “xwayland-grab-" "focus) and issue a keyboard grab to force all keyboard events to that "
"access-rules”." "window. This option is seldom used and has no effect on regular X11 windows "
"which can receive keyboard focus under normal circumstances. For a X11 grab "
"to be taken into account under Wayland, the client must also either send a "
"specific X11 ClientMessage to the root window or be among the applications "
"white-listed in key “xwayland-grab-access-rules”."
msgstr "" msgstr ""
"Permet che il cjapâ il control de tastiere emetût di aplicazions X11 che a " "Permet a ducj i events di tastiere di jessi indreçâts sui barcons “override "
"zirin in Xwayland, di jessi tignûts in considerazion. Par une cjapade di " "redirect” di X11 cuntun cjapâ il control de tastiere emetût di aplicazions "
"control di X11, par che e sedi tignude in considerazion sot Wayland, il " "X11 che a zirin in Xwayland, di jessi tignûts in considerazion. Par une "
"client al scugne ancje inviâ un specific messaç (X11 ClientMessage) al " "cjapade di control di X11, par che e sedi tignude in considerazion sot "
"barcon lidrîs o jessi tra lis aplicazions metudis te liste blancje inte clâf " "Wayland, il client al scugne ancje inviâ un specific messaç (X11 "
"“xwayland-grab-access-rules”." "ClientMessage) al barcon lidrîs o jessi tra lis aplicazions metudis te liste "
"blancje inte clâf “xwayland-grab-access-rules”."
#: data/org.gnome.mutter.wayland.gschema.xml.in:77 #: data/org.gnome.mutter.wayland.gschema.xml.in:84
msgid "Xwayland applications allowed to issue keyboard grabs" msgid "Xwayland applications allowed to issue keyboard grabs"
msgstr "Aplicazions Xwayland che a puedin cjapâ la tastiere" msgstr "Aplicazions Xwayland che a puedin cjapâ la tastiere"
#: data/org.gnome.mutter.wayland.gschema.xml.in:78 #: data/org.gnome.mutter.wayland.gschema.xml.in:85
msgid "" msgid ""
"List the resource names or resource class of X11 windows either allowed or " "List the resource names or resource class of X11 windows either allowed or "
"not allowed to issue X11 keyboard grabs under Xwayland. The resource name or " "not allowed to issue X11 keyboard grabs under Xwayland. The resource name or "
@@ -522,7 +543,7 @@ msgstr ""
#. TRANSLATORS: This string refers to a button that switches between #. TRANSLATORS: This string refers to a button that switches between
#. * different modes. #. * different modes.
#. #.
#: src/backends/meta-input-settings.c:2426 #: src/backends/meta-input-settings.c:2531
#, c-format #, c-format
msgid "Mode Switch (Group %d)" msgid "Mode Switch (Group %d)"
msgstr "Cambie mût (Grup %d)" msgstr "Cambie mût (Grup %d)"
@@ -530,34 +551,34 @@ msgstr "Cambie mût (Grup %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets' #. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs. #. * mapping through the available outputs.
#. #.
#: src/backends/meta-input-settings.c:2449 #: src/backends/meta-input-settings.c:2554
msgid "Switch monitor" msgid "Switch monitor"
msgstr "Cambie visôr" msgstr "Cambie visôr"
#: src/backends/meta-input-settings.c:2451 #: src/backends/meta-input-settings.c:2556
msgid "Show on-screen help" msgid "Show on-screen help"
msgstr "Mostre jutori a schermi" msgstr "Mostre jutori a schermi"
#: src/backends/meta-monitor-manager.c:976 #: src/backends/meta-monitor.c:223
msgid "Built-in display" msgid "Built-in display"
msgstr "Display integrât" msgstr "Display integrât"
#: src/backends/meta-monitor-manager.c:1008 #: src/backends/meta-monitor.c:252
msgid "Unknown" msgid "Unknown"
msgstr "No cognossût" msgstr "No cognossût"
#: src/backends/meta-monitor-manager.c:1010 #: src/backends/meta-monitor.c:254
msgid "Unknown Display" msgid "Unknown Display"
msgstr "Display no cognossût" msgstr "Display no cognossût"
#: src/backends/meta-monitor-manager.c:1018 #: src/backends/meta-monitor.c:262
#, c-format #, c-format
msgctxt "" msgctxt ""
"This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'" "This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'"
msgid "%s %s" msgid "%s %s"
msgstr "%s %s" msgstr "%s %s"
#: src/backends/meta-monitor-manager.c:1026 #: src/backends/meta-monitor.c:270
#, c-format #, c-format
msgctxt "" msgctxt ""
"This is a monitor vendor name followed by product/model name where size in " "This is a monitor vendor name followed by product/model name where size in "
@@ -565,9 +586,14 @@ msgctxt ""
msgid "%s %s" msgid "%s %s"
msgstr "%s %s" msgstr "%s %s"
#. Translators: this string will appear in Sysprof
#: src/backends/meta-profiler.c:82
msgid "Compositor"
msgstr "Composidôr"
#. This probably means that a non-WM compositor like xcompmgr is running; #. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit #. * we have no way to get it to exit
#: src/compositor/compositor.c:508 #: src/compositor/compositor.c:510
#, c-format #, c-format
msgid "" msgid ""
"Another compositing manager is already running on screen %i on display “%s”." "Another compositing manager is already running on screen %i on display “%s”."
@@ -672,7 +698,7 @@ msgstr "Stampe version"
msgid "Mutter plugin to use" msgid "Mutter plugin to use"
msgstr "Plugin Mutter di doprâ" msgstr "Plugin Mutter di doprâ"
#: src/core/prefs.c:1786 #: src/core/prefs.c:1834
#, c-format #, c-format
msgid "Workspace %d" msgid "Workspace %d"
msgstr "Spazi di lavôr %d" msgstr "Spazi di lavôr %d"
@@ -686,7 +712,7 @@ msgstr "Mutter al è stât compilât cence supuart pe modalitât fetose\n"
msgid "Mode Switch: Mode %d" msgid "Mode Switch: Mode %d"
msgstr "Cambie mût: mût %d" msgstr "Cambie mût: mût %d"
#: src/x11/meta-x11-display.c:669 #: src/x11/meta-x11-display.c:681
#, c-format #, c-format
msgid "" msgid ""
"Display “%s” already has a window manager; try using the --replace option to " "Display “%s” already has a window manager; try using the --replace option to "
@@ -695,16 +721,16 @@ msgstr ""
"Il display “%s” al à za un window manager; prove dopre la opzion --replace " "Il display “%s” al à za un window manager; prove dopre la opzion --replace "
"par rimplaçâ chel atuâl." "par rimplaçâ chel atuâl."
#: src/x11/meta-x11-display.c:1011 #: src/x11/meta-x11-display.c:1023
msgid "Failed to initialize GDK\n" msgid "Failed to initialize GDK\n"
msgstr "No si è rivâts a inizializâ GDK\n" msgstr "No si è rivâts a inizializâ GDK\n"
#: src/x11/meta-x11-display.c:1035 #: src/x11/meta-x11-display.c:1047
#, c-format #, c-format
msgid "Failed to open X Window System display “%s”\n" msgid "Failed to open X Window System display “%s”\n"
msgstr "Impussibil vierzi il display “%s” di X Window System\n" msgstr "Impussibil vierzi il display “%s” di X Window System\n"
#: src/x11/meta-x11-display.c:1116 #: src/x11/meta-x11-display.c:1131
#, c-format #, c-format
msgid "Screen %d on display “%s” is invalid\n" msgid "Screen %d on display “%s” is invalid\n"
msgstr "Schermi %d su display “%s” no valit\n" msgstr "Schermi %d su display “%s” no valit\n"

100
po/id.po
View File

@@ -11,15 +11,15 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: mutter master\n" "Project-Id-Version: mutter master\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
"POT-Creation-Date: 2019-05-06 16:50+0000\n" "POT-Creation-Date: 2019-07-04 12:35+0000\n"
"PO-Revision-Date: 2019-05-07 14:13+0700\n" "PO-Revision-Date: 2019-07-08 15:11+0700\n"
"Last-Translator: Kukuh Syafaat <kukuhsyafaat@gnome.org>\n" "Last-Translator: Kukuh Syafaat <kukuhsyafaat@gnome.org>\n"
"Language-Team: Indonesian <gnome-l10n-id@googlegroups.com>\n" "Language-Team: Indonesian <gnome-l10n-id@googlegroups.com>\n"
"Language: id\n" "Language: id\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.2.1\n" "X-Generator: Poedit 2.2.3\n"
"Plural-Forms: nplurals=2; plural= n!=1;\n" "Plural-Forms: nplurals=2; plural= n!=1;\n"
#: data/50-mutter-navigation.xml:6 #: data/50-mutter-navigation.xml:6
@@ -395,7 +395,9 @@ msgid ""
"proof. Currently possible keywords: • “scale-monitor-framebuffer” — makes " "proof. Currently possible keywords: • “scale-monitor-framebuffer” — makes "
"mutter default to layout logical monitors in a logical pixel coordinate " "mutter default to layout logical monitors in a logical pixel coordinate "
"space, while scaling monitor framebuffers instead of window content, to " "space, while scaling monitor framebuffers instead of window content, to "
"manage HiDPI monitors. Does not require a restart." "manage HiDPI monitors. Does not require a restart. • “rt-scheduler” — makes "
"mutter request a low priority real-time scheduling. The executable or user "
"must have CAP_SYS_NICE. Requires a restart."
msgstr "" msgstr ""
"Untuk mengaktifkan fitur eksperimental, tambahkan kata kunci fitur ke dalam " "Untuk mengaktifkan fitur eksperimental, tambahkan kata kunci fitur ke dalam "
"daftar. Apakah fitur memerlukan nyala ulang kompositor tergantung pada fitur " "daftar. Apakah fitur memerlukan nyala ulang kompositor tergantung pada fitur "
@@ -405,21 +407,31 @@ msgstr ""
"mungkin: • “scale-monitor-framebuffer” — membuat bawaan mutter untuk tata " "mungkin: • “scale-monitor-framebuffer” — membuat bawaan mutter untuk tata "
"letak monitor logikal dalam ruang koordinat pixel logikal, sambil " "letak monitor logikal dalam ruang koordinat pixel logikal, sambil "
"menskalakan framebuffer monitor alih-alih konten jendela, untuk mengelola " "menskalakan framebuffer monitor alih-alih konten jendela, untuk mengelola "
"monitor HiDPI. Tidak perlu mulai ulang." "monitor HiDPI. Tidak perlu nyala ulang. • \"rt-scheduler\" — membuat mutter "
"meminta jadwal waktu sebenarnya prioritas rendah. Yang dapat dieksekusi atau "
"pengguna harus memiliki CAP_SYS_NICE. Membutuhkan nyala ulang."
#: data/org.gnome.mutter.gschema.xml.in:141 #: data/org.gnome.mutter.gschema.xml.in:132
msgid "Modifier to use to locate the pointer"
msgstr "Pengubah yang digunakan untuk menemukan penunjuk"
#: data/org.gnome.mutter.gschema.xml.in:133
msgid "This key will initiate the “locate pointer” action."
msgstr "Kunci ini akan memulai aksi \"penunjuk lokasi\"."
#: data/org.gnome.mutter.gschema.xml.in:153
msgid "Select window from tab popup" msgid "Select window from tab popup"
msgstr "Pilih jendela dari popup tab" msgstr "Pilih jendela dari popup tab"
#: data/org.gnome.mutter.gschema.xml.in:146 #: data/org.gnome.mutter.gschema.xml.in:158
msgid "Cancel tab popup" msgid "Cancel tab popup"
msgstr "Batalkan popup tab" msgstr "Batalkan popup tab"
#: data/org.gnome.mutter.gschema.xml.in:151 #: data/org.gnome.mutter.gschema.xml.in:163
msgid "Switch monitor configurations" msgid "Switch monitor configurations"
msgstr "Tukar konfigurasi monitor bawaan" msgstr "Tukar konfigurasi monitor bawaan"
#: data/org.gnome.mutter.gschema.xml.in:156 #: data/org.gnome.mutter.gschema.xml.in:168
msgid "Rotates the built-in monitor configuration" msgid "Rotates the built-in monitor configuration"
msgstr "Memutar konfigurasi monitor bawaan" msgstr "Memutar konfigurasi monitor bawaan"
@@ -476,30 +488,39 @@ msgid "Re-enable shortcuts"
msgstr "Aktifkan kembali pintasan" msgstr "Aktifkan kembali pintasan"
#: data/org.gnome.mutter.wayland.gschema.xml.in:64 #: data/org.gnome.mutter.wayland.gschema.xml.in:64
msgid "Allow grabs with Xwayland" msgid "Allow X11 grabs to lock keyboard focus with Xwayland"
msgstr "Izinkan menggenggam dengan Xwayland" msgstr "Izinkan X11 menggenggam untuk mengunci fokus papan tik dengan Xwayland"
#: data/org.gnome.mutter.wayland.gschema.xml.in:65 #: data/org.gnome.mutter.wayland.gschema.xml.in:65
msgid "" msgid ""
"Allow keyboard grabs issued by X11 applications running in Xwayland to be " "Allow all keyboard events to be routed to X11 “override redirect” windows "
"taken into account. For a X11 grab to be taken into account under Wayland, " "with a grab when running in Xwayland. This option is to support X11 clients "
"the client must also either send a specific X11 ClientMessage to the root " "which map an “override redirect” window (which do not receive keyboard "
"window or be among the applications white-listed in key “xwayland-grab-" "focus) and issue a keyboard grab to force all keyboard events to that "
"access-rules”." "window. This option is seldom used and has no effect on regular X11 windows "
"which can receive keyboard focus under normal circumstances. For a X11 grab "
"to be taken into account under Wayland, the client must also either send a "
"specific X11 ClientMessage to the root window or be among the applications "
"white-listed in key “xwayland-grab-access-rules”."
msgstr "" msgstr ""
"Mengizinkan pengambilalihan papan ketik yang dikeluarkan oleh aplikasi X11 " "Izinkan semua peristiwa papan tik dialihkan ke jendela X11 \"override "
"yang berjalan di Xwayland untuk diperhitungkan. Agar pengambilalihan X11 " "redirect\" dengan perambanan saat berjalan di Xwayland. Opsi ini adalah "
"diperhitungkan di bawah Wayland, klien juga harus mengirimkan ClientMessage " "untuk mendukung klien X11 yang memetakan jendela \"override redirect\" (yang "
"X11 tertentu ke jendela root atau berada di antara aplikasi yang tercantum " "tidak menerima fokus papan tik) dan mengeluarkan pegangan papan tik untuk "
"dalam daftar putih \"xwayland-grab-access-rules\"." "memaksa semua peristiwa papan tik ke jendela itu. Opsi ini jarang digunakan "
"dan tidak berpengaruh pada jendela X11 biasa yang dapat menerima fokus papan "
"tik dalam keadaan normal. Agar pengambilan X11 diperhitungkan di bawah "
"Wayland, klien juga harus mengirim PesanKlien X11 tertentu ke jendela root "
"atau di antara aplikasi yang masuk dalam daftar putih “xwayland-grab-access-"
"rules”."
#: data/org.gnome.mutter.wayland.gschema.xml.in:77 #: data/org.gnome.mutter.wayland.gschema.xml.in:84
msgid "Xwayland applications allowed to issue keyboard grabs" msgid "Xwayland applications allowed to issue keyboard grabs"
msgstr "" msgstr ""
"Aplikasi Xwayland yang diizinkan untuk mengeluarkan pengambilalihan papan " "Aplikasi Xwayland yang diizinkan untuk mengeluarkan pengambilalihan papan "
"ketik" "ketik"
#: data/org.gnome.mutter.wayland.gschema.xml.in:78 #: data/org.gnome.mutter.wayland.gschema.xml.in:85
msgid "" msgid ""
"List the resource names or resource class of X11 windows either allowed or " "List the resource names or resource class of X11 windows either allowed or "
"not allowed to issue X11 keyboard grabs under Xwayland. The resource name or " "not allowed to issue X11 keyboard grabs under Xwayland. The resource name or "
@@ -527,7 +548,7 @@ msgstr ""
#. TRANSLATORS: This string refers to a button that switches between #. TRANSLATORS: This string refers to a button that switches between
#. * different modes. #. * different modes.
#. #.
#: src/backends/meta-input-settings.c:2426 #: src/backends/meta-input-settings.c:2531
#, c-format #, c-format
msgid "Mode Switch (Group %d)" msgid "Mode Switch (Group %d)"
msgstr "Tukar Mode: (Grup %d)" msgstr "Tukar Mode: (Grup %d)"
@@ -535,34 +556,34 @@ msgstr "Tukar Mode: (Grup %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets' #. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs. #. * mapping through the available outputs.
#. #.
#: src/backends/meta-input-settings.c:2449 #: src/backends/meta-input-settings.c:2554
msgid "Switch monitor" msgid "Switch monitor"
msgstr "Berpindah monitor" msgstr "Berpindah monitor"
#: src/backends/meta-input-settings.c:2451 #: src/backends/meta-input-settings.c:2556
msgid "Show on-screen help" msgid "Show on-screen help"
msgstr "Tampilkan bantuan pada layar" msgstr "Tampilkan bantuan pada layar"
#: src/backends/meta-monitor-manager.c:976 #: src/backends/meta-monitor.c:223
msgid "Built-in display" msgid "Built-in display"
msgstr "Tampilan bawaan" msgstr "Tampilan bawaan"
#: src/backends/meta-monitor-manager.c:1008 #: src/backends/meta-monitor.c:252
msgid "Unknown" msgid "Unknown"
msgstr "Tak Dikenal" msgstr "Tak Dikenal"
#: src/backends/meta-monitor-manager.c:1010 #: src/backends/meta-monitor.c:254
msgid "Unknown Display" msgid "Unknown Display"
msgstr "Tampilan Tak Dikenal" msgstr "Tampilan Tak Dikenal"
#: src/backends/meta-monitor-manager.c:1018 #: src/backends/meta-monitor.c:262
#, c-format #, c-format
msgctxt "" msgctxt ""
"This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'" "This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'"
msgid "%s %s" msgid "%s %s"
msgstr "%s %s" msgstr "%s %s"
#: src/backends/meta-monitor-manager.c:1026 #: src/backends/meta-monitor.c:270
#, c-format #, c-format
msgctxt "" msgctxt ""
"This is a monitor vendor name followed by product/model name where size in " "This is a monitor vendor name followed by product/model name where size in "
@@ -570,9 +591,14 @@ msgctxt ""
msgid "%s %s" msgid "%s %s"
msgstr "%s %s" msgstr "%s %s"
#. Translators: this string will appear in Sysprof
#: src/backends/meta-profiler.c:82
msgid "Compositor"
msgstr "Kompositor"
#. This probably means that a non-WM compositor like xcompmgr is running; #. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit #. * we have no way to get it to exit
#: src/compositor/compositor.c:508 #: src/compositor/compositor.c:510
#, c-format #, c-format
msgid "" msgid ""
"Another compositing manager is already running on screen %i on display “%s”." "Another compositing manager is already running on screen %i on display “%s”."
@@ -676,7 +702,7 @@ msgstr "Cetak versi"
msgid "Mutter plugin to use" msgid "Mutter plugin to use"
msgstr "Pengaya Mutter yang dipakai" msgstr "Pengaya Mutter yang dipakai"
#: src/core/prefs.c:1786 #: src/core/prefs.c:1834
#, c-format #, c-format
msgid "Workspace %d" msgid "Workspace %d"
msgstr "Area kerja %d" msgstr "Area kerja %d"
@@ -690,7 +716,7 @@ msgstr "Muter dikompilasi tanpa dukungan mode riuh\n"
msgid "Mode Switch: Mode %d" msgid "Mode Switch: Mode %d"
msgstr "Tukar Mode: Mode %d" msgstr "Tukar Mode: Mode %d"
#: src/x11/meta-x11-display.c:669 #: src/x11/meta-x11-display.c:682
#, c-format #, c-format
msgid "" msgid ""
"Display “%s” already has a window manager; try using the --replace option to " "Display “%s” already has a window manager; try using the --replace option to "
@@ -699,16 +725,16 @@ msgstr ""
"Tampilan \"%s\" sudah memiliki manajer jendela; cobalah gunakan pilihan --" "Tampilan \"%s\" sudah memiliki manajer jendela; cobalah gunakan pilihan --"
"replace untuk mengganti manajer jendela saat ini." "replace untuk mengganti manajer jendela saat ini."
#: src/x11/meta-x11-display.c:1011 #: src/x11/meta-x11-display.c:1024
msgid "Failed to initialize GDK\n" msgid "Failed to initialize GDK\n"
msgstr "Gagal menginisialisasi GDK\n" msgstr "Gagal menginisialisasi GDK\n"
#: src/x11/meta-x11-display.c:1035 #: src/x11/meta-x11-display.c:1048
#, c-format #, c-format
msgid "Failed to open X Window System display “%s”\n" msgid "Failed to open X Window System display “%s”\n"
msgstr "Gagal membuka tampilan X Window System \"%s\"\n" msgstr "Gagal membuka tampilan X Window System \"%s\"\n"
#: src/x11/meta-x11-display.c:1116 #: src/x11/meta-x11-display.c:1132
#, c-format #, c-format
msgid "Screen %d on display “%s” is invalid\n" msgid "Screen %d on display “%s” is invalid\n"
msgstr "Layar %d pada tampilan \"%s\" tidak valid\n" msgstr "Layar %d pada tampilan \"%s\" tidak valid\n"

View File

@@ -21,16 +21,16 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: mutter\n" "Project-Id-Version: mutter\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
"POT-Creation-Date: 2019-02-04 17:52+0000\n" "POT-Creation-Date: 2019-07-18 13:55+0000\n"
"PO-Revision-Date: 2019-02-20 22:11-0300\n" "PO-Revision-Date: 2019-07-22 01:40-0300\n"
"Last-Translator: Rafael Fontenelle <rafaelff@gnome.org>\n" "Last-Translator: Rafael Fontenelle <rafaelff@gnome.org>\n"
"Language-Team: Portuguese - Brazil <gnome-pt_br-list@gnome.org>\n" "Language-Team: Brazilian Portuguese <gnome-pt_br-list@gnome.org>\n"
"Language: pt_BR\n" "Language: pt_BR\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1)\n" "Plural-Forms: nplurals=2; plural=(n > 1)\n"
"X-Generator: Gtranslator 3.31.90\n" "X-Generator: Gtranslator 3.32.0\n"
"X-Project-Style: gnome\n" "X-Project-Style: gnome\n"
#: data/50-mutter-navigation.xml:6 #: data/50-mutter-navigation.xml:6
@@ -406,6 +406,16 @@ msgid "Enable experimental features"
msgstr "Habilitar recursos experimentais" msgstr "Habilitar recursos experimentais"
#: data/org.gnome.mutter.gschema.xml.in:108 #: data/org.gnome.mutter.gschema.xml.in:108
#| msgid ""
#| "To enable experimental features, add the feature keyword to the list. "
#| "Whether the feature requires restarting the compositor depends on the "
#| "given feature. Any experimental feature is not required to still be "
#| "available, or configurable. Dont expect adding anything in this setting "
#| "to be future proof. Currently possible keywords: • “scale-monitor-"
#| "framebuffer” — makes mutter default to layout logical monitors in a "
#| "logical pixel coordinate space, while scaling monitor framebuffers "
#| "instead of window content, to manage HiDPI monitors. Does not require a "
#| "restart."
msgid "" msgid ""
"To enable experimental features, add the feature keyword to the list. " "To enable experimental features, add the feature keyword to the list. "
"Whether the feature requires restarting the compositor depends on the given " "Whether the feature requires restarting the compositor depends on the given "
@@ -414,7 +424,9 @@ msgid ""
"proof. Currently possible keywords: • “scale-monitor-framebuffer” — makes " "proof. Currently possible keywords: • “scale-monitor-framebuffer” — makes "
"mutter default to layout logical monitors in a logical pixel coordinate " "mutter default to layout logical monitors in a logical pixel coordinate "
"space, while scaling monitor framebuffers instead of window content, to " "space, while scaling monitor framebuffers instead of window content, to "
"manage HiDPI monitors. Does not require a restart." "manage HiDPI monitors. Does not require a restart. • “rt-scheduler” — makes "
"mutter request a low priority real-time scheduling. The executable or user "
"must have CAP_SYS_NICE. Requires a restart."
msgstr "" msgstr ""
"Para habilitar recursos experimentais, adicione a palavra-chave do recurso à " "Para habilitar recursos experimentais, adicione a palavra-chave do recurso à "
"lista. Se o recurso exige ou não reiniciar o compositor, depende do recurso " "lista. Se o recurso exige ou não reiniciar o compositor, depende do recurso "
@@ -424,21 +436,31 @@ msgstr ""
"framebuffer” — torna o mutter padrão para a disposição de monitores lógicos " "framebuffer” — torna o mutter padrão para a disposição de monitores lógicos "
"em um espaço lógico coordenado por pixels, ao dimensionar buffers de quadros " "em um espaço lógico coordenado por pixels, ao dimensionar buffers de quadros "
"de monitor em vez de conteúdo de janela, para gerenciar monitores HiDPI. Não " "de monitor em vez de conteúdo de janela, para gerenciar monitores HiDPI. Não "
"exige uma reinicialização." "exige uma reinicialização. • “rt-scheduler” — faz o mutter solicitar um "
"agendamento de tempo real de baixa prioridade. O executável ou usuário deve "
"ter CAP_SYS_NICE. Exige uma reinicialização."
#: data/org.gnome.mutter.gschema.xml.in:141 #: data/org.gnome.mutter.gschema.xml.in:132
msgid "Modifier to use to locate the pointer"
msgstr "Modificador para usar ao localizar o ponteiro"
#: data/org.gnome.mutter.gschema.xml.in:133
msgid "This key will initiate the “locate pointer” action."
msgstr "Essa chave vai iniciar a ação de “localizar ponteiro”."
#: data/org.gnome.mutter.gschema.xml.in:153
msgid "Select window from tab popup" msgid "Select window from tab popup"
msgstr "Selecione a janela a partir da aba instantânea" msgstr "Selecione a janela a partir da aba instantânea"
#: data/org.gnome.mutter.gschema.xml.in:146 #: data/org.gnome.mutter.gschema.xml.in:158
msgid "Cancel tab popup" msgid "Cancel tab popup"
msgstr "Cancelar aba instantânea" msgstr "Cancelar aba instantânea"
#: data/org.gnome.mutter.gschema.xml.in:151 #: data/org.gnome.mutter.gschema.xml.in:163
msgid "Switch monitor configurations" msgid "Switch monitor configurations"
msgstr "Trocar configurações de monitor" msgstr "Trocar configurações de monitor"
#: data/org.gnome.mutter.gschema.xml.in:156 #: data/org.gnome.mutter.gschema.xml.in:168
msgid "Rotates the built-in monitor configuration" msgid "Rotates the built-in monitor configuration"
msgstr "Gira a configuração de monitor embutido" msgstr "Gira a configuração de monitor embutido"
@@ -495,28 +517,44 @@ msgid "Re-enable shortcuts"
msgstr "Reabilita atalhos" msgstr "Reabilita atalhos"
#: data/org.gnome.mutter.wayland.gschema.xml.in:64 #: data/org.gnome.mutter.wayland.gschema.xml.in:64
msgid "Allow grabs with Xwayland" #| msgid "Allow grabs with Xwayland"
msgstr "Permitir capturas com Xwayland" msgid "Allow X11 grabs to lock keyboard focus with Xwayland"
msgstr "Permitir as capturas do X11 travar o foco do teclado com Xwayland"
#: data/org.gnome.mutter.wayland.gschema.xml.in:65 #: data/org.gnome.mutter.wayland.gschema.xml.in:65
#| msgid ""
#| "Allow keyboard grabs issued by X11 applications running in Xwayland to be "
#| "taken into account. For a X11 grab to be taken into account under "
#| "Wayland, the client must also either send a specific X11 ClientMessage to "
#| "the root window or be among the applications white-listed in key "
#| "“xwayland-grab-access-rules”."
msgid "" msgid ""
"Allow keyboard grabs issued by X11 applications running in Xwayland to be " "Allow all keyboard events to be routed to X11 “override redirect” windows "
"taken into account. For a X11 grab to be taken into account under Wayland, " "with a grab when running in Xwayland. This option is to support X11 clients "
"the client must also either send a specific X11 ClientMessage to the root " "which map an “override redirect” window (which do not receive keyboard "
"window or be among the applications white-listed in key “xwayland-grab-" "focus) and issue a keyboard grab to force all keyboard events to that "
"access-rules”." "window. This option is seldom used and has no effect on regular X11 windows "
"which can receive keyboard focus under normal circumstances. For a X11 grab "
"to be taken into account under Wayland, the client must also either send a "
"specific X11 ClientMessage to the root window or be among the applications "
"white-listed in key “xwayland-grab-access-rules”."
msgstr "" msgstr ""
"Permite capturas de teclado emitidas por aplicativos X11 em execução no " "Permita que todos os eventos do teclado sejam roteados para as janelas "
"Xwayland para serem levadas em consideração. Para que uma captura de X11 " "“override redirect” do X11 com uma captura ao executar no Xwayland. Esta "
"seja levada em consideração no Wayland, o cliente também deve enviar um X11 " "opção é para ter suporte a clientes X11 que mapeiam uma janela “override "
"ClientMessage específica para a janela raiz ou estar entre os aplicativos " "redirect” (que não recebe o foco do teclado) e emitem uma captura de teclado "
"listados em branco na chave “xwayland-grab-access-rules”." "para forçar todos os eventos do teclado para aquela janela. Esta opção é "
"raramente usada e não tem efeito nas janelas comuns do X11, que podem "
"receber o foco do teclado em circunstâncias normais. Para que uma captura de "
"X11 seja levada em conta no Wayland, o cliente também deve enviar uma "
"ClientMessage específica do X11 para a janela raiz ou estar entre os "
"aplicativos na lista branca na chave “xwayland-grab-access-rules”."
#: data/org.gnome.mutter.wayland.gschema.xml.in:77 #: data/org.gnome.mutter.wayland.gschema.xml.in:84
msgid "Xwayland applications allowed to issue keyboard grabs" msgid "Xwayland applications allowed to issue keyboard grabs"
msgstr "Aplicativos Xwayland com permissão para emitir capturas de teclado" msgstr "Aplicativos Xwayland com permissão para emitir capturas de teclado"
#: data/org.gnome.mutter.wayland.gschema.xml.in:78 #: data/org.gnome.mutter.wayland.gschema.xml.in:85
msgid "" msgid ""
"List the resource names or resource class of X11 windows either allowed or " "List the resource names or resource class of X11 windows either allowed or "
"not allowed to issue X11 keyboard grabs under Xwayland. The resource name or " "not allowed to issue X11 keyboard grabs under Xwayland. The resource name or "
@@ -543,7 +581,7 @@ msgstr ""
#. TRANSLATORS: This string refers to a button that switches between #. TRANSLATORS: This string refers to a button that switches between
#. * different modes. #. * different modes.
#. #.
#: src/backends/meta-input-settings.c:2423 #: src/backends/meta-input-settings.c:2531
#, c-format #, c-format
msgid "Mode Switch (Group %d)" msgid "Mode Switch (Group %d)"
msgstr "Alternador de modo (Grupo %d)" msgstr "Alternador de modo (Grupo %d)"
@@ -551,52 +589,56 @@ msgstr "Alternador de modo (Grupo %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets' #. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs. #. * mapping through the available outputs.
#. #.
#: src/backends/meta-input-settings.c:2446 #: src/backends/meta-input-settings.c:2554
msgid "Switch monitor" msgid "Switch monitor"
msgstr "Trocar monitor" msgstr "Trocar monitor"
#: src/backends/meta-input-settings.c:2448 #: src/backends/meta-input-settings.c:2556
msgid "Show on-screen help" msgid "Show on-screen help"
msgstr "Mostrar ajuda na tela" msgstr "Mostrar ajuda na tela"
#: src/backends/meta-monitor-manager.c:954 #: src/backends/meta-monitor.c:223
msgid "Built-in display" msgid "Built-in display"
msgstr "Tela embutida" msgstr "Tela embutida"
#: src/backends/meta-monitor-manager.c:986 #: src/backends/meta-monitor.c:252
msgid "Unknown" msgid "Unknown"
msgstr "Desconhecido" msgstr "Desconhecido"
#: src/backends/meta-monitor-manager.c:988 #: src/backends/meta-monitor.c:254
msgid "Unknown Display" msgid "Unknown Display"
msgstr "Monitor desconhecido" msgstr "Monitor desconhecido"
#: src/backends/meta-monitor-manager.c:996 #: src/backends/meta-monitor.c:262
#, c-format #, c-format
#| msgid "%s %s"
msgctxt "" msgctxt ""
"This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'" "This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'"
msgid "%s %s" msgid "%s %s"
msgstr "%s %s" msgstr "%s %s"
#: src/backends/meta-monitor-manager.c:1004 #: src/backends/meta-monitor.c:270
#, c-format #, c-format
#| msgid "%s %s"
msgctxt "" msgctxt ""
"This is a monitor vendor name followed by product/model name where size in " "This is a monitor vendor name followed by product/model name where size in "
"inches could not be calculated, e.g. Dell U2414H" "inches could not be calculated, e.g. Dell U2414H"
msgid "%s %s" msgid "%s %s"
msgstr "%s %s" msgstr "%s %s"
#. Translators: this string will appear in Sysprof
#: src/backends/meta-profiler.c:82
#| msgid "Compositing Manager"
msgid "Compositor"
msgstr "Compositor"
#. This probably means that a non-WM compositor like xcompmgr is running; #. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit #. * we have no way to get it to exit
#: src/compositor/compositor.c:482 #: src/compositor/compositor.c:510
#, c-format #, c-format
msgid "" msgid ""
"Another compositing manager is already running on screen %i on display “%s”." "Another compositing manager is already running on screen %i on display “%s”."
msgstr "Outro compositor de janelas está em execução na tela %i na área “%s”." msgstr "Outro gerenciador de composição de janelas está em execução na tela %i na área “%s”."
#: src/core/bell.c:252 #: src/core/bell.c:192
msgid "Bell event" msgid "Bell event"
msgstr "Evento de som" msgstr "Evento de som"
@@ -645,16 +687,16 @@ msgid "Run with X11 backend"
msgstr "Executa com backend X11" msgstr "Executa com backend X11"
#. Translators: %s is a window title #. Translators: %s is a window title
#: src/core/meta-close-dialog-default.c:150 #: src/core/meta-close-dialog-default.c:151
#, c-format #, c-format
msgid "“%s” is not responding." msgid "“%s” is not responding."
msgstr "“%s” não está respondendo." msgstr "“%s” não está respondendo."
#: src/core/meta-close-dialog-default.c:152 #: src/core/meta-close-dialog-default.c:153
msgid "Application is not responding." msgid "Application is not responding."
msgstr "O aplicativo não está respondendo." msgstr "O aplicativo não está respondendo."
#: src/core/meta-close-dialog-default.c:157 #: src/core/meta-close-dialog-default.c:158
msgid "" msgid ""
"You may choose to wait a short while for it to continue or force the " "You may choose to wait a short while for it to continue or force the "
"application to quit entirely." "application to quit entirely."
@@ -662,11 +704,11 @@ msgstr ""
"Você pode escolher aguardar um pouco e continuar ou forçar o aplicativo a " "Você pode escolher aguardar um pouco e continuar ou forçar o aplicativo a "
"sair completamente." "sair completamente."
#: src/core/meta-close-dialog-default.c:164 #: src/core/meta-close-dialog-default.c:165
msgid "_Force Quit" msgid "_Force Quit"
msgstr "_Forçar sair" msgstr "_Forçar sair"
#: src/core/meta-close-dialog-default.c:164 #: src/core/meta-close-dialog-default.c:165
msgid "_Wait" msgid "_Wait"
msgstr "_Esperar" msgstr "_Esperar"
@@ -694,7 +736,7 @@ msgstr "Versão impressa"
msgid "Mutter plugin to use" msgid "Mutter plugin to use"
msgstr "Plug-in do Mutter para usar" msgstr "Plug-in do Mutter para usar"
#: src/core/prefs.c:1786 #: src/core/prefs.c:1849
#, c-format #, c-format
msgid "Workspace %d" msgid "Workspace %d"
msgstr "Espaço de trabalho %d" msgstr "Espaço de trabalho %d"
@@ -708,7 +750,7 @@ msgstr "O Mutter foi compilado sem suporte para modo detalhado\n"
msgid "Mode Switch: Mode %d" msgid "Mode Switch: Mode %d"
msgstr "Alternador de modo: Modo %d" msgstr "Alternador de modo: Modo %d"
#: src/x11/meta-x11-display.c:666 #: src/x11/meta-x11-display.c:682
#, c-format #, c-format
msgid "" msgid ""
"Display “%s” already has a window manager; try using the --replace option to " "Display “%s” already has a window manager; try using the --replace option to "
@@ -717,20 +759,25 @@ msgstr ""
"A exibição “%s” já possui um gerenciador de janelas; tente usar a opção --" "A exibição “%s” já possui um gerenciador de janelas; tente usar a opção --"
"replace para substituir o gerenciador de janelas atual." "replace para substituir o gerenciador de janelas atual."
#: src/x11/meta-x11-display.c:1008 #: src/x11/meta-x11-display.c:1024
msgid "Failed to initialize GDK\n" msgid "Failed to initialize GDK\n"
msgstr "Falha ao inicializar GDK\n" msgstr "Falha ao inicializar GDK\n"
#: src/x11/meta-x11-display.c:1032 #: src/x11/meta-x11-display.c:1048
#, c-format #, c-format
msgid "Failed to open X Window System display “%s”\n" msgid "Failed to open X Window System display “%s”\n"
msgstr "Falha ao abrir a exibição “%s” do sistema de janelas X\n" msgstr "Falha ao abrir a exibição “%s” do sistema de janelas X\n"
#: src/x11/meta-x11-display.c:1115 #: src/x11/meta-x11-display.c:1132
#, c-format #, c-format
msgid "Screen %d on display “%s” is invalid\n" msgid "Screen %d on display “%s” is invalid\n"
msgstr "A tela %d na exibição “%s” é inválida\n" msgstr "A tela %d na exibição “%s” é inválida\n"
#: src/x11/meta-x11-selection-input-stream.c:445
#, c-format
msgid "Format %s not supported"
msgstr "Sem suporte ao formato %s"
#: src/x11/session.c:1821 #: src/x11/session.c:1821
msgid "" msgid ""
"These windows do not support “save current setup” and will have to be " "These windows do not support “save current setup” and will have to be "
@@ -739,7 +786,7 @@ msgstr ""
"Estas janelas não oferecem suporte para a opção “salvar configuração atual” " "Estas janelas não oferecem suporte para a opção “salvar configuração atual” "
"e precisarão ser reiniciadas manualmente quando você reiniciar a sessão." "e precisarão ser reiniciadas manualmente quando você reiniciar a sessão."
#: src/x11/window-props.c:568 #: src/x11/window-props.c:569
#, c-format #, c-format
msgid "%s (on %s)" msgid "%s (on %s)"
msgstr "%s (em %s)" msgstr "%s (em %s)"
@@ -2072,9 +2119,6 @@ msgstr "%s (em %s)"
#~ msgid "Commands to run in response to keybindings" #~ msgid "Commands to run in response to keybindings"
#~ msgstr "Comandos executados em resposta a teclas de atalho" #~ msgstr "Comandos executados em resposta a teclas de atalho"
#~ msgid "Compositing Manager"
#~ msgstr "Gerenciador de composição"
#~ msgid "Control how new windows get focus" #~ msgid "Control how new windows get focus"
#~ msgstr "Controla como novas janelas obtêm foco" #~ msgstr "Controla como novas janelas obtêm foco"

View File

@@ -144,6 +144,7 @@ struct _MetaBackendPrivate
gboolean is_pointer_position_initialized; gboolean is_pointer_position_initialized;
guint device_update_idle_id; guint device_update_idle_id;
guint keymap_state_changed_id;
GHashTable *device_monitors; GHashTable *device_monitors;
@@ -178,6 +179,14 @@ meta_backend_finalize (GObject *object)
MetaBackend *backend = META_BACKEND (object); MetaBackend *backend = META_BACKEND (object);
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend); MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
if (priv->keymap_state_changed_id)
{
ClutterKeymap *keymap;
keymap = clutter_backend_get_keymap (priv->clutter_backend);
g_signal_handler_disconnect (keymap, priv->keymap_state_changed_id);
}
g_list_free_full (priv->gpus, g_object_unref); g_list_free_full (priv->gpus, g_object_unref);
g_clear_object (&priv->monitor_manager); g_clear_object (&priv->monitor_manager);
@@ -491,6 +500,7 @@ meta_backend_real_post_init (MetaBackend *backend)
{ {
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend); MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
ClutterDeviceManager *device_manager = clutter_device_manager_get_default (); ClutterDeviceManager *device_manager = clutter_device_manager_get_default ();
ClutterKeymap *keymap = clutter_backend_get_keymap (priv->clutter_backend);
priv->stage = meta_stage_new (backend); priv->stage = meta_stage_new (backend);
clutter_actor_realize (priv->stage); clutter_actor_realize (priv->stage);
@@ -517,6 +527,15 @@ meta_backend_real_post_init (MetaBackend *backend)
priv->input_settings = meta_backend_create_input_settings (backend); priv->input_settings = meta_backend_create_input_settings (backend);
if (priv->input_settings)
{
priv->keymap_state_changed_id =
g_signal_connect_swapped (keymap, "state-changed",
G_CALLBACK (meta_input_settings_maybe_save_numlock_state),
priv->input_settings);
meta_input_settings_maybe_restore_numlock_state (priv->input_settings);
}
#ifdef HAVE_REMOTE_DESKTOP #ifdef HAVE_REMOTE_DESKTOP
priv->remote_access_controller = priv->remote_access_controller =
g_object_new (META_TYPE_REMOTE_ACCESS_CONTROLLER, NULL); g_object_new (META_TYPE_REMOTE_ACCESS_CONTROLLER, NULL);

View File

@@ -302,7 +302,7 @@ meta_barrier_destroy (MetaBarrier *barrier)
static void static void
meta_barrier_init (MetaBarrier *barrier) meta_barrier_init (MetaBarrier *barrier)
{ {
barrier->priv = G_TYPE_INSTANCE_GET_PRIVATE (barrier, META_TYPE_BARRIER, MetaBarrierPrivate); barrier->priv = meta_barrier_get_instance_private (barrier);
} }
void void

View File

@@ -50,6 +50,7 @@ enum
{ {
CURSOR_CHANGED, CURSOR_CHANGED,
CURSOR_MOVED, CURSOR_MOVED,
VISIBILITY_CHANGED,
LAST_SIGNAL LAST_SIGNAL
}; };
@@ -173,6 +174,13 @@ meta_cursor_tracker_class_init (MetaCursorTrackerClass *klass)
G_TYPE_NONE, 2, G_TYPE_NONE, 2,
G_TYPE_FLOAT, G_TYPE_FLOAT,
G_TYPE_FLOAT); G_TYPE_FLOAT);
signals[VISIBILITY_CHANGED] = g_signal_new ("visibility-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
} }
/** /**
@@ -418,6 +426,12 @@ meta_cursor_tracker_get_pointer (MetaCursorTracker *tracker,
get_pointer_position_gdk (x, y, (int*)mods); get_pointer_position_gdk (x, y, (int*)mods);
} }
gboolean
meta_cursor_tracker_get_pointer_visible (MetaCursorTracker *tracker)
{
return tracker->is_showing;
}
void void
meta_cursor_tracker_set_pointer_visible (MetaCursorTracker *tracker, meta_cursor_tracker_set_pointer_visible (MetaCursorTracker *tracker,
gboolean visible) gboolean visible)
@@ -427,6 +441,8 @@ meta_cursor_tracker_set_pointer_visible (MetaCursorTracker *tracker,
tracker->is_showing = visible; tracker->is_showing = visible;
sync_cursor (tracker); sync_cursor (tracker);
g_signal_emit (tracker, signals[VISIBILITY_CHANGED], 0);
} }
MetaCursorSprite * MetaCursorSprite *

View File

@@ -30,6 +30,8 @@ gboolean meta_dnd_handle_xdnd_event (MetaBackend *backend,
Display *xdisplay, Display *xdisplay,
XEvent *xev); XEvent *xev);
void meta_dnd_init_xdnd (MetaX11Display *x11_display);
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
void meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor); void meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor);
void meta_dnd_wayland_handle_end_modal (MetaCompositor *compositor); void meta_dnd_wayland_handle_end_modal (MetaCompositor *compositor);

View File

@@ -1,7 +1,8 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* /*
* Copyright (C) 2016 Red Hat Inc. * Copyright (C) 2016, 2017 Red Hat Inc.
* Copyright (C) 2018, 2019 DisplayLink (UK) Ltd.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -574,6 +575,97 @@ meta_egl_destroy_image (MetaEgl *egl,
return TRUE; return TRUE;
} }
EGLImageKHR
meta_egl_create_dmabuf_image (MetaEgl *egl,
EGLDisplay egl_display,
unsigned int width,
unsigned int height,
uint32_t drm_format,
uint32_t n_planes,
const int *fds,
const uint32_t *strides,
const uint32_t *offsets,
const uint64_t *modifiers,
GError **error)
{
EGLint attribs[37];
int atti = 0;
/* This requires the Mesa commit in
* Mesa 10.3 (08264e5dad4df448e7718e782ad9077902089a07) or
* Mesa 10.2.7 (55d28925e6109a4afd61f109e845a8a51bd17652).
* Otherwise Mesa closes the fd behind our back and re-importing
* will fail.
* https://bugs.freedesktop.org/show_bug.cgi?id=76188
*/
attribs[atti++] = EGL_WIDTH;
attribs[atti++] = width;
attribs[atti++] = EGL_HEIGHT;
attribs[atti++] = height;
attribs[atti++] = EGL_LINUX_DRM_FOURCC_EXT;
attribs[atti++] = drm_format;
if (n_planes > 0)
{
attribs[atti++] = EGL_DMA_BUF_PLANE0_FD_EXT;
attribs[atti++] = fds[0];
attribs[atti++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT;
attribs[atti++] = offsets[0];
attribs[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
attribs[atti++] = strides[0];
if (modifiers)
{
attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT;
attribs[atti++] = modifiers[0] & 0xFFFFFFFF;
attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT;
attribs[atti++] = modifiers[0] >> 32;
}
}
if (n_planes > 1)
{
attribs[atti++] = EGL_DMA_BUF_PLANE1_FD_EXT;
attribs[atti++] = fds[1];
attribs[atti++] = EGL_DMA_BUF_PLANE1_OFFSET_EXT;
attribs[atti++] = offsets[1];
attribs[atti++] = EGL_DMA_BUF_PLANE1_PITCH_EXT;
attribs[atti++] = strides[1];
if (modifiers)
{
attribs[atti++] = EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT;
attribs[atti++] = modifiers[1] & 0xFFFFFFFF;
attribs[atti++] = EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT;
attribs[atti++] = modifiers[1] >> 32;
}
}
if (n_planes > 2)
{
attribs[atti++] = EGL_DMA_BUF_PLANE2_FD_EXT;
attribs[atti++] = fds[2];
attribs[atti++] = EGL_DMA_BUF_PLANE2_OFFSET_EXT;
attribs[atti++] = offsets[2];
attribs[atti++] = EGL_DMA_BUF_PLANE2_PITCH_EXT;
attribs[atti++] = strides[2];
if (modifiers)
{
attribs[atti++] = EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT;
attribs[atti++] = modifiers[2] & 0xFFFFFFFF;
attribs[atti++] = EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT;
attribs[atti++] = modifiers[2] >> 32;
}
}
attribs[atti++] = EGL_NONE;
g_assert (atti <= G_N_ELEMENTS (attribs));
return meta_egl_create_image (egl, egl_display, EGL_NO_CONTEXT,
EGL_LINUX_DMA_BUF_EXT, NULL,
attribs,
error);
}
gboolean gboolean
meta_egl_make_current (MetaEgl *egl, meta_egl_make_current (MetaEgl *egl,
EGLDisplay display, EGLDisplay display,

View File

@@ -2,6 +2,7 @@
/* /*
* Copyright (C) 2016 Red Hat Inc. * Copyright (C) 2016 Red Hat Inc.
* Copyright (C) 2019 DisplayLink (UK) Ltd.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -100,6 +101,18 @@ gboolean meta_egl_destroy_image (MetaEgl *egl,
EGLImageKHR image, EGLImageKHR image,
GError **error); GError **error);
EGLImageKHR meta_egl_create_dmabuf_image (MetaEgl *egl,
EGLDisplay egl_display,
unsigned int width,
unsigned int height,
uint32_t drm_format,
uint32_t n_planes,
const int *fds,
const uint32_t *strides,
const uint32_t *offsets,
const uint64_t *modifiers,
GError **error);
EGLSurface meta_egl_create_window_surface (MetaEgl *egl, EGLSurface meta_egl_create_window_surface (MetaEgl *egl,
EGLDisplay display, EGLDisplay display,
EGLConfig config, EGLConfig config,

View File

@@ -144,4 +144,7 @@ WacomDevice * meta_input_settings_get_tablet_wacom_device (MetaInputSettings *se
ClutterInputDevice *device); ClutterInputDevice *device);
#endif #endif
void meta_input_settings_maybe_save_numlock_state (MetaInputSettings *input_settings);
void meta_input_settings_maybe_restore_numlock_state (MetaInputSettings *input_settings);
#endif /* META_INPUT_SETTINGS_PRIVATE_H */ #endif /* META_INPUT_SETTINGS_PRIVATE_H */

View File

@@ -1152,6 +1152,8 @@ meta_input_settings_changed_cb (GSettings *settings,
strcmp (key, "repeat-interval") == 0 || strcmp (key, "repeat-interval") == 0 ||
strcmp (key, "delay") == 0) strcmp (key, "delay") == 0)
update_keyboard_repeat (input_settings); update_keyboard_repeat (input_settings);
else if (strcmp (key, "remember-numlock-state") == 0)
meta_input_settings_maybe_save_numlock_state (input_settings);
} }
} }
@@ -2609,3 +2611,39 @@ meta_input_settings_get_pad_action_label (MetaInputSettings *input_settings,
return NULL; return NULL;
} }
void
meta_input_settings_maybe_save_numlock_state (MetaInputSettings *input_settings)
{
MetaInputSettingsPrivate *priv;
ClutterKeymap *keymap;
gboolean numlock_state;
priv = meta_input_settings_get_instance_private (input_settings);
if (!g_settings_get_boolean (priv->keyboard_settings, "remember-numlock-state"))
return;
keymap = clutter_backend_get_keymap (clutter_get_default_backend ());
numlock_state = clutter_keymap_get_num_lock_state (keymap);
if (numlock_state == g_settings_get_boolean (priv->keyboard_settings, "numlock-state"))
return;
g_settings_set_boolean (priv->keyboard_settings, "numlock-state", numlock_state);
}
void
meta_input_settings_maybe_restore_numlock_state (MetaInputSettings *input_settings)
{
MetaInputSettingsPrivate *priv;
gboolean numlock_state;
priv = meta_input_settings_get_instance_private (input_settings);
if (!g_settings_get_boolean (priv->keyboard_settings, "remember-numlock-state"))
return;
numlock_state = g_settings_get_boolean (priv->keyboard_settings, "numlock-state");
meta_backend_set_numlock (meta_get_backend (), numlock_state);
}

View File

@@ -145,15 +145,7 @@ append_monitor (MetaMonitorManager *manager,
const char *mode_specs_str; const char *mode_specs_str;
GList *l; GList *l;
for (i = 0; i < G_N_ELEMENTS (default_specs); i++) mode_specs_str = getenv ("MUTTER_DEBUG_DUMMY_MODE_SPECS");
{
CrtcModeSpec *spec;
spec = g_memdup (&default_specs[i], sizeof (CrtcModeSpec));
mode_specs = g_list_prepend (mode_specs, spec);
}
mode_specs_str = getenv ("MUTTER_DEBUG_DUMMY_MONITORS_SPECS");
if (mode_specs_str && *mode_specs_str != '\0') if (mode_specs_str && *mode_specs_str != '\0')
{ {
g_auto (GStrv) specs = g_strsplit (mode_specs_str, ":", -1); g_auto (GStrv) specs = g_strsplit (mode_specs_str, ":", -1);
@@ -181,6 +173,16 @@ append_monitor (MetaMonitorManager *manager,
} }
} }
} }
else
{
for (i = 0; i < G_N_ELEMENTS (default_specs); i++)
{
CrtcModeSpec *spec;
spec = g_memdup (&default_specs[i], sizeof (CrtcModeSpec));
mode_specs = g_list_prepend (mode_specs, spec);
}
}
for (l = mode_specs; l; l = l->next) for (l = mode_specs; l; l = l->next)
{ {
@@ -395,10 +397,11 @@ meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager)
* Specifies the number of dummy monitors to include in the stage. Every * Specifies the number of dummy monitors to include in the stage. Every
* monitor is 1024x786 pixels and they are placed on a horizontal row. * monitor is 1024x786 pixels and they are placed on a horizontal row.
* *
* MUTTER_DEBUG_DUMMY_MONITORS_SPECS * MUTTER_DEBUG_DUMMY_MODE_SPECS
* *
* A colon separated list of monitor specifications that can be used to * A colon separated list of mode specifications that can be used to
* configure the monitor via dbus API. * configure the monitor via dbus API. Setting this environment variable
* overrides the default set of modes available.
* Format should be WWxHH:WWxHH@RR * Format should be WWxHH:WWxHH@RR
* *
* MUTTER_DEBUG_DUMMY_MONITOR_SCALES * MUTTER_DEBUG_DUMMY_MONITOR_SCALES

View File

@@ -385,4 +385,7 @@ void meta_monitor_manager_clear_crtc (MetaCrtc *crtc);
gboolean meta_monitor_has_aspect_as_size (MetaMonitor *monitor); gboolean meta_monitor_has_aspect_as_size (MetaMonitor *monitor);
char * meta_monitor_manager_get_vendor_name (MetaMonitorManager *manager,
const char *vendor);
#endif /* META_MONITOR_MANAGER_PRIVATE_H */ #endif /* META_MONITOR_MANAGER_PRIVATE_H */

View File

@@ -345,6 +345,9 @@ meta_monitor_manager_power_save_mode_changed (MetaMonitorManager *manager,
MetaMonitorManagerPrivate *priv = MetaMonitorManagerPrivate *priv =
meta_monitor_manager_get_instance_private (manager); meta_monitor_manager_get_instance_private (manager);
if (priv->power_save_mode == mode)
return;
priv->power_save_mode = mode; priv->power_save_mode = mode;
g_signal_emit (manager, signals[POWER_SAVE_MODE_CHANGED], 0); g_signal_emit (manager, signals[POWER_SAVE_MODE_CHANGED], 0);
} }
@@ -921,29 +924,6 @@ meta_monitor_manager_class_init (MetaMonitorManagerClass *klass)
g_object_class_install_properties (object_class, PROP_LAST, obj_props); g_object_class_install_properties (object_class, PROP_LAST, obj_props);
} }
static const double known_diagonals[] = {
12.1,
13.3,
15.6
};
static char *
diagonal_to_str (double d)
{
unsigned int i;
for (i = 0; i < G_N_ELEMENTS (known_diagonals); i++)
{
double delta;
delta = fabs(known_diagonals[i] - d);
if (delta < 0.1)
return g_strdup_printf ("%0.1lf\"", known_diagonals[i]);
}
return g_strdup_printf ("%d\"", (int) (d + 0.5));
}
gboolean gboolean
meta_monitor_has_aspect_as_size (MetaMonitor *monitor) meta_monitor_has_aspect_as_size (MetaMonitor *monitor)
{ {
@@ -960,79 +940,6 @@ meta_monitor_has_aspect_as_size (MetaMonitor *monitor)
(width_mm == 16 && height_mm == 10); (width_mm == 16 && height_mm == 10);
} }
static char *
make_display_name (MetaMonitorManager *manager,
MetaMonitor *monitor)
{
g_autofree char *inches = NULL;
g_autofree char *vendor_name = NULL;
const char *vendor = NULL;
const char *product_name = NULL;
int width_mm;
int height_mm;
meta_monitor_get_physical_dimensions (monitor, &width_mm, &height_mm);
if (meta_monitor_is_laptop_panel (monitor))
return g_strdup (_("Built-in display"));
if (width_mm > 0 && height_mm > 0)
{
if (!meta_monitor_has_aspect_as_size (monitor))
{
double d = sqrt (width_mm * width_mm +
height_mm * height_mm);
inches = diagonal_to_str (d / 25.4);
}
else
{
product_name = meta_monitor_get_product (monitor);
}
}
vendor = meta_monitor_get_vendor (monitor);
if (g_strcmp0 (vendor, "unknown") != 0)
{
if (!manager->pnp_ids)
manager->pnp_ids = gnome_pnp_ids_new ();
vendor_name = gnome_pnp_ids_get_pnp_id (manager->pnp_ids,
vendor);
if (!vendor_name)
vendor_name = g_strdup (vendor);
}
else
{
if (inches != NULL)
vendor_name = g_strdup (_("Unknown"));
else
vendor_name = g_strdup (_("Unknown Display"));
}
if (inches != NULL)
{
/**/
return g_strdup_printf (C_("This is a monitor vendor name, followed by a "
"size in inches, like 'Dell 15\"'",
"%s %s"),
vendor_name, inches);
}
else if (product_name != NULL)
{
return g_strdup_printf (C_("This is a monitor vendor name followed by "
"product/model name where size in inches "
"could not be calculated, e.g. Dell U2414H",
"%s %s"),
vendor_name, product_name);
}
else
{
return g_strdup (vendor_name);
}
}
static const char * static const char *
get_connector_type_name (MetaConnectorType connector_type) get_connector_type_name (MetaConnectorType connector_type)
{ {
@@ -1383,7 +1290,7 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
GVariantBuilder monitor_properties_builder; GVariantBuilder monitor_properties_builder;
GList *k; GList *k;
gboolean is_builtin; gboolean is_builtin;
char *display_name; const char *display_name;
current_mode = meta_monitor_get_current_mode (monitor); current_mode = meta_monitor_get_current_mode (monitor);
preferred_mode = meta_monitor_get_preferred_mode (monitor); preferred_mode = meta_monitor_get_preferred_mode (monitor);
@@ -1472,10 +1379,10 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
"is-builtin", "is-builtin",
g_variant_new_boolean (is_builtin)); g_variant_new_boolean (is_builtin));
display_name = make_display_name (manager, monitor); display_name = meta_monitor_get_display_name (monitor);
g_variant_builder_add (&monitor_properties_builder, "{sv}", g_variant_builder_add (&monitor_properties_builder, "{sv}",
"display-name", "display-name",
g_variant_new_take_string (display_name)); g_variant_new_string (display_name));
g_variant_builder_add (&monitors_builder, MONITOR_FORMAT, g_variant_builder_add (&monitors_builder, MONITOR_FORMAT,
monitor_spec->connector, monitor_spec->connector,
@@ -2734,7 +2641,7 @@ rebuild_monitors (MetaMonitorManager *manager)
{ {
MetaMonitorNormal *monitor_normal; MetaMonitorNormal *monitor_normal;
monitor_normal = meta_monitor_normal_new (gpu, output); monitor_normal = meta_monitor_normal_new (gpu, manager, output);
manager->monitors = g_list_append (manager->monitors, manager->monitors = g_list_append (manager->monitors,
monitor_normal); monitor_normal);
} }
@@ -3189,3 +3096,23 @@ meta_monitor_manager_get_config_manager (MetaMonitorManager *manager)
{ {
return manager->config_manager; return manager->config_manager;
} }
/**
* meta_monitor_manager_get_vendor_name:
* @manager: A #MetaMonitorManager object
* @vendor: the PNP ID of the monitor
*
* Find the full vendor name from the given monitor PNP ID.
*
* Returns: (transfer full): A string containing the vendor name,
* or NULL when not found.
*/
char *
meta_monitor_manager_get_vendor_name (MetaMonitorManager *manager,
const char *vendor)
{
if (!manager->pnp_ids)
manager->pnp_ids = gnome_pnp_ids_new ();
return gnome_pnp_ids_get_pnp_id (manager->pnp_ids, vendor);
}

View File

@@ -75,6 +75,8 @@ typedef struct _MetaMonitorPrivate
* the primary one). * the primary one).
*/ */
uint64_t winsys_id; uint64_t winsys_id;
char *display_name;
} MetaMonitorPrivate; } MetaMonitorPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (MetaMonitor, meta_monitor, G_TYPE_OBJECT) G_DEFINE_TYPE_WITH_PRIVATE (MetaMonitor, meta_monitor, G_TYPE_OBJECT)
@@ -181,6 +183,99 @@ meta_monitor_generate_spec (MetaMonitor *monitor)
priv->spec = monitor_spec; priv->spec = monitor_spec;
} }
static const double known_diagonals[] = {
12.1,
13.3,
15.6
};
static char *
diagonal_to_str (double d)
{
unsigned int i;
for (i = 0; i < G_N_ELEMENTS (known_diagonals); i++)
{
double delta;
delta = fabs(known_diagonals[i] - d);
if (delta < 0.1)
return g_strdup_printf ("%0.1lf\"", known_diagonals[i]);
}
return g_strdup_printf ("%d\"", (int) (d + 0.5));
}
static char *
meta_monitor_make_display_name (MetaMonitor *monitor,
MetaMonitorManager *monitor_manager)
{
g_autofree char *inches = NULL;
g_autofree char *vendor_name = NULL;
const char *vendor = NULL;
const char *product_name = NULL;
int width_mm;
int height_mm;
meta_monitor_get_physical_dimensions (monitor, &width_mm, &height_mm);
if (meta_monitor_is_laptop_panel (monitor))
return g_strdup (_("Built-in display"));
if (width_mm > 0 && height_mm > 0)
{
if (!meta_monitor_has_aspect_as_size (monitor))
{
double d = sqrt (width_mm * width_mm +
height_mm * height_mm);
inches = diagonal_to_str (d / 25.4);
}
else
{
product_name = meta_monitor_get_product (monitor);
}
}
vendor = meta_monitor_get_vendor (monitor);
if (g_strcmp0 (vendor, "unknown") != 0)
{
vendor_name = meta_monitor_manager_get_vendor_name (monitor_manager,
vendor);
if (!vendor_name)
vendor_name = g_strdup (vendor);
}
else
{
if (inches != NULL)
vendor_name = g_strdup (_("Unknown"));
else
vendor_name = g_strdup (_("Unknown Display"));
}
if (inches != NULL)
{
/**/
return g_strdup_printf (C_("This is a monitor vendor name, followed by a "
"size in inches, like 'Dell 15\"'",
"%s %s"),
vendor_name, inches);
}
else if (product_name != NULL)
{
return g_strdup_printf (C_("This is a monitor vendor name followed by "
"product/model name where size in inches "
"could not be calculated, e.g. Dell U2414H",
"%s %s"),
vendor_name, product_name);
}
else
{
return g_strdup (vendor_name);
}
}
MetaGpu * MetaGpu *
meta_monitor_get_gpu (MetaMonitor *monitor) meta_monitor_get_gpu (MetaMonitor *monitor)
{ {
@@ -410,6 +505,7 @@ meta_monitor_finalize (GObject *object)
g_hash_table_destroy (priv->mode_ids); g_hash_table_destroy (priv->mode_ids);
g_list_free_full (priv->modes, (GDestroyNotify) meta_monitor_mode_free); g_list_free_full (priv->modes, (GDestroyNotify) meta_monitor_mode_free);
meta_monitor_spec_free (priv->spec); meta_monitor_spec_free (priv->spec);
g_free (priv->display_name);
G_OBJECT_CLASS (meta_monitor_parent_class)->finalize (object); G_OBJECT_CLASS (meta_monitor_parent_class)->finalize (object);
} }
@@ -551,8 +647,9 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
} }
MetaMonitorNormal * MetaMonitorNormal *
meta_monitor_normal_new (MetaGpu *gpu, meta_monitor_normal_new (MetaGpu *gpu,
MetaOutput *output) MetaMonitorManager *monitor_manager,
MetaOutput *output)
{ {
MetaMonitorNormal *monitor_normal; MetaMonitorNormal *monitor_normal;
MetaMonitor *monitor; MetaMonitor *monitor;
@@ -570,6 +667,9 @@ meta_monitor_normal_new (MetaGpu *gpu,
meta_monitor_normal_generate_modes (monitor_normal); meta_monitor_normal_generate_modes (monitor_normal);
monitor_priv->display_name = meta_monitor_make_display_name (monitor,
monitor_manager);
return monitor_normal; return monitor_normal;
} }
@@ -1208,6 +1308,9 @@ meta_monitor_tiled_new (MetaGpu *gpu,
meta_monitor_tiled_generate_modes (monitor_tiled); meta_monitor_tiled_generate_modes (monitor_tiled);
monitor_priv->display_name = meta_monitor_make_display_name (monitor,
monitor_manager);
return monitor_tiled; return monitor_tiled;
} }
@@ -1765,3 +1868,12 @@ meta_monitor_mode_foreach_output (MetaMonitor *monitor,
return TRUE; return TRUE;
} }
const char *
meta_monitor_get_display_name (MetaMonitor *monitor)
{
MetaMonitorPrivate *monitor_priv =
meta_monitor_get_instance_private (monitor);
return monitor_priv->display_name;
}

View File

@@ -101,8 +101,9 @@ MetaMonitorTiled * meta_monitor_tiled_new (MetaGpu *gpu,
MetaOutput *output); MetaOutput *output);
META_EXPORT_TEST META_EXPORT_TEST
MetaMonitorNormal * meta_monitor_normal_new (MetaGpu *gpu, MetaMonitorNormal * meta_monitor_normal_new (MetaGpu *gpu,
MetaOutput *output); MetaMonitorManager *monitor_manager,
MetaOutput *output);
META_EXPORT_TEST META_EXPORT_TEST
MetaMonitorSpec * meta_monitor_get_spec (MetaMonitor *monitor); MetaMonitorSpec * meta_monitor_get_spec (MetaMonitor *monitor);
@@ -280,4 +281,6 @@ int meta_monitor_spec_compare (MetaMonitorSpec *monitor_spec_a,
META_EXPORT_TEST META_EXPORT_TEST
void meta_monitor_spec_free (MetaMonitorSpec *monitor_id); void meta_monitor_spec_free (MetaMonitorSpec *monitor_id);
const char * meta_monitor_get_display_name (MetaMonitor *monitor);
#endif /* META_MONITOR_H */ #endif /* META_MONITOR_H */

View File

@@ -31,7 +31,6 @@
#include "backends/meta-dbus-session-watcher.h" #include "backends/meta-dbus-session-watcher.h"
#include "backends/meta-screen-cast-session.h" #include "backends/meta-screen-cast-session.h"
#include "backends/meta-remote-access-controller-private.h" #include "backends/meta-remote-access-controller-private.h"
#include "backends/native/meta-backend-native.h"
#include "backends/x11/meta-backend-x11.h" #include "backends/x11/meta-backend-x11.h"
#include "cogl/cogl.h" #include "cogl/cogl.h"
#include "meta/meta-backend.h" #include "meta/meta-backend.h"

View File

@@ -90,6 +90,12 @@ meta_renderer_create_view (MetaRenderer *renderer,
*/ */
void void
meta_renderer_rebuild_views (MetaRenderer *renderer) meta_renderer_rebuild_views (MetaRenderer *renderer)
{
return META_RENDERER_GET_CLASS (renderer)->rebuild_views (renderer);
}
static void
meta_renderer_real_rebuild_views (MetaRenderer *renderer)
{ {
MetaRendererPrivate *priv = meta_renderer_get_instance_private (renderer); MetaRendererPrivate *priv = meta_renderer_get_instance_private (renderer);
MetaBackend *backend = meta_get_backend (); MetaBackend *backend = meta_get_backend ();
@@ -181,4 +187,6 @@ meta_renderer_class_init (MetaRendererClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_renderer_finalize; object_class->finalize = meta_renderer_finalize;
klass->rebuild_views = meta_renderer_real_rebuild_views;
} }

View File

@@ -43,6 +43,7 @@ struct _MetaRendererClass
CoglRenderer * (* create_cogl_renderer) (MetaRenderer *renderer); CoglRenderer * (* create_cogl_renderer) (MetaRenderer *renderer);
MetaRendererView * (* create_view) (MetaRenderer *renderer, MetaRendererView * (* create_view) (MetaRenderer *renderer,
MetaLogicalMonitor *logical_monitor); MetaLogicalMonitor *logical_monitor);
void (* rebuild_views) (MetaRenderer *renderer);
}; };
CoglRenderer * meta_renderer_create_cogl_renderer (MetaRenderer *renderer); CoglRenderer * meta_renderer_create_cogl_renderer (MetaRenderer *renderer);

View File

@@ -814,6 +814,7 @@ void meta_backend_native_resume (MetaBackendNative *native)
meta_backend_get_monitor_manager (backend); meta_backend_get_monitor_manager (backend);
MetaMonitorManagerKms *monitor_manager_kms = MetaMonitorManagerKms *monitor_manager_kms =
META_MONITOR_MANAGER_KMS (monitor_manager); META_MONITOR_MANAGER_KMS (monitor_manager);
MetaInputSettings *input_settings;
MetaIdleMonitor *idle_monitor; MetaIdleMonitor *idle_monitor;
meta_monitor_manager_kms_resume (monitor_manager_kms); meta_monitor_manager_kms_resume (monitor_manager_kms);
@@ -827,4 +828,7 @@ void meta_backend_native_resume (MetaBackendNative *native)
idle_monitor = meta_backend_get_idle_monitor (backend, 0); idle_monitor = meta_backend_get_idle_monitor (backend, 0);
meta_idle_monitor_reset_idletime (idle_monitor); meta_idle_monitor_reset_idletime (idle_monitor);
input_settings = meta_backend_get_input_settings (backend);
meta_input_settings_maybe_restore_numlock_state (input_settings);
} }

View File

@@ -40,6 +40,17 @@ struct _MetaKmsCrtc
G_DEFINE_TYPE (MetaKmsCrtc, meta_kms_crtc, G_TYPE_OBJECT) G_DEFINE_TYPE (MetaKmsCrtc, meta_kms_crtc, G_TYPE_OBJECT)
void
meta_kms_crtc_set_gamma (MetaKmsCrtc *crtc,
MetaKmsUpdate *update,
int size,
const uint16_t *red,
const uint16_t *green,
const uint16_t *blue)
{
meta_kms_update_set_crtc_gamma (update, crtc, size, red, green, blue);
}
MetaKmsDevice * MetaKmsDevice *
meta_kms_crtc_get_device (MetaKmsCrtc *crtc) meta_kms_crtc_get_device (MetaKmsCrtc *crtc)
{ {
@@ -64,6 +75,36 @@ meta_kms_crtc_get_idx (MetaKmsCrtc *crtc)
return crtc->idx; return crtc->idx;
} }
static void
read_gamma_state (MetaKmsCrtc *crtc,
MetaKmsImplDevice *impl_device,
drmModeCrtc *drm_crtc)
{
MetaKmsCrtcState *current_state = &crtc->current_state;
if (current_state->gamma.size != drm_crtc->gamma_size)
{
current_state->gamma.size = drm_crtc->gamma_size;
current_state->gamma.red = g_realloc_n (current_state->gamma.red,
drm_crtc->gamma_size,
sizeof (uint16_t));
current_state->gamma.green = g_realloc_n (current_state->gamma.green,
drm_crtc->gamma_size,
sizeof (uint16_t));
current_state->gamma.blue = g_realloc_n (current_state->gamma.blue,
drm_crtc->gamma_size,
sizeof (uint16_t));
}
drmModeCrtcGetGamma (meta_kms_impl_device_get_fd (impl_device),
crtc->id,
current_state->gamma.size,
current_state->gamma.red,
current_state->gamma.green,
current_state->gamma.blue);
}
static void static void
meta_kms_crtc_read_state (MetaKmsCrtc *crtc, meta_kms_crtc_read_state (MetaKmsCrtc *crtc,
MetaKmsImplDevice *impl_device, MetaKmsImplDevice *impl_device,
@@ -79,6 +120,8 @@ meta_kms_crtc_read_state (MetaKmsCrtc *crtc,
.is_drm_mode_valid = drm_crtc->mode_valid, .is_drm_mode_valid = drm_crtc->mode_valid,
.drm_mode = drm_crtc->mode, .drm_mode = drm_crtc->mode,
}; };
read_gamma_state (crtc, impl_device, drm_crtc);
} }
void void
@@ -109,6 +152,18 @@ meta_kms_crtc_new (MetaKmsImplDevice *impl_device,
return crtc; return crtc;
} }
static void
meta_kms_crtc_finalize (GObject *object)
{
MetaKmsCrtc *crtc = META_KMS_CRTC (object);
g_clear_pointer (&crtc->current_state.gamma.red, g_free);
g_clear_pointer (&crtc->current_state.gamma.green, g_free);
g_clear_pointer (&crtc->current_state.gamma.blue, g_free);
G_OBJECT_CLASS (meta_kms_crtc_parent_class)->finalize (object);
}
static void static void
meta_kms_crtc_init (MetaKmsCrtc *crtc) meta_kms_crtc_init (MetaKmsCrtc *crtc)
{ {
@@ -117,4 +172,7 @@ meta_kms_crtc_init (MetaKmsCrtc *crtc)
static void static void
meta_kms_crtc_class_init (MetaKmsCrtcClass *klass) meta_kms_crtc_class_init (MetaKmsCrtcClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_kms_crtc_finalize;
} }

View File

@@ -36,6 +36,14 @@ typedef struct _MetaKmsCrtcState
uint32_t common_possible_crtcs; uint32_t common_possible_crtcs;
uint32_t common_possible_clones; uint32_t common_possible_clones;
uint32_t encoder_device_idxs; uint32_t encoder_device_idxs;
struct {
uint16_t *red;
uint16_t *green;
uint16_t *blue;
int size;
} gamma;
} MetaKmsCrtcState; } MetaKmsCrtcState;
#define META_TYPE_KMS_CRTC (meta_kms_crtc_get_type ()) #define META_TYPE_KMS_CRTC (meta_kms_crtc_get_type ())
@@ -43,6 +51,13 @@ G_DECLARE_FINAL_TYPE (MetaKmsCrtc, meta_kms_crtc,
META, KMS_CRTC, META, KMS_CRTC,
GObject) GObject)
void meta_kms_crtc_set_gamma (MetaKmsCrtc *crtc,
MetaKmsUpdate *update,
int size,
const uint16_t *red,
const uint16_t *green,
const uint16_t *blue);
MetaKmsDevice * meta_kms_crtc_get_device (MetaKmsCrtc *crtc); MetaKmsDevice * meta_kms_crtc_get_device (MetaKmsCrtc *crtc);
const MetaKmsCrtcState * meta_kms_crtc_get_current_state (MetaKmsCrtc *crtc); const MetaKmsCrtcState * meta_kms_crtc_get_current_state (MetaKmsCrtc *crtc);

View File

@@ -156,7 +156,9 @@ create_impl_device_in_impl (MetaKmsImpl *impl,
CreateImplDeviceData *data = user_data; CreateImplDeviceData *data = user_data;
MetaKmsImplDevice *impl_device; MetaKmsImplDevice *impl_device;
impl_device = meta_kms_impl_device_new (data->device, impl, data->fd); impl_device = meta_kms_impl_device_new (data->device, impl, data->fd, error);
if (!impl_device)
return FALSE;
data->out_impl_device = impl_device; data->out_impl_device = impl_device;
data->out_crtcs = meta_kms_impl_device_copy_crtcs (impl_device); data->out_crtcs = meta_kms_impl_device_copy_crtcs (impl_device);

View File

@@ -307,25 +307,41 @@ meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device)
} }
MetaKmsImplDevice * MetaKmsImplDevice *
meta_kms_impl_device_new (MetaKmsDevice *device, meta_kms_impl_device_new (MetaKmsDevice *device,
MetaKmsImpl *impl, MetaKmsImpl *impl,
int fd) int fd,
GError **error)
{ {
MetaKms *kms = meta_kms_impl_get_kms (impl); MetaKms *kms = meta_kms_impl_get_kms (impl);
MetaKmsImplDevice *impl_device; MetaKmsImplDevice *impl_device;
int ret;
drmModeRes *drm_resources; drmModeRes *drm_resources;
meta_assert_in_kms_impl (kms); meta_assert_in_kms_impl (kms);
ret = drmSetClientCap (fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
if (ret != 0)
{
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (-ret),
"Failed to activate universal planes: %s",
g_strerror (-ret));
return NULL;
}
drm_resources = drmModeGetResources (fd);
if (!drm_resources)
{
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
"Failed to activate universal planes: %s",
g_strerror (errno));
return NULL;
}
impl_device = g_object_new (META_TYPE_KMS_IMPL_DEVICE, NULL); impl_device = g_object_new (META_TYPE_KMS_IMPL_DEVICE, NULL);
impl_device->device = device; impl_device->device = device;
impl_device->impl = impl; impl_device->impl = impl;
impl_device->fd = fd; impl_device->fd = fd;
drmSetClientCap (fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
drm_resources = drmModeGetResources (fd);
init_crtcs (impl_device, drm_resources); init_crtcs (impl_device, drm_resources);
init_connectors (impl_device, drm_resources); init_connectors (impl_device, drm_resources);
init_planes (impl_device); init_planes (impl_device);

View File

@@ -57,8 +57,9 @@ void meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device);
int meta_kms_impl_device_close (MetaKmsImplDevice *impl_device); int meta_kms_impl_device_close (MetaKmsImplDevice *impl_device);
MetaKmsImplDevice * meta_kms_impl_device_new (MetaKmsDevice *device, MetaKmsImplDevice * meta_kms_impl_device_new (MetaKmsDevice *device,
MetaKmsImpl *kms_impl, MetaKmsImpl *kms_impl,
int fd); int fd,
GError **error);
#endif /* META_KMS_IMPL_DEVICE_H */ #endif /* META_KMS_IMPL_DEVICE_H */

View File

@@ -201,7 +201,7 @@ process_mode_set (MetaKmsImpl *impl,
GError **error) GError **error)
{ {
MetaKmsImplSimple *impl_simple = META_KMS_IMPL_SIMPLE (impl); MetaKmsImplSimple *impl_simple = META_KMS_IMPL_SIMPLE (impl);
MetaKmsCrtc *crtc = mode_set->crtc;; MetaKmsCrtc *crtc = mode_set->crtc;
MetaKmsDevice *device = meta_kms_crtc_get_device (crtc); MetaKmsDevice *device = meta_kms_crtc_get_device (crtc);
MetaKmsImplDevice *impl_device = meta_kms_device_get_impl_device (device); MetaKmsImplDevice *impl_device = meta_kms_device_get_impl_device (device);
g_autofree uint32_t *connectors = NULL; g_autofree uint32_t *connectors = NULL;
@@ -284,6 +284,35 @@ process_mode_set (MetaKmsImpl *impl,
return TRUE; return TRUE;
} }
static gboolean
process_crtc_gamma (MetaKmsImpl *impl,
MetaKmsCrtcGamma *gamma,
GError **error)
{
MetaKmsCrtc *crtc = gamma->crtc;
MetaKmsDevice *device = meta_kms_crtc_get_device (crtc);
MetaKmsImplDevice *impl_device = meta_kms_device_get_impl_device (device);
int fd;
int ret;
fd = meta_kms_impl_device_get_fd (impl_device);
ret = drmModeCrtcSetGamma (fd, meta_kms_crtc_get_id (crtc),
gamma->size,
gamma->red,
gamma->green,
gamma->blue);
if (ret != 0)
{
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (-ret),
"drmModeCrtcSetGamma on CRTC %u failed: %s",
meta_kms_crtc_get_id (crtc),
g_strerror (-ret));
return FALSE;
}
return TRUE;
}
static gboolean static gboolean
is_timestamp_earlier_than (uint64_t ts1, is_timestamp_earlier_than (uint64_t ts1,
uint64_t ts2) uint64_t ts2)
@@ -708,6 +737,14 @@ meta_kms_impl_simple_process_update (MetaKmsImpl *impl,
goto discard_page_flips; goto discard_page_flips;
} }
for (l = meta_kms_update_get_crtc_gammas (update); l; l = l->next)
{
MetaKmsCrtcGamma *gamma = l->data;
if (!process_crtc_gamma (impl, gamma, error))
goto discard_page_flips;
}
for (l = meta_kms_update_get_page_flips (update); l; l = l->next) for (l = meta_kms_update_get_page_flips (update); l; l = l->next)
{ {
MetaKmsPageFlip *page_flip = l->data; MetaKmsPageFlip *page_flip = l->data;

View File

@@ -22,6 +22,7 @@
#include "backends/native/meta-kms-plane.h" #include "backends/native/meta-kms-plane.h"
#include <drm_fourcc.h>
#include <stdio.h> #include <stdio.h>
#include "backends/meta-monitor-transform.h" #include "backends/meta-monitor-transform.h"
@@ -293,9 +294,39 @@ parse_formats (MetaKmsPlane *plane,
drmModeFreePropertyBlob (blob); drmModeFreePropertyBlob (blob);
} }
static void
set_formats_from_array (MetaKmsPlane *plane,
const uint32_t *formats,
size_t n_formats)
{
size_t i;
for (i = 0; i < n_formats; i++)
{
g_hash_table_insert (plane->formats_modifiers,
GUINT_TO_POINTER (formats[i]), NULL);
}
}
/*
* In case the DRM driver does not expose a format list for the
* primary plane (does not support universal planes nor
* IN_FORMATS property), hardcode something that is probably supported.
*/
static const uint32_t drm_default_formats[] =
{
/* The format everything should always support by convention */
DRM_FORMAT_XRGB8888,
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
/* OpenGL GL_RGBA, GL_UNSIGNED_BYTE format, hopefully supported */
DRM_FORMAT_XBGR8888
#endif
};
static void static void
init_formats (MetaKmsPlane *plane, init_formats (MetaKmsPlane *plane,
MetaKmsImplDevice *impl_device, MetaKmsImplDevice *impl_device,
drmModePlane *drm_plane,
drmModeObjectProperties *drm_plane_props) drmModeObjectProperties *drm_plane_props)
{ {
drmModePropertyPtr prop; drmModePropertyPtr prop;
@@ -317,6 +348,21 @@ init_formats (MetaKmsPlane *plane,
parse_formats (plane, impl_device, blob_id); parse_formats (plane, impl_device, blob_id);
drmModeFreeProperty (prop); drmModeFreeProperty (prop);
} }
if (g_hash_table_size (plane->formats_modifiers) == 0)
{
set_formats_from_array (plane,
drm_plane->formats,
drm_plane->count_formats);
}
/* final formats fallback to something hardcoded */
if (g_hash_table_size (plane->formats_modifiers) == 0)
{
set_formats_from_array (plane,
drm_default_formats,
G_N_ELEMENTS (drm_default_formats));
}
} }
MetaKmsPlane * MetaKmsPlane *
@@ -334,7 +380,7 @@ meta_kms_plane_new (MetaKmsPlaneType type,
plane->device = meta_kms_impl_device_get_device (impl_device); plane->device = meta_kms_impl_device_get_device (impl_device);
init_rotations (plane, impl_device, drm_plane_props); init_rotations (plane, impl_device, drm_plane_props);
init_formats (plane, impl_device, drm_plane_props); init_formats (plane, impl_device, drm_plane, drm_plane_props);
return plane; return plane;
} }

View File

@@ -59,6 +59,15 @@ typedef struct _MetaKmsConnectorProperty
uint64_t value; uint64_t value;
} MetaKmsConnectorProperty; } MetaKmsConnectorProperty;
typedef struct _MetaKmsCrtcGamma
{
MetaKmsCrtc *crtc;
int size;
uint16_t *red;
uint16_t *green;
uint16_t *blue;
} MetaKmsCrtcGamma;
typedef struct _MetaKmsPageFlip typedef struct _MetaKmsPageFlip
{ {
MetaKmsCrtc *crtc; MetaKmsCrtc *crtc;
@@ -77,6 +86,13 @@ void meta_kms_update_set_connector_property (MetaKmsUpdate *update,
uint32_t prop_id, uint32_t prop_id,
uint64_t value); uint64_t value);
void meta_kms_update_set_crtc_gamma (MetaKmsUpdate *update,
MetaKmsCrtc *crtc,
int size,
const uint16_t *red,
const uint16_t *green,
const uint16_t *blue);
void meta_kms_plane_assignment_set_plane_property (MetaKmsPlaneAssignment *plane_assignment, void meta_kms_plane_assignment_set_plane_property (MetaKmsPlaneAssignment *plane_assignment,
uint32_t prop_id, uint32_t prop_id,
uint64_t value); uint64_t value);
@@ -89,6 +105,8 @@ GList * meta_kms_update_get_page_flips (MetaKmsUpdate *update);
GList * meta_kms_update_get_connector_properties (MetaKmsUpdate *update); GList * meta_kms_update_get_connector_properties (MetaKmsUpdate *update);
GList * meta_kms_update_get_crtc_gammas (MetaKmsUpdate *update);
gboolean meta_kms_update_has_mode_set (MetaKmsUpdate *update); gboolean meta_kms_update_has_mode_set (MetaKmsUpdate *update);
#endif /* META_KMS_UPDATE_PRIVATE_H */ #endif /* META_KMS_UPDATE_PRIVATE_H */

View File

@@ -34,6 +34,7 @@ struct _MetaKmsUpdate
GList *plane_assignments; GList *plane_assignments;
GList *page_flips; GList *page_flips;
GList *connector_properties; GList *connector_properties;
GList *crtc_gammas;
}; };
static MetaKmsProperty * static MetaKmsProperty *
@@ -142,6 +143,39 @@ meta_kms_update_set_connector_property (MetaKmsUpdate *update,
prop); prop);
} }
static void
meta_kms_crtc_gamma_free (MetaKmsCrtcGamma *gamma)
{
g_free (gamma->red);
g_free (gamma->green);
g_free (gamma->blue);
g_free (gamma);
}
void
meta_kms_update_set_crtc_gamma (MetaKmsUpdate *update,
MetaKmsCrtc *crtc,
int size,
const uint16_t *red,
const uint16_t *green,
const uint16_t *blue)
{
MetaKmsCrtcGamma *gamma;
g_assert (!meta_kms_update_is_sealed (update));
gamma = g_new0 (MetaKmsCrtcGamma, 1);
*gamma = (MetaKmsCrtcGamma) {
.crtc = crtc,
.size = size,
.red = g_memdup (red, size * sizeof *red),
.green = g_memdup (green, size * sizeof *green),
.blue = g_memdup (blue, size * sizeof *blue),
};
update->crtc_gammas = g_list_prepend (update->crtc_gammas, gamma);
}
void void
meta_kms_update_page_flip (MetaKmsUpdate *update, meta_kms_update_page_flip (MetaKmsUpdate *update,
MetaKmsCrtc *crtc, MetaKmsCrtc *crtc,
@@ -225,6 +259,12 @@ meta_kms_update_get_connector_properties (MetaKmsUpdate *update)
return update->connector_properties; return update->connector_properties;
} }
GList *
meta_kms_update_get_crtc_gammas (MetaKmsUpdate *update)
{
return update->crtc_gammas;
}
gboolean gboolean
meta_kms_update_has_mode_set (MetaKmsUpdate *update) meta_kms_update_has_mode_set (MetaKmsUpdate *update)
{ {
@@ -258,6 +298,7 @@ meta_kms_update_free (MetaKmsUpdate *update)
(GDestroyNotify) meta_kms_mode_set_free); (GDestroyNotify) meta_kms_mode_set_free);
g_list_free_full (update->page_flips, g_free); g_list_free_full (update->page_flips, g_free);
g_list_free_full (update->connector_properties, g_free); g_list_free_full (update->connector_properties, g_free);
g_list_free_full (update->crtc_gammas, (GDestroyNotify) meta_kms_crtc_gamma_free);
g_free (update); g_free (update);
} }

View File

@@ -367,20 +367,16 @@ meta_monitor_manager_kms_get_crtc_gamma (MetaMonitorManager *manager,
unsigned short **green, unsigned short **green,
unsigned short **blue) unsigned short **blue)
{ {
MetaGpu *gpu = meta_crtc_get_gpu (crtc); MetaKmsCrtc *kms_crtc;
int kms_fd = meta_gpu_kms_get_fd (META_GPU_KMS (gpu)); const MetaKmsCrtcState *crtc_state;
drmModeCrtc *kms_crtc;
kms_crtc = drmModeGetCrtc (kms_fd, crtc->crtc_id); kms_crtc = meta_crtc_kms_get_kms_crtc (crtc);
crtc_state = meta_kms_crtc_get_current_state (kms_crtc);
*size = kms_crtc->gamma_size; *size = crtc_state->gamma.size;
*red = g_new (unsigned short, *size); *red = g_memdup (crtc_state->gamma.red, *size * sizeof **red);
*green = g_new (unsigned short, *size); *green = g_memdup (crtc_state->gamma.green, *size * sizeof **green);
*blue = g_new (unsigned short, *size); *blue = g_memdup (crtc_state->gamma.blue, *size * sizeof **blue);
drmModeCrtcGetGamma (kms_fd, crtc->crtc_id, *size, *red, *green, *blue);
drmModeFreeCrtc (kms_crtc);
} }
static char * static char *
@@ -453,20 +449,25 @@ meta_monitor_manager_kms_set_crtc_gamma (MetaMonitorManager *manager,
unsigned short *green, unsigned short *green,
unsigned short *blue) unsigned short *blue)
{ {
MetaGpu *gpu = meta_crtc_get_gpu (crtc); MetaBackend *backend = meta_monitor_manager_get_backend (manager);
int kms_fd = meta_gpu_kms_get_fd (META_GPU_KMS (gpu)); MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
MetaKms *kms = meta_backend_native_get_kms (backend_native);
MetaKmsCrtc *kms_crtc;
g_autofree char *gamma_ramp_string = NULL; g_autofree char *gamma_ramp_string = NULL;
int ret; MetaKmsUpdate *kms_update;
g_autoptr (GError) error = NULL;
gamma_ramp_string = generate_gamma_ramp_string (size, red, green, blue); gamma_ramp_string = generate_gamma_ramp_string (size, red, green, blue);
g_debug ("Setting CRTC (%ld) gamma to %s", crtc->crtc_id, gamma_ramp_string); g_debug ("Setting CRTC (%ld) gamma to %s", crtc->crtc_id, gamma_ramp_string);
ret = drmModeCrtcSetGamma (kms_fd, crtc->crtc_id, size, red, green, blue); kms_update = meta_kms_ensure_pending_update (kms);
if (ret != 0)
{ kms_crtc = meta_crtc_kms_get_kms_crtc (crtc);
g_warning ("Failed to set CRTC (%ld) Gamma: %s", meta_kms_crtc_set_gamma (kms_crtc, kms_update,
crtc->crtc_id, g_strerror (-ret)); size, red, green, blue);
}
if (!meta_kms_post_pending_update_sync (kms, &error))
g_warning ("Failed to CRTC gamma: %s", error->message);
} }
static void static void

View File

@@ -45,101 +45,6 @@
#error "Somehow included OpenGL headers when we shouldn't have" #error "Somehow included OpenGL headers when we shouldn't have"
#endif #endif
static EGLImageKHR
create_egl_image (MetaEgl *egl,
EGLDisplay egl_display,
EGLContext egl_context,
unsigned int width,
unsigned int height,
uint32_t n_planes,
uint32_t *strides,
uint32_t *offsets,
uint64_t *modifiers,
uint32_t format,
int fd,
GError **error)
{
EGLint attribs[37];
int atti = 0;
gboolean has_modifier;
/* This requires the Mesa commit in
* Mesa 10.3 (08264e5dad4df448e7718e782ad9077902089a07) or
* Mesa 10.2.7 (55d28925e6109a4afd61f109e845a8a51bd17652).
* Otherwise Mesa closes the fd behind our back and re-importing
* will fail.
* https://bugs.freedesktop.org/show_bug.cgi?id=76188
*/
attribs[atti++] = EGL_WIDTH;
attribs[atti++] = width;
attribs[atti++] = EGL_HEIGHT;
attribs[atti++] = height;
attribs[atti++] = EGL_LINUX_DRM_FOURCC_EXT;
attribs[atti++] = format;
has_modifier = (modifiers[0] != DRM_FORMAT_MOD_INVALID &&
modifiers[0] != DRM_FORMAT_MOD_LINEAR);
if (n_planes > 0)
{
attribs[atti++] = EGL_DMA_BUF_PLANE0_FD_EXT;
attribs[atti++] = fd;
attribs[atti++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT;
attribs[atti++] = offsets[0];
attribs[atti++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
attribs[atti++] = strides[0];
if (has_modifier)
{
attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT;
attribs[atti++] = modifiers[0] & 0xFFFFFFFF;
attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT;
attribs[atti++] = modifiers[0] >> 32;
}
}
if (n_planes > 1)
{
attribs[atti++] = EGL_DMA_BUF_PLANE1_FD_EXT;
attribs[atti++] = fd;
attribs[atti++] = EGL_DMA_BUF_PLANE1_OFFSET_EXT;
attribs[atti++] = offsets[1];
attribs[atti++] = EGL_DMA_BUF_PLANE1_PITCH_EXT;
attribs[atti++] = strides[1];
if (has_modifier)
{
attribs[atti++] = EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT;
attribs[atti++] = modifiers[1] & 0xFFFFFFFF;
attribs[atti++] = EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT;
attribs[atti++] = modifiers[1] >> 32;
}
}
if (n_planes > 2)
{
attribs[atti++] = EGL_DMA_BUF_PLANE2_FD_EXT;
attribs[atti++] = fd;
attribs[atti++] = EGL_DMA_BUF_PLANE2_OFFSET_EXT;
attribs[atti++] = offsets[2];
attribs[atti++] = EGL_DMA_BUF_PLANE2_PITCH_EXT;
attribs[atti++] = strides[2];
if (has_modifier)
{
attribs[atti++] = EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT;
attribs[atti++] = modifiers[2] & 0xFFFFFFFF;
attribs[atti++] = EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT;
attribs[atti++] = modifiers[2] >> 32;
}
}
attribs[atti++] = EGL_NONE;
return meta_egl_create_image (egl, egl_display, EGL_NO_CONTEXT,
EGL_LINUX_DMA_BUF_EXT, NULL,
attribs,
error);
}
static void static void
paint_egl_image (MetaGles3 *gles3, paint_egl_image (MetaGles3 *gles3,
EGLImageKHR egl_image, EGLImageKHR egl_image,
@@ -195,8 +100,10 @@ meta_renderer_native_gles3_blit_shared_bo (MetaEgl *egl,
uint32_t strides[4] = { 0 }; uint32_t strides[4] = { 0 };
uint32_t offsets[4] = { 0 }; uint32_t offsets[4] = { 0 };
uint64_t modifiers[4] = { 0 }; uint64_t modifiers[4] = { 0 };
int fds[4] = { -1, -1, -1, -1 };
uint32_t format; uint32_t format;
EGLImageKHR egl_image; EGLImageKHR egl_image;
gboolean use_modifiers;
shared_bo_fd = gbm_bo_get_fd (shared_bo); shared_bo_fd = gbm_bo_get_fd (shared_bo);
if (shared_bo_fd < 0) if (shared_bo_fd < 0)
@@ -216,17 +123,27 @@ meta_renderer_native_gles3_blit_shared_bo (MetaEgl *egl,
strides[i] = gbm_bo_get_stride_for_plane (shared_bo, i); strides[i] = gbm_bo_get_stride_for_plane (shared_bo, i);
offsets[i] = gbm_bo_get_offset (shared_bo, i); offsets[i] = gbm_bo_get_offset (shared_bo, i);
modifiers[i] = gbm_bo_get_modifier (shared_bo); modifiers[i] = gbm_bo_get_modifier (shared_bo);
fds[i] = shared_bo_fd;
} }
egl_image = create_egl_image (egl, /* Workaround for https://gitlab.gnome.org/GNOME/mutter/issues/18 */
egl_display, if (modifiers[0] == DRM_FORMAT_MOD_LINEAR ||
egl_context, modifiers[0] == DRM_FORMAT_MOD_INVALID)
width, height, use_modifiers = FALSE;
n_planes, else
strides, offsets, use_modifiers = TRUE;
modifiers, format,
shared_bo_fd, egl_image = meta_egl_create_dmabuf_image (egl,
error); egl_display,
width,
height,
format,
n_planes,
fds,
strides,
offsets,
use_modifiers ? modifiers : NULL,
error);
close (shared_bo_fd); close (shared_bo_fd);
if (!egl_image) if (!egl_image)

View File

@@ -3,7 +3,7 @@
/* /*
* Copyright (C) 2011 Intel Corporation. * Copyright (C) 2011 Intel Corporation.
* Copyright (C) 2016 Red Hat * Copyright (C) 2016 Red Hat
* Copyright (c) 2018 DisplayLink (UK) Ltd. * Copyright (c) 2018,2019 DisplayLink (UK) Ltd.
* *
* Permission is hereby granted, free of charge, to any person * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation
@@ -69,6 +69,8 @@
#include "backends/native/meta-renderer-native-gles3.h" #include "backends/native/meta-renderer-native-gles3.h"
#include "backends/native/meta-renderer-native.h" #include "backends/native/meta-renderer-native.h"
#include "cogl/cogl.h" #include "cogl/cogl.h"
#include "cogl/cogl-framebuffer.h"
#include "cogl/cogl-trace.h"
#include "core/boxes-private.h" #include "core/boxes-private.h"
#ifndef EGL_DRM_MASTER_FD_EXT #ifndef EGL_DRM_MASTER_FD_EXT
@@ -93,8 +95,14 @@ static GParamSpec *obj_props[PROP_LAST];
typedef enum _MetaSharedFramebufferCopyMode typedef enum _MetaSharedFramebufferCopyMode
{ {
META_SHARED_FRAMEBUFFER_COPY_MODE_GPU, /* the secondary GPU will make the copy */
META_SHARED_FRAMEBUFFER_COPY_MODE_CPU META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU,
/*
* The copy is made in the primary GPU rendering context, either
* as a CPU copy through Cogl read-pixels or as primary GPU copy
* using glBlitFramebuffer.
*/
META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY
} MetaSharedFramebufferCopyMode; } MetaSharedFramebufferCopyMode;
typedef struct _MetaRendererNativeGpuData typedef struct _MetaRendererNativeGpuData
@@ -121,6 +129,7 @@ typedef struct _MetaRendererNativeGpuData
struct { struct {
MetaSharedFramebufferCopyMode copy_mode; MetaSharedFramebufferCopyMode copy_mode;
gboolean is_hardware_rendering; gboolean is_hardware_rendering;
gboolean has_EGL_EXT_image_dma_buf_import_modifiers;
/* For GPU blit mode */ /* For GPU blit mode */
EGLContext egl_context; EGLContext egl_context;
@@ -138,6 +147,7 @@ typedef struct _MetaDumbBuffer
int height; int height;
int stride_bytes; int stride_bytes;
uint32_t drm_format; uint32_t drm_format;
int dmabuf_fd;
} MetaDumbBuffer; } MetaDumbBuffer;
typedef struct _MetaOnscreenNativeSecondaryGpuState typedef struct _MetaOnscreenNativeSecondaryGpuState
@@ -159,6 +169,9 @@ typedef struct _MetaOnscreenNativeSecondaryGpuState
} cpu; } cpu;
int pending_flips; int pending_flips;
gboolean noted_primary_gpu_copy_ok;
gboolean noted_primary_gpu_copy_failed;
} MetaOnscreenNativeSecondaryGpuState; } MetaOnscreenNativeSecondaryGpuState;
typedef struct _MetaOnscreenNative typedef struct _MetaOnscreenNative
@@ -240,6 +253,10 @@ init_dumb_fb (MetaDumbBuffer *dumb_fb,
uint32_t format, uint32_t format,
GError **error); GError **error);
static int
meta_dumb_buffer_ensure_dmabuf_fd (MetaDumbBuffer *dumb_fb,
MetaGpuKms *gpu_kms);
static MetaEgl * static MetaEgl *
meta_renderer_native_get_egl (MetaRendererNative *renderer_native); meta_renderer_native_get_egl (MetaRendererNative *renderer_native);
@@ -256,6 +273,9 @@ cogl_pixel_format_from_drm_format (uint32_t drm_format,
CoglPixelFormat *out_format, CoglPixelFormat *out_format,
CoglTextureComponents *out_components); CoglTextureComponents *out_components);
static void
meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native);
static void static void
meta_renderer_native_gpu_data_free (MetaRendererNativeGpuData *renderer_gpu_data) meta_renderer_native_gpu_data_free (MetaRendererNativeGpuData *renderer_gpu_data)
{ {
@@ -867,7 +887,7 @@ init_secondary_gpu_state (MetaRendererNative *renderer_native,
switch (renderer_gpu_data->secondary.copy_mode) switch (renderer_gpu_data->secondary.copy_mode)
{ {
case META_SHARED_FRAMEBUFFER_COPY_MODE_GPU: case META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU:
if (!init_secondary_gpu_state_gpu_copy_mode (renderer_native, if (!init_secondary_gpu_state_gpu_copy_mode (renderer_native,
onscreen, onscreen,
renderer_gpu_data, renderer_gpu_data,
@@ -875,7 +895,7 @@ init_secondary_gpu_state (MetaRendererNative *renderer_native,
error)) error))
return FALSE; return FALSE;
break; break;
case META_SHARED_FRAMEBUFFER_COPY_MODE_CPU: case META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY:
if (!init_secondary_gpu_state_cpu_copy_mode (renderer_native, if (!init_secondary_gpu_state_cpu_copy_mode (renderer_native,
onscreen, onscreen,
renderer_gpu_data, renderer_gpu_data,
@@ -959,10 +979,10 @@ free_current_secondary_bo (MetaGpuKms *gpu_kms,
renderer_gpu_data = secondary_gpu_state->renderer_gpu_data; renderer_gpu_data = secondary_gpu_state->renderer_gpu_data;
switch (renderer_gpu_data->secondary.copy_mode) switch (renderer_gpu_data->secondary.copy_mode)
{ {
case META_SHARED_FRAMEBUFFER_COPY_MODE_GPU: case META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU:
g_clear_object (&secondary_gpu_state->gbm.current_fb); g_clear_object (&secondary_gpu_state->gbm.current_fb);
break; break;
case META_SHARED_FRAMEBUFFER_COPY_MODE_CPU: case META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY:
break; break;
} }
} }
@@ -1450,10 +1470,10 @@ free_next_secondary_bo (MetaGpuKms *gpu_kms,
renderer_gpu_data = secondary_gpu_state->renderer_gpu_data; renderer_gpu_data = secondary_gpu_state->renderer_gpu_data;
switch (renderer_gpu_data->secondary.copy_mode) switch (renderer_gpu_data->secondary.copy_mode)
{ {
case META_SHARED_FRAMEBUFFER_COPY_MODE_GPU: case META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU:
g_clear_object (&secondary_gpu_state->gbm.next_fb); g_clear_object (&secondary_gpu_state->gbm.next_fb);
break; break;
case META_SHARED_FRAMEBUFFER_COPY_MODE_CPU: case META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY:
break; break;
} }
} }
@@ -1757,6 +1777,9 @@ copy_shared_framebuffer_gpu (CoglOnscreen *onscreen,
MetaDrmBufferGbm *buffer_gbm; MetaDrmBufferGbm *buffer_gbm;
struct gbm_bo *bo; struct gbm_bo *bo;
COGL_TRACE_BEGIN_SCOPED (CopySharedFramebufferSecondaryGpu,
"FB Copy (secondary GPU)");
if (!meta_egl_make_current (egl, if (!meta_egl_make_current (egl,
renderer_gpu_data->egl_display, renderer_gpu_data->egl_display,
secondary_gpu_state->egl_surface, secondary_gpu_state->egl_surface,
@@ -1823,6 +1846,131 @@ secondary_gpu_get_next_dumb_buffer (MetaOnscreenNativeSecondaryGpuState *seconda
return &secondary_gpu_state->cpu.dumb_fbs[0]; return &secondary_gpu_state->cpu.dumb_fbs[0];
} }
static gboolean
copy_shared_framebuffer_primary_gpu (CoglOnscreen *onscreen,
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state)
{
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
CoglContext *cogl_context = framebuffer->context;
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
CoglDisplay *cogl_display = cogl_context->display;
CoglRenderer *cogl_renderer = cogl_display->renderer;
CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys;
EGLDisplay egl_display = cogl_renderer_egl->edpy;
MetaRendererNative *renderer_native = onscreen_native->renderer_native;
MetaEgl *egl = meta_renderer_native_get_egl (renderer_native);
MetaRendererNativeGpuData *primary_gpu_data;
MetaDrmBufferDumb *buffer_dumb;
MetaDumbBuffer *dumb_fb;
int dmabuf_fd;
EGLImageKHR egl_image;
g_autoptr (GError) error = NULL;
uint32_t strides[1];
uint32_t offsets[1];
uint64_t modifiers[1];
CoglPixelFormat cogl_format;
CoglEglImageFlags flags;
CoglTexture2D *cogl_tex;
CoglOffscreen *cogl_fbo;
int ret;
COGL_TRACE_BEGIN_SCOPED (CopySharedFramebufferPrimaryGpu,
"FB Copy (primary GPU)");
primary_gpu_data = meta_renderer_native_get_gpu_data (renderer_native,
renderer_native->primary_gpu_kms);
if (!primary_gpu_data->secondary.has_EGL_EXT_image_dma_buf_import_modifiers)
return FALSE;
dumb_fb = secondary_gpu_get_next_dumb_buffer (secondary_gpu_state);
g_assert (cogl_framebuffer_get_width (framebuffer) == dumb_fb->width);
g_assert (cogl_framebuffer_get_height (framebuffer) == dumb_fb->height);
ret = cogl_pixel_format_from_drm_format (dumb_fb->drm_format,
&cogl_format,
NULL);
g_assert (ret);
dmabuf_fd = meta_dumb_buffer_ensure_dmabuf_fd (dumb_fb,
secondary_gpu_state->gpu_kms);
if (dmabuf_fd == -1)
return FALSE;
strides[0] = dumb_fb->stride_bytes;
offsets[0] = 0;
modifiers[0] = DRM_FORMAT_MOD_LINEAR;
egl_image = meta_egl_create_dmabuf_image (egl,
egl_display,
dumb_fb->width,
dumb_fb->height,
dumb_fb->drm_format,
1 /* n_planes */,
&dmabuf_fd,
strides,
offsets,
modifiers,
&error);
if (egl_image == EGL_NO_IMAGE_KHR)
{
g_debug ("%s: Failed to import dumb buffer to EGL: %s",
__func__, error->message);
return FALSE;
}
flags = COGL_EGL_IMAGE_FLAG_NO_GET_DATA;
cogl_tex = cogl_egl_texture_2d_new_from_image (cogl_context,
dumb_fb->width,
dumb_fb->height,
cogl_format,
egl_image,
flags,
&error);
meta_egl_destroy_image (egl, egl_display, egl_image, NULL);
if (!cogl_tex)
{
g_debug ("%s: Failed to make Cogl texture: %s",
__func__, error->message);
return FALSE;
}
cogl_fbo = cogl_offscreen_new_with_texture (COGL_TEXTURE (cogl_tex));
cogl_object_unref (cogl_tex);
if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (cogl_fbo), &error))
{
g_debug ("%s: Failed Cogl FBO alloc: %s",
__func__, error->message);
cogl_object_unref (cogl_fbo);
return FALSE;
}
if (!cogl_blit_framebuffer (framebuffer, COGL_FRAMEBUFFER (cogl_fbo),
0, 0, 0, 0,
dumb_fb->width, dumb_fb->height, &error))
{
g_debug ("%s: Failed Cogl blit: %s", __func__, error->message);
cogl_object_unref (cogl_fbo);
return FALSE;
}
cogl_object_unref (cogl_fbo);
g_clear_object (&secondary_gpu_state->gbm.next_fb);
buffer_dumb = meta_drm_buffer_dumb_new (dumb_fb->fb_id);
secondary_gpu_state->gbm.next_fb = META_DRM_BUFFER (buffer_dumb);
secondary_gpu_state->cpu.dumb_fb = dumb_fb;
return TRUE;
}
typedef struct _PixelFormatMap { typedef struct _PixelFormatMap {
uint32_t drm_format; uint32_t drm_format;
CoglPixelFormat cogl_format; CoglPixelFormat cogl_format;
@@ -1895,6 +2043,9 @@ copy_shared_framebuffer_cpu (CoglOnscreen *onscreen,
gboolean ret; gboolean ret;
MetaDrmBufferDumb *buffer_dumb; MetaDrmBufferDumb *buffer_dumb;
COGL_TRACE_BEGIN_SCOPED (CopySharedFramebufferCpu,
"FB Copy (CPU)");
dumb_fb = secondary_gpu_get_next_dumb_buffer (secondary_gpu_state); dumb_fb = secondary_gpu_get_next_dumb_buffer (secondary_gpu_state);
g_assert (cogl_framebuffer_get_width (framebuffer) == dumb_fb->width); g_assert (cogl_framebuffer_get_width (framebuffer) == dumb_fb->width);
@@ -1945,13 +2096,30 @@ update_secondary_gpu_state_pre_swap_buffers (CoglOnscreen *onscreen)
renderer_gpu_data = secondary_gpu_state->renderer_gpu_data; renderer_gpu_data = secondary_gpu_state->renderer_gpu_data;
switch (renderer_gpu_data->secondary.copy_mode) switch (renderer_gpu_data->secondary.copy_mode)
{ {
case META_SHARED_FRAMEBUFFER_COPY_MODE_GPU: case META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU:
/* Done after eglSwapBuffers. */ /* Done after eglSwapBuffers. */
break; break;
case META_SHARED_FRAMEBUFFER_COPY_MODE_CPU: case META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY:
copy_shared_framebuffer_cpu (onscreen, if (!copy_shared_framebuffer_primary_gpu (onscreen,
secondary_gpu_state, secondary_gpu_state))
renderer_gpu_data); {
if (!secondary_gpu_state->noted_primary_gpu_copy_failed)
{
g_debug ("Using primary GPU to copy for %s failed once.",
meta_gpu_kms_get_file_path (secondary_gpu_state->gpu_kms));
secondary_gpu_state->noted_primary_gpu_copy_failed = TRUE;
}
copy_shared_framebuffer_cpu (onscreen,
secondary_gpu_state,
renderer_gpu_data);
}
else if (!secondary_gpu_state->noted_primary_gpu_copy_ok)
{
g_debug ("Using primary GPU to copy for %s succeeded once.",
meta_gpu_kms_get_file_path (secondary_gpu_state->gpu_kms));
secondary_gpu_state->noted_primary_gpu_copy_ok = TRUE;
}
break; break;
} }
} }
@@ -1979,13 +2147,13 @@ update_secondary_gpu_state_post_swap_buffers (CoglOnscreen *onscreen,
secondary_gpu_state->gpu_kms); secondary_gpu_state->gpu_kms);
switch (renderer_gpu_data->secondary.copy_mode) switch (renderer_gpu_data->secondary.copy_mode)
{ {
case META_SHARED_FRAMEBUFFER_COPY_MODE_GPU: case META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU:
copy_shared_framebuffer_gpu (onscreen, copy_shared_framebuffer_gpu (onscreen,
secondary_gpu_state, secondary_gpu_state,
renderer_gpu_data, renderer_gpu_data,
egl_context_changed); egl_context_changed);
break; break;
case META_SHARED_FRAMEBUFFER_COPY_MODE_CPU: case META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY:
/* Done before eglSwapBuffers. */ /* Done before eglSwapBuffers. */
break; break;
} }
@@ -2458,6 +2626,7 @@ init_dumb_fb (MetaDumbBuffer *dumb_fb,
dumb_fb->height = height; dumb_fb->height = height;
dumb_fb->stride_bytes = create_arg.pitch; dumb_fb->stride_bytes = create_arg.pitch;
dumb_fb->drm_format = format; dumb_fb->drm_format = format;
dumb_fb->dmabuf_fd = -1;
return TRUE; return TRUE;
@@ -2475,6 +2644,33 @@ err_ioctl:
return FALSE; return FALSE;
} }
static int
meta_dumb_buffer_ensure_dmabuf_fd (MetaDumbBuffer *dumb_fb,
MetaGpuKms *gpu_kms)
{
int ret;
int kms_fd;
int dmabuf_fd;
if (dumb_fb->dmabuf_fd != -1)
return dumb_fb->dmabuf_fd;
kms_fd = meta_gpu_kms_get_fd (gpu_kms);
ret = drmPrimeHandleToFD (kms_fd, dumb_fb->handle, DRM_CLOEXEC,
&dmabuf_fd);
if (ret)
{
g_debug ("Failed to export dumb drm buffer: %s",
g_strerror (errno));
return -1;
}
dumb_fb->dmabuf_fd = dmabuf_fd;
return dumb_fb->dmabuf_fd;
}
static void static void
release_dumb_fb (MetaDumbBuffer *dumb_fb, release_dumb_fb (MetaDumbBuffer *dumb_fb,
MetaGpuKms *gpu_kms) MetaGpuKms *gpu_kms)
@@ -2485,6 +2681,9 @@ release_dumb_fb (MetaDumbBuffer *dumb_fb,
if (!dumb_fb->map) if (!dumb_fb->map)
return; return;
if (dumb_fb->dmabuf_fd != -1)
close (dumb_fb->dmabuf_fd);
munmap (dumb_fb->map, dumb_fb->map_size); munmap (dumb_fb->map, dumb_fb->map_size);
dumb_fb->map = NULL; dumb_fb->map = NULL;
@@ -2633,8 +2832,6 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
CoglContext *cogl_context = framebuffer->context; CoglContext *cogl_context = framebuffer->context;
CoglDisplay *cogl_display = cogl_context_get_display (cogl_context); CoglDisplay *cogl_display = cogl_context_get_display (cogl_context);
CoglDisplayEGL *cogl_display_egl = cogl_display->winsys; CoglDisplayEGL *cogl_display_egl = cogl_display->winsys;
CoglRenderer *cogl_renderer = cogl_context->display->renderer;
CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys;
CoglOnscreenEGL *onscreen_egl = onscreen->winsys; CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
MetaOnscreenNative *onscreen_native; MetaOnscreenNative *onscreen_native;
MetaRendererNative *renderer_native; MetaRendererNative *renderer_native;
@@ -2688,6 +2885,8 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
if (onscreen_native->egl.stream != EGL_NO_STREAM_KHR) if (onscreen_native->egl.stream != EGL_NO_STREAM_KHR)
{ {
MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native); MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native);
CoglRenderer *cogl_renderer = cogl_context->display->renderer;
CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys;
meta_egl_destroy_stream (egl, meta_egl_destroy_stream (egl,
cogl_renderer_egl->edpy, cogl_renderer_egl->edpy,
@@ -2743,7 +2942,7 @@ meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_native)
return TRUE; return TRUE;
} }
void static void
meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native) meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native)
{ {
MetaRenderer *renderer = META_RENDERER (renderer_native); MetaRenderer *renderer = META_RENDERER (renderer_native);
@@ -3110,6 +3309,23 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
return view; return view;
} }
static void
meta_renderer_native_rebuild_views (MetaRenderer *renderer)
{
MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer);
MetaBackendNative *backend_native =
META_BACKEND_NATIVE (renderer_native->backend);
MetaKms *kms = meta_backend_native_get_kms (backend_native);
MetaRendererClass *parent_renderer_class =
META_RENDERER_CLASS (meta_renderer_native_parent_class);
meta_kms_discard_pending_page_flips (kms);
parent_renderer_class->rebuild_views (renderer);
meta_renderer_native_queue_modes_reset (META_RENDERER_NATIVE (renderer));
}
void void
meta_renderer_native_finish_frame (MetaRendererNative *renderer_native) meta_renderer_native_finish_frame (MetaRendererNative *renderer_native)
{ {
@@ -3340,7 +3556,12 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data,
renderer_gpu_data->secondary.is_hardware_rendering = TRUE; renderer_gpu_data->secondary.is_hardware_rendering = TRUE;
renderer_gpu_data->secondary.egl_context = egl_context; renderer_gpu_data->secondary.egl_context = egl_context;
renderer_gpu_data->secondary.egl_config = egl_config; renderer_gpu_data->secondary.egl_config = egl_config;
renderer_gpu_data->secondary.copy_mode = META_SHARED_FRAMEBUFFER_COPY_MODE_GPU; renderer_gpu_data->secondary.copy_mode = META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU;
renderer_gpu_data->secondary.has_EGL_EXT_image_dma_buf_import_modifiers =
meta_egl_has_extensions (egl, egl_display, NULL,
"EGL_EXT_image_dma_buf_import_modifiers",
NULL);
return TRUE; return TRUE;
@@ -3360,7 +3581,7 @@ static void
init_secondary_gpu_data_cpu (MetaRendererNativeGpuData *renderer_gpu_data) init_secondary_gpu_data_cpu (MetaRendererNativeGpuData *renderer_gpu_data)
{ {
renderer_gpu_data->secondary.is_hardware_rendering = FALSE; renderer_gpu_data->secondary.is_hardware_rendering = FALSE;
renderer_gpu_data->secondary.copy_mode = META_SHARED_FRAMEBUFFER_COPY_MODE_CPU; renderer_gpu_data->secondary.copy_mode = META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY;
} }
static void static void
@@ -3934,6 +4155,7 @@ meta_renderer_native_class_init (MetaRendererNativeClass *klass)
renderer_class->create_cogl_renderer = meta_renderer_native_create_cogl_renderer; renderer_class->create_cogl_renderer = meta_renderer_native_create_cogl_renderer;
renderer_class->create_view = meta_renderer_native_create_view; renderer_class->create_view = meta_renderer_native_create_view;
renderer_class->rebuild_views = meta_renderer_native_rebuild_views;
obj_props[PROP_BACKEND] = obj_props[PROP_BACKEND] =
g_param_spec_object ("backend", g_param_spec_object ("backend",

Some files were not shown because too many files have changed in this diff Show More