Compare commits

..

7 Commits

Author SHA1 Message Date
Niels De Graef
1fd5e9bb0b WIP 2019-06-24 15:14:01 +02:00
Niels De Graef
940a485206 WIP 2019-06-24 15:14:01 +02:00
Niels De Graef
784b1750c4 wayland: Support complex (YUV) pixel formats
In the previous commits, we added the possibility to use pixel formats
which are complex (YUV-based and/or multi-planar) inside Cogl. Use this
new feature by assuming we get a CoglMultiPlaneTexture, rather than a
"simple" CoglTexture.

To easily test whether this works, one can use GStreamer pipelines
(you'll need gst-plugins-bad for this to work):

For normal BGRA (this should already work before this commit):

```
$ gst-launch-1.0 videotestsrc ! "video/x-raw" ! waylandsink
```

For NV12 (a popular video format):

```
$ gst-launch-1.0 videotestsrc ! "video/x-raw,format=NV12" ! waylandsink
```

For YUV 4:2:2 (another video format):

```
$ gst-launch-1.0 videotestsrc ! "video/x-raw,format=Y42B" ! waylandsink
```

You can also replace with other video sinks, like `vaapisink`.

`glimagesink` also works, but for some reason seems to unconditionally
convert to RGBA before submitting a texture (so it doesn't do a lot
really).

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=705514
2019-06-24 15:14:01 +02:00
Niels De Graef
f8747a2fe2 cogl: Add CoglMultiPlaneTexture for complex formats
Mutter always assumed that any texture it got was
representable by a `CoglTexture`, which does not have this kind of
concept. This also has the useful feature that each `CoglTexture`
corresponds to a single layer in a `CoglPipeline`.

To deal with this, we introduce a new object: a `CoglMultiPlaneTexture`
consists of multiple `CoglTexture`s, each representing a plane in the
texture we got. It also provides knows when to use a
CoglPixelFormatConversion.
2019-06-24 15:14:01 +02:00
Niels De Graef
89111517bd cogl: Add non-RGBA pixel formats
Up until now, we didn't support any YUV pixel formats. This was for
several reasons: first, we draw onto an RGBA framebuffer, so any
YUV-based color format needs to be converted to RGBA using a shader.

Next, some more complex pixel format have extra properties that we have
not had to deal with right now: they can be located on multiple "planes"
(which means components are not combined in a single texture or memory
block). Some pixel formats also have a notion of "subsampling", where
one does not save a component for each and every pixel, but rather for
every other pixel (possibly in both the horizontal and vertical sense).

To deal with this, we introduce a new type as well:
`CoglPixelFormatConversion` provides a wrapper for the necessary shaders
(which in Cogl are represented by `CoglSnippet`s).
2019-06-24 15:14:01 +02:00
Niels De Graef
990b0efc17 WIP: Add a COGL_TEXTURE_COMPONENTS_R 2019-06-24 15:14:01 +02:00
Niels De Graef
ce643392ec cogl: Replace G_8 with R_8 pixel format
Cogl doesn't use `COGL_PIXEL_FORMAT_G_8` anywhere, and it has differing
implementations depending on the driver (Mesa averages it out over the
diferent components, while NVIDIA stores it in the R component).

Furthermore, by having this new pixel format, we can use this for
single-component uploads, which will be useful when dealing with
non-trivial textures (such as YUV-based textures).
2019-06-24 15:14:01 +02:00
166 changed files with 5457 additions and 3395 deletions

View File

@@ -28,20 +28,6 @@ build-mutter:
- 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:
stage: test
dependencies:

View File

@@ -1,31 +1,21 @@
# 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
RUN dnf -y update && dnf -y upgrade && \
dnf install -y 'dnf-command(builddep)' && \
dnf install -y 'dnf-command(copr)' && \
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 && \
# 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 && \
# Until Fedora catches up with mesa bug fixes
dnf upgrade -y mesa-dri-drivers mesa-libEGL && \
# 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 sysprof-devel && \
# Unpackaged versions
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 && \

66
NEWS
View File

@@ -1,69 +1,3 @@
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
======
* Fix rendering lag on Xorg [Daniel; !520, !281]

View File

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

View File

@@ -252,13 +252,6 @@ clutter_clone_allocate (ClutterActor *self,
if (priv->clone_source == NULL)
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
/* XXX - this is wrong: ClutterClone cannot clone unparented
* actors, as it will break all invariants

View File

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

View File

@@ -277,6 +277,24 @@ typedef enum
CLUTTER_ANIMATION_LAST
} 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:
* @CLUTTER_TEXT_DIRECTION_DEFAULT: Use the default setting, as returned

View File

@@ -85,6 +85,8 @@ G_LOCK_DEFINE_STATIC (ClutterCntx);
/* main lock and locking/unlocking functions */
static GMutex clutter_threads_mutex;
static GCallback clutter_threads_lock = NULL;
static GCallback clutter_threads_unlock = NULL;
/* command line options */
static gboolean clutter_is_initialized = FALSE;
@@ -144,10 +146,38 @@ static const GDebugKey clutter_paint_debug_keys[] = {
{ "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
clutter_threads_init_default (void)
{
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"
@@ -353,6 +383,28 @@ clutter_config_read (void)
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
_clutter_context_get_show_fps (void)
{
@@ -401,6 +453,86 @@ clutter_disable_accessibility (void)
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
_clutter_id_to_color (guint id_,
ClutterColor *col)
@@ -652,6 +784,69 @@ clutter_main (void)
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
_clutter_threads_dispatch (gpointer data)
{
@@ -708,11 +903,17 @@ _clutter_threads_dispatch_free (gpointer data)
* SafeClosure *closure = data;
* gboolean res = FALSE;
*
* // mark the critical section //
*
* clutter_threads_enter();
*
* // the callback does not need to acquire the Clutter
* / lock itself, as it is held by the this proxy handler
* //
* res = closure->callback (closure->data);
*
* clutter_threads_leave();
*
* return res;
* }
* static gulong
@@ -892,23 +1093,69 @@ clutter_threads_add_timeout (guint interval,
void
_clutter_threads_acquire_lock (void)
{
g_mutex_lock (&clutter_threads_mutex);
if (clutter_threads_lock != NULL)
(* clutter_threads_lock) ();
}
void
_clutter_threads_release_lock (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);
if (clutter_threads_unlock != NULL)
(* clutter_threads_unlock) ();
}
/**
* clutter_threads_enter:
*
* Locks 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_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
@@ -958,6 +1205,7 @@ clutter_context_get_default_unlocked (void)
ctx->settings = clutter_settings_get_default ();
_clutter_settings_set_backend (ctx->settings, ctx->backend);
ctx->motion_events_per_actor = TRUE;
ctx->last_repaint_id = 1;
}
@@ -978,6 +1226,36 @@ _clutter_context_get_default (void)
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
clutter_arg_direction_cb (const char *key,
const char *value,
@@ -2380,6 +2658,24 @@ clutter_get_default_frame_rate (void)
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
on_grab_actor_destroy (ClutterActor *actor,
ClutterInputDevice *device)
@@ -2594,6 +2890,57 @@ clutter_input_device_get_grabbed_actor (ClutterInputDevice *device)
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:
*
@@ -2607,6 +2954,32 @@ clutter_ungrab_pointer (void)
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:
*
@@ -2706,6 +3079,170 @@ clutter_get_keyboard_grab (void)
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:
*
@@ -3040,6 +3577,43 @@ _clutter_context_get_pick_mode (void)
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:
* @backend_type: the name of the backend to check

View File

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

View File

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

View File

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

View File

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

View File

@@ -2240,7 +2240,14 @@ clutter_stage_init (ClutterStage *self)
priv->throttle_motion_events = TRUE;
priv->min_size_changed = FALSE;
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),
&default_stage_color);

View File

@@ -171,7 +171,7 @@ clutter_text_buffer_normal_insert_text (ClutterTextBuffer *buffer,
/* Actual text insertion */
at = g_utf8_offset_to_pointer (pv->normal_text, position) - pv->normal_text;
memmove (pv->normal_text + at + n_bytes, pv->normal_text + at, pv->normal_text_bytes - at);
g_memmove (pv->normal_text + at + n_bytes, pv->normal_text + at, pv->normal_text_bytes - at);
memcpy (pv->normal_text + at, chars, n_bytes);
/* 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;
end = g_utf8_offset_to_pointer (pv->normal_text, position + n_chars) - pv->normal_text;
memmove (pv->normal_text + start, pv->normal_text + end, pv->normal_text_bytes + 1 - end);
g_memmove (pv->normal_text + start, pv->normal_text + end, pv->normal_text_bytes + 1 - end);
pv->normal_text_chars -= n_chars;
pv->normal_text_bytes -= (end - start);

View File

@@ -0,0 +1,85 @@
/*
* 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,6 +234,7 @@ clutter_deprecated_headers = [
'deprecated/clutter-container.h',
'deprecated/clutter-group.h',
'deprecated/clutter-keysyms.h',
'deprecated/clutter-main.h',
'deprecated/clutter-rectangle.h',
'deprecated/clutter-stage-manager.h',
'deprecated/clutter-stage.h',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -39,13 +39,6 @@
#define PANGO_ENABLE_BACKEND 1
#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/pangocairo.h>
#include <pango/pango-renderer.h>

View File

@@ -937,12 +937,12 @@ cogl_atlas_texture_new_from_data (CoglContext *ctx,
CoglBitmap *bmp;
CoglAtlasTexture *atlas_tex;
g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL);
g_return_val_if_fail (cogl_pixel_format_get_n_planes (format) == 1, NULL);
g_return_val_if_fail (data != NULL, NULL);
/* Rowstride from width if not given */
if (rowstride == 0)
rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
rowstride = width * cogl_pixel_format_get_bytes_per_pixel_simple (format);
/* Wrap the data into a bitmap */
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
can use 1024x1024, otherwise we'll assume it will take 4 bytes
per pixel and use 512x512. */
if (_cogl_pixel_format_get_bytes_per_pixel (format) == 1)
if (cogl_pixel_format_get_bytes_per_pixel_simple (format) == 1)
size = 1024;
else
size = 512;
@@ -291,7 +291,9 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
{
uint8_t *clear_data;
CoglBitmap *clear_bmp;
int bpp = _cogl_pixel_format_get_bytes_per_pixel (atlas->texture_format);
int bpp;
bpp = cogl_pixel_format_get_bytes_per_pixel_simple (atlas->texture_format);
/* Create a buffer of zeroes to initially clear the texture */
clear_data = g_malloc0 (width * height * bpp);

View File

@@ -320,7 +320,37 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format)
case COGL_PIXEL_FORMAT_DEPTH_32:
case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
case COGL_PIXEL_FORMAT_ANY:
/* No support for YUV or multi-plane formats */
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 ();
case COGL_PIXEL_FORMAT_A_8:
@@ -328,7 +358,7 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format)
case COGL_PIXEL_FORMAT_RGB_565:
case COGL_PIXEL_FORMAT_RGBA_4444:
case COGL_PIXEL_FORMAT_RGBA_5551:
case COGL_PIXEL_FORMAT_G_8:
case COGL_PIXEL_FORMAT_R_8:
case COGL_PIXEL_FORMAT_RGB_888:
case COGL_PIXEL_FORMAT_BGR_888:
case COGL_PIXEL_FORMAT_RGBA_8888:

View File

@@ -65,21 +65,16 @@ G_PASTE (_cogl_unpack_a_8_, component_size) (const uint8_t *src,
}
inline static void
G_PASTE (_cogl_unpack_g_8_, component_size) (const uint8_t *src,
G_PASTE (_cogl_unpack_r_8_, component_size) (const uint8_t *src,
component_type *dst,
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)
{
component_type v = UNPACK_BYTE (src[0]);
dst[0] = v;
dst[1] = v;
dst[2] = v;
dst[3] = UNPACK_BYTE (255);
dst[0] = UNPACK_BYTE (*src);
dst[1] = 0;
dst[2] = 0;
dst[3] = 0;
dst += 4;
src++;
}
@@ -341,8 +336,8 @@ G_PASTE (_cogl_unpack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_A_8:
G_PASTE (_cogl_unpack_a_8_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_G_8:
G_PASTE (_cogl_unpack_g_8_, component_size) (src, dst, width);
case COGL_PIXEL_FORMAT_R_8:
G_PASTE (_cogl_unpack_r_8_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RG_88:
G_PASTE (_cogl_unpack_rg_88_, component_size) (src, dst, width);
@@ -400,7 +395,37 @@ G_PASTE (_cogl_unpack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_DEPTH_32:
case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
case COGL_PIXEL_FORMAT_ANY:
/* No support for YUV or multi-plane formats */
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 ();
}
}
@@ -433,18 +458,13 @@ G_PASTE (_cogl_pack_a_8_, component_size) (const component_type *src,
}
inline static void
G_PASTE (_cogl_pack_g_8_, component_size) (const component_type *src,
G_PASTE (_cogl_pack_r_8_, component_size) (const component_type *src,
uint8_t *dst,
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)
{
component_type v = (src[0] + src[1] + src[2]) / 3;
*dst = PACK_BYTE (v);
*dst = PACK_BYTE (src[0]);
src += 4;
dst++;
}
@@ -702,8 +722,8 @@ G_PASTE (_cogl_pack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_A_8:
G_PASTE (_cogl_pack_a_8_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_G_8:
G_PASTE (_cogl_pack_g_8_, component_size) (src, dst, width);
case COGL_PIXEL_FORMAT_R_8:
G_PASTE (_cogl_pack_r_8_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RG_88:
G_PASTE (_cogl_pack_rg_88_, component_size) (src, dst, width);
@@ -761,7 +781,37 @@ G_PASTE (_cogl_pack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_DEPTH_32:
case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
case COGL_PIXEL_FORMAT_ANY:
/* No support for YUV or multi-plane formats */
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 ();
}
}

View File

@@ -136,7 +136,7 @@ _cogl_bitmap_copy_subregion (CoglBitmap *src,
(dst->format & ~COGL_PREMULT_BIT),
FALSE);
bpp = _cogl_pixel_format_get_bytes_per_pixel (src->format);
bpp = cogl_pixel_format_get_bytes_per_pixel_simple (src->format);
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 */
if (rowstride == 0)
rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
rowstride = width * cogl_pixel_format_get_bytes_per_pixel_simple (format);
bmp = g_slice_new (CoglBitmap);
bmp->context = context;
@@ -211,7 +211,7 @@ _cogl_bitmap_new_with_malloc_buffer (CoglContext *context,
GError **error)
{
static CoglUserDataKey bitmap_free_key;
int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (format);
int rowstride = ((width * bpp) + 3) & ~3;
uint8_t *data = g_try_malloc (rowstride * height);
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
* libdrm a tiled buffer for instance */
rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
rowstride = width * cogl_pixel_format_get_bytes_per_pixel_simple (format);
pixel_buffer =
cogl_pixel_buffer_new (context,

View File

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

View File

@@ -4,7 +4,6 @@
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2007,2008,2009 Intel Corporation.
* Copyright (C) 2019 DisplayLink (UK) Ltd.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -364,6 +363,63 @@ void
_cogl_push_framebuffers (CoglFramebuffer *draw_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
_cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer);

View File

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

View File

@@ -3,8 +3,7 @@
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2007,2008,2009,2011 Intel Corporation.
* Copyright (C) 2019 DisplayLink (UK) Ltd.
* Copyright (C) 2011 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -1798,69 +1797,6 @@ typedef enum /*< prefix=COGL_FRAMEBUFFER_ERROR >*/
gboolean
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
#endif /* __COGL_FRAMEBUFFER_H */

View File

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

View File

@@ -0,0 +1,157 @@
/*
* 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

@@ -0,0 +1,187 @@
/*
* 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

@@ -0,0 +1,182 @@
/*
* 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

@@ -0,0 +1,92 @@
/*
* 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,241 +35,667 @@
#include <stdlib.h>
#include "cogl-pixel-format.h"
#include "cogl-texture.h"
/* An entry to map CoglPixelFormats to their respective properties */
typedef struct _CoglPixelFormatInfo
{
CoglPixelFormat cogl_format;
const char *format_str;
int bpp; /* Bytes per pixel */
int aligned; /* Aligned components? (-1 if n/a) */
int aligned; /* Is aligned? (bool; -1 if n/a) */
uint8_t n_planes;
/* 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;
static const CoglPixelFormatInfo format_info_table[] = {
{
.cogl_format = COGL_PIXEL_FORMAT_ANY,
.format_str = "ANY",
.bpp = 0,
.aligned = -1
.n_planes = 0,
.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,
.format_str = "A_8",
.bpp = 1,
.aligned = 1
.n_planes = 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,
.format_str = "RGB_565",
.bpp = 2,
.aligned = 0
.n_planes = 1,
.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,
.format_str = "RGBA_4444",
.bpp = 2,
.aligned = 0
.n_planes = 1,
.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,
.format_str = "RGBA_5551",
.bpp = 2,
.aligned = 0
.n_planes = 1,
.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,
.format_str = "YUV",
.bpp = 0,
.aligned = -1
.n_planes = 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_G_8,
.format_str = "G_8",
.bpp = 1,
.aligned = 1
.cogl_format = COGL_PIXEL_FORMAT_R_8,
.format_str = "R_8",
.n_planes = 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,
.format_str = "RG_88",
.bpp = 2,
.aligned = 1
.n_planes = 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,
.format_str = "RGB_888",
.bpp = 3,
.aligned = 1
.n_planes = 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,
.format_str = "BGR_888",
.bpp = 3,
.aligned = 1
.n_planes = 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,
.format_str = "RGBA_8888",
.bpp = 4,
.aligned = 1
.n_planes = 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,
.format_str = "BGRA_8888",
.bpp = 4,
.aligned = 1
.n_planes = 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,
.format_str = "ARGB_8888",
.bpp = 4,
.aligned = 1
.n_planes = 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,
.format_str = "ABGR_8888",
.bpp = 4,
.aligned = 1
.n_planes = 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,
.format_str = "RGBA_1010102",
.bpp = 4,
.aligned = 0
.n_planes = 1,
.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,
.format_str = "BGRA_1010102",
.bpp = 4,
.aligned = 0
.n_planes = 1,
.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,
.format_str = "ARGB_2101010",
.bpp = 4,
.aligned = 0
.n_planes = 1,
.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,
.format_str = "ABGR_2101010",
.bpp = 4,
.aligned = 0
.n_planes = 1,
.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,
.format_str = "RGBA_8888_PRE",
.bpp = 4,
.aligned = 1
.n_planes = 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,
.format_str = "BGRA_8888_PRE",
.bpp = 4,
.aligned = 1
.n_planes = 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,
.format_str = "ARGB_8888_PRE",
.bpp = 4,
.aligned = 1
.n_planes = 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,
.format_str = "ABGR_8888_PRE",
.bpp = 4,
.aligned = 1
.n_planes = 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,
.format_str = "RGBA_4444_PRE",
.bpp = 2,
.aligned = 0
.n_planes = 1,
.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,
.format_str = "RGBA_5551_PRE",
.bpp = 2,
.aligned = 0
.n_planes = 1,
.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,
.format_str = "RGBA_1010102_PRE",
.bpp = 4,
.aligned = 0
.n_planes = 1,
.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,
.format_str = "BGRA_1010102_PRE",
.bpp = 4,
.aligned = 0
.n_planes = 1,
.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,
.format_str = "ARGB_2101010_PRE",
.bpp = 4,
.aligned = 0
.n_planes = 1,
.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,
.format_str = "ABGR_2101010_PRE",
.bpp = 4,
.aligned = 0
.n_planes = 1,
.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,
.format_str = "DEPTH_16",
.bpp = 2,
.aligned = 1
.n_planes = 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,
.format_str = "DEPTH_32",
.bpp = 4,
.aligned = 1
.n_planes = 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,
.format_str = "DEPTH_24_STENCIL_8",
.bpp = 4,
.aligned = 1
.n_planes = 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 }
},
};
/*
* 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)
uint8_t
cogl_pixel_format_get_bytes_per_pixel_simple (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].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 ();
}
/* 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
_cogl_pixel_format_is_endian_dependant (CoglPixelFormat format)
{
@@ -295,6 +721,44 @@ _cogl_pixel_format_is_endian_dependant (CoglPixelFormat format)
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 *
cogl_pixel_format_to_string (CoglPixelFormat format)
{
@@ -308,3 +772,51 @@ cogl_pixel_format_to_string (CoglPixelFormat format)
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):
*
* 0 = undefined
* 1, 8 = 1 bpp (e.g. A_8, G_8)
* 1, 8 = 1 bpp (e.g. A_8, R_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)
@@ -145,8 +145,8 @@ G_BEGIN_DECLS
* @COGL_PIXEL_FORMAT_RGB_565: RGB, 16 bits
* @COGL_PIXEL_FORMAT_RGBA_4444: RGBA, 16 bits
* @COGL_PIXEL_FORMAT_RGBA_5551: RGBA, 16 bits
* @COGL_PIXEL_FORMAT_YUV: Not currently supported
* @COGL_PIXEL_FORMAT_G_8: Single luminance component
* @COGL_PIXEL_FORMAT_YUV: Obsolete. See the other YUV-based formats.
* @COGL_PIXEL_FORMAT_R_8: Single red component, 8 bits
* @COGL_PIXEL_FORMAT_RGB_888: RGB, 24 bits
* @COGL_PIXEL_FORMAT_BGR_888: BGR, 24 bits
* @COGL_PIXEL_FORMAT_RGBA_8888: RGBA, 32 bits
@@ -167,6 +167,35 @@ G_BEGIN_DECLS
* @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_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
* component, the order of the components specify the order in
@@ -198,7 +227,7 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
COGL_PIXEL_FORMAT_RGBA_4444 = 5 | COGL_A_BIT,
COGL_PIXEL_FORMAT_RGBA_5551 = 6 | COGL_A_BIT,
COGL_PIXEL_FORMAT_YUV = 7,
COGL_PIXEL_FORMAT_G_8 = 8,
COGL_PIXEL_FORMAT_R_8 = 8,
COGL_PIXEL_FORMAT_RG_88 = 9,
@@ -230,20 +259,83 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
COGL_PIXEL_FORMAT_DEPTH_16 = (9 | 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;
/**
* 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
*
* Queries how many bytes a pixel of the given @format takes.
*
* Return value: The number of bytes taken for a pixel of the given
* @format.
* Returns: The no. of bytes in one pixel of the given single-plane @format.
*/
int
_cogl_pixel_format_get_bytes_per_pixel (CoglPixelFormat format);
uint8_t
cogl_pixel_format_get_bytes_per_pixel_simple (CoglPixelFormat format);
/*
* _cogl_pixel_format_has_aligned_components:
@@ -284,6 +376,26 @@ _cogl_pixel_format_is_endian_dependant (CoglPixelFormat format);
#define COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT(format) \
(((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:
* @format: a #CoglPixelFormat
@@ -295,6 +407,14 @@ _cogl_pixel_format_is_endian_dependant (CoglPixelFormat format);
const char *
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
#endif /* __COGL_PIXEL_FORMAT_H__ */

View File

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

View File

@@ -47,7 +47,6 @@ struct _CoglTexture2D
gboolean auto_mipmap;
gboolean mipmaps_dirty;
gboolean is_foreign;
gboolean is_get_data_supported;
/* TODO: factor out these OpenGL specific members into some form
* 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);
if (last_x_span->waste > 0 || last_y_span->waste > 0)
{
int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (format);
CoglSpan *first_x_span
= &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
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);
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (source_format);
uint8_t *bmp_data;
const uint8_t *src;
uint8_t *dst;
@@ -972,7 +972,7 @@ cogl_texture_2d_sliced_new_from_data (CoglContext *ctx,
/* Rowstride from width if not given */
if (rowstride == 0)
rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
rowstride = width * cogl_pixel_format_get_bytes_per_pixel_simple (format);
/* Wrap the data into a bitmap */
bmp = cogl_bitmap_new_for_data (ctx,

View File

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

View File

@@ -60,12 +60,6 @@ G_BEGIN_DECLS
typedef struct _CoglTexture2D CoglTexture2D;
#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:
*
@@ -224,8 +218,8 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
int width,
int height,
CoglPixelFormat format,
CoglTextureComponents components,
EGLImageKHR image,
CoglEglImageFlags flags,
GError **error);
typedef gboolean (*CoglTexture2DEGLImageExternalAlloc) (CoglTexture2D *tex_2d,

View File

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

View File

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

View File

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

View File

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

View File

@@ -153,6 +153,7 @@ typedef struct _CoglTextureVertex CoglTextureVertex;
* @COGL_FEATURE_TEXTURE_READ_PIXELS: glReadPixels() support
* @COGL_FEATURE_OFFSCREEN: FBO support
* @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_STENCIL_BUFFER: Stencil buffer support
* @COGL_FEATURE_VBOS: VBO support
@@ -180,6 +181,7 @@ typedef enum
COGL_FEATURE_TEXTURE_READ_PIXELS = (1 << 4),
COGL_FEATURE_OFFSCREEN = (1 << 6),
COGL_FEATURE_OFFSCREEN_MULTISAMPLE = (1 << 7),
COGL_FEATURE_OFFSCREEN_BLIT = (1 << 8),
COGL_FEATURE_FOUR_CLIP_PLANES = (1 << 9),
COGL_FEATURE_STENCIL_BUFFER = (1 << 10),
COGL_FEATURE_VBOS = (1 << 11),

View File

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

View File

@@ -59,6 +59,7 @@
#include <cogl/cogl1-context.h>
#include <cogl/cogl-bitmap.h>
#include <cogl/cogl-color.h>
#include <cogl/cogl-pixel-format-conversion.h>
#include <cogl/cogl-matrix.h>
#include <cogl/cogl-matrix-stack.h>
#include <cogl/cogl-offscreen.h>
@@ -108,6 +109,7 @@
#include <cogl/cogl-sub-texture.h>
#include <cogl/cogl-atlas-texture.h>
#include <cogl/cogl-meta-texture.h>
#include <cogl/cogl-multi-plane-texture.h>
#include <cogl/cogl-primitive-texture.h>
#include <cogl/cogl-index-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 */
if (rowstride == 0)
rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
rowstride = width * cogl_pixel_format_get_bytes_per_pixel_simple (format);
/* Wrap the data into a bitmap */
bmp = cogl_bitmap_new_for_data (ctx,

View File

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

View File

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

View File

@@ -58,18 +58,11 @@ _cogl_driver_pixel_format_from_gl_internal (CoglContext *context,
{
case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8:
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;
return TRUE;
case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8:
case GL_LUMINANCE12: case GL_LUMINANCE16:
*out_format = COGL_PIXEL_FORMAT_G_8;
case GL_RED:
*out_format = COGL_PIXEL_FORMAT_R_8;
return TRUE;
case GL_RG:
@@ -126,9 +119,9 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
}
gltype = GL_UNSIGNED_BYTE;
break;
case COGL_PIXEL_FORMAT_G_8:
glintformat = GL_LUMINANCE;
glformat = GL_LUMINANCE;
case COGL_PIXEL_FORMAT_R_8:
glintformat = GL_RED;
glformat = GL_RED;
gltype = GL_UNSIGNED_BYTE;
break;
@@ -267,7 +260,37 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
break;
case COGL_PIXEL_FORMAT_ANY:
/* No support for YUV or multi-plane formats */
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 ();
break;
}
@@ -421,7 +444,7 @@ _cogl_driver_update_features (CoglContext *ctx,
if (ctx->glBlitFramebuffer)
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER, TRUE);
COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT, TRUE);
if (ctx->glRenderbufferStorageMultisampleIMG)
{

View File

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

View File

@@ -86,9 +86,18 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
glformat = GL_ALPHA;
gltype = GL_UNSIGNED_BYTE;
break;
case COGL_PIXEL_FORMAT_G_8:
glintformat = GL_LUMINANCE;
glformat = GL_LUMINANCE;
case COGL_PIXEL_FORMAT_R_8:
if (cogl_has_feature (context, COGL_FEATURE_ID_TEXTURE_RG))
{
glintformat = GL_RED;
glformat = GL_R8;
}
else
{
glintformat = GL_LUMINANCE;
glformat = GL_LUMINANCE;
}
gltype = GL_UNSIGNED_BYTE;
break;
@@ -198,7 +207,37 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
break;
case COGL_PIXEL_FORMAT_ANY:
/* No support for YUV or multi-plane formats */
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 ();
break;
}
@@ -330,7 +369,7 @@ _cogl_driver_update_features (CoglContext *context,
if (context->glBlitFramebuffer)
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_BLIT_FRAMEBUFFER, TRUE);
COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT, TRUE);
if (_cogl_check_extension ("GL_OES_element_index_uint", gl_extensions))
{

View File

@@ -96,6 +96,16 @@ _cogl_texture_driver_gen (CoglContext *ctx,
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;
}
@@ -152,7 +162,7 @@ prepare_bitmap_alignment_for_upload (CoglContext *ctx,
GError **error)
{
CoglPixelFormat format = cogl_bitmap_get_format (src_bmp);
int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (format);
int src_rowstride = cogl_bitmap_get_rowstride (src_bmp);
int width = cogl_bitmap_get_width (src_bmp);
int alignment = 1;
@@ -195,7 +205,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx,
GLuint gl_handle;
uint8_t *data;
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (source_format);
CoglBitmap *slice_bmp;
int rowstride;
gboolean status = TRUE;
@@ -337,7 +347,7 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx,
GError **error)
{
CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp);
int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);
int bpp = cogl_pixel_format_get_bytes_per_pixel_simple (source_format);
int rowstride;
int bmp_width = cogl_bitmap_get_width (source_bmp);
int bmp_height = cogl_bitmap_get_height (source_bmp);

View File

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

View File

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

View File

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

View File

@@ -730,7 +730,7 @@ _cogl_texture_pixmap_x11_update_image_texture (CoglTexturePixmapX11 *tex_pixmap)
image->bits_per_pixel,
image->byte_order == LSBFirst);
bpp = _cogl_pixel_format_get_bytes_per_pixel (image_format);
bpp = cogl_pixel_format_get_bytes_per_pixel_simple (image_format);
offset = image->bytes_per_line * src_y + bpp * src_x;
_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->height,
texture_format,
COGL_TEXTURE_COMPONENTS_RGBA,
egl_tex_pixmap->image,
COGL_EGL_IMAGE_FLAG_NONE,
NULL));
tex_pixmap->winsys = egl_tex_pixmap;

View File

@@ -173,12 +173,7 @@ test_read_texture_formats (void)
test_read_byte (tex_2d, COGL_PIXEL_FORMAT_A_8, 0x78);
#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
test_read_byte (tex_2d, COGL_PIXEL_FORMAT_R_8, 0x12);
/* We should always be able to read into an RG buffer regardless of
* whether RG textures are supported because Cogl will do the

View File

@@ -135,12 +135,7 @@ void
test_write_texture_formats (void)
{
test_write_byte (test_ctx, COGL_PIXEL_FORMAT_A_8, 0x34, 0x00000034);
#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
test_write_byte (test_ctx, COGL_PIXEL_FORMAT_R_8, 0x34, 0x34000000);
/* We should always be able to read from an RG buffer regardless of
* whether RG textures are supported because Cogl will do the

View File

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

View File

@@ -1,17 +1,12 @@
project('mutter', 'c',
version: '3.33.4',
version: '3.33.2',
meson_version: '>= 0.50.0',
license: 'GPLv2+'
)
mutter_plugin_api_version = '3'
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)
libmutter_api_version = '4'
# generic version requirements
fribidi_req = '>= 1.0.0'
@@ -23,7 +18,7 @@ uprof_req = '>= 0.3'
pango_req = '>= 1.2.0'
cairo_req = '>= 1.10.0'
pangocairo_req = '>= 1.20'
gsettings_desktop_schemas_req = '>= 3.33.0'
gsettings_desktop_schemas_req = '>= 3.31.0'
json_glib_req = '>= 0.12.0'
upower_glib_req = '>= 0.99.0'
xcomposite_req = '>= 0.4'

View File

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

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

100
po/id.po
View File

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

View File

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

View File

@@ -144,7 +144,6 @@ struct _MetaBackendPrivate
gboolean is_pointer_position_initialized;
guint device_update_idle_id;
guint keymap_state_changed_id;
GHashTable *device_monitors;
@@ -179,14 +178,6 @@ meta_backend_finalize (GObject *object)
MetaBackend *backend = META_BACKEND (object);
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_clear_object (&priv->monitor_manager);
@@ -500,7 +491,6 @@ meta_backend_real_post_init (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
ClutterDeviceManager *device_manager = clutter_device_manager_get_default ();
ClutterKeymap *keymap = clutter_backend_get_keymap (priv->clutter_backend);
priv->stage = meta_stage_new (backend);
clutter_actor_realize (priv->stage);
@@ -527,15 +517,6 @@ meta_backend_real_post_init (MetaBackend *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
priv->remote_access_controller =
g_object_new (META_TYPE_REMOTE_ACCESS_CONTROLLER, NULL);

View File

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

View File

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

View File

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

View File

@@ -1,8 +1,7 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2016, 2017 Red Hat Inc.
* Copyright (C) 2018, 2019 DisplayLink (UK) Ltd.
* Copyright (C) 2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -575,97 +574,6 @@ meta_egl_destroy_image (MetaEgl *egl,
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
meta_egl_make_current (MetaEgl *egl,
EGLDisplay display,

View File

@@ -2,7 +2,6 @@
/*
* Copyright (C) 2016 Red Hat Inc.
* Copyright (C) 2019 DisplayLink (UK) Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -101,18 +100,6 @@ gboolean meta_egl_destroy_image (MetaEgl *egl,
EGLImageKHR image,
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,
EGLDisplay display,
EGLConfig config,

View File

@@ -144,7 +144,4 @@ WacomDevice * meta_input_settings_get_tablet_wacom_device (MetaInputSettings *se
ClutterInputDevice *device);
#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 */

View File

@@ -1152,8 +1152,6 @@ meta_input_settings_changed_cb (GSettings *settings,
strcmp (key, "repeat-interval") == 0 ||
strcmp (key, "delay") == 0)
update_keyboard_repeat (input_settings);
else if (strcmp (key, "remember-numlock-state") == 0)
meta_input_settings_maybe_save_numlock_state (input_settings);
}
}
@@ -2611,39 +2609,3 @@ meta_input_settings_get_pad_action_label (MetaInputSettings *input_settings,
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,7 +145,15 @@ append_monitor (MetaMonitorManager *manager,
const char *mode_specs_str;
GList *l;
mode_specs_str = getenv ("MUTTER_DEBUG_DUMMY_MODE_SPECS");
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);
}
mode_specs_str = getenv ("MUTTER_DEBUG_DUMMY_MONITORS_SPECS");
if (mode_specs_str && *mode_specs_str != '\0')
{
g_auto (GStrv) specs = g_strsplit (mode_specs_str, ":", -1);
@@ -173,16 +181,6 @@ 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)
{
@@ -397,11 +395,10 @@ meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager)
* Specifies the number of dummy monitors to include in the stage. Every
* monitor is 1024x786 pixels and they are placed on a horizontal row.
*
* MUTTER_DEBUG_DUMMY_MODE_SPECS
* MUTTER_DEBUG_DUMMY_MONITORS_SPECS
*
* A colon separated list of mode specifications that can be used to
* configure the monitor via dbus API. Setting this environment variable
* overrides the default set of modes available.
* A colon separated list of monitor specifications that can be used to
* configure the monitor via dbus API.
* Format should be WWxHH:WWxHH@RR
*
* MUTTER_DEBUG_DUMMY_MONITOR_SCALES

View File

@@ -385,7 +385,4 @@ void meta_monitor_manager_clear_crtc (MetaCrtc *crtc);
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 */

View File

@@ -345,9 +345,6 @@ meta_monitor_manager_power_save_mode_changed (MetaMonitorManager *manager,
MetaMonitorManagerPrivate *priv =
meta_monitor_manager_get_instance_private (manager);
if (priv->power_save_mode == mode)
return;
priv->power_save_mode = mode;
g_signal_emit (manager, signals[POWER_SAVE_MODE_CHANGED], 0);
}
@@ -924,6 +921,29 @@ meta_monitor_manager_class_init (MetaMonitorManagerClass *klass)
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
meta_monitor_has_aspect_as_size (MetaMonitor *monitor)
{
@@ -940,6 +960,79 @@ meta_monitor_has_aspect_as_size (MetaMonitor *monitor)
(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 *
get_connector_type_name (MetaConnectorType connector_type)
{
@@ -1290,7 +1383,7 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
GVariantBuilder monitor_properties_builder;
GList *k;
gboolean is_builtin;
const char *display_name;
char *display_name;
current_mode = meta_monitor_get_current_mode (monitor);
preferred_mode = meta_monitor_get_preferred_mode (monitor);
@@ -1379,10 +1472,10 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
"is-builtin",
g_variant_new_boolean (is_builtin));
display_name = meta_monitor_get_display_name (monitor);
display_name = make_display_name (manager, monitor);
g_variant_builder_add (&monitor_properties_builder, "{sv}",
"display-name",
g_variant_new_string (display_name));
g_variant_new_take_string (display_name));
g_variant_builder_add (&monitors_builder, MONITOR_FORMAT,
monitor_spec->connector,
@@ -2641,7 +2734,7 @@ rebuild_monitors (MetaMonitorManager *manager)
{
MetaMonitorNormal *monitor_normal;
monitor_normal = meta_monitor_normal_new (gpu, manager, output);
monitor_normal = meta_monitor_normal_new (gpu, output);
manager->monitors = g_list_append (manager->monitors,
monitor_normal);
}
@@ -3096,23 +3189,3 @@ meta_monitor_manager_get_config_manager (MetaMonitorManager *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,8 +75,6 @@ typedef struct _MetaMonitorPrivate
* the primary one).
*/
uint64_t winsys_id;
char *display_name;
} MetaMonitorPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (MetaMonitor, meta_monitor, G_TYPE_OBJECT)
@@ -183,99 +181,6 @@ meta_monitor_generate_spec (MetaMonitor *monitor)
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 *
meta_monitor_get_gpu (MetaMonitor *monitor)
{
@@ -505,7 +410,6 @@ meta_monitor_finalize (GObject *object)
g_hash_table_destroy (priv->mode_ids);
g_list_free_full (priv->modes, (GDestroyNotify) meta_monitor_mode_free);
meta_monitor_spec_free (priv->spec);
g_free (priv->display_name);
G_OBJECT_CLASS (meta_monitor_parent_class)->finalize (object);
}
@@ -647,9 +551,8 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
}
MetaMonitorNormal *
meta_monitor_normal_new (MetaGpu *gpu,
MetaMonitorManager *monitor_manager,
MetaOutput *output)
meta_monitor_normal_new (MetaGpu *gpu,
MetaOutput *output)
{
MetaMonitorNormal *monitor_normal;
MetaMonitor *monitor;
@@ -667,9 +570,6 @@ meta_monitor_normal_new (MetaGpu *gpu,
meta_monitor_normal_generate_modes (monitor_normal);
monitor_priv->display_name = meta_monitor_make_display_name (monitor,
monitor_manager);
return monitor_normal;
}
@@ -1308,9 +1208,6 @@ meta_monitor_tiled_new (MetaGpu *gpu,
meta_monitor_tiled_generate_modes (monitor_tiled);
monitor_priv->display_name = meta_monitor_make_display_name (monitor,
monitor_manager);
return monitor_tiled;
}
@@ -1868,12 +1765,3 @@ meta_monitor_mode_foreach_output (MetaMonitor *monitor,
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,9 +101,8 @@ MetaMonitorTiled * meta_monitor_tiled_new (MetaGpu *gpu,
MetaOutput *output);
META_EXPORT_TEST
MetaMonitorNormal * meta_monitor_normal_new (MetaGpu *gpu,
MetaMonitorManager *monitor_manager,
MetaOutput *output);
MetaMonitorNormal * meta_monitor_normal_new (MetaGpu *gpu,
MetaOutput *output);
META_EXPORT_TEST
MetaMonitorSpec * meta_monitor_get_spec (MetaMonitor *monitor);
@@ -281,6 +280,4 @@ int meta_monitor_spec_compare (MetaMonitorSpec *monitor_spec_a,
META_EXPORT_TEST
void meta_monitor_spec_free (MetaMonitorSpec *monitor_id);
const char * meta_monitor_get_display_name (MetaMonitor *monitor);
#endif /* META_MONITOR_H */

View File

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

View File

@@ -90,12 +90,6 @@ meta_renderer_create_view (MetaRenderer *renderer,
*/
void
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);
MetaBackend *backend = meta_get_backend ();
@@ -187,6 +181,4 @@ meta_renderer_class_init (MetaRendererClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_renderer_finalize;
klass->rebuild_views = meta_renderer_real_rebuild_views;
}

View File

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

View File

@@ -814,7 +814,6 @@ void meta_backend_native_resume (MetaBackendNative *native)
meta_backend_get_monitor_manager (backend);
MetaMonitorManagerKms *monitor_manager_kms =
META_MONITOR_MANAGER_KMS (monitor_manager);
MetaInputSettings *input_settings;
MetaIdleMonitor *idle_monitor;
meta_monitor_manager_kms_resume (monitor_manager_kms);
@@ -828,7 +827,4 @@ void meta_backend_native_resume (MetaBackendNative *native)
idle_monitor = meta_backend_get_idle_monitor (backend, 0);
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,17 +40,6 @@ struct _MetaKmsCrtc
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 *
meta_kms_crtc_get_device (MetaKmsCrtc *crtc)
{
@@ -75,36 +64,6 @@ meta_kms_crtc_get_idx (MetaKmsCrtc *crtc)
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
meta_kms_crtc_read_state (MetaKmsCrtc *crtc,
MetaKmsImplDevice *impl_device,
@@ -120,8 +79,6 @@ meta_kms_crtc_read_state (MetaKmsCrtc *crtc,
.is_drm_mode_valid = drm_crtc->mode_valid,
.drm_mode = drm_crtc->mode,
};
read_gamma_state (crtc, impl_device, drm_crtc);
}
void
@@ -152,18 +109,6 @@ meta_kms_crtc_new (MetaKmsImplDevice *impl_device,
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
meta_kms_crtc_init (MetaKmsCrtc *crtc)
{
@@ -172,7 +117,4 @@ meta_kms_crtc_init (MetaKmsCrtc *crtc)
static void
meta_kms_crtc_class_init (MetaKmsCrtcClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_kms_crtc_finalize;
}

View File

@@ -36,14 +36,6 @@ typedef struct _MetaKmsCrtcState
uint32_t common_possible_crtcs;
uint32_t common_possible_clones;
uint32_t encoder_device_idxs;
struct {
uint16_t *red;
uint16_t *green;
uint16_t *blue;
int size;
} gamma;
} MetaKmsCrtcState;
#define META_TYPE_KMS_CRTC (meta_kms_crtc_get_type ())
@@ -51,13 +43,6 @@ G_DECLARE_FINAL_TYPE (MetaKmsCrtc, meta_kms_crtc,
META, KMS_CRTC,
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);
const MetaKmsCrtcState * meta_kms_crtc_get_current_state (MetaKmsCrtc *crtc);

View File

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

View File

@@ -307,41 +307,25 @@ meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device)
}
MetaKmsImplDevice *
meta_kms_impl_device_new (MetaKmsDevice *device,
MetaKmsImpl *impl,
int fd,
GError **error)
meta_kms_impl_device_new (MetaKmsDevice *device,
MetaKmsImpl *impl,
int fd)
{
MetaKms *kms = meta_kms_impl_get_kms (impl);
MetaKmsImplDevice *impl_device;
int ret;
drmModeRes *drm_resources;
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->device = device;
impl_device->impl = impl;
impl_device->fd = fd;
drmSetClientCap (fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
drm_resources = drmModeGetResources (fd);
init_crtcs (impl_device, drm_resources);
init_connectors (impl_device, drm_resources);
init_planes (impl_device);

View File

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

View File

@@ -201,7 +201,7 @@ process_mode_set (MetaKmsImpl *impl,
GError **error)
{
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);
MetaKmsImplDevice *impl_device = meta_kms_device_get_impl_device (device);
g_autofree uint32_t *connectors = NULL;
@@ -284,35 +284,6 @@ process_mode_set (MetaKmsImpl *impl,
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
is_timestamp_earlier_than (uint64_t ts1,
uint64_t ts2)
@@ -737,14 +708,6 @@ meta_kms_impl_simple_process_update (MetaKmsImpl *impl,
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)
{
MetaKmsPageFlip *page_flip = l->data;

View File

@@ -22,7 +22,6 @@
#include "backends/native/meta-kms-plane.h"
#include <drm_fourcc.h>
#include <stdio.h>
#include "backends/meta-monitor-transform.h"
@@ -294,39 +293,9 @@ parse_formats (MetaKmsPlane *plane,
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
init_formats (MetaKmsPlane *plane,
MetaKmsImplDevice *impl_device,
drmModePlane *drm_plane,
drmModeObjectProperties *drm_plane_props)
{
drmModePropertyPtr prop;
@@ -348,21 +317,6 @@ init_formats (MetaKmsPlane *plane,
parse_formats (plane, impl_device, blob_id);
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 *
@@ -380,7 +334,7 @@ meta_kms_plane_new (MetaKmsPlaneType type,
plane->device = meta_kms_impl_device_get_device (impl_device);
init_rotations (plane, impl_device, drm_plane_props);
init_formats (plane, impl_device, drm_plane, drm_plane_props);
init_formats (plane, impl_device, drm_plane_props);
return plane;
}

View File

@@ -59,15 +59,6 @@ typedef struct _MetaKmsConnectorProperty
uint64_t value;
} MetaKmsConnectorProperty;
typedef struct _MetaKmsCrtcGamma
{
MetaKmsCrtc *crtc;
int size;
uint16_t *red;
uint16_t *green;
uint16_t *blue;
} MetaKmsCrtcGamma;
typedef struct _MetaKmsPageFlip
{
MetaKmsCrtc *crtc;
@@ -86,13 +77,6 @@ void meta_kms_update_set_connector_property (MetaKmsUpdate *update,
uint32_t prop_id,
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,
uint32_t prop_id,
uint64_t value);
@@ -105,8 +89,6 @@ GList * meta_kms_update_get_page_flips (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);
#endif /* META_KMS_UPDATE_PRIVATE_H */

View File

@@ -34,7 +34,6 @@ struct _MetaKmsUpdate
GList *plane_assignments;
GList *page_flips;
GList *connector_properties;
GList *crtc_gammas;
};
static MetaKmsProperty *
@@ -143,39 +142,6 @@ meta_kms_update_set_connector_property (MetaKmsUpdate *update,
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
meta_kms_update_page_flip (MetaKmsUpdate *update,
MetaKmsCrtc *crtc,
@@ -259,12 +225,6 @@ meta_kms_update_get_connector_properties (MetaKmsUpdate *update)
return update->connector_properties;
}
GList *
meta_kms_update_get_crtc_gammas (MetaKmsUpdate *update)
{
return update->crtc_gammas;
}
gboolean
meta_kms_update_has_mode_set (MetaKmsUpdate *update)
{
@@ -298,7 +258,6 @@ meta_kms_update_free (MetaKmsUpdate *update)
(GDestroyNotify) meta_kms_mode_set_free);
g_list_free_full (update->page_flips, 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);
}

View File

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

View File

@@ -45,6 +45,101 @@
#error "Somehow included OpenGL headers when we shouldn't have"
#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
paint_egl_image (MetaGles3 *gles3,
EGLImageKHR egl_image,
@@ -100,10 +195,8 @@ meta_renderer_native_gles3_blit_shared_bo (MetaEgl *egl,
uint32_t strides[4] = { 0 };
uint32_t offsets[4] = { 0 };
uint64_t modifiers[4] = { 0 };
int fds[4] = { -1, -1, -1, -1 };
uint32_t format;
EGLImageKHR egl_image;
gboolean use_modifiers;
shared_bo_fd = gbm_bo_get_fd (shared_bo);
if (shared_bo_fd < 0)
@@ -123,27 +216,17 @@ meta_renderer_native_gles3_blit_shared_bo (MetaEgl *egl,
strides[i] = gbm_bo_get_stride_for_plane (shared_bo, i);
offsets[i] = gbm_bo_get_offset (shared_bo, i);
modifiers[i] = gbm_bo_get_modifier (shared_bo);
fds[i] = shared_bo_fd;
}
/* Workaround for https://gitlab.gnome.org/GNOME/mutter/issues/18 */
if (modifiers[0] == DRM_FORMAT_MOD_LINEAR ||
modifiers[0] == DRM_FORMAT_MOD_INVALID)
use_modifiers = FALSE;
else
use_modifiers = TRUE;
egl_image = meta_egl_create_dmabuf_image (egl,
egl_display,
width,
height,
format,
n_planes,
fds,
strides,
offsets,
use_modifiers ? modifiers : NULL,
error);
egl_image = create_egl_image (egl,
egl_display,
egl_context,
width, height,
n_planes,
strides, offsets,
modifiers, format,
shared_bo_fd,
error);
close (shared_bo_fd);
if (!egl_image)

View File

@@ -3,7 +3,7 @@
/*
* Copyright (C) 2011 Intel Corporation.
* Copyright (C) 2016 Red Hat
* Copyright (c) 2018,2019 DisplayLink (UK) Ltd.
* Copyright (c) 2018 DisplayLink (UK) Ltd.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -69,8 +69,6 @@
#include "backends/native/meta-renderer-native-gles3.h"
#include "backends/native/meta-renderer-native.h"
#include "cogl/cogl.h"
#include "cogl/cogl-framebuffer.h"
#include "cogl/cogl-trace.h"
#include "core/boxes-private.h"
#ifndef EGL_DRM_MASTER_FD_EXT
@@ -95,14 +93,8 @@ static GParamSpec *obj_props[PROP_LAST];
typedef enum _MetaSharedFramebufferCopyMode
{
/* the secondary GPU will make the copy */
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
META_SHARED_FRAMEBUFFER_COPY_MODE_GPU,
META_SHARED_FRAMEBUFFER_COPY_MODE_CPU
} MetaSharedFramebufferCopyMode;
typedef struct _MetaRendererNativeGpuData
@@ -129,7 +121,6 @@ typedef struct _MetaRendererNativeGpuData
struct {
MetaSharedFramebufferCopyMode copy_mode;
gboolean is_hardware_rendering;
gboolean has_EGL_EXT_image_dma_buf_import_modifiers;
/* For GPU blit mode */
EGLContext egl_context;
@@ -147,7 +138,6 @@ typedef struct _MetaDumbBuffer
int height;
int stride_bytes;
uint32_t drm_format;
int dmabuf_fd;
} MetaDumbBuffer;
typedef struct _MetaOnscreenNativeSecondaryGpuState
@@ -169,9 +159,6 @@ typedef struct _MetaOnscreenNativeSecondaryGpuState
} cpu;
int pending_flips;
gboolean noted_primary_gpu_copy_ok;
gboolean noted_primary_gpu_copy_failed;
} MetaOnscreenNativeSecondaryGpuState;
typedef struct _MetaOnscreenNative
@@ -253,10 +240,6 @@ init_dumb_fb (MetaDumbBuffer *dumb_fb,
uint32_t format,
GError **error);
static int
meta_dumb_buffer_ensure_dmabuf_fd (MetaDumbBuffer *dumb_fb,
MetaGpuKms *gpu_kms);
static MetaEgl *
meta_renderer_native_get_egl (MetaRendererNative *renderer_native);
@@ -273,9 +256,6 @@ cogl_pixel_format_from_drm_format (uint32_t drm_format,
CoglPixelFormat *out_format,
CoglTextureComponents *out_components);
static void
meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native);
static void
meta_renderer_native_gpu_data_free (MetaRendererNativeGpuData *renderer_gpu_data)
{
@@ -887,7 +867,7 @@ init_secondary_gpu_state (MetaRendererNative *renderer_native,
switch (renderer_gpu_data->secondary.copy_mode)
{
case META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU:
case META_SHARED_FRAMEBUFFER_COPY_MODE_GPU:
if (!init_secondary_gpu_state_gpu_copy_mode (renderer_native,
onscreen,
renderer_gpu_data,
@@ -895,7 +875,7 @@ init_secondary_gpu_state (MetaRendererNative *renderer_native,
error))
return FALSE;
break;
case META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY:
case META_SHARED_FRAMEBUFFER_COPY_MODE_CPU:
if (!init_secondary_gpu_state_cpu_copy_mode (renderer_native,
onscreen,
renderer_gpu_data,
@@ -979,10 +959,10 @@ free_current_secondary_bo (MetaGpuKms *gpu_kms,
renderer_gpu_data = secondary_gpu_state->renderer_gpu_data;
switch (renderer_gpu_data->secondary.copy_mode)
{
case META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU:
case META_SHARED_FRAMEBUFFER_COPY_MODE_GPU:
g_clear_object (&secondary_gpu_state->gbm.current_fb);
break;
case META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY:
case META_SHARED_FRAMEBUFFER_COPY_MODE_CPU:
break;
}
}
@@ -1470,10 +1450,10 @@ free_next_secondary_bo (MetaGpuKms *gpu_kms,
renderer_gpu_data = secondary_gpu_state->renderer_gpu_data;
switch (renderer_gpu_data->secondary.copy_mode)
{
case META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU:
case META_SHARED_FRAMEBUFFER_COPY_MODE_GPU:
g_clear_object (&secondary_gpu_state->gbm.next_fb);
break;
case META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY:
case META_SHARED_FRAMEBUFFER_COPY_MODE_CPU:
break;
}
}
@@ -1777,9 +1757,6 @@ copy_shared_framebuffer_gpu (CoglOnscreen *onscreen,
MetaDrmBufferGbm *buffer_gbm;
struct gbm_bo *bo;
COGL_TRACE_BEGIN_SCOPED (CopySharedFramebufferSecondaryGpu,
"FB Copy (secondary GPU)");
if (!meta_egl_make_current (egl,
renderer_gpu_data->egl_display,
secondary_gpu_state->egl_surface,
@@ -1846,131 +1823,6 @@ secondary_gpu_get_next_dumb_buffer (MetaOnscreenNativeSecondaryGpuState *seconda
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 {
uint32_t drm_format;
CoglPixelFormat cogl_format;
@@ -2043,9 +1895,6 @@ copy_shared_framebuffer_cpu (CoglOnscreen *onscreen,
gboolean ret;
MetaDrmBufferDumb *buffer_dumb;
COGL_TRACE_BEGIN_SCOPED (CopySharedFramebufferCpu,
"FB Copy (CPU)");
dumb_fb = secondary_gpu_get_next_dumb_buffer (secondary_gpu_state);
g_assert (cogl_framebuffer_get_width (framebuffer) == dumb_fb->width);
@@ -2096,30 +1945,13 @@ update_secondary_gpu_state_pre_swap_buffers (CoglOnscreen *onscreen)
renderer_gpu_data = secondary_gpu_state->renderer_gpu_data;
switch (renderer_gpu_data->secondary.copy_mode)
{
case META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU:
case META_SHARED_FRAMEBUFFER_COPY_MODE_GPU:
/* Done after eglSwapBuffers. */
break;
case META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY:
if (!copy_shared_framebuffer_primary_gpu (onscreen,
secondary_gpu_state))
{
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;
}
case META_SHARED_FRAMEBUFFER_COPY_MODE_CPU:
copy_shared_framebuffer_cpu (onscreen,
secondary_gpu_state,
renderer_gpu_data);
break;
}
}
@@ -2147,13 +1979,13 @@ update_secondary_gpu_state_post_swap_buffers (CoglOnscreen *onscreen,
secondary_gpu_state->gpu_kms);
switch (renderer_gpu_data->secondary.copy_mode)
{
case META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU:
case META_SHARED_FRAMEBUFFER_COPY_MODE_GPU:
copy_shared_framebuffer_gpu (onscreen,
secondary_gpu_state,
renderer_gpu_data,
egl_context_changed);
break;
case META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY:
case META_SHARED_FRAMEBUFFER_COPY_MODE_CPU:
/* Done before eglSwapBuffers. */
break;
}
@@ -2626,7 +2458,6 @@ init_dumb_fb (MetaDumbBuffer *dumb_fb,
dumb_fb->height = height;
dumb_fb->stride_bytes = create_arg.pitch;
dumb_fb->drm_format = format;
dumb_fb->dmabuf_fd = -1;
return TRUE;
@@ -2644,33 +2475,6 @@ err_ioctl:
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
release_dumb_fb (MetaDumbBuffer *dumb_fb,
MetaGpuKms *gpu_kms)
@@ -2681,9 +2485,6 @@ release_dumb_fb (MetaDumbBuffer *dumb_fb,
if (!dumb_fb->map)
return;
if (dumb_fb->dmabuf_fd != -1)
close (dumb_fb->dmabuf_fd);
munmap (dumb_fb->map, dumb_fb->map_size);
dumb_fb->map = NULL;
@@ -2832,6 +2633,8 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
CoglContext *cogl_context = framebuffer->context;
CoglDisplay *cogl_display = cogl_context_get_display (cogl_context);
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;
MetaOnscreenNative *onscreen_native;
MetaRendererNative *renderer_native;
@@ -2885,8 +2688,6 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
if (onscreen_native->egl.stream != EGL_NO_STREAM_KHR)
{
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,
cogl_renderer_egl->edpy,
@@ -2942,7 +2743,7 @@ meta_renderer_native_supports_mirroring (MetaRendererNative *renderer_native)
return TRUE;
}
static void
void
meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native)
{
MetaRenderer *renderer = META_RENDERER (renderer_native);
@@ -3309,23 +3110,6 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
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
meta_renderer_native_finish_frame (MetaRendererNative *renderer_native)
{
@@ -3556,12 +3340,7 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data,
renderer_gpu_data->secondary.is_hardware_rendering = TRUE;
renderer_gpu_data->secondary.egl_context = egl_context;
renderer_gpu_data->secondary.egl_config = egl_config;
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);
renderer_gpu_data->secondary.copy_mode = META_SHARED_FRAMEBUFFER_COPY_MODE_GPU;
return TRUE;
@@ -3581,7 +3360,7 @@ static void
init_secondary_gpu_data_cpu (MetaRendererNativeGpuData *renderer_gpu_data)
{
renderer_gpu_data->secondary.is_hardware_rendering = FALSE;
renderer_gpu_data->secondary.copy_mode = META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY;
renderer_gpu_data->secondary.copy_mode = META_SHARED_FRAMEBUFFER_COPY_MODE_CPU;
}
static void
@@ -4155,7 +3934,6 @@ meta_renderer_native_class_init (MetaRendererNativeClass *klass)
renderer_class->create_cogl_renderer = meta_renderer_native_create_cogl_renderer;
renderer_class->create_view = meta_renderer_native_create_view;
renderer_class->rebuild_views = meta_renderer_native_rebuild_views;
obj_props[PROP_BACKEND] =
g_param_spec_object ("backend",

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