Compare commits
1 Commits
wip/nields
...
wip/nielsd
Author | SHA1 | Date | |
---|---|---|---|
![]() |
620a9f5193 |
@@ -1,4 +1,4 @@
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v2
|
||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v1
|
||||
|
||||
stages:
|
||||
- review
|
||||
@@ -17,7 +17,7 @@ check-commit-log:
|
||||
build-mutter:
|
||||
stage: build
|
||||
script:
|
||||
- meson . build -Dbuildtype=debugoptimized -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
||||
- meson . build -Dbuildtype=debugoptimized -Degl_device=true -Dwayland_eglstream=true --werror
|
||||
- ninja -C build
|
||||
- ninja -C build install
|
||||
artifacts:
|
||||
@@ -35,31 +35,16 @@ test-mutter:
|
||||
variables:
|
||||
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
|
||||
GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data"
|
||||
G_SLICE: "always-malloc"
|
||||
MALLOC_CHECK_: "3"
|
||||
NO_AT_BRIDGE: "1"
|
||||
MALLOC_PERTURB_: "123"
|
||||
script:
|
||||
- dconf update
|
||||
- mkdir -m 700 $XDG_RUNTIME_DIR
|
||||
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
|
||||
- >
|
||||
dbus-run-session -- xvfb-run -s '+iglx -noreset'
|
||||
meson test -C build --no-rebuild -t 10 --verbose --no-stdsplit --print-errorlogs --wrap catchsegv
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
|
||||
can-build-gnome-shell:
|
||||
stage: test
|
||||
dependencies:
|
||||
- build-mutter
|
||||
before_script:
|
||||
- meson install --no-rebuild -C build
|
||||
script:
|
||||
- .gitlab-ci/checkout-gnome-shell.sh
|
||||
- meson gnome-shell gnome-shell/build --prefix /usr
|
||||
- ninja -C gnome-shell/build install
|
||||
- bash -x ./.gitlab-ci/run-tests.sh
|
||||
only:
|
||||
- merge_requests
|
||||
- /^.*$/
|
||||
artifacts:
|
||||
reports:
|
||||
junit: "build/${CI_JOB_NAME}-report.xml"
|
||||
name: "mutter-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
|
||||
when: always
|
||||
paths:
|
||||
- "build/meson-logs"
|
||||
- "build/${CI_JOB_NAME}-report.xml"
|
||||
|
@@ -1,26 +1,17 @@
|
||||
FROM fedora:30
|
||||
FROM fedora:29
|
||||
|
||||
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 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 && \
|
||||
|
||||
# For running unit tests
|
||||
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs && \
|
||||
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 && \
|
||||
|
||||
# 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/jadahl/mutter-ci/fedora-29-x86_64/00848426-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/00848426-gsettings-desktop-schemas/gsettings-desktop-schemas-devel-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm && \
|
||||
|
||||
dnf install -y intltool redhat-rpm-config make && \
|
||||
|
||||
# GNOME Shell
|
||||
dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \
|
||||
dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \
|
||||
dnf remove -y --noautoremove mutter mutter-devel && \
|
||||
|
||||
dnf clean all
|
||||
|
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
mutter_branch=$(git describe --contains --all HEAD)
|
||||
gnome_shell_target=
|
||||
|
||||
git clone https://gitlab.gnome.org/GNOME/gnome-shell.git
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo Checkout failed
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd gnome-shell
|
||||
|
||||
if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
|
||||
merge_request_remote=${CI_MERGE_REQUEST_SOURCE_PROJECT_URL//mutter/gnome-shell}
|
||||
merge_request_branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
|
||||
|
||||
echo Looking for $merge_request_branch on remote ...
|
||||
if git fetch -q $merge_request_remote $merge_request_branch 2>/dev/null; then
|
||||
gnome_shell_target=FETCH_HEAD
|
||||
else
|
||||
gnome_shell_target=origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
|
||||
echo Using $gnome_shell_target instead
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$gnome_shell_target" ]; then
|
||||
gnome_shell_target=$(git branch -r -l origin/$mutter_branch)
|
||||
gnome_shell_target=${gnome_shell_target:-$(git branch -r -l ${mutter_branch#remotes/})}
|
||||
gnome_shell_target=${gnome_shell_target:-origin/master}
|
||||
echo Using $gnome_shell_target instead
|
||||
fi
|
||||
|
||||
git checkout -q $gnome_shell_target
|
109
.gitlab-ci/meson-junit-report.py
Executable file
109
.gitlab-ci/meson-junit-report.py
Executable file
@@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Turns a Meson testlog.json file into a JUnit XML report
|
||||
#
|
||||
# Copyright 2019 GNOME Foundation
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#
|
||||
# Original author: Emmanuele Bassi
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
aparser = argparse.ArgumentParser(description='Turns a Meson test log into a JUnit report')
|
||||
aparser.add_argument('--project-name', metavar='NAME',
|
||||
help='The project name',
|
||||
default='unknown')
|
||||
aparser.add_argument('--job-id', metavar='ID',
|
||||
help='The job ID for the report',
|
||||
default='Unknown')
|
||||
aparser.add_argument('--branch', metavar='NAME',
|
||||
help='Branch of the project being tested',
|
||||
default='master')
|
||||
aparser.add_argument('--output', metavar='FILE',
|
||||
help='The output file, stdout by default',
|
||||
type=argparse.FileType('w', encoding='UTF-8'),
|
||||
default=sys.stdout)
|
||||
aparser.add_argument('infile', metavar='FILE',
|
||||
help='The input testlog.json, stdin by default',
|
||||
type=argparse.FileType('r', encoding='UTF-8'),
|
||||
default=sys.stdin)
|
||||
|
||||
args = aparser.parse_args()
|
||||
|
||||
outfile = args.output
|
||||
|
||||
testsuites = ET.Element('testsuites')
|
||||
testsuites.set('id', '{}/{}'.format(args.job_id, args.branch))
|
||||
testsuites.set('package', args.project_name)
|
||||
testsuites.set('timestamp', datetime.datetime.utcnow().isoformat(timespec='minutes'))
|
||||
|
||||
suites = {}
|
||||
for line in args.infile:
|
||||
data = json.loads(line)
|
||||
(full_suite, unit_name) = data['name'].split(' / ')
|
||||
(project_name, suite_name) = full_suite.split(':')
|
||||
|
||||
duration = data['duration']
|
||||
return_code = data['returncode']
|
||||
log = data['stdout']
|
||||
|
||||
unit = {
|
||||
'suite': suite_name,
|
||||
'name': unit_name,
|
||||
'duration': duration,
|
||||
'returncode': return_code,
|
||||
'stdout': log,
|
||||
}
|
||||
|
||||
units = suites.setdefault(suite_name, [])
|
||||
units.append(unit)
|
||||
|
||||
for name, units in suites.items():
|
||||
print('Processing suite {} (units: {})'.format(name, len(units)))
|
||||
|
||||
def if_failed(unit):
|
||||
if unit['returncode'] != 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
def if_succeded(unit):
|
||||
if unit['returncode'] == 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
successes = list(filter(if_succeded, units))
|
||||
failures = list(filter(if_failed, units))
|
||||
print(' - {}: {} pass, {} fail'.format(name, len(successes), len(failures)))
|
||||
|
||||
testsuite = ET.SubElement(testsuites, 'testsuite')
|
||||
testsuite.set('name', '{}/{}'.format(args.project_name, name))
|
||||
testsuite.set('tests', str(len(units)))
|
||||
testsuite.set('errors', str(len(failures)))
|
||||
testsuite.set('failures', str(len(failures)))
|
||||
|
||||
for unit in successes:
|
||||
testcase = ET.SubElement(testsuite, 'testcase')
|
||||
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
|
||||
testcase.set('name', unit['name'])
|
||||
testcase.set('time', str(unit['duration']))
|
||||
|
||||
for unit in failures:
|
||||
testcase = ET.SubElement(testsuite, 'testcase')
|
||||
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
|
||||
testcase.set('name', unit['name'])
|
||||
testcase.set('time', str(unit['duration']))
|
||||
|
||||
failure = ET.SubElement(testcase, 'failure')
|
||||
failure.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
|
||||
failure.set('name', unit['name'])
|
||||
failure.set('type', 'error')
|
||||
failure.text = unit['stdout']
|
||||
|
||||
output = ET.tostring(testsuites, encoding='unicode')
|
||||
outfile.write(output)
|
20
.gitlab-ci/run-tests.sh
Executable file
20
.gitlab-ci/run-tests.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
set +e
|
||||
|
||||
mkdir -m 700 $XDG_RUNTIME_DIR
|
||||
glib-compile-schemas $GSETTINGS_SCHEMA_DIR
|
||||
|
||||
dbus-run-session -- \
|
||||
xvfb-run -s '+iglx -noreset' \
|
||||
meson test -C build --no-rebuild -t 10 --wrap catchsegv
|
||||
|
||||
exit_code=$?
|
||||
|
||||
python3 .gitlab-ci/meson-junit-report.py \
|
||||
--project-name=mutter \
|
||||
--job-id "${CI_JOB_NAME}" \
|
||||
--output "build/${CI_JOB_NAME}-report.xml" \
|
||||
build/meson-logs/testlog-catchsegv.json
|
||||
|
||||
exit $exit_code
|
40
NEWS
40
NEWS
@@ -1,43 +1,3 @@
|
||||
3.33.2
|
||||
======
|
||||
* Fix rendering lag on Xorg [Daniel; !520, !281]
|
||||
* Misc. bug fixes and cleanups [Carlos, Marco, Jonas D., Florian, Niels,
|
||||
Daniel, Benjamin, Jonas Å., Ignacio, Vasilis; #598, !576, !547, !578,
|
||||
!583, !582, !469, !524, !119, !571, !584, !585, !586, #425]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Benjamin Berg, Jonas Dreßler, Carlos Garnacho, Niels De Graef,
|
||||
Vasilis Liaskovitis, Florian Müllner, Ignacio Casal Quinteiro,
|
||||
Marco Trevisan (Treviño), Daniel van Vugt
|
||||
|
||||
Translators:
|
||||
Daniel Mustieles [es]
|
||||
|
||||
3.33.1
|
||||
======
|
||||
* Remove unused APIs and outdated driver support
|
||||
[Adam; !481, !468, !489, !487, !546]
|
||||
* Enable EGL_IMG_context_priority [Adam; !454]
|
||||
* Disable mouse keys with Numlock on [Olivier; #530]
|
||||
* Fix crash when restarting on X11 [Marco; #576]
|
||||
* Implement clipboard manager [Carlos; !320]
|
||||
* Fix spurious idle signals that prevent session unblank [Jonas Å.; !543]
|
||||
* Fix mapping of touchscreens that don't report dimensions [Carlos; #581]
|
||||
* Fix propagating fractional scaling factor [Robert; !537]
|
||||
* Add experimental RT scheduling support [Carlos; !460]
|
||||
* Misc. bug fixes and cleanups [Robert, Carlos, Olivier, Ray, Marco, Jonas D.,
|
||||
Georges, Daniel V., Daniel M; !467, !504, !551, !552, #575, #556, !557, !442,
|
||||
!562, !535, !548, #586, !567, !396, !422, !507]
|
||||
|
||||
Contributors:
|
||||
Jonas Ådahl, Piotr Drąg, Jonas Dreßler, Olivier Fourdan, Carlos Garnacho,
|
||||
Adam Jackson, Robert Mader, Daniel García Moreno, Florian Müllner,
|
||||
Georges Basile Stavracas Neto, Ray Strode, Marco Trevisan (Treviño),
|
||||
Daniel van Vugt
|
||||
|
||||
Translators:
|
||||
Daniel Mustieles [es], Fabio Tomat [fur], Kukuh Syafaat [id]
|
||||
|
||||
3.32.1
|
||||
======
|
||||
* Fix fallback app menu on wayland [Florian; #493]
|
||||
|
@@ -1044,8 +1044,10 @@ _cally_actor_clean_action_list (CallyActor *cally_actor)
|
||||
|
||||
if (priv->action_list)
|
||||
{
|
||||
g_list_free_full (priv->action_list,
|
||||
(GDestroyNotify) _cally_actor_destroy_action_info);
|
||||
g_list_foreach (priv->action_list,
|
||||
(GFunc) _cally_actor_destroy_action_info,
|
||||
NULL);
|
||||
g_list_free (priv->action_list);
|
||||
priv->action_list = NULL;
|
||||
}
|
||||
}
|
||||
|
@@ -577,7 +577,8 @@ _clutter_meta_group_clear_metas (ClutterMetaGroup *group)
|
||||
{
|
||||
g_list_foreach (group->meta, (GFunc) _clutter_actor_meta_set_actor, NULL);
|
||||
|
||||
g_list_free_full (group->meta, g_object_unref);
|
||||
g_list_foreach (group->meta, (GFunc) g_object_unref, NULL);
|
||||
g_list_free (group->meta);
|
||||
group->meta = NULL;
|
||||
}
|
||||
|
||||
|
@@ -8849,9 +8849,9 @@ _clutter_actor_queue_redraw_full (ClutterActor *self,
|
||||
*
|
||||
* later during _clutter_stage_do_update(), once relayouting is done
|
||||
* and the scenegraph has been updated we will call:
|
||||
* clutter_stage_maybe_finish_queue_redraws().
|
||||
* _clutter_stage_finish_queue_redraws().
|
||||
*
|
||||
* clutter_stage_maybe_finish_queue_redraws() will call
|
||||
* _clutter_stage_finish_queue_redraws() will call
|
||||
* _clutter_actor_finish_queue_redraw() for each listed actor.
|
||||
*
|
||||
* Note: actors *are* allowed to queue further redraws during this
|
||||
|
@@ -235,7 +235,8 @@ clutter_binding_pool_finalize (GObject *gobject)
|
||||
|
||||
g_hash_table_destroy (pool->entries_hash);
|
||||
|
||||
g_slist_free_full (pool->entries, (GDestroyNotify) binding_entry_free);
|
||||
g_slist_foreach (pool->entries, (GFunc) binding_entry_free, NULL);
|
||||
g_slist_free (pool->entries);
|
||||
|
||||
G_OBJECT_CLASS (clutter_binding_pool_parent_class)->finalize (gobject);
|
||||
}
|
||||
|
@@ -355,10 +355,6 @@ on_captured_event (ClutterActor *stage,
|
||||
|
||||
switch (clutter_event_type (event))
|
||||
{
|
||||
case CLUTTER_TOUCH_CANCEL:
|
||||
clutter_click_action_release (action);
|
||||
break;
|
||||
|
||||
case CLUTTER_TOUCH_END:
|
||||
has_button = FALSE;
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
|
@@ -282,7 +282,6 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
|
||||
/* enable depth testing */
|
||||
cogl_depth_state_init (&depth_state);
|
||||
cogl_depth_state_set_test_enabled (&depth_state, TRUE);
|
||||
cogl_depth_state_set_test_function (&depth_state, COGL_DEPTH_TEST_FUNCTION_LEQUAL);
|
||||
cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL);
|
||||
|
||||
/* enable backface culling if we have a back material */
|
||||
|
@@ -1021,9 +1021,6 @@ clutter_event_get_event_sequence (const ClutterEvent *event)
|
||||
event->type == CLUTTER_TOUCH_END ||
|
||||
event->type == CLUTTER_TOUCH_CANCEL)
|
||||
return event->touch.sequence;
|
||||
else if (event->type == CLUTTER_ENTER ||
|
||||
event->type == CLUTTER_LEAVE)
|
||||
return event->crossing.sequence;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -269,7 +269,6 @@ struct _ClutterCrossingEvent
|
||||
gfloat x;
|
||||
gfloat y;
|
||||
ClutterInputDevice *device;
|
||||
ClutterEventSequence *sequence;
|
||||
ClutterActor *related;
|
||||
};
|
||||
|
||||
|
@@ -834,7 +834,6 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||
event->crossing.x = device->current_x;
|
||||
event->crossing.y = device->current_y;
|
||||
event->crossing.related = actor;
|
||||
event->crossing.sequence = sequence;
|
||||
clutter_event_set_device (event, device);
|
||||
|
||||
/* we need to make sure that this event is processed
|
||||
@@ -871,7 +870,6 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||
event->crossing.y = device->current_y;
|
||||
event->crossing.source = actor;
|
||||
event->crossing.related = old_actor;
|
||||
event->crossing.sequence = sequence;
|
||||
clutter_event_set_device (event, device);
|
||||
|
||||
/* see above */
|
||||
@@ -1036,10 +1034,9 @@ _clutter_input_device_update (ClutterInputDevice *device,
|
||||
ClutterActor *new_cursor_actor;
|
||||
ClutterActor *old_cursor_actor;
|
||||
ClutterPoint point = { -1, -1 };
|
||||
ClutterInputDeviceType device_type = device->device_type;
|
||||
|
||||
g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&
|
||||
device_type != CLUTTER_PAD_DEVICE);
|
||||
if (device->device_type == CLUTTER_KEYBOARD_DEVICE)
|
||||
return NULL;
|
||||
|
||||
stage = device->stage;
|
||||
if (G_UNLIKELY (stage == NULL))
|
||||
|
@@ -2004,36 +2004,6 @@ emit_pointer_event (ClutterEvent *event,
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emit_crossing_event (ClutterEvent *event,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
ClutterMainContext *context = _clutter_context_get_default ();
|
||||
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
|
||||
ClutterActor *grab_actor = NULL;
|
||||
|
||||
if (_clutter_event_process_filters (event))
|
||||
return;
|
||||
|
||||
if (sequence)
|
||||
{
|
||||
if (device->sequence_grab_actors != NULL)
|
||||
grab_actor = g_hash_table_lookup (device->sequence_grab_actors, sequence);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (context->pointer_grab_actor != NULL)
|
||||
grab_actor = context->pointer_grab_actor;
|
||||
else if (device != NULL && device->pointer_grab_actor != NULL)
|
||||
grab_actor = device->pointer_grab_actor;
|
||||
}
|
||||
|
||||
if (grab_actor != NULL)
|
||||
clutter_actor_event (grab_actor, event, FALSE);
|
||||
else
|
||||
emit_event_chain (event);
|
||||
}
|
||||
|
||||
static inline void
|
||||
emit_touch_event (ClutterEvent *event,
|
||||
ClutterInputDevice *device)
|
||||
@@ -2207,7 +2177,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
{
|
||||
ClutterActor *actor = NULL;
|
||||
|
||||
emit_crossing_event (event, device);
|
||||
emit_pointer_event (event, device);
|
||||
|
||||
actor = _clutter_input_device_update (device, NULL, FALSE);
|
||||
if (actor != stage)
|
||||
@@ -2219,12 +2189,12 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
crossing->crossing.related = stage;
|
||||
crossing->crossing.source = actor;
|
||||
|
||||
emit_crossing_event (crossing, device);
|
||||
emit_pointer_event (crossing, device);
|
||||
clutter_event_free (crossing);
|
||||
}
|
||||
}
|
||||
else
|
||||
emit_crossing_event (event, device);
|
||||
emit_pointer_event (event, device);
|
||||
break;
|
||||
|
||||
case CLUTTER_LEAVE:
|
||||
@@ -2243,10 +2213,10 @@ _clutter_process_event_details (ClutterActor *stage,
|
||||
crossing->crossing.related = stage;
|
||||
crossing->crossing.source = device->cursor_actor;
|
||||
|
||||
emit_crossing_event (crossing, device);
|
||||
emit_pointer_event (crossing, device);
|
||||
clutter_event_free (crossing);
|
||||
}
|
||||
emit_crossing_event (event, device);
|
||||
emit_pointer_event (event, device);
|
||||
break;
|
||||
|
||||
case CLUTTER_DESTROY_NOTIFY:
|
||||
|
@@ -412,7 +412,8 @@ master_clock_advance_timelines (ClutterMasterClockDefault *master_clock)
|
||||
for (l = timelines; l != NULL; l = l->next)
|
||||
_clutter_timeline_do_tick (l->data, master_clock->cur_tick / 1000);
|
||||
|
||||
g_slist_free_full (timelines, g_object_unref);
|
||||
g_slist_foreach (timelines, (GFunc) g_object_unref, NULL);
|
||||
g_slist_free (timelines);
|
||||
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
if (_clutter_diagnostic_enabled ())
|
||||
@@ -573,7 +574,8 @@ clutter_clock_dispatch (GSource *source,
|
||||
|
||||
master_clock_reschedule_stage_updates (master_clock, stages);
|
||||
|
||||
g_slist_free_full (stages, g_object_unref);
|
||||
g_slist_foreach (stages, (GFunc) g_object_unref, NULL);
|
||||
g_slist_free (stages);
|
||||
|
||||
master_clock->prev_tick = master_clock->cur_tick;
|
||||
|
||||
|
@@ -295,7 +295,8 @@ clutter_path_clear (ClutterPath *path)
|
||||
{
|
||||
ClutterPathPrivate *priv = path->priv;
|
||||
|
||||
g_slist_free_full (priv->nodes, (GDestroyNotify) clutter_path_node_full_free);
|
||||
g_slist_foreach (priv->nodes, (GFunc) clutter_path_node_full_free, NULL);
|
||||
g_slist_free (priv->nodes);
|
||||
|
||||
priv->nodes = priv->nodes_tail = NULL;
|
||||
priv->nodes_dirty = TRUE;
|
||||
@@ -658,7 +659,8 @@ clutter_path_parse_description (const gchar *p,
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
g_slist_free_full (nodes, (GDestroyNotify) clutter_path_node_full_free);
|
||||
g_slist_foreach (nodes, (GFunc) clutter_path_node_full_free, NULL);
|
||||
g_slist_free (nodes);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@@ -303,11 +303,6 @@ gboolean _clutter_util_matrix_decompose (const ClutterMatrix *src,
|
||||
ClutterVertex *translate_p,
|
||||
ClutterVertex4 *perspective_p);
|
||||
|
||||
PangoDirection _clutter_pango_unichar_direction (gunichar ch);
|
||||
|
||||
PangoDirection _clutter_pango_find_base_dir (const gchar *text,
|
||||
gint length);
|
||||
|
||||
typedef struct _ClutterPlane
|
||||
{
|
||||
float v0[3];
|
||||
|
@@ -2021,7 +2021,8 @@ add_children (ClutterScript *script,
|
||||
clutter_container_add_actor (container, CLUTTER_ACTOR (object));
|
||||
}
|
||||
|
||||
g_list_free_full (oinfo->children, g_free);
|
||||
g_list_foreach (oinfo->children, (GFunc) g_free, NULL);
|
||||
g_list_free (oinfo->children);
|
||||
|
||||
oinfo->children = unresolved;
|
||||
}
|
||||
|
@@ -346,12 +346,15 @@ object_info_free (gpointer data)
|
||||
g_free (oinfo->class_name);
|
||||
g_free (oinfo->type_func);
|
||||
|
||||
g_list_free_full (oinfo->properties, property_info_free);
|
||||
g_list_foreach (oinfo->properties, (GFunc) property_info_free, NULL);
|
||||
g_list_free (oinfo->properties);
|
||||
|
||||
g_list_free_full (oinfo->signals, signal_info_free);
|
||||
g_list_foreach (oinfo->signals, (GFunc) signal_info_free, NULL);
|
||||
g_list_free (oinfo->signals);
|
||||
|
||||
/* these are ids */
|
||||
g_list_free_full (oinfo->children, g_free);
|
||||
g_list_foreach (oinfo->children, (GFunc) g_free, NULL);
|
||||
g_list_free (oinfo->children);
|
||||
|
||||
/* we unref top-level objects and leave the actors alone,
|
||||
* unless we are unmerging in which case we have to destroy
|
||||
@@ -843,7 +846,8 @@ clutter_script_unmerge_objects (ClutterScript *script,
|
||||
for (l = data.ids; l != NULL; l = l->next)
|
||||
g_hash_table_remove (priv->objects, l->data);
|
||||
|
||||
g_slist_free_full (data.ids, g_free);
|
||||
g_slist_foreach (data.ids, (GFunc) g_free, NULL);
|
||||
g_slist_free (data.ids);
|
||||
|
||||
clutter_script_ensure_objects (script);
|
||||
}
|
||||
|
@@ -89,8 +89,8 @@ clutter_stage_manager_dispose (GObject *gobject)
|
||||
|
||||
stage_manager = CLUTTER_STAGE_MANAGER (gobject);
|
||||
|
||||
g_slist_free_full (stage_manager->stages,
|
||||
(GDestroyNotify) clutter_actor_destroy);
|
||||
g_slist_foreach (stage_manager->stages, (GFunc) clutter_actor_destroy, NULL);
|
||||
g_slist_free (stage_manager->stages);
|
||||
stage_manager->stages = NULL;
|
||||
|
||||
G_OBJECT_CLASS (clutter_stage_manager_parent_class)->dispose (gobject);
|
||||
|
@@ -1303,8 +1303,14 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
|
||||
return TRUE;
|
||||
|
||||
if (_clutter_stage_window_ignoring_redraw_clips (stage_window))
|
||||
return FALSE;
|
||||
{
|
||||
_clutter_stage_window_add_redraw_clip (stage_window, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Convert the clip volume into stage coordinates and then into an
|
||||
* axis aligned stage coordinates bounding box...
|
||||
*/
|
||||
if (redraw_clip == NULL)
|
||||
{
|
||||
_clutter_stage_window_add_redraw_clip (stage_window, NULL);
|
||||
@@ -1314,8 +1320,6 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
|
||||
if (redraw_clip->is_empty)
|
||||
return TRUE;
|
||||
|
||||
/* Convert the clip volume into stage coordinates and then into an
|
||||
* axis aligned stage coordinates bounding box... */
|
||||
_clutter_paint_volume_get_stage_paint_box (redraw_clip,
|
||||
stage,
|
||||
&bounding_box);
|
||||
|
@@ -751,7 +751,7 @@ clutter_text_create_layout_no_cache (ClutterText *text,
|
||||
if (priv->password_char != 0)
|
||||
pango_dir = PANGO_DIRECTION_NEUTRAL;
|
||||
else
|
||||
pango_dir = _clutter_pango_find_base_dir (contents, contents_len);
|
||||
pango_dir = pango_find_base_dir (contents, contents_len);
|
||||
|
||||
if (pango_dir == PANGO_DIRECTION_NEUTRAL)
|
||||
{
|
||||
@@ -1975,7 +1975,6 @@ selection_paint (ClutterText *self,
|
||||
else
|
||||
{
|
||||
/* Paint selection background first */
|
||||
CoglPipeline *color_pipeline = cogl_pipeline_copy (default_color_pipeline);
|
||||
PangoLayout *layout = clutter_text_get_layout (self);
|
||||
CoglPath *selection_path = cogl_path_new ();
|
||||
CoglColor cogl_color = { 0, };
|
||||
@@ -1988,19 +1987,11 @@ selection_paint (ClutterText *self,
|
||||
else
|
||||
color = &priv->text_color;
|
||||
|
||||
cogl_color_init_from_4ub (&cogl_color,
|
||||
color->red,
|
||||
color->green,
|
||||
color->blue,
|
||||
paint_opacity * color->alpha / 255);
|
||||
cogl_color_premultiply (&cogl_color);
|
||||
cogl_pipeline_set_color (color_pipeline, &cogl_color);
|
||||
|
||||
clutter_text_foreach_selection_rectangle_prescaled (self,
|
||||
add_selection_rectangle_to_path,
|
||||
selection_path);
|
||||
|
||||
cogl_framebuffer_fill_path (fb, color_pipeline, selection_path);
|
||||
cogl_path_fill (selection_path);
|
||||
|
||||
/* Paint selected text */
|
||||
cogl_framebuffer_push_path_clip (fb, selection_path);
|
||||
|
@@ -32,7 +32,6 @@
|
||||
|
||||
#include "clutter-build-config.h"
|
||||
|
||||
#include <fribidi.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "clutter-debug.h"
|
||||
@@ -106,9 +105,8 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
|
||||
ClutterRect *dest)
|
||||
void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
|
||||
ClutterRect *dest)
|
||||
{
|
||||
*dest = (ClutterRect) {
|
||||
.origin = {
|
||||
@@ -122,9 +120,8 @@ _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_util_rectangle_int_extents (const ClutterRect *src,
|
||||
cairo_rectangle_int_t *dest)
|
||||
void _clutter_util_rectangle_int_extents (const ClutterRect *src,
|
||||
cairo_rectangle_int_t *dest)
|
||||
{
|
||||
ClutterRect tmp = *src;
|
||||
|
||||
@@ -138,11 +135,10 @@ _clutter_util_rectangle_int_extents (const ClutterRect *src,
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
_clutter_util_rectangle_offset (const cairo_rectangle_int_t *src,
|
||||
int x,
|
||||
int y,
|
||||
cairo_rectangle_int_t *dest)
|
||||
void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src,
|
||||
int x,
|
||||
int y,
|
||||
cairo_rectangle_int_t *dest)
|
||||
{
|
||||
*dest = *src;
|
||||
|
||||
@@ -700,45 +696,3 @@ clutter_interval_register_progress_func (GType value_type,
|
||||
|
||||
G_UNLOCK (progress_funcs);
|
||||
}
|
||||
|
||||
PangoDirection
|
||||
_clutter_pango_unichar_direction (gunichar ch)
|
||||
{
|
||||
FriBidiCharType fribidi_ch_type;
|
||||
|
||||
G_STATIC_ASSERT (sizeof (FriBidiChar) == sizeof (gunichar));
|
||||
|
||||
fribidi_ch_type = fribidi_get_bidi_type (ch);
|
||||
|
||||
if (!FRIBIDI_IS_STRONG (fribidi_ch_type))
|
||||
return PANGO_DIRECTION_NEUTRAL;
|
||||
else if (FRIBIDI_IS_RTL (fribidi_ch_type))
|
||||
return PANGO_DIRECTION_RTL;
|
||||
else
|
||||
return PANGO_DIRECTION_LTR;
|
||||
}
|
||||
|
||||
PangoDirection
|
||||
_clutter_pango_find_base_dir (const gchar *text,
|
||||
gint length)
|
||||
{
|
||||
PangoDirection dir = PANGO_DIRECTION_NEUTRAL;
|
||||
const gchar *p;
|
||||
|
||||
g_return_val_if_fail (text != NULL || length == 0, PANGO_DIRECTION_NEUTRAL);
|
||||
|
||||
p = text;
|
||||
while ((length < 0 || p < text + length) && *p)
|
||||
{
|
||||
gunichar wc = g_utf8_get_char (p);
|
||||
|
||||
dir = _clutter_pango_unichar_direction (wc);
|
||||
|
||||
if (dir != PANGO_DIRECTION_NEUTRAL)
|
||||
break;
|
||||
|
||||
p = g_utf8_next_char (p);
|
||||
}
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
@@ -77,10 +77,6 @@ enum
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static void
|
||||
clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window,
|
||||
gint sync_delay);
|
||||
|
||||
static void
|
||||
clutter_stage_cogl_unrealize (ClutterStageWindow *stage_window)
|
||||
{
|
||||
@@ -126,16 +122,6 @@ _clutter_stage_cogl_presented (ClutterStageCogl *stage_cogl,
|
||||
}
|
||||
|
||||
_clutter_stage_presented (stage_cogl->wrapper, frame_event, frame_info);
|
||||
|
||||
if (frame_event == COGL_FRAME_EVENT_COMPLETE &&
|
||||
stage_cogl->update_time != -1)
|
||||
{
|
||||
ClutterStageWindow *stage_window = CLUTTER_STAGE_WINDOW (stage_cogl);
|
||||
|
||||
stage_cogl->update_time = -1;
|
||||
clutter_stage_cogl_schedule_update (stage_window,
|
||||
stage_cogl->last_sync_delay);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -166,15 +152,10 @@ clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window,
|
||||
gint64 now;
|
||||
float refresh_rate;
|
||||
gint64 refresh_interval;
|
||||
int64_t min_render_time_allowed;
|
||||
int64_t max_render_time_allowed;
|
||||
int64_t next_presentation_time;
|
||||
|
||||
if (stage_cogl->update_time != -1)
|
||||
return;
|
||||
|
||||
stage_cogl->last_sync_delay = sync_delay;
|
||||
|
||||
now = g_get_monotonic_time ();
|
||||
|
||||
if (sync_delay < 0)
|
||||
@@ -203,18 +184,10 @@ clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window,
|
||||
if (refresh_interval == 0)
|
||||
refresh_interval = 16667; /* 1/60th second */
|
||||
|
||||
min_render_time_allowed = refresh_interval / 2;
|
||||
max_render_time_allowed = refresh_interval - 1000 * sync_delay;
|
||||
stage_cogl->update_time = stage_cogl->last_presentation_time + 1000 * sync_delay;
|
||||
|
||||
if (min_render_time_allowed > max_render_time_allowed)
|
||||
min_render_time_allowed = max_render_time_allowed;
|
||||
|
||||
next_presentation_time = stage_cogl->last_presentation_time + refresh_interval;
|
||||
|
||||
while (next_presentation_time < now + min_render_time_allowed)
|
||||
next_presentation_time += refresh_interval;
|
||||
|
||||
stage_cogl->update_time = next_presentation_time - max_render_time_allowed;
|
||||
while (stage_cogl->update_time < now)
|
||||
stage_cogl->update_time += refresh_interval;
|
||||
}
|
||||
|
||||
static gint64
|
||||
@@ -300,7 +273,7 @@ clutter_stage_cogl_ignoring_redraw_clips (ClutterStageWindow *stage_window)
|
||||
}
|
||||
|
||||
/* A redraw clip represents (in stage coordinates) the bounding box of
|
||||
* something that needs to be redrawn. Typically they are added to the
|
||||
* something that needs to be redraw. Typically they are added to the
|
||||
* StageWindow as a result of clutter_actor_queue_clipped_redraw() by
|
||||
* actors such as ClutterGLXTexturePixmap. All redraw clips are
|
||||
* discarded after the next paint.
|
||||
@@ -529,8 +502,8 @@ fill_current_damage_history_and_step (ClutterStageView *view)
|
||||
*current_fb_damage = (cairo_rectangle_int_t) {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = ceilf (view_rect.width * fb_scale),
|
||||
.height = ceilf (view_rect.height * fb_scale)
|
||||
.width = view_rect.width * fb_scale,
|
||||
.height = view_rect.height * fb_scale
|
||||
};
|
||||
view_priv->damage_index++;
|
||||
}
|
||||
|
@@ -59,8 +59,6 @@ struct _ClutterStageCogl
|
||||
* junk frames to start with. */
|
||||
unsigned int frame_count;
|
||||
|
||||
gint last_sync_delay;
|
||||
|
||||
cairo_rectangle_int_t bounding_redraw_clip;
|
||||
|
||||
guint initialized_redraw_clip : 1;
|
||||
|
@@ -250,8 +250,7 @@ get_direction (XkbDescPtr xkb,
|
||||
{
|
||||
int level = 0;
|
||||
KeySym sym = XkbKeySymEntry (xkb, code, level, group);
|
||||
PangoDirection dir =
|
||||
_clutter_pango_unichar_direction (clutter_keysym_to_unicode (sym));
|
||||
PangoDirection dir = pango_unichar_direction (clutter_keysym_to_unicode (sym));
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
|
@@ -38,7 +38,6 @@ clutter_pkg_deps = [
|
||||
]
|
||||
|
||||
clutter_pkg_private_deps = [
|
||||
fribidi_dep,
|
||||
gdk_pixbuf_dep,
|
||||
gthread_dep,
|
||||
gmodule_no_export_dep,
|
||||
|
@@ -114,12 +114,12 @@ test_destroy_destroy (ClutterActor *self)
|
||||
test->tex = NULL;
|
||||
}
|
||||
|
||||
g_assert_nonnull (test->children);
|
||||
g_list_foreach (test->children, (GFunc) clutter_actor_destroy, NULL);
|
||||
g_list_free (test->children);
|
||||
test->children = NULL;
|
||||
|
||||
if (CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy)
|
||||
CLUTTER_ACTOR_CLASS (test_destroy_parent_class)->destroy (self);
|
||||
|
||||
g_assert_null (test->children);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -38,7 +38,8 @@ timeline_data_init (TimelineData *data, int timeline_num)
|
||||
static void
|
||||
timeline_data_destroy (TimelineData *data)
|
||||
{
|
||||
g_slist_free_full (data->markers_hit, g_free);
|
||||
g_slist_foreach (data->markers_hit, (GFunc) g_free, NULL);
|
||||
g_slist_free (data->markers_hit);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -483,8 +483,8 @@ _cogl_pango_display_list_node_free (CoglPangoDisplayListNode *node)
|
||||
void
|
||||
_cogl_pango_display_list_clear (CoglPangoDisplayList *dl)
|
||||
{
|
||||
g_slist_free_full (dl->nodes, (GDestroyNotify)
|
||||
_cogl_pango_display_list_node_free);
|
||||
g_slist_foreach (dl->nodes, (GFunc) _cogl_pango_display_list_node_free, NULL);
|
||||
g_slist_free (dl->nodes);
|
||||
dl->nodes = NULL;
|
||||
dl->last_node = NULL;
|
||||
}
|
||||
|
@@ -460,7 +460,9 @@ cogl_path_fill (CoglPath *path);
|
||||
* use while filling a path.</note>
|
||||
*
|
||||
* Stability: unstable
|
||||
* Deprecated: 1.16: Use cogl_path_fill() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_path_fill)
|
||||
void
|
||||
cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
@@ -490,7 +492,9 @@ cogl_path_stroke (CoglPath *path);
|
||||
* regardless of the current transformation matrix.
|
||||
*
|
||||
* Stability: unstable
|
||||
* Deprecated: 1.16: Use cogl_path_stroke() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_path_stroke)
|
||||
void
|
||||
cogl_framebuffer_stroke_path (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
@@ -525,7 +529,9 @@ cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
|
||||
*
|
||||
* Since: 1.8
|
||||
* Stability: Unstable
|
||||
* Deprecated: 1.16: Use cogl_framebuffer_push_path_clip() instead
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_framebuffer_push_path_clip)
|
||||
void
|
||||
cogl_clip_push_from_path (CoglPath *path);
|
||||
|
||||
|
@@ -1504,6 +1504,7 @@ cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
|
||||
COGL_FRAMEBUFFER_STATE_CLIP;
|
||||
}
|
||||
|
||||
/* XXX: deprecated */
|
||||
void
|
||||
cogl_clip_push_from_path (CoglPath *path)
|
||||
{
|
||||
@@ -1574,6 +1575,7 @@ _cogl_path_build_stroke_attribute_buffer (CoglPath *path)
|
||||
data->stroke_n_attributes = n_attributes;
|
||||
}
|
||||
|
||||
/* XXX: deprecated */
|
||||
void
|
||||
cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
@@ -1586,6 +1588,7 @@ cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
|
||||
_cogl_path_fill_nodes (path, framebuffer, pipeline, 0 /* flags */);
|
||||
}
|
||||
|
||||
/* XXX: deprecated */
|
||||
void
|
||||
cogl_framebuffer_stroke_path (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
|
@@ -43,7 +43,6 @@ typedef struct _CoglBitmap CoglBitmap;
|
||||
#include <cogl/cogl-buffer.h>
|
||||
#include <cogl/cogl-context.h>
|
||||
#include <cogl/cogl-pixel-buffer.h>
|
||||
#include <cogl/cogl-pixel-format.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
|
@@ -31,7 +31,7 @@
|
||||
#ifndef __COGL_MUTTER_H___
|
||||
#define __COGL_MUTTER_H___
|
||||
|
||||
#include "cogl-config.h"
|
||||
#include "cogl-mutter-config.h"
|
||||
#include "cogl-defines.h"
|
||||
|
||||
#include <cogl/cogl-texture.h>
|
||||
|
@@ -452,8 +452,15 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
|
||||
_cogl_bitmask_destroy (&uniforms_state->changed_mask);
|
||||
}
|
||||
|
||||
if (pipeline->differences & COGL_PIPELINE_STATE_NEEDS_BIG_STATE)
|
||||
g_slice_free (CoglPipelineBigState, pipeline->big_state);
|
||||
|
||||
if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS)
|
||||
g_list_free_full (pipeline->layer_differences, cogl_object_unref);
|
||||
{
|
||||
g_list_foreach (pipeline->layer_differences,
|
||||
(GFunc)cogl_object_unref, NULL);
|
||||
g_list_free (pipeline->layer_differences);
|
||||
}
|
||||
|
||||
if (pipeline->differences & COGL_PIPELINE_STATE_VERTEX_SNIPPETS)
|
||||
_cogl_pipeline_snippet_list_free (&pipeline->big_state->vertex_snippets);
|
||||
@@ -461,9 +468,6 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
|
||||
if (pipeline->differences & COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS)
|
||||
_cogl_pipeline_snippet_list_free (&pipeline->big_state->fragment_snippets);
|
||||
|
||||
if (pipeline->differences & COGL_PIPELINE_STATE_NEEDS_BIG_STATE)
|
||||
g_slice_free (CoglPipelineBigState, pipeline->big_state);
|
||||
|
||||
g_list_free (pipeline->deprecated_get_layers_list);
|
||||
|
||||
recursively_free_layer_caches (pipeline);
|
||||
@@ -933,7 +937,12 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
|
||||
|
||||
if (dest->differences & COGL_PIPELINE_STATE_LAYERS &&
|
||||
dest->layer_differences)
|
||||
g_list_free_full (dest->layer_differences, cogl_object_unref);
|
||||
{
|
||||
g_list_foreach (dest->layer_differences,
|
||||
(GFunc)cogl_object_unref,
|
||||
NULL);
|
||||
g_list_free (dest->layer_differences);
|
||||
}
|
||||
|
||||
for (l = src->layer_differences; l; l = l->next)
|
||||
{
|
||||
|
@@ -1,374 +0,0 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2007,2008,2009,2010 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "cogl-config.h"
|
||||
#include "cogl-defines.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "cogl-pixel-format.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) */
|
||||
} CoglPixelFormatInfo;
|
||||
|
||||
static const CoglPixelFormatInfo format_info_table[] = {
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_ANY,
|
||||
.format_str = "ANY",
|
||||
.bpp = 0,
|
||||
.aligned = -1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_A_8,
|
||||
.format_str = "A_8",
|
||||
.bpp = 1,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_RGB_565,
|
||||
.format_str = "RGB_565",
|
||||
.bpp = 2,
|
||||
.aligned = 0
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_RGBA_4444,
|
||||
.format_str = "RGBA_4444",
|
||||
.bpp = 2,
|
||||
.aligned = 0
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_RGBA_5551,
|
||||
.format_str = "RGBA_5551",
|
||||
.bpp = 2,
|
||||
.aligned = 0
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_YUV,
|
||||
.format_str = "YUV",
|
||||
.bpp = 0,
|
||||
.aligned = -1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_G_8,
|
||||
.format_str = "G_8",
|
||||
.bpp = 1,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_RG_88,
|
||||
.format_str = "RG_88",
|
||||
.bpp = 2,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_RGB_888,
|
||||
.format_str = "RGB_888",
|
||||
.bpp = 3,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_BGR_888,
|
||||
.format_str = "BGR_888",
|
||||
.bpp = 3,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_RGBA_8888,
|
||||
.format_str = "RGBA_8888",
|
||||
.bpp = 4,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_BGRA_8888,
|
||||
.format_str = "BGRA_8888",
|
||||
.bpp = 4,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_ARGB_8888,
|
||||
.format_str = "ARGB_8888",
|
||||
.bpp = 4,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_ABGR_8888,
|
||||
.format_str = "ABGR_8888",
|
||||
.bpp = 4,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_RGBA_1010102,
|
||||
.format_str = "RGBA_1010102",
|
||||
.bpp = 4,
|
||||
.aligned = 0
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_BGRA_1010102,
|
||||
.format_str = "BGRA_1010102",
|
||||
.bpp = 4,
|
||||
.aligned = 0
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010,
|
||||
.format_str = "ARGB_2101010",
|
||||
.bpp = 4,
|
||||
.aligned = 0
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_ABGR_2101010,
|
||||
.format_str = "ABGR_2101010",
|
||||
.bpp = 4,
|
||||
.aligned = 0
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE,
|
||||
.format_str = "RGBA_8888_PRE",
|
||||
.bpp = 4,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_BGRA_8888_PRE,
|
||||
.format_str = "BGRA_8888_PRE",
|
||||
.bpp = 4,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_ARGB_8888_PRE,
|
||||
.format_str = "ARGB_8888_PRE",
|
||||
.bpp = 4,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_ABGR_8888_PRE,
|
||||
.format_str = "ABGR_8888_PRE",
|
||||
.bpp = 4,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_RGBA_4444_PRE,
|
||||
.format_str = "RGBA_4444_PRE",
|
||||
.bpp = 2,
|
||||
.aligned = 0
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_RGBA_5551_PRE,
|
||||
.format_str = "RGBA_5551_PRE",
|
||||
.bpp = 2,
|
||||
.aligned = 0
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_RGBA_1010102_PRE,
|
||||
.format_str = "RGBA_1010102_PRE",
|
||||
.bpp = 4,
|
||||
.aligned = 0
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_BGRA_1010102_PRE,
|
||||
.format_str = "BGRA_1010102_PRE",
|
||||
.bpp = 4,
|
||||
.aligned = 0
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010_PRE,
|
||||
.format_str = "ARGB_2101010_PRE",
|
||||
.bpp = 4,
|
||||
.aligned = 0
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_ABGR_2101010_PRE,
|
||||
.format_str = "ABGR_2101010_PRE",
|
||||
.bpp = 4,
|
||||
.aligned = 0
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_DEPTH_16,
|
||||
.format_str = "DEPTH_16",
|
||||
.bpp = 2,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_DEPTH_32,
|
||||
.format_str = "DEPTH_32",
|
||||
.bpp = 4,
|
||||
.aligned = 1
|
||||
},
|
||||
{
|
||||
.cogl_format = COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8,
|
||||
.format_str = "DEPTH_24_STENCIL_8",
|
||||
.bpp = 4,
|
||||
.aligned = 1
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* Returns the number of bytes-per-pixel of a given format. The bpp
|
||||
* can be extracted from the least significant nibble of the pixel
|
||||
* format (see CoglPixelFormat).
|
||||
*
|
||||
* The mapping is the following (see discussion on bug #660188):
|
||||
*
|
||||
* 0 = undefined
|
||||
* 1, 8 = 1 bpp (e.g. A_8, G_8)
|
||||
* 2 = 3 bpp, aligned (e.g. 888)
|
||||
* 3 = 4 bpp, aligned (e.g. 8888)
|
||||
* 4-6 = 2 bpp, not aligned (e.g. 565, 4444, 5551)
|
||||
* 7 = undefined yuv
|
||||
* 9 = 2 bpp, aligned
|
||||
* 10 = undefined
|
||||
* 11 = undefined
|
||||
* 12 = 3 bpp, not aligned
|
||||
* 13 = 4 bpp, not aligned (e.g. 2101010)
|
||||
* 14-15 = undefined
|
||||
*/
|
||||
int
|
||||
_cogl_pixel_format_get_bytes_per_pixel (CoglPixelFormat format)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
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_assert_not_reached ();
|
||||
}
|
||||
|
||||
/* Note: this also refers to the mapping defined above for
|
||||
* _cogl_pixel_format_get_bytes_per_pixel() */
|
||||
gboolean
|
||||
_cogl_pixel_format_is_endian_dependant (CoglPixelFormat format)
|
||||
{
|
||||
int aligned = -1;
|
||||
size_t i;
|
||||
|
||||
/* NB: currently checking whether the format components are aligned
|
||||
* or not determines whether the format is endian dependent or not.
|
||||
* In the future though we might consider adding formats with
|
||||
* aligned components that are also endian independant. */
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (format_info_table); i++)
|
||||
{
|
||||
if (format_info_table[i].cogl_format == format)
|
||||
{
|
||||
aligned = format_info_table[i].aligned;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_return_val_if_fail (aligned != -1, FALSE);
|
||||
|
||||
return aligned;
|
||||
}
|
||||
|
||||
const char *
|
||||
cogl_pixel_format_to_string (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].format_str;
|
||||
}
|
||||
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
#ifdef COGL_HAS_LIBDRM
|
||||
|
||||
typedef struct _PixelFormatMap {
|
||||
uint32_t drm_format;
|
||||
CoglPixelFormat cogl_format;
|
||||
CoglTextureComponents cogl_components;
|
||||
} PixelFormatMap;
|
||||
|
||||
static const PixelFormatMap pixel_format_map[] = {
|
||||
/* DRM formats are defined as little-endian, not machine endian. */
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
{ DRM_FORMAT_RGB565, COGL_PIXEL_FORMAT_RGB_565, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_ABGR8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_XBGR8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_ARGB8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_XRGB8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_BGRA8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_BGRX8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
#elif G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
/* DRM_FORMAT_RGB565 cannot be expressed. */
|
||||
{ DRM_FORMAT_ABGR8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_XBGR8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_ARGB8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_XRGB8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_BGRA8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_BGRX8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
#else
|
||||
#error "unexpected G_BYTE_ORDER"
|
||||
#endif
|
||||
};
|
||||
|
||||
gboolean
|
||||
cogl_pixel_format_from_drm_format (uint32_t drm_format,
|
||||
CoglPixelFormat *out_format,
|
||||
CoglTextureComponents *out_components)
|
||||
{
|
||||
const size_t n = G_N_ELEMENTS (pixel_format_map);
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
if (pixel_format_map[i].drm_format == drm_format)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == n)
|
||||
return FALSE;
|
||||
|
||||
if (out_format)
|
||||
*out_format = pixel_format_map[i].cogl_format;
|
||||
|
||||
if (out_components)
|
||||
*out_components = pixel_format_map[i].cogl_components;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,335 +0,0 @@
|
||||
/*
|
||||
* Cogl
|
||||
*
|
||||
* A Low Level GPU Graphics and Utilities API
|
||||
*
|
||||
* Copyright (C) 2008,2009 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
|
||||
#error "Only <cogl/cogl.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __COGL_PIXEL_FORMAT_H__
|
||||
#define __COGL_PIXEL_FORMAT_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef COGL_HAS_LIBDRM
|
||||
#include <drm_fourcc.h>
|
||||
#endif
|
||||
|
||||
#include <cogl/cogl-defines.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* SECTION:cogl-pixel-format
|
||||
* @short_description: Pixel formats supported by Cogl
|
||||
*
|
||||
* The pixel format of an image descrbes how the bits of each pixel are
|
||||
* represented in memory. For example: an image can be laid out as one long
|
||||
* sequence of pixels, where each pixel is a sequence of 8 bits of Red, Green
|
||||
* and Blue. The amount of bits that are used can be different for each pixel
|
||||
* format, as well as the components (for example an Alpha layer to include
|
||||
* transparency, or non_RGBA).
|
||||
*
|
||||
* Other examples of factors that can influence the layout in memory are the
|
||||
* system's endianness.
|
||||
*
|
||||
* This file also contains methods to map Linux DRM 4CC codes to
|
||||
* CoglPixelFormats.
|
||||
*/
|
||||
|
||||
#define COGL_A_BIT (1 << 4)
|
||||
#define COGL_BGR_BIT (1 << 5)
|
||||
#define COGL_AFIRST_BIT (1 << 6)
|
||||
#define COGL_PREMULT_BIT (1 << 7)
|
||||
#define COGL_DEPTH_BIT (1 << 8)
|
||||
#define COGL_STENCIL_BIT (1 << 9)
|
||||
|
||||
/* XXX: Notes to those adding new formats here...
|
||||
*
|
||||
* First this diagram outlines how we allocate the 32bits of a
|
||||
* CoglPixelFormat currently...
|
||||
*
|
||||
* 6 bits for flags
|
||||
* |-----|
|
||||
* enum unused 4 bits for the bytes-per-pixel
|
||||
* and component alignment info
|
||||
* |------| |-------------| |--|
|
||||
* 00000000 xxxxxxxx xxxxxxSD PFBA0000
|
||||
* ^ stencil
|
||||
* ^ depth
|
||||
* ^ premult
|
||||
* ^ alpha first
|
||||
* ^ bgr order
|
||||
* ^ has alpha
|
||||
*
|
||||
* The most awkward part about the formats is how we use the last 4
|
||||
* bits to encode the bytes per pixel and component alignment
|
||||
* information. Ideally we should have had 3 bits for the bpp and a
|
||||
* flag for alignment but we didn't plan for that in advance so we
|
||||
* instead use a small lookup table to query the bpp and whether the
|
||||
* components are byte aligned or not.
|
||||
*
|
||||
* 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 = YUV: undefined bpp, undefined alignment
|
||||
* 9 = 2 bpp, aligned
|
||||
* 10 = depth, aligned (8, 16, 24, 32, 32f)
|
||||
* 11 = undefined
|
||||
* 12 = 3 bpp, not aligned
|
||||
* 13 = 4 bpp, not aligned (e.g. 2101010)
|
||||
* 14-15 = undefined
|
||||
*
|
||||
* Note: the gap at 10-11 is just because we wanted to maintain that
|
||||
* all non-aligned formats have the third bit set in case that's
|
||||
* useful later.
|
||||
*
|
||||
* Since we don't want to waste bits adding more and more flags, we'd
|
||||
* like to see most new pixel formats that can't be represented
|
||||
* uniquely with the existing flags in the least significant byte
|
||||
* simply be enumerated with sequential values in the most significant
|
||||
* enum byte.
|
||||
*
|
||||
* Note: Cogl avoids exposing any padded XRGB or RGBX formats and
|
||||
* instead we leave it up to applications to decided whether they
|
||||
* consider the A component as padding or valid data. We shouldn't
|
||||
* change this policy without good reasoning.
|
||||
*
|
||||
* So to add a new format:
|
||||
* 1) Use the mapping table above to figure out what to but in
|
||||
* the lowest nibble.
|
||||
* 2) OR in the COGL_PREMULT_BIT, COGL_AFIRST_BIT, COGL_A_BIT and
|
||||
* COGL_BGR_BIT flags as appropriate.
|
||||
* 3) If the result is not yet unique then also combine with an
|
||||
* increment of the last sequence number in the most significant
|
||||
* byte.
|
||||
*
|
||||
* The last sequence number used was 0 (i.e. no formats currently need
|
||||
* a sequence number)
|
||||
* Update this note whenever a new sequence number is used.
|
||||
*/
|
||||
/**
|
||||
* CoglPixelFormat:
|
||||
* @COGL_PIXEL_FORMAT_ANY: Any format
|
||||
* @COGL_PIXEL_FORMAT_A_8: 8 bits alpha mask
|
||||
* @COGL_PIXEL_FORMAT_RG_88: RG, 16 bits. Note that red-green textures
|
||||
* are only available if %COGL_FEATURE_ID_TEXTURE_RG is advertised.
|
||||
* See cogl_texture_set_components() for details.
|
||||
* @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_RGB_888: RGB, 24 bits
|
||||
* @COGL_PIXEL_FORMAT_BGR_888: BGR, 24 bits
|
||||
* @COGL_PIXEL_FORMAT_RGBA_8888: RGBA, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_BGRA_8888: BGRA, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_ARGB_8888: ARGB, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_ABGR_8888: ABGR, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_RGBA_1010102 : RGBA, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_BGRA_1010102 : BGRA, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_ARGB_2101010 : ARGB, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_ABGR_2101010 : ABGR, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_RGBA_8888_PRE: Premultiplied RGBA, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_BGRA_8888_PRE: Premultiplied BGRA, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_ARGB_8888_PRE: Premultiplied ARGB, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_ABGR_8888_PRE: Premultiplied ABGR, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_RGBA_4444_PRE: Premultiplied RGBA, 16 bits
|
||||
* @COGL_PIXEL_FORMAT_RGBA_5551_PRE: Premultiplied RGBA, 16 bits
|
||||
* @COGL_PIXEL_FORMAT_RGBA_1010102_PRE: Premultiplied RGBA, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_BGRA_1010102_PRE: Premultiplied BGRA, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_ARGB_2101010_PRE: Premultiplied ARGB, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_ABGR_2101010_PRE: Premultiplied ABGR, 32 bits, 10 bpc
|
||||
*
|
||||
* Pixel formats used by Cogl. For the formats with a byte per
|
||||
* component, the order of the components specify the order in
|
||||
* increasing memory addresses. So for example
|
||||
* %COGL_PIXEL_FORMAT_RGB_888 would have the red component in the
|
||||
* lowest address, green in the next address and blue after that
|
||||
* regardless of the endianness of the system.
|
||||
*
|
||||
* For the formats with non byte aligned components the component
|
||||
* order specifies the order within a 16-bit or 32-bit number from
|
||||
* most significant bit to least significant. So for
|
||||
* %COGL_PIXEL_FORMAT_RGB_565, the red component would be in bits
|
||||
* 11-15, the green component would be in 6-11 and the blue component
|
||||
* would be in 1-5. Therefore the order in memory depends on the
|
||||
* endianness of the system.
|
||||
*
|
||||
* When uploading a texture %COGL_PIXEL_FORMAT_ANY can be used as the
|
||||
* internal format. Cogl will try to pick the best format to use
|
||||
* internally and convert the texture data if necessary.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
|
||||
{
|
||||
COGL_PIXEL_FORMAT_ANY = 0,
|
||||
COGL_PIXEL_FORMAT_A_8 = 1 | COGL_A_BIT,
|
||||
|
||||
COGL_PIXEL_FORMAT_RGB_565 = 4,
|
||||
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_RG_88 = 9,
|
||||
|
||||
COGL_PIXEL_FORMAT_RGB_888 = 2,
|
||||
COGL_PIXEL_FORMAT_BGR_888 = (2 | COGL_BGR_BIT),
|
||||
|
||||
COGL_PIXEL_FORMAT_RGBA_8888 = (3 | COGL_A_BIT),
|
||||
COGL_PIXEL_FORMAT_BGRA_8888 = (3 | COGL_A_BIT | COGL_BGR_BIT),
|
||||
COGL_PIXEL_FORMAT_ARGB_8888 = (3 | COGL_A_BIT | COGL_AFIRST_BIT),
|
||||
COGL_PIXEL_FORMAT_ABGR_8888 = (3 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
|
||||
|
||||
COGL_PIXEL_FORMAT_RGBA_1010102 = (13 | COGL_A_BIT),
|
||||
COGL_PIXEL_FORMAT_BGRA_1010102 = (13 | COGL_A_BIT | COGL_BGR_BIT),
|
||||
COGL_PIXEL_FORMAT_ARGB_2101010 = (13 | COGL_A_BIT | COGL_AFIRST_BIT),
|
||||
COGL_PIXEL_FORMAT_ABGR_2101010 = (13 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
|
||||
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT),
|
||||
COGL_PIXEL_FORMAT_BGRA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT),
|
||||
COGL_PIXEL_FORMAT_ARGB_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_AFIRST_BIT),
|
||||
COGL_PIXEL_FORMAT_ABGR_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
|
||||
COGL_PIXEL_FORMAT_RGBA_4444_PRE = (COGL_PIXEL_FORMAT_RGBA_4444 | COGL_A_BIT | COGL_PREMULT_BIT),
|
||||
COGL_PIXEL_FORMAT_RGBA_5551_PRE = (COGL_PIXEL_FORMAT_RGBA_5551 | COGL_A_BIT | COGL_PREMULT_BIT),
|
||||
|
||||
COGL_PIXEL_FORMAT_RGBA_1010102_PRE = (COGL_PIXEL_FORMAT_RGBA_1010102 | COGL_PREMULT_BIT),
|
||||
COGL_PIXEL_FORMAT_BGRA_1010102_PRE = (COGL_PIXEL_FORMAT_BGRA_1010102 | COGL_PREMULT_BIT),
|
||||
COGL_PIXEL_FORMAT_ARGB_2101010_PRE = (COGL_PIXEL_FORMAT_ARGB_2101010 | COGL_PREMULT_BIT),
|
||||
COGL_PIXEL_FORMAT_ABGR_2101010_PRE = (COGL_PIXEL_FORMAT_ABGR_2101010 | COGL_PREMULT_BIT),
|
||||
|
||||
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)
|
||||
} CoglPixelFormat;
|
||||
|
||||
/*
|
||||
* _cogl_pixel_format_get_bytes_per_pixel:
|
||||
* @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.
|
||||
*/
|
||||
int
|
||||
_cogl_pixel_format_get_bytes_per_pixel (CoglPixelFormat format);
|
||||
|
||||
/*
|
||||
* _cogl_pixel_format_has_aligned_components:
|
||||
* @format: a #CoglPixelFormat
|
||||
*
|
||||
* Queries whether the ordering of the components for the given
|
||||
* @format depend on the endianness of the host CPU or if the
|
||||
* components can be accessed using bit shifting and bitmasking by
|
||||
* loading a whole pixel into a word.
|
||||
*
|
||||
* XXX: If we ever consider making something like this public we
|
||||
* should really try to think of a better name and come up with
|
||||
* much clearer documentation since it really depends on what
|
||||
* point of view you consider this from whether a format like
|
||||
* COGL_PIXEL_FORMAT_RGBA_8888 is endian dependent. E.g. If you
|
||||
* read an RGBA_8888 pixel into a uint32
|
||||
* it's endian dependent how you mask out the different channels.
|
||||
* But If you already have separate color components and you want
|
||||
* to write them to an RGBA_8888 pixel then the bytes can be
|
||||
* written sequentially regardless of the endianness.
|
||||
*
|
||||
* Return value: %TRUE if you need to consider the host CPU
|
||||
* endianness when dealing with the given @format
|
||||
* else %FALSE.
|
||||
*/
|
||||
gboolean
|
||||
_cogl_pixel_format_is_endian_dependant (CoglPixelFormat format);
|
||||
|
||||
/*
|
||||
* COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT(format):
|
||||
* @format: a #CoglPixelFormat
|
||||
*
|
||||
* Returns TRUE if the pixel format can take a premult bit. This is
|
||||
* currently true for all formats that have an alpha channel except
|
||||
* COGL_PIXEL_FORMAT_A_8 (because that doesn't have any other
|
||||
* components to multiply by the alpha).
|
||||
*/
|
||||
#define COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT(format) \
|
||||
(((format) & COGL_A_BIT) && (format) != COGL_PIXEL_FORMAT_A_8)
|
||||
|
||||
/**
|
||||
* cogl_pixel_format_to_string:
|
||||
* @format: a #CoglPixelFormat
|
||||
*
|
||||
* Returns a string representation of @format, useful for debugging purposes.
|
||||
*
|
||||
* Returns: (transfer none): A string representation of @format.
|
||||
*/
|
||||
const char *
|
||||
cogl_pixel_format_to_string (CoglPixelFormat format);
|
||||
|
||||
#ifdef COGL_HAS_LIBDRM
|
||||
|
||||
/* added in libdrm 2.4.95 */
|
||||
#ifndef DRM_FORMAT_INVALID
|
||||
#define DRM_FORMAT_INVALID 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* cogl_pixel_format_from_drm_format:
|
||||
* @drm_format: The DRM 4CC code (as specified in drm_fourcc.h)
|
||||
* @out_format: (optional): The corresponding #CoglPixelFormat (if successful)
|
||||
* @out_components: (optional): The corresponding #CoglTextureComponents (if
|
||||
* sucessful)
|
||||
*
|
||||
* Does an internal lookup to find a #CoglPixelFormat that matches the given
|
||||
* DRM 4CC code. If no such format could be found, this function will return
|
||||
* %FALSE and the output parameters will stay untouched.
|
||||
*
|
||||
* Returns: %TRUE if a #CoglPixelFormat corresponding to the 4CC code exists,
|
||||
* %FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
cogl_pixel_format_from_drm_format (uint32_t drm_format,
|
||||
CoglPixelFormat *out_format,
|
||||
CoglTextureComponents *out_components);
|
||||
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_PIXEL_FORMAT_H__ */
|
@@ -116,6 +116,57 @@ _cogl_get_enable_legacy_state (void);
|
||||
#define _cogl_has_private_feature(ctx, feature) \
|
||||
COGL_FLAGS_GET ((ctx)->private_features, (feature))
|
||||
|
||||
/*
|
||||
* _cogl_pixel_format_get_bytes_per_pixel:
|
||||
* @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.
|
||||
*/
|
||||
int
|
||||
_cogl_pixel_format_get_bytes_per_pixel (CoglPixelFormat format);
|
||||
|
||||
/*
|
||||
* _cogl_pixel_format_has_aligned_components:
|
||||
* @format: a #CoglPixelFormat
|
||||
*
|
||||
* Queries whether the ordering of the components for the given
|
||||
* @format depend on the endianness of the host CPU or if the
|
||||
* components can be accessed using bit shifting and bitmasking by
|
||||
* loading a whole pixel into a word.
|
||||
*
|
||||
* XXX: If we ever consider making something like this public we
|
||||
* should really try to think of a better name and come up with
|
||||
* much clearer documentation since it really depends on what
|
||||
* point of view you consider this from whether a format like
|
||||
* COGL_PIXEL_FORMAT_RGBA_8888 is endian dependent. E.g. If you
|
||||
* read an RGBA_8888 pixel into a uint32
|
||||
* it's endian dependent how you mask out the different channels.
|
||||
* But If you already have separate color components and you want
|
||||
* to write them to an RGBA_8888 pixel then the bytes can be
|
||||
* written sequentially regardless of the endianness.
|
||||
*
|
||||
* Return value: %TRUE if you need to consider the host CPU
|
||||
* endianness when dealing with the given @format
|
||||
* else %FALSE.
|
||||
*/
|
||||
gboolean
|
||||
_cogl_pixel_format_is_endian_dependant (CoglPixelFormat format);
|
||||
|
||||
/*
|
||||
* COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT(format):
|
||||
* @format: a #CoglPixelFormat
|
||||
*
|
||||
* Returns TRUE if the pixel format can take a premult bit. This is
|
||||
* currently true for all formats that have an alpha channel except
|
||||
* COGL_PIXEL_FORMAT_A_8 (because that doesn't have any other
|
||||
* components to multiply by the alpha).
|
||||
*/
|
||||
#define COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT(format) \
|
||||
(((format) & COGL_A_BIT) && (format) != COGL_PIXEL_FORMAT_A_8)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_PRIVATE_H__ */
|
||||
|
@@ -194,8 +194,10 @@ _cogl_renderer_free (CoglRenderer *renderer)
|
||||
if (renderer->libgl_module)
|
||||
g_module_close (renderer->libgl_module);
|
||||
|
||||
g_slist_free_full (renderer->event_filters,
|
||||
(GDestroyNotify) native_filter_closure_free);
|
||||
g_slist_foreach (renderer->event_filters,
|
||||
(GFunc) native_filter_closure_free,
|
||||
NULL);
|
||||
g_slist_free (renderer->event_filters);
|
||||
|
||||
g_array_free (renderer->poll_fds, TRUE);
|
||||
|
||||
|
@@ -53,7 +53,6 @@ typedef struct _CoglTexture CoglTexture;
|
||||
#include <cogl/cogl-macros.h>
|
||||
#include <cogl/cogl-defines.h>
|
||||
#include <cogl/cogl-pixel-buffer.h>
|
||||
#include <cogl/cogl-pixel-format.h>
|
||||
#include <cogl/cogl-bitmap.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
@@ -147,6 +147,172 @@ typedef struct _CoglTextureVertex CoglTextureVertex;
|
||||
#define COGL_DEPTH_BIT (1 << 8)
|
||||
#define COGL_STENCIL_BIT (1 << 9)
|
||||
|
||||
/* XXX: Notes to those adding new formats here...
|
||||
*
|
||||
* First this diagram outlines how we allocate the 32bits of a
|
||||
* CoglPixelFormat currently...
|
||||
*
|
||||
* 6 bits for flags
|
||||
* |-----|
|
||||
* enum unused 4 bits for the bytes-per-pixel
|
||||
* and component alignment info
|
||||
* |------| |-------------| |--|
|
||||
* 00000000 xxxxxxxx xxxxxxSD PFBA0000
|
||||
* ^ stencil
|
||||
* ^ depth
|
||||
* ^ premult
|
||||
* ^ alpha first
|
||||
* ^ bgr order
|
||||
* ^ has alpha
|
||||
*
|
||||
* The most awkward part about the formats is how we use the last 4
|
||||
* bits to encode the bytes per pixel and component alignment
|
||||
* information. Ideally we should have had 3 bits for the bpp and a
|
||||
* flag for alignment but we didn't plan for that in advance so we
|
||||
* instead use a small lookup table to query the bpp and whether the
|
||||
* components are byte aligned or not.
|
||||
*
|
||||
* 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 = YUV: undefined bpp, undefined alignment
|
||||
* 9 = 2 bpp, aligned
|
||||
* 10 = depth, aligned (8, 16, 24, 32, 32f)
|
||||
* 11 = undefined
|
||||
* 12 = 3 bpp, not aligned
|
||||
* 13 = 4 bpp, not aligned (e.g. 2101010)
|
||||
* 14-15 = undefined
|
||||
*
|
||||
* Note: the gap at 10-11 is just because we wanted to maintain that
|
||||
* all non-aligned formats have the third bit set in case that's
|
||||
* useful later.
|
||||
*
|
||||
* Since we don't want to waste bits adding more and more flags, we'd
|
||||
* like to see most new pixel formats that can't be represented
|
||||
* uniquely with the existing flags in the least significant byte
|
||||
* simply be enumerated with sequential values in the most significant
|
||||
* enum byte.
|
||||
*
|
||||
* Note: Cogl avoids exposing any padded XRGB or RGBX formats and
|
||||
* instead we leave it up to applications to decided whether they
|
||||
* consider the A component as padding or valid data. We shouldn't
|
||||
* change this policy without good reasoning.
|
||||
*
|
||||
* So to add a new format:
|
||||
* 1) Use the mapping table above to figure out what to but in
|
||||
* the lowest nibble.
|
||||
* 2) OR in the COGL_PREMULT_BIT, COGL_AFIRST_BIT, COGL_A_BIT and
|
||||
* COGL_BGR_BIT flags as appropriate.
|
||||
* 3) If the result is not yet unique then also combine with an
|
||||
* increment of the last sequence number in the most significant
|
||||
* byte.
|
||||
*
|
||||
* The last sequence number used was 0 (i.e. no formats currently need
|
||||
* a sequence number)
|
||||
* Update this note whenever a new sequence number is used.
|
||||
*/
|
||||
/**
|
||||
* CoglPixelFormat:
|
||||
* @COGL_PIXEL_FORMAT_ANY: Any format
|
||||
* @COGL_PIXEL_FORMAT_A_8: 8 bits alpha mask
|
||||
* @COGL_PIXEL_FORMAT_RG_88: RG, 16 bits. Note that red-green textures
|
||||
* are only available if %COGL_FEATURE_ID_TEXTURE_RG is advertised.
|
||||
* See cogl_texture_set_components() for details.
|
||||
* @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_RGB_888: RGB, 24 bits
|
||||
* @COGL_PIXEL_FORMAT_BGR_888: BGR, 24 bits
|
||||
* @COGL_PIXEL_FORMAT_RGBA_8888: RGBA, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_BGRA_8888: BGRA, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_ARGB_8888: ARGB, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_ABGR_8888: ABGR, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_RGBA_1010102 : RGBA, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_BGRA_1010102 : BGRA, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_ARGB_2101010 : ARGB, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_ABGR_2101010 : ABGR, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_RGBA_8888_PRE: Premultiplied RGBA, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_BGRA_8888_PRE: Premultiplied BGRA, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_ARGB_8888_PRE: Premultiplied ARGB, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_ABGR_8888_PRE: Premultiplied ABGR, 32 bits
|
||||
* @COGL_PIXEL_FORMAT_RGBA_4444_PRE: Premultiplied RGBA, 16 bits
|
||||
* @COGL_PIXEL_FORMAT_RGBA_5551_PRE: Premultiplied RGBA, 16 bits
|
||||
* @COGL_PIXEL_FORMAT_RGBA_1010102_PRE: Premultiplied RGBA, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_BGRA_1010102_PRE: Premultiplied BGRA, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_ARGB_2101010_PRE: Premultiplied ARGB, 32 bits, 10 bpc
|
||||
* @COGL_PIXEL_FORMAT_ABGR_2101010_PRE: Premultiplied ABGR, 32 bits, 10 bpc
|
||||
*
|
||||
* Pixel formats used by Cogl. For the formats with a byte per
|
||||
* component, the order of the components specify the order in
|
||||
* increasing memory addresses. So for example
|
||||
* %COGL_PIXEL_FORMAT_RGB_888 would have the red component in the
|
||||
* lowest address, green in the next address and blue after that
|
||||
* regardless of the endianness of the system.
|
||||
*
|
||||
* For the formats with non byte aligned components the component
|
||||
* order specifies the order within a 16-bit or 32-bit number from
|
||||
* most significant bit to least significant. So for
|
||||
* %COGL_PIXEL_FORMAT_RGB_565, the red component would be in bits
|
||||
* 11-15, the green component would be in 6-11 and the blue component
|
||||
* would be in 1-5. Therefore the order in memory depends on the
|
||||
* endianness of the system.
|
||||
*
|
||||
* When uploading a texture %COGL_PIXEL_FORMAT_ANY can be used as the
|
||||
* internal format. Cogl will try to pick the best format to use
|
||||
* internally and convert the texture data if necessary.
|
||||
*
|
||||
* Since: 0.8
|
||||
*/
|
||||
typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
|
||||
{
|
||||
COGL_PIXEL_FORMAT_ANY = 0,
|
||||
COGL_PIXEL_FORMAT_A_8 = 1 | COGL_A_BIT,
|
||||
|
||||
COGL_PIXEL_FORMAT_RGB_565 = 4,
|
||||
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_RG_88 = 9,
|
||||
|
||||
COGL_PIXEL_FORMAT_RGB_888 = 2,
|
||||
COGL_PIXEL_FORMAT_BGR_888 = (2 | COGL_BGR_BIT),
|
||||
|
||||
COGL_PIXEL_FORMAT_RGBA_8888 = (3 | COGL_A_BIT),
|
||||
COGL_PIXEL_FORMAT_BGRA_8888 = (3 | COGL_A_BIT | COGL_BGR_BIT),
|
||||
COGL_PIXEL_FORMAT_ARGB_8888 = (3 | COGL_A_BIT | COGL_AFIRST_BIT),
|
||||
COGL_PIXEL_FORMAT_ABGR_8888 = (3 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
|
||||
|
||||
COGL_PIXEL_FORMAT_RGBA_1010102 = (13 | COGL_A_BIT),
|
||||
COGL_PIXEL_FORMAT_BGRA_1010102 = (13 | COGL_A_BIT | COGL_BGR_BIT),
|
||||
COGL_PIXEL_FORMAT_ARGB_2101010 = (13 | COGL_A_BIT | COGL_AFIRST_BIT),
|
||||
COGL_PIXEL_FORMAT_ABGR_2101010 = (13 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
|
||||
|
||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT),
|
||||
COGL_PIXEL_FORMAT_BGRA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT),
|
||||
COGL_PIXEL_FORMAT_ARGB_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_AFIRST_BIT),
|
||||
COGL_PIXEL_FORMAT_ABGR_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
|
||||
COGL_PIXEL_FORMAT_RGBA_4444_PRE = (COGL_PIXEL_FORMAT_RGBA_4444 | COGL_A_BIT | COGL_PREMULT_BIT),
|
||||
COGL_PIXEL_FORMAT_RGBA_5551_PRE = (COGL_PIXEL_FORMAT_RGBA_5551 | COGL_A_BIT | COGL_PREMULT_BIT),
|
||||
|
||||
COGL_PIXEL_FORMAT_RGBA_1010102_PRE = (COGL_PIXEL_FORMAT_RGBA_1010102 | COGL_PREMULT_BIT),
|
||||
COGL_PIXEL_FORMAT_BGRA_1010102_PRE = (COGL_PIXEL_FORMAT_BGRA_1010102 | COGL_PREMULT_BIT),
|
||||
COGL_PIXEL_FORMAT_ARGB_2101010_PRE = (COGL_PIXEL_FORMAT_ARGB_2101010 | COGL_PREMULT_BIT),
|
||||
COGL_PIXEL_FORMAT_ABGR_2101010_PRE = (COGL_PIXEL_FORMAT_ABGR_2101010 | COGL_PREMULT_BIT),
|
||||
|
||||
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)
|
||||
} CoglPixelFormat;
|
||||
|
||||
/**
|
||||
* CoglFeatureFlags:
|
||||
* @COGL_FEATURE_TEXTURE_YUV: ycbcr conversion support
|
||||
|
@@ -35,7 +35,6 @@
|
||||
#include <math.h>
|
||||
|
||||
#include <cogl/cogl-defines.h>
|
||||
#include <cogl/cogl-pixel-format.h>
|
||||
#include "cogl-types.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@@ -54,27 +54,41 @@ static char *_cogl_x11_display_name = NULL;
|
||||
static GList *_cogl_xlib_renderers = NULL;
|
||||
|
||||
static void
|
||||
_xlib_renderer_data_free (CoglXlibRenderer *data)
|
||||
destroy_xlib_renderer_data (void *user_data)
|
||||
{
|
||||
CoglXlibRenderer *data = user_data;
|
||||
|
||||
if (data->xvisinfo)
|
||||
XFree (data->xvisinfo);
|
||||
|
||||
g_slice_free (CoglXlibRenderer, data);
|
||||
g_slice_free (CoglXlibRenderer, user_data);
|
||||
}
|
||||
|
||||
CoglXlibRenderer *
|
||||
_cogl_xlib_renderer_get_data (CoglRenderer *renderer)
|
||||
{
|
||||
static CoglUserDataKey key;
|
||||
CoglXlibRenderer *data;
|
||||
|
||||
/* Constructs a CoglXlibRenderer struct on demand and attaches it to
|
||||
the object using user data. It's done this way instead of using a
|
||||
subclassing hierarchy in the winsys data because all EGL winsys's
|
||||
need the EGL winsys data but only one of them wants the Xlib
|
||||
data. */
|
||||
|
||||
if (!renderer->custom_winsys_user_data)
|
||||
renderer->custom_winsys_user_data = g_slice_new0 (CoglXlibRenderer);
|
||||
data = cogl_object_get_user_data (COGL_OBJECT (renderer), &key);
|
||||
|
||||
return renderer->custom_winsys_user_data;
|
||||
if (data == NULL)
|
||||
{
|
||||
data = g_slice_new0 (CoglXlibRenderer);
|
||||
|
||||
cogl_object_set_user_data (COGL_OBJECT (renderer),
|
||||
&key,
|
||||
data,
|
||||
destroy_xlib_renderer_data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -556,8 +570,6 @@ _cogl_xlib_renderer_disconnect (CoglRenderer *renderer)
|
||||
if (!renderer->foreign_xdpy && xlib_renderer->xdpy)
|
||||
XCloseDisplay (xlib_renderer->xdpy);
|
||||
|
||||
g_clear_pointer (&renderer->custom_winsys_user_data, _xlib_renderer_data_free);
|
||||
|
||||
unregister_xlib_renderer (renderer);
|
||||
}
|
||||
|
||||
|
@@ -764,3 +764,55 @@ _cogl_init (void)
|
||||
initialized = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
int bpp_lut[] = { 0, 1, 3, 4,
|
||||
2, 2, 2, 0,
|
||||
1, 2, 0, 0,
|
||||
3, 4, 0, 0 };
|
||||
|
||||
return bpp_lut [format & 0xf];
|
||||
}
|
||||
|
||||
/* Note: this also refers to the mapping defined above for
|
||||
* _cogl_pixel_format_get_bytes_per_pixel() */
|
||||
gboolean
|
||||
_cogl_pixel_format_is_endian_dependant (CoglPixelFormat format)
|
||||
{
|
||||
int aligned_lut[] = { -1, 1, 1, 1,
|
||||
0, 0, 0, -1,
|
||||
1, 1, -1, -1,
|
||||
0, 0, -1, -1};
|
||||
int aligned = aligned_lut[format & 0xf];
|
||||
|
||||
_COGL_RETURN_VAL_IF_FAIL (aligned != -1, FALSE);
|
||||
|
||||
/* NB: currently checking whether the format components are aligned
|
||||
* or not determines whether the format is endian dependent or not.
|
||||
* In the future though we might consider adding formats with
|
||||
* aligned components that are also endian independant. */
|
||||
|
||||
return aligned;
|
||||
}
|
||||
|
@@ -64,7 +64,6 @@
|
||||
#include <cogl/cogl-matrix.h>
|
||||
#include <cogl/cogl-matrix-stack.h>
|
||||
#include <cogl/cogl-offscreen.h>
|
||||
#include <cogl/cogl-pixel-format.h>
|
||||
#include <cogl/cogl-primitives.h>
|
||||
#include <cogl/cogl-texture.h>
|
||||
#include <cogl/cogl-types.h>
|
||||
|
@@ -59,8 +59,10 @@ _cogl_program_free (CoglProgram *program)
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
/* Unref all of the attached shaders and destroy the list */
|
||||
g_slist_free_full (program->attached_shaders, cogl_handle_unref);
|
||||
/* Unref all of the attached shaders */
|
||||
g_slist_foreach (program->attached_shaders, (GFunc) cogl_handle_unref, NULL);
|
||||
/* Destroy the list */
|
||||
g_slist_free (program->attached_shaders);
|
||||
|
||||
for (i = 0; i < program->custom_uniforms->len; i++)
|
||||
{
|
||||
|
@@ -12,9 +12,6 @@ cdata.set('COGL_HAS_X11', have_x11)
|
||||
cdata.set('COGL_HAS_X11_SUPPORT', have_x11)
|
||||
cdata.set('COGL_HAS_XLIB', have_x11)
|
||||
cdata.set('COGL_HAS_XLIB_SUPPORT', have_x11)
|
||||
if have_native_backend
|
||||
cdata.set('COGL_HAS_LIBDRM', libdrm_dep.found())
|
||||
endif
|
||||
|
||||
cogl_defines_h = configure_file(
|
||||
input: 'cogl-defines.h.meson',
|
||||
@@ -91,7 +88,6 @@ cogl_headers = [
|
||||
'cogl-pipeline.h',
|
||||
'cogl-pipeline-state.h',
|
||||
'cogl-pipeline-layer-state.h',
|
||||
'cogl-pixel-format.h',
|
||||
'cogl-primitives.h',
|
||||
'cogl-texture.h',
|
||||
'cogl-texture-2d.h',
|
||||
@@ -237,7 +233,6 @@ cogl_sources = [
|
||||
'cogl-display.c',
|
||||
'cogl-driver.h',
|
||||
'cogl.c',
|
||||
'cogl-pixel-format.c',
|
||||
'cogl-object-private.h',
|
||||
'cogl-object.h',
|
||||
'cogl-object.c',
|
||||
|
@@ -14,6 +14,12 @@ cogl_config_h = configure_file(
|
||||
output: 'cogl-config.h',
|
||||
configuration: cdata)
|
||||
|
||||
# TODO: Remove this when autotools support is removed
|
||||
cogl_mutter_config_h = configure_file(
|
||||
input: 'cogl-config.h.meson',
|
||||
output: 'cogl-mutter-config.h',
|
||||
configuration: cdata)
|
||||
|
||||
cogl_pkg_deps = [
|
||||
glib_dep,
|
||||
gobject_dep,
|
||||
|
@@ -4,9 +4,19 @@ cdata = configuration_data()
|
||||
cdata.set('HAVE_GL', have_gl.to_int())
|
||||
cdata.set('HAVE_GLES2', have_gles2.to_int())
|
||||
|
||||
cogl_installed_tests_libexecdir = join_paths(
|
||||
mutter_installed_tests_libexecdir, 'cogl', 'conform')
|
||||
install_data('run-tests.sh', install_dir: cogl_installed_tests_libexecdir)
|
||||
# Until meson 0.50 setting the install parameter in 'configure_file' is ignored
|
||||
# if 'install_dir' is set, then until mutter doesn't depend on such meson version
|
||||
# cogl_installed_tests_libexecdir should be empty unless have_installed_tests
|
||||
# is false, or this file will be installed anyway.
|
||||
#
|
||||
# See https://github.com/mesonbuild/meson/issues/4160
|
||||
cogl_installed_tests_libexecdir = ''
|
||||
|
||||
if have_installed_tests
|
||||
cogl_installed_tests_libexecdir = join_paths(
|
||||
mutter_installed_tests_libexecdir, 'cogl', 'conform')
|
||||
install_data('run-tests.sh', install_dir: cogl_installed_tests_libexecdir)
|
||||
endif
|
||||
|
||||
cogl_config_env = configure_file(
|
||||
input: 'config.env.in',
|
||||
|
@@ -120,10 +120,6 @@
|
||||
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.
|
||||
</description>
|
||||
</key>
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
project('mutter', 'c',
|
||||
version: '3.33.2',
|
||||
meson_version: '>= 0.50.0',
|
||||
version: '3.32.1',
|
||||
meson_version: '>= 0.48.0',
|
||||
license: 'GPLv2+'
|
||||
)
|
||||
|
||||
@@ -9,7 +9,6 @@ mutter_plugin_api_version = '3'
|
||||
libmutter_api_version = '4'
|
||||
|
||||
# generic version requirements
|
||||
fribidi_req = '>= 1.0.0'
|
||||
glib_req = '>= 2.53.2'
|
||||
gi_req = '>= 0.9.5'
|
||||
gtk3_req = '>= 3.19.8'
|
||||
@@ -87,7 +86,6 @@ pango_dep = dependency('pango', version: pango_req)
|
||||
cairo_dep = dependency('cairo', version: cairo_req)
|
||||
cairo_gobject_dep = dependency('cairo-gobject', version: cairo_req)
|
||||
pangocairo_dep = dependency('pangocairo', version: pangocairo_req)
|
||||
fribidi_dep = dependency('fribidi', version: fribidi_req)
|
||||
gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas',
|
||||
version: gsettings_desktop_schemas_req)
|
||||
glib_dep = dependency('glib-2.0', version: glib_req)
|
||||
|
@@ -26,7 +26,6 @@ src/ui/theme.c
|
||||
src/wayland/meta-wayland-tablet-pad.c
|
||||
src/x11/meta-x11-display.c
|
||||
src/x11/meta-x11-errors.c
|
||||
src/x11/meta-x11-selection-input-stream.c
|
||||
src/x11/session.c
|
||||
src/x11/window-props.c
|
||||
src/x11/xprops.c
|
||||
|
63
po/es.po
63
po/es.po
@@ -13,8 +13,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: mutter.master\n"
|
||||
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
|
||||
"POT-Creation-Date: 2019-05-15 13:19+0000\n"
|
||||
"PO-Revision-Date: 2019-05-16 12:38+0200\n"
|
||||
"POT-Creation-Date: 2019-03-28 12:21+0000\n"
|
||||
"PO-Revision-Date: 2019-03-01 12:17+0100\n"
|
||||
"Last-Translator: Daniel Mustieles <daniel.mustieles@gmail.com>\n"
|
||||
"Language-Team: es <gnome-es-list@gnome.org>\n"
|
||||
"Language: es\n"
|
||||
@@ -22,7 +22,7 @@ msgstr ""
|
||||
"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"
|
||||
|
||||
#: data/50-mutter-navigation.xml:6
|
||||
msgid "Navigation"
|
||||
@@ -397,16 +397,6 @@ msgid "Enable experimental features"
|
||||
msgstr "Activar las características experimentales"
|
||||
|
||||
#: 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. Don’t 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 "
|
||||
@@ -415,9 +405,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 activar las características experimentales, añada la palabra clave de "
|
||||
"la característica a la lista. Depende de la característica que se deba "
|
||||
@@ -428,23 +416,21 @@ msgstr ""
|
||||
"manera predeterminada de disponer monitores lógicos en un espacio lógico de "
|
||||
"coordenadas de píxeles, al escalar framebuffers de monitores framebuffers en "
|
||||
"lugar del contenido de ventana, para administrar monitores HiDPI. No "
|
||||
"requiere un reinicio. • “rt-scheduler” — hace que mutter pida una "
|
||||
"planificación en tiempo real con prioridad baja. El ejecutable o el usuario "
|
||||
"deben tener CAP_SYS_NICE. Requiere reniciar."
|
||||
"requiere un reinicio."
|
||||
|
||||
#: data/org.gnome.mutter.gschema.xml.in:145
|
||||
#: data/org.gnome.mutter.gschema.xml.in:141
|
||||
msgid "Select window from tab popup"
|
||||
msgstr "Seleccionar ventana de la pestaña emergente"
|
||||
|
||||
#: data/org.gnome.mutter.gschema.xml.in:150
|
||||
#: data/org.gnome.mutter.gschema.xml.in:146
|
||||
msgid "Cancel tab popup"
|
||||
msgstr "Cancelar pestaña emergente"
|
||||
|
||||
#: data/org.gnome.mutter.gschema.xml.in:155
|
||||
#: data/org.gnome.mutter.gschema.xml.in:151
|
||||
msgid "Switch monitor configurations"
|
||||
msgstr "Cambiar la configuración del monitor"
|
||||
|
||||
#: data/org.gnome.mutter.gschema.xml.in:160
|
||||
#: data/org.gnome.mutter.gschema.xml.in:156
|
||||
msgid "Rotates the built-in monitor configuration"
|
||||
msgstr "Rota la configuración del monitor empotrado"
|
||||
|
||||
@@ -548,7 +534,7 @@ msgstr ""
|
||||
#. TRANSLATORS: This string refers to a button that switches between
|
||||
#. * different modes.
|
||||
#.
|
||||
#: src/backends/meta-input-settings.c:2426
|
||||
#: src/backends/meta-input-settings.c:2424
|
||||
#, c-format
|
||||
msgid "Mode Switch (Group %d)"
|
||||
msgstr "Cambiar modo (grupo %d)"
|
||||
@@ -556,34 +542,34 @@ msgstr "Cambiar modo (grupo %d)"
|
||||
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
|
||||
#. * mapping through the available outputs.
|
||||
#.
|
||||
#: src/backends/meta-input-settings.c:2449
|
||||
#: src/backends/meta-input-settings.c:2447
|
||||
msgid "Switch monitor"
|
||||
msgstr "Cambiar monitor"
|
||||
|
||||
#: src/backends/meta-input-settings.c:2451
|
||||
#: src/backends/meta-input-settings.c:2449
|
||||
msgid "Show on-screen help"
|
||||
msgstr "Mostrar la ayuda en pantalla"
|
||||
|
||||
#: src/backends/meta-monitor-manager.c:976
|
||||
#: src/backends/meta-monitor-manager.c:955
|
||||
msgid "Built-in display"
|
||||
msgstr "Pantalla integrada"
|
||||
|
||||
#: src/backends/meta-monitor-manager.c:1008
|
||||
#: src/backends/meta-monitor-manager.c:987
|
||||
msgid "Unknown"
|
||||
msgstr "Desconocida"
|
||||
|
||||
#: src/backends/meta-monitor-manager.c:1010
|
||||
#: src/backends/meta-monitor-manager.c:989
|
||||
msgid "Unknown Display"
|
||||
msgstr "Pantalla desconocida"
|
||||
|
||||
#: src/backends/meta-monitor-manager.c:1018
|
||||
#: src/backends/meta-monitor-manager.c:997
|
||||
#, 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-manager.c:1026
|
||||
#: src/backends/meta-monitor-manager.c:1005
|
||||
#, c-format
|
||||
msgctxt ""
|
||||
"This is a monitor vendor name followed by product/model name where size in "
|
||||
@@ -593,7 +579,7 @@ msgstr "%s %s"
|
||||
|
||||
#. 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:508
|
||||
#: src/compositor/compositor.c:482
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Another compositing manager is already running on screen %i on display “%s”."
|
||||
@@ -713,7 +699,7 @@ msgstr "Mutter fue compilado sin soporte para modo prolijo\n"
|
||||
msgid "Mode Switch: Mode %d"
|
||||
msgstr "Cambiar modo: modo %d"
|
||||
|
||||
#: src/x11/meta-x11-display.c:669
|
||||
#: src/x11/meta-x11-display.c:666
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Display “%s” already has a window manager; try using the --replace option to "
|
||||
@@ -722,25 +708,20 @@ msgstr ""
|
||||
"La pantalla «%s» ya tiene un gestor de ventanas; pruebe a usar la opción «--"
|
||||
"replace» para reemplazar el gestor de ventanas activo."
|
||||
|
||||
#: src/x11/meta-x11-display.c:1011
|
||||
#: src/x11/meta-x11-display.c:1008
|
||||
msgid "Failed to initialize GDK\n"
|
||||
msgstr "Falló al inicializar GDK\n"
|
||||
|
||||
#: src/x11/meta-x11-display.c:1035
|
||||
#: src/x11/meta-x11-display.c:1032
|
||||
#, c-format
|
||||
msgid "Failed to open X Window System display “%s”\n"
|
||||
msgstr "Ocurrió un error al abrir la pantalla de X Window System «%s»\n"
|
||||
|
||||
#: src/x11/meta-x11-display.c:1116
|
||||
#: src/x11/meta-x11-display.c:1113
|
||||
#, c-format
|
||||
msgid "Screen %d on display “%s” is invalid\n"
|
||||
msgstr "La ventana %d en la pantalla «%s» no es válida\n"
|
||||
|
||||
#: src/x11/meta-x11-selection-input-stream.c:445
|
||||
#, c-format
|
||||
msgid "Format %s not supported"
|
||||
msgstr "Formato %s no soportado"
|
||||
|
||||
#: src/x11/session.c:1821
|
||||
msgid ""
|
||||
"These windows do not support “save current setup” and will have to be "
|
||||
|
51
po/fur.po
51
po/fur.po
@@ -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-05-03 17:25+0000\n"
|
||||
"PO-Revision-Date: 2019-05-03 19:39+0200\n"
|
||||
"POT-Creation-Date: 2019-02-04 17:52+0000\n"
|
||||
"PO-Revision-Date: 2019-02-05 12:13+0100\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.1\n"
|
||||
"X-Generator: Poedit 2.2\n"
|
||||
|
||||
#: data/50-mutter-navigation.xml:6
|
||||
msgid "Navigation"
|
||||
@@ -522,7 +522,7 @@ msgstr ""
|
||||
#. TRANSLATORS: This string refers to a button that switches between
|
||||
#. * different modes.
|
||||
#.
|
||||
#: src/backends/meta-input-settings.c:2426
|
||||
#: src/backends/meta-input-settings.c:2423
|
||||
#, c-format
|
||||
msgid "Mode Switch (Group %d)"
|
||||
msgstr "Cambie mût (Grup %d)"
|
||||
@@ -530,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:2449
|
||||
#: src/backends/meta-input-settings.c:2446
|
||||
msgid "Switch monitor"
|
||||
msgstr "Cambie visôr"
|
||||
|
||||
#: src/backends/meta-input-settings.c:2451
|
||||
#: src/backends/meta-input-settings.c:2448
|
||||
msgid "Show on-screen help"
|
||||
msgstr "Mostre jutori a schermi"
|
||||
|
||||
#: src/backends/meta-monitor-manager.c:976
|
||||
#: src/backends/meta-monitor-manager.c:954
|
||||
msgid "Built-in display"
|
||||
msgstr "Display integrât"
|
||||
|
||||
#: src/backends/meta-monitor-manager.c:1008
|
||||
#: src/backends/meta-monitor-manager.c:986
|
||||
msgid "Unknown"
|
||||
msgstr "No cognossût"
|
||||
|
||||
#: src/backends/meta-monitor-manager.c:1010
|
||||
#: src/backends/meta-monitor-manager.c:988
|
||||
msgid "Unknown Display"
|
||||
msgstr "Display no cognossût"
|
||||
|
||||
#: src/backends/meta-monitor-manager.c:1018
|
||||
#: src/backends/meta-monitor-manager.c:996
|
||||
#, 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-manager.c:1026
|
||||
#: src/backends/meta-monitor-manager.c:1004
|
||||
#, c-format
|
||||
msgctxt ""
|
||||
"This is a monitor vendor name followed by product/model name where size in "
|
||||
@@ -567,7 +567,7 @@ msgstr "%s %s"
|
||||
|
||||
#. 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:508
|
||||
#: src/compositor/compositor.c:482
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Another compositing manager is already running on screen %i on display “%s”."
|
||||
@@ -575,7 +575,7 @@ msgstr ""
|
||||
"Un altri compositing manager al è za in esecuzion sul schermi %i sul display "
|
||||
"“%s”."
|
||||
|
||||
#: src/core/bell.c:192
|
||||
#: src/core/bell.c:252
|
||||
msgid "Bell event"
|
||||
msgstr "Event cjampane"
|
||||
|
||||
@@ -624,16 +624,16 @@ msgid "Run with X11 backend"
|
||||
msgstr "Eseguìs cul 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” nol rispuint."
|
||||
|
||||
#: src/core/meta-close-dialog-default.c:153
|
||||
#: src/core/meta-close-dialog-default.c:152
|
||||
msgid "Application is not responding."
|
||||
msgstr "La aplicazion no rispuint."
|
||||
|
||||
#: 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."
|
||||
@@ -641,11 +641,11 @@ msgstr ""
|
||||
"Al è pussibil sielzi di spietâ un pôc lassant che la aplicazion e continui o "
|
||||
"sfuarçâ la aplicazion par sierâle dal dut."
|
||||
|
||||
#: src/core/meta-close-dialog-default.c:165
|
||||
#: src/core/meta-close-dialog-default.c:164
|
||||
msgid "_Force Quit"
|
||||
msgstr "Sfuarce _Jessude"
|
||||
|
||||
#: src/core/meta-close-dialog-default.c:165
|
||||
#: src/core/meta-close-dialog-default.c:164
|
||||
msgid "_Wait"
|
||||
msgstr "_Spiete"
|
||||
|
||||
@@ -686,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:669
|
||||
#: src/x11/meta-x11-display.c:666
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Display “%s” already has a window manager; try using the --replace option to "
|
||||
@@ -695,25 +695,20 @@ 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:1011
|
||||
#: src/x11/meta-x11-display.c:1008
|
||||
msgid "Failed to initialize GDK\n"
|
||||
msgstr "No si è rivâts a inizializâ GDK\n"
|
||||
|
||||
#: src/x11/meta-x11-display.c:1035
|
||||
#: src/x11/meta-x11-display.c:1032
|
||||
#, 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:1116
|
||||
#: src/x11/meta-x11-display.c:1115
|
||||
#, c-format
|
||||
msgid "Screen %d on display “%s” is invalid\n"
|
||||
msgstr "Schermi %d su display “%s” no valit\n"
|
||||
|
||||
#: src/x11/meta-x11-selection-input-stream.c:445
|
||||
#, c-format
|
||||
msgid "Format %s not supported"
|
||||
msgstr "Il formât %s nol è supuartât"
|
||||
|
||||
#: src/x11/session.c:1821
|
||||
msgid ""
|
||||
"These windows do not support “save current setup” and will have to be "
|
||||
@@ -722,7 +717,7 @@ msgstr ""
|
||||
"Chescj barcons no supuartin la funzion “salve impostazions atuâls” e si "
|
||||
"scugnarà tornâ a inviâlis a man tal prossim acès."
|
||||
|
||||
#: src/x11/window-props.c:569
|
||||
#: src/x11/window-props.c:568
|
||||
#, c-format
|
||||
msgid "%s (on %s)"
|
||||
msgstr "%s (su %s)"
|
||||
|
50
po/id.po
50
po/id.po
@@ -6,13 +6,12 @@
|
||||
# Ahmad Riza H Nst <rizahnst@eriagempita.co.id>, 2006.
|
||||
# Dirgita <dirgitadevina@yahoo.co.id>, 2011, 2012, 2014.
|
||||
# Andika Triwidada <andika@gmail.com>, 2011-2015.
|
||||
# Kukuh Syafaat <kukuhsyafaat@gnome.org>, 2017, 2018, 2019.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: mutter master\n"
|
||||
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
|
||||
"POT-Creation-Date: 2019-05-06 16:50+0000\n"
|
||||
"PO-Revision-Date: 2019-05-07 14:13+0700\n"
|
||||
"POT-Creation-Date: 2019-02-04 17:52+0000\n"
|
||||
"PO-Revision-Date: 2019-02-06 21:17+0700\n"
|
||||
"Last-Translator: Kukuh Syafaat <kukuhsyafaat@gnome.org>\n"
|
||||
"Language-Team: Indonesian <gnome-l10n-id@googlegroups.com>\n"
|
||||
"Language: id\n"
|
||||
@@ -527,7 +526,7 @@ msgstr ""
|
||||
#. TRANSLATORS: This string refers to a button that switches between
|
||||
#. * different modes.
|
||||
#.
|
||||
#: src/backends/meta-input-settings.c:2426
|
||||
#: src/backends/meta-input-settings.c:2423
|
||||
#, c-format
|
||||
msgid "Mode Switch (Group %d)"
|
||||
msgstr "Tukar Mode: (Grup %d)"
|
||||
@@ -535,34 +534,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:2449
|
||||
#: src/backends/meta-input-settings.c:2446
|
||||
msgid "Switch monitor"
|
||||
msgstr "Berpindah monitor"
|
||||
|
||||
#: src/backends/meta-input-settings.c:2451
|
||||
#: src/backends/meta-input-settings.c:2448
|
||||
msgid "Show on-screen help"
|
||||
msgstr "Tampilkan bantuan pada layar"
|
||||
|
||||
#: src/backends/meta-monitor-manager.c:976
|
||||
#: src/backends/meta-monitor-manager.c:954
|
||||
msgid "Built-in display"
|
||||
msgstr "Tampilan bawaan"
|
||||
|
||||
#: src/backends/meta-monitor-manager.c:1008
|
||||
#: src/backends/meta-monitor-manager.c:986
|
||||
msgid "Unknown"
|
||||
msgstr "Tak Dikenal"
|
||||
|
||||
#: src/backends/meta-monitor-manager.c:1010
|
||||
#: src/backends/meta-monitor-manager.c:988
|
||||
msgid "Unknown Display"
|
||||
msgstr "Tampilan Tak Dikenal"
|
||||
|
||||
#: src/backends/meta-monitor-manager.c:1018
|
||||
#: src/backends/meta-monitor-manager.c:996
|
||||
#, 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-manager.c:1026
|
||||
#: src/backends/meta-monitor-manager.c:1004
|
||||
#, c-format
|
||||
msgctxt ""
|
||||
"This is a monitor vendor name followed by product/model name where size in "
|
||||
@@ -572,14 +571,14 @@ msgstr "%s %s"
|
||||
|
||||
#. 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:508
|
||||
#: src/compositor/compositor.c:482
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Another compositing manager is already running on screen %i on display “%s”."
|
||||
msgstr ""
|
||||
"Manajer komposit lain telah berjalan pada layar %i pada tampilan \"%s\"."
|
||||
|
||||
#: src/core/bell.c:192
|
||||
#: src/core/bell.c:252
|
||||
msgid "Bell event"
|
||||
msgstr "Bel peristiwa"
|
||||
|
||||
@@ -628,27 +627,27 @@ msgid "Run with X11 backend"
|
||||
msgstr "Jalankan dengan 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\" tak merespon."
|
||||
|
||||
#: src/core/meta-close-dialog-default.c:153
|
||||
#: src/core/meta-close-dialog-default.c:152
|
||||
msgid "Application is not responding."
|
||||
msgstr "Aplikasi tak merespon."
|
||||
|
||||
#: 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."
|
||||
msgstr ""
|
||||
"Anda bisa memilih untuk menunggu sebentar atau memaksa aplikasi keluar."
|
||||
|
||||
#: src/core/meta-close-dialog-default.c:165
|
||||
#: src/core/meta-close-dialog-default.c:164
|
||||
msgid "_Force Quit"
|
||||
msgstr "_Matikan Paksa"
|
||||
|
||||
#: src/core/meta-close-dialog-default.c:165
|
||||
#: src/core/meta-close-dialog-default.c:164
|
||||
msgid "_Wait"
|
||||
msgstr "_Tunggu"
|
||||
|
||||
@@ -690,7 +689,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:669
|
||||
#: src/x11/meta-x11-display.c:666
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Display “%s” already has a window manager; try using the --replace option to "
|
||||
@@ -699,25 +698,20 @@ msgstr ""
|
||||
"Tampilan \"%s\" sudah memiliki manajer jendela; cobalah gunakan pilihan --"
|
||||
"replace untuk mengganti manajer jendela saat ini."
|
||||
|
||||
#: src/x11/meta-x11-display.c:1011
|
||||
#: src/x11/meta-x11-display.c:1008
|
||||
msgid "Failed to initialize GDK\n"
|
||||
msgstr "Gagal menginisialisasi GDK\n"
|
||||
|
||||
#: src/x11/meta-x11-display.c:1035
|
||||
#: src/x11/meta-x11-display.c:1032
|
||||
#, 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:1116
|
||||
#: src/x11/meta-x11-display.c:1115
|
||||
#, c-format
|
||||
msgid "Screen %d on display “%s” is invalid\n"
|
||||
msgstr "Layar %d pada tampilan \"%s\" tidak valid\n"
|
||||
|
||||
#: src/x11/meta-x11-selection-input-stream.c:445
|
||||
#, c-format
|
||||
msgid "Format %s not supported"
|
||||
msgstr "Format %s tidak didukung"
|
||||
|
||||
#: src/x11/session.c:1821
|
||||
msgid ""
|
||||
"These windows do not support “save current setup” and will have to be "
|
||||
@@ -726,7 +720,7 @@ msgstr ""
|
||||
"Jendela ini tidak mendukung \"menyimpan setelan aktif saat ini\" dan mesti "
|
||||
"dijalankan ulang secara manual kala berikut Anda log masuk."
|
||||
|
||||
#: src/x11/window-props.c:569
|
||||
#: src/x11/window-props.c:568
|
||||
#, c-format
|
||||
msgid "%s (on %s)"
|
||||
msgstr "%s (pada %s)"
|
||||
|
@@ -353,7 +353,7 @@ find_builtin_output (MetaInputMapper *mapper,
|
||||
return panel != NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
guess_candidates (MetaInputMapper *mapper,
|
||||
MetaMapperInputInfo *input,
|
||||
DeviceCandidates *info)
|
||||
@@ -381,13 +381,21 @@ guess_candidates (MetaInputMapper *mapper,
|
||||
info->candidates[META_MATCH_SIZE] = matched_monitor;
|
||||
}
|
||||
|
||||
if (input->builtin || best == N_OUTPUT_MATCHES)
|
||||
if (input->builtin)
|
||||
{
|
||||
best = MIN (best, META_MATCH_IS_BUILTIN);
|
||||
find_builtin_output (mapper, &info->candidates[META_MATCH_IS_BUILTIN]);
|
||||
}
|
||||
|
||||
info->best = best;
|
||||
if (best < N_OUTPUT_MATCHES)
|
||||
{
|
||||
info->best = best;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -400,7 +408,8 @@ mapping_helper_add (MappingHelper *helper,
|
||||
|
||||
info.input = input;
|
||||
|
||||
guess_candidates (mapper, input, &info);
|
||||
if (!guess_candidates (mapper, input, &info))
|
||||
return;
|
||||
|
||||
for (i = 0; i < helper->device_maps->len; i++)
|
||||
{
|
||||
|
@@ -589,7 +589,12 @@ meta_monitor_normal_derive_layout (MetaMonitor *monitor,
|
||||
|
||||
output = meta_monitor_get_main_output (monitor);
|
||||
crtc = meta_output_get_assigned_crtc (output);
|
||||
*layout = crtc->rect;
|
||||
*layout = (MetaRectangle) {
|
||||
.x = crtc->rect.x,
|
||||
.y = crtc->rect.y,
|
||||
.width = crtc->rect.width,
|
||||
.height = crtc->rect.height
|
||||
};
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@@ -33,7 +33,6 @@ typedef enum _MetaExperimentalFeature
|
||||
META_EXPERIMENTAL_FEATURE_NONE = 0,
|
||||
META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER = (1 << 0),
|
||||
META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS = (1 << 1),
|
||||
META_EXPERIMENTAL_FEATURE_RT_SCHEDULER = (1 << 2),
|
||||
} MetaExperimentalFeature;
|
||||
|
||||
#define META_TYPE_SETTINGS (meta_settings_get_type ())
|
||||
|
@@ -264,8 +264,6 @@ experimental_features_handler (GVariant *features_variant,
|
||||
features |= META_EXPERIMENTAL_FEATURE_SCALE_MONITOR_FRAMEBUFFER;
|
||||
else if (g_str_equal (feature, "kms-modifiers"))
|
||||
features |= META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS;
|
||||
else if (g_str_equal (feature, "rt-scheduler"))
|
||||
features |= META_EXPERIMENTAL_FEATURE_RT_SCHEDULER;
|
||||
else
|
||||
g_info ("Unknown experimental feature '%s'\n", feature);
|
||||
}
|
||||
|
@@ -37,7 +37,6 @@
|
||||
#include "backends/native/meta-backend-native.h"
|
||||
#include "backends/native/meta-backend-native-private.h"
|
||||
|
||||
#include <sched.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "backends/meta-cursor-tracker-private.h"
|
||||
@@ -45,7 +44,6 @@
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "backends/meta-monitor-manager-private.h"
|
||||
#include "backends/meta-pointer-constraint.h"
|
||||
#include "backends/meta-settings-private.h"
|
||||
#include "backends/meta-stage-private.h"
|
||||
#include "backends/native/meta-barrier-native.h"
|
||||
#include "backends/native/meta-clutter-backend-native.h"
|
||||
@@ -333,7 +331,6 @@ static void
|
||||
meta_backend_native_post_init (MetaBackend *backend)
|
||||
{
|
||||
ClutterDeviceManager *manager = clutter_device_manager_get_default ();
|
||||
MetaSettings *settings = meta_backend_get_settings (backend);
|
||||
|
||||
META_BACKEND_CLASS (meta_backend_native_parent_class)->post_init (backend);
|
||||
|
||||
@@ -341,20 +338,6 @@ meta_backend_native_post_init (MetaBackend *backend)
|
||||
NULL, NULL);
|
||||
clutter_evdev_set_relative_motion_filter (manager, relative_motion_filter,
|
||||
meta_backend_get_monitor_manager (backend));
|
||||
|
||||
if (meta_settings_is_experimental_feature_enabled (settings,
|
||||
META_EXPERIMENTAL_FEATURE_RT_SCHEDULER))
|
||||
{
|
||||
int retval;
|
||||
struct sched_param sp = {
|
||||
.sched_priority = sched_get_priority_min (SCHED_RR)
|
||||
};
|
||||
|
||||
retval = sched_setscheduler (0, SCHED_RR | SCHED_RESET_ON_FORK, &sp);
|
||||
|
||||
if (retval != 0)
|
||||
g_warning ("Failed to set RT scheduler: %m");
|
||||
}
|
||||
}
|
||||
|
||||
static MetaMonitorManager *
|
||||
|
@@ -823,7 +823,6 @@ static void
|
||||
cursor_priv_free (MetaCursorNativePrivate *cursor_priv)
|
||||
{
|
||||
g_hash_table_destroy (cursor_priv->gpu_states);
|
||||
g_free (cursor_priv);
|
||||
}
|
||||
|
||||
static MetaCursorNativePrivate *
|
||||
|
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Intel Corporation.
|
||||
* Copyright (C) 2016 Red Hat
|
||||
* Copyright (C) 2018 DisplayLink (UK) Ltd.
|
||||
* Copyright (C) 2018 Canonical Ltd.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "backends/native/meta-drm-buffer-dumb.h"
|
||||
|
||||
struct _MetaDrmBufferDumb
|
||||
{
|
||||
MetaDrmBuffer parent;
|
||||
|
||||
uint32_t fb_id;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaDrmBufferDumb, meta_drm_buffer_dumb, META_TYPE_DRM_BUFFER)
|
||||
|
||||
MetaDrmBufferDumb *
|
||||
meta_drm_buffer_dumb_new (uint32_t dumb_fb_id)
|
||||
{
|
||||
MetaDrmBufferDumb *buffer_dumb;
|
||||
|
||||
buffer_dumb = g_object_new (META_TYPE_DRM_BUFFER_DUMB, NULL);
|
||||
buffer_dumb->fb_id = dumb_fb_id;
|
||||
|
||||
return buffer_dumb;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
meta_drm_buffer_dumb_get_fb_id (MetaDrmBuffer *buffer)
|
||||
{
|
||||
return META_DRM_BUFFER_DUMB (buffer)->fb_id;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_drm_buffer_dumb_init (MetaDrmBufferDumb *buffer_dumb)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
meta_drm_buffer_dumb_class_init (MetaDrmBufferDumbClass *klass)
|
||||
{
|
||||
MetaDrmBufferClass *buffer_class = META_DRM_BUFFER_CLASS (klass);
|
||||
|
||||
buffer_class->get_fb_id = meta_drm_buffer_dumb_get_fb_id;
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Canonical Ltd.
|
||||
* Copyright (C) 2019 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
|
||||
* 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 META_DRM_BUFFER_DUMB_H
|
||||
#define META_DRM_BUFFER_DUMB_H
|
||||
|
||||
#include "backends/native/meta-drm-buffer.h"
|
||||
|
||||
#define META_TYPE_DRM_BUFFER_DUMB (meta_drm_buffer_dumb_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaDrmBufferDumb,
|
||||
meta_drm_buffer_dumb,
|
||||
META, DRM_BUFFER_DUMB,
|
||||
MetaDrmBuffer)
|
||||
|
||||
MetaDrmBufferDumb * meta_drm_buffer_dumb_new (uint32_t dumb_fb_id);
|
||||
|
||||
#endif /* META_DRM_BUFFER_DUMB_H */
|
@@ -1,232 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Intel Corporation.
|
||||
* Copyright (C) 2016 Red Hat
|
||||
* Copyright (C) 2018 DisplayLink (UK) Ltd.
|
||||
* Copyright (C) 2018 Canonical Ltd.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "backends/native/meta-drm-buffer-gbm.h"
|
||||
|
||||
#include <drm_fourcc.h>
|
||||
#include <errno.h>
|
||||
#include <xf86drm.h>
|
||||
#include <xf86drmMode.h>
|
||||
|
||||
#define INVALID_FB_ID 0U
|
||||
|
||||
struct _MetaDrmBufferGbm
|
||||
{
|
||||
MetaDrmBuffer parent;
|
||||
|
||||
MetaGpuKms *gpu_kms;
|
||||
|
||||
struct gbm_surface *surface;
|
||||
|
||||
struct gbm_bo *bo;
|
||||
uint32_t fb_id;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaDrmBufferGbm, meta_drm_buffer_gbm, META_TYPE_DRM_BUFFER)
|
||||
|
||||
struct gbm_bo *
|
||||
meta_drm_buffer_gbm_get_bo (MetaDrmBufferGbm *buffer_gbm)
|
||||
{
|
||||
return buffer_gbm->bo;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
acquire_swapped_buffer (MetaDrmBufferGbm *buffer_gbm,
|
||||
gboolean use_modifiers,
|
||||
GError **error)
|
||||
{
|
||||
uint32_t handles[4] = {0, 0, 0, 0};
|
||||
uint32_t strides[4] = {0, 0, 0, 0};
|
||||
uint32_t offsets[4] = {0, 0, 0, 0};
|
||||
uint64_t modifiers[4] = {0, 0, 0, 0};
|
||||
uint32_t width, height;
|
||||
uint32_t format;
|
||||
struct gbm_bo *bo;
|
||||
int kms_fd;
|
||||
|
||||
kms_fd = meta_gpu_kms_get_fd (buffer_gbm->gpu_kms);
|
||||
|
||||
bo = gbm_surface_lock_front_buffer (buffer_gbm->surface);
|
||||
if (!bo)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"gbm_surface_lock_front_buffer failed");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gbm_bo_get_handle_for_plane (bo, 0).s32 == -1)
|
||||
{
|
||||
/* Failed to fetch handle to plane, falling back to old method */
|
||||
strides[0] = gbm_bo_get_stride (bo);
|
||||
handles[0] = gbm_bo_get_handle (bo).u32;
|
||||
offsets[0] = 0;
|
||||
modifiers[0] = DRM_FORMAT_MOD_INVALID;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < gbm_bo_get_plane_count (bo); i++)
|
||||
{
|
||||
strides[i] = gbm_bo_get_stride_for_plane (bo, i);
|
||||
handles[i] = gbm_bo_get_handle_for_plane (bo, i).u32;
|
||||
offsets[i] = gbm_bo_get_offset (bo, i);
|
||||
modifiers[i] = gbm_bo_get_modifier (bo);
|
||||
}
|
||||
}
|
||||
|
||||
width = gbm_bo_get_width (bo);
|
||||
height = gbm_bo_get_height (bo);
|
||||
format = gbm_bo_get_format (bo);
|
||||
|
||||
if (use_modifiers && modifiers[0] != DRM_FORMAT_MOD_INVALID)
|
||||
{
|
||||
if (drmModeAddFB2WithModifiers (kms_fd,
|
||||
width, height,
|
||||
format,
|
||||
handles,
|
||||
strides,
|
||||
offsets,
|
||||
modifiers,
|
||||
&buffer_gbm->fb_id,
|
||||
DRM_MODE_FB_MODIFIERS))
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
g_io_error_from_errno (errno),
|
||||
"drmModeAddFB2WithModifiers failed: %s",
|
||||
g_strerror (errno));
|
||||
gbm_surface_release_buffer (buffer_gbm->surface, bo);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (drmModeAddFB2 (kms_fd,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
handles,
|
||||
strides,
|
||||
offsets,
|
||||
&buffer_gbm->fb_id,
|
||||
0))
|
||||
{
|
||||
if (format != DRM_FORMAT_XRGB8888)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"drmModeAddFB does not support format 0x%x",
|
||||
format);
|
||||
gbm_surface_release_buffer (buffer_gbm->surface, bo);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (drmModeAddFB (kms_fd,
|
||||
width,
|
||||
height,
|
||||
24,
|
||||
32,
|
||||
strides[0],
|
||||
handles[0],
|
||||
&buffer_gbm->fb_id))
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
g_io_error_from_errno (errno),
|
||||
"drmModeAddFB failed: %s",
|
||||
g_strerror (errno));
|
||||
gbm_surface_release_buffer (buffer_gbm->surface, bo);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
buffer_gbm->bo = bo;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
MetaDrmBufferGbm *
|
||||
meta_drm_buffer_gbm_new (MetaGpuKms *gpu_kms,
|
||||
struct gbm_surface *gbm_surface,
|
||||
gboolean use_modifiers,
|
||||
GError **error)
|
||||
{
|
||||
MetaDrmBufferGbm *buffer_gbm;
|
||||
|
||||
buffer_gbm = g_object_new (META_TYPE_DRM_BUFFER_GBM, NULL);
|
||||
buffer_gbm->gpu_kms = gpu_kms;
|
||||
buffer_gbm->surface = gbm_surface;
|
||||
|
||||
if (!acquire_swapped_buffer (buffer_gbm, use_modifiers, error))
|
||||
{
|
||||
g_object_unref (buffer_gbm);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return buffer_gbm;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
meta_drm_buffer_gbm_get_fb_id (MetaDrmBuffer *buffer)
|
||||
{
|
||||
return META_DRM_BUFFER_GBM (buffer)->fb_id;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_drm_buffer_gbm_finalize (GObject *object)
|
||||
{
|
||||
MetaDrmBufferGbm *buffer_gbm = META_DRM_BUFFER_GBM (object);
|
||||
|
||||
if (buffer_gbm->fb_id != INVALID_FB_ID)
|
||||
{
|
||||
int kms_fd;
|
||||
|
||||
kms_fd = meta_gpu_kms_get_fd (buffer_gbm->gpu_kms);
|
||||
drmModeRmFB (kms_fd, buffer_gbm->fb_id);
|
||||
}
|
||||
|
||||
if (buffer_gbm->bo)
|
||||
gbm_surface_release_buffer (buffer_gbm->surface, buffer_gbm->bo);
|
||||
|
||||
G_OBJECT_CLASS (meta_drm_buffer_gbm_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_drm_buffer_gbm_init (MetaDrmBufferGbm *buffer_gbm)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
meta_drm_buffer_gbm_class_init (MetaDrmBufferGbmClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
MetaDrmBufferClass *buffer_class = META_DRM_BUFFER_CLASS (klass);
|
||||
|
||||
object_class->finalize = meta_drm_buffer_gbm_finalize;
|
||||
|
||||
buffer_class->get_fb_id = meta_drm_buffer_gbm_get_fb_id;
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Canonical Ltd.
|
||||
* Copyright (C) 2019 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
|
||||
* 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 META_DRM_BUFFER_GBM_H
|
||||
#define META_DRM_BUFFER_GBM_H
|
||||
|
||||
#include <gbm.h>
|
||||
|
||||
#include "backends/native/meta-drm-buffer.h"
|
||||
#include "backends/native/meta-gpu-kms.h"
|
||||
|
||||
#define META_TYPE_DRM_BUFFER_GBM (meta_drm_buffer_gbm_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaDrmBufferGbm,
|
||||
meta_drm_buffer_gbm,
|
||||
META, DRM_BUFFER_GBM,
|
||||
MetaDrmBuffer)
|
||||
|
||||
MetaDrmBufferGbm * meta_drm_buffer_gbm_new (MetaGpuKms *gpu_kms,
|
||||
struct gbm_surface *gbm_surface,
|
||||
gboolean use_modifiers,
|
||||
GError **error);
|
||||
|
||||
struct gbm_bo * meta_drm_buffer_gbm_get_bo (MetaDrmBufferGbm *buffer_gbm);
|
||||
|
||||
#endif /* META_DRM_BUFFER_GBM_H */
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Intel Corporation.
|
||||
* Copyright (C) 2016 Red Hat
|
||||
* Copyright (C) 2018 DisplayLink (UK) Ltd.
|
||||
* Copyright (C) 2018 Canonical Ltd.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "backends/native/meta-drm-buffer.h"
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (MetaDrmBuffer, meta_drm_buffer, G_TYPE_OBJECT)
|
||||
|
||||
uint32_t
|
||||
meta_drm_buffer_get_fb_id (MetaDrmBuffer *buffer)
|
||||
{
|
||||
return META_DRM_BUFFER_GET_CLASS (buffer)->get_fb_id (buffer);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_drm_buffer_init (MetaDrmBuffer *buffer)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
meta_drm_buffer_class_init (MetaDrmBufferClass *klass)
|
||||
{
|
||||
}
|
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Canonical Ltd.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
|
||||
*/
|
||||
|
||||
#ifndef META_DRM_BUFFER_H
|
||||
#define META_DRM_BUFFER_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define META_TYPE_DRM_BUFFER (meta_drm_buffer_get_type ())
|
||||
G_DECLARE_DERIVABLE_TYPE (MetaDrmBuffer,
|
||||
meta_drm_buffer,
|
||||
META, DRM_BUFFER,
|
||||
GObject)
|
||||
|
||||
struct _MetaDrmBufferClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
uint32_t (* get_fb_id) (MetaDrmBuffer *buffer);
|
||||
};
|
||||
|
||||
MetaDrmBuffer *
|
||||
meta_drm_buffer_new_from_dumb (uint32_t dumb_fb_id);
|
||||
|
||||
uint32_t meta_drm_buffer_get_fb_id (MetaDrmBuffer *buffer);
|
||||
|
||||
#endif /* META_DRM_BUFFER_H */
|
@@ -251,15 +251,13 @@ get_session_proxy (GCancellable *cancellable,
|
||||
}
|
||||
|
||||
static Login1Seat *
|
||||
get_seat_proxy (gchar *seat_id,
|
||||
GCancellable *cancellable,
|
||||
get_seat_proxy (GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
g_autofree char *seat_proxy_path = get_escaped_dbus_path ("/org/freedesktop/login1/seat", seat_id);
|
||||
Login1Seat *seat = login1_seat_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
|
||||
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
|
||||
"org.freedesktop.login1",
|
||||
seat_proxy_path,
|
||||
"/org/freedesktop/login1/seat/self",
|
||||
cancellable, error);
|
||||
if (!seat)
|
||||
g_prefix_error(error, "Could not get seat proxy: ");
|
||||
@@ -513,7 +511,7 @@ meta_launcher_new (GError **error)
|
||||
if (!seat_id)
|
||||
goto fail;
|
||||
|
||||
seat_proxy = get_seat_proxy (seat_id, NULL, error);
|
||||
seat_proxy = get_seat_proxy (NULL, error);
|
||||
if (!seat_proxy)
|
||||
goto fail;
|
||||
|
||||
|
@@ -58,9 +58,6 @@
|
||||
#include "backends/meta-output.h"
|
||||
#include "backends/meta-renderer-view.h"
|
||||
#include "backends/native/meta-crtc-kms.h"
|
||||
#include "backends/native/meta-drm-buffer-dumb.h"
|
||||
#include "backends/native/meta-drm-buffer-gbm.h"
|
||||
#include "backends/native/meta-drm-buffer.h"
|
||||
#include "backends/native/meta-gpu-kms.h"
|
||||
#include "backends/native/meta-monitor-manager-kms.h"
|
||||
#include "backends/native/meta-renderer-native-gles3.h"
|
||||
@@ -73,6 +70,11 @@
|
||||
#define EGL_DRM_MASTER_FD_EXT 0x333C
|
||||
#endif
|
||||
|
||||
/* added in libdrm 2.4.95 */
|
||||
#ifndef DRM_FORMAT_INVALID
|
||||
#define DRM_FORMAT_INVALID 0
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
@@ -142,8 +144,10 @@ typedef struct _MetaOnscreenNativeSecondaryGpuState
|
||||
|
||||
struct {
|
||||
struct gbm_surface *surface;
|
||||
MetaDrmBuffer *current_fb;
|
||||
MetaDrmBuffer *next_fb;
|
||||
uint32_t current_fb_id;
|
||||
uint32_t next_fb_id;
|
||||
struct gbm_bo *current_bo;
|
||||
struct gbm_bo *next_bo;
|
||||
} gbm;
|
||||
|
||||
struct {
|
||||
@@ -164,8 +168,10 @@ typedef struct _MetaOnscreenNative
|
||||
|
||||
struct {
|
||||
struct gbm_surface *surface;
|
||||
MetaDrmBuffer *current_fb;
|
||||
MetaDrmBuffer *next_fb;
|
||||
uint32_t current_fb_id;
|
||||
uint32_t next_fb_id;
|
||||
struct gbm_bo *current_bo;
|
||||
struct gbm_bo *next_bo;
|
||||
} gbm;
|
||||
|
||||
#ifdef HAVE_EGL_DEVICE
|
||||
@@ -247,6 +253,11 @@ static void
|
||||
free_next_secondary_bo (MetaGpuKms *gpu_kms,
|
||||
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state);
|
||||
|
||||
static gboolean
|
||||
cogl_pixel_format_from_drm_format (uint32_t drm_format,
|
||||
CoglPixelFormat *out_format,
|
||||
CoglTextureComponents *out_components);
|
||||
|
||||
static MetaBackend *
|
||||
backend_from_renderer_native (MetaRendererNative *renderer_native)
|
||||
{
|
||||
@@ -960,12 +971,25 @@ free_current_secondary_bo (MetaGpuKms *gpu_kms,
|
||||
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state)
|
||||
{
|
||||
MetaRendererNativeGpuData *renderer_gpu_data;
|
||||
int kms_fd;
|
||||
|
||||
kms_fd = meta_gpu_kms_get_fd (gpu_kms);
|
||||
|
||||
renderer_gpu_data = secondary_gpu_state->renderer_gpu_data;
|
||||
switch (renderer_gpu_data->secondary.copy_mode)
|
||||
{
|
||||
case META_SHARED_FRAMEBUFFER_COPY_MODE_GPU:
|
||||
g_clear_object (&secondary_gpu_state->gbm.current_fb);
|
||||
if (secondary_gpu_state->gbm.current_fb_id)
|
||||
{
|
||||
drmModeRmFB (kms_fd, secondary_gpu_state->gbm.current_fb_id);
|
||||
secondary_gpu_state->gbm.current_fb_id = 0;
|
||||
}
|
||||
if (secondary_gpu_state->gbm.current_bo)
|
||||
{
|
||||
gbm_surface_release_buffer (secondary_gpu_state->gbm.surface,
|
||||
secondary_gpu_state->gbm.current_bo);
|
||||
secondary_gpu_state->gbm.current_bo = NULL;
|
||||
}
|
||||
break;
|
||||
case META_SHARED_FRAMEBUFFER_COPY_MODE_CPU:
|
||||
break;
|
||||
@@ -977,8 +1001,22 @@ free_current_bo (CoglOnscreen *onscreen)
|
||||
{
|
||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
||||
MetaGpuKms *render_gpu = onscreen_native->render_gpu;
|
||||
int kms_fd;
|
||||
|
||||
g_clear_object (&onscreen_native->gbm.current_fb);
|
||||
kms_fd = meta_gpu_kms_get_fd (render_gpu);
|
||||
|
||||
if (onscreen_native->gbm.current_fb_id)
|
||||
{
|
||||
drmModeRmFB (kms_fd, onscreen_native->gbm.current_fb_id);
|
||||
onscreen_native->gbm.current_fb_id = 0;
|
||||
}
|
||||
if (onscreen_native->gbm.current_bo)
|
||||
{
|
||||
gbm_surface_release_buffer (onscreen_native->gbm.surface,
|
||||
onscreen_native->gbm.current_bo);
|
||||
onscreen_native->gbm.current_bo = NULL;
|
||||
}
|
||||
|
||||
g_hash_table_foreach (onscreen_native->secondary_gpu_states,
|
||||
(GHFunc) free_current_secondary_bo,
|
||||
@@ -1272,9 +1310,11 @@ static void
|
||||
swap_secondary_drm_fb (MetaGpuKms *gpu_kms,
|
||||
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state)
|
||||
{
|
||||
g_set_object (&secondary_gpu_state->gbm.current_fb,
|
||||
secondary_gpu_state->gbm.next_fb);
|
||||
g_clear_object (&secondary_gpu_state->gbm.next_fb);
|
||||
secondary_gpu_state->gbm.current_fb_id = secondary_gpu_state->gbm.next_fb_id;
|
||||
secondary_gpu_state->gbm.next_fb_id = 0;
|
||||
|
||||
secondary_gpu_state->gbm.current_bo = secondary_gpu_state->gbm.next_bo;
|
||||
secondary_gpu_state->gbm.next_bo = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1285,8 +1325,11 @@ meta_onscreen_native_swap_drm_fb (CoglOnscreen *onscreen)
|
||||
|
||||
free_current_bo (onscreen);
|
||||
|
||||
g_set_object (&onscreen_native->gbm.current_fb, onscreen_native->gbm.next_fb);
|
||||
g_clear_object (&onscreen_native->gbm.next_fb);
|
||||
onscreen_native->gbm.current_fb_id = onscreen_native->gbm.next_fb_id;
|
||||
onscreen_native->gbm.next_fb_id = 0;
|
||||
|
||||
onscreen_native->gbm.current_bo = onscreen_native->gbm.next_bo;
|
||||
onscreen_native->gbm.next_bo = NULL;
|
||||
|
||||
g_hash_table_foreach (onscreen_native->secondary_gpu_states,
|
||||
(GHFunc) swap_secondary_drm_fb,
|
||||
@@ -1370,7 +1413,17 @@ free_next_secondary_bo (MetaGpuKms *gpu_kms,
|
||||
switch (renderer_gpu_data->secondary.copy_mode)
|
||||
{
|
||||
case META_SHARED_FRAMEBUFFER_COPY_MODE_GPU:
|
||||
g_clear_object (&secondary_gpu_state->gbm.next_fb);
|
||||
if (secondary_gpu_state->gbm.next_fb_id)
|
||||
{
|
||||
int kms_fd;
|
||||
|
||||
kms_fd = meta_gpu_kms_get_fd (gpu_kms);
|
||||
drmModeRmFB (kms_fd, secondary_gpu_state->gbm.next_fb_id);
|
||||
gbm_surface_release_buffer (secondary_gpu_state->gbm.surface,
|
||||
secondary_gpu_state->gbm.next_bo);
|
||||
secondary_gpu_state->gbm.next_fb_id = 0;
|
||||
secondary_gpu_state->gbm.next_bo = NULL;
|
||||
}
|
||||
break;
|
||||
case META_SHARED_FRAMEBUFFER_COPY_MODE_CPU:
|
||||
break;
|
||||
@@ -1395,7 +1448,17 @@ flip_closure_destroyed (MetaRendererView *view)
|
||||
switch (renderer_gpu_data->mode)
|
||||
{
|
||||
case META_RENDERER_NATIVE_MODE_GBM:
|
||||
g_clear_object (&onscreen_native->gbm.next_fb);
|
||||
if (onscreen_native->gbm.next_fb_id)
|
||||
{
|
||||
int kms_fd;
|
||||
|
||||
kms_fd = meta_gpu_kms_get_fd (render_gpu);
|
||||
drmModeRmFB (kms_fd, onscreen_native->gbm.next_fb_id);
|
||||
gbm_surface_release_buffer (onscreen_native->gbm.surface,
|
||||
onscreen_native->gbm.next_bo);
|
||||
onscreen_native->gbm.next_bo = NULL;
|
||||
onscreen_native->gbm.next_fb_id = 0;
|
||||
}
|
||||
|
||||
g_hash_table_foreach (onscreen_native->secondary_gpu_states,
|
||||
(GHFunc) free_next_secondary_bo,
|
||||
@@ -1745,12 +1808,12 @@ meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
|
||||
case META_RENDERER_NATIVE_MODE_GBM:
|
||||
if (gpu_kms == render_gpu)
|
||||
{
|
||||
fb_id = meta_drm_buffer_get_fb_id (onscreen_native->gbm.next_fb);
|
||||
fb_id = onscreen_native->gbm.next_fb_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
secondary_gpu_state = get_secondary_gpu_state (onscreen, gpu_kms);
|
||||
fb_id = meta_drm_buffer_get_fb_id (secondary_gpu_state->gbm.next_fb);
|
||||
fb_id = secondary_gpu_state->gbm.next_fb_id;
|
||||
}
|
||||
|
||||
if (!meta_gpu_kms_flip_crtc (gpu_kms,
|
||||
@@ -1816,7 +1879,7 @@ set_crtc_fb (CoglOnscreen *onscreen,
|
||||
if (!secondary_gpu_state)
|
||||
return;
|
||||
|
||||
fb_id = meta_drm_buffer_get_fb_id (secondary_gpu_state->gbm.next_fb);
|
||||
fb_id = secondary_gpu_state->gbm.next_fb_id;
|
||||
}
|
||||
|
||||
x = crtc->rect.x - logical_monitor->rect.x;
|
||||
@@ -1859,7 +1922,7 @@ meta_onscreen_native_set_crtc_modes (CoglOnscreen *onscreen)
|
||||
switch (renderer_gpu_data->mode)
|
||||
{
|
||||
case META_RENDERER_NATIVE_MODE_GBM:
|
||||
fb_id = meta_drm_buffer_get_fb_id (onscreen_native->gbm.next_fb);
|
||||
fb_id = onscreen_native->gbm.next_fb_id;
|
||||
break;
|
||||
#ifdef HAVE_EGL_DEVICE
|
||||
case META_RENDERER_NATIVE_MODE_EGL_DEVICE:
|
||||
@@ -1927,7 +1990,7 @@ crtc_mode_set_fallback (CoglOnscreen *onscreen,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fb_id = meta_drm_buffer_get_fb_id (onscreen_native->gbm.next_fb);
|
||||
fb_id = onscreen_native->gbm.next_fb_id;
|
||||
set_crtc_fb (onscreen, logical_monitor, crtc, fb_id);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -2027,6 +2090,101 @@ meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen)
|
||||
g_closure_unref (flip_closure);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gbm_get_next_fb_id (MetaGpuKms *gpu_kms,
|
||||
struct gbm_surface *gbm_surface,
|
||||
struct gbm_bo **out_next_bo,
|
||||
uint32_t *out_next_fb_id)
|
||||
{
|
||||
MetaRendererNative *renderer_native = meta_renderer_native_from_gpu (gpu_kms);
|
||||
struct gbm_bo *next_bo;
|
||||
uint32_t next_fb_id;
|
||||
int kms_fd;
|
||||
uint32_t handles[4] = { 0, };
|
||||
uint32_t strides[4] = { 0, };
|
||||
uint32_t offsets[4] = { 0, };
|
||||
uint64_t modifiers[4] = { 0, };
|
||||
int i;
|
||||
|
||||
/* Now we need to set the CRTC to whatever is the front buffer */
|
||||
next_bo = gbm_surface_lock_front_buffer (gbm_surface);
|
||||
|
||||
if (!next_bo)
|
||||
{
|
||||
g_error ("Impossible to lock surface front buffer: %m");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gbm_bo_get_handle_for_plane (next_bo, 0).s32 == -1)
|
||||
{
|
||||
/* Failed to fetch handle to plane, falling back to old method */
|
||||
strides[0] = gbm_bo_get_stride (next_bo);
|
||||
handles[0] = gbm_bo_get_handle (next_bo).u32;
|
||||
offsets[0] = 0;
|
||||
modifiers[0] = DRM_FORMAT_MOD_INVALID;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < gbm_bo_get_plane_count (next_bo); i++)
|
||||
{
|
||||
strides[i] = gbm_bo_get_stride_for_plane (next_bo, i);
|
||||
handles[i] = gbm_bo_get_handle_for_plane (next_bo, i).u32;
|
||||
offsets[i] = gbm_bo_get_offset (next_bo, i);
|
||||
modifiers[i] = gbm_bo_get_modifier (next_bo);
|
||||
}
|
||||
}
|
||||
|
||||
kms_fd = meta_gpu_kms_get_fd (gpu_kms);
|
||||
|
||||
if (renderer_native->use_modifiers &&
|
||||
modifiers[0] != DRM_FORMAT_MOD_INVALID)
|
||||
{
|
||||
if (drmModeAddFB2WithModifiers (kms_fd,
|
||||
gbm_bo_get_width (next_bo),
|
||||
gbm_bo_get_height (next_bo),
|
||||
gbm_bo_get_format (next_bo),
|
||||
handles,
|
||||
strides,
|
||||
offsets,
|
||||
modifiers,
|
||||
&next_fb_id,
|
||||
DRM_MODE_FB_MODIFIERS))
|
||||
{
|
||||
g_warning ("Failed to create new back buffer handle: %m");
|
||||
gbm_surface_release_buffer (gbm_surface, next_bo);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (drmModeAddFB2 (kms_fd,
|
||||
gbm_bo_get_width (next_bo),
|
||||
gbm_bo_get_height (next_bo),
|
||||
gbm_bo_get_format (next_bo),
|
||||
handles,
|
||||
strides,
|
||||
offsets,
|
||||
&next_fb_id,
|
||||
0))
|
||||
{
|
||||
if (drmModeAddFB (kms_fd,
|
||||
gbm_bo_get_width (next_bo),
|
||||
gbm_bo_get_height (next_bo),
|
||||
24, /* depth */
|
||||
32, /* bpp */
|
||||
strides[0],
|
||||
handles[0],
|
||||
&next_fb_id))
|
||||
{
|
||||
g_warning ("Failed to create new back buffer handle: %m");
|
||||
gbm_surface_release_buffer (gbm_surface, next_bo);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
*out_next_bo = next_bo;
|
||||
*out_next_fb_id = next_fb_id;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
wait_for_pending_flips (CoglOnscreen *onscreen)
|
||||
{
|
||||
@@ -2059,8 +2217,6 @@ copy_shared_framebuffer_gpu (CoglOnscreen *onscreen,
|
||||
MetaRendererNative *renderer_native = renderer_gpu_data->renderer_native;
|
||||
MetaEgl *egl = meta_renderer_native_get_egl (renderer_native);
|
||||
GError *error = NULL;
|
||||
MetaDrmBufferGbm *buffer_gbm;
|
||||
struct gbm_bo *bo;
|
||||
|
||||
if (!meta_egl_make_current (egl,
|
||||
renderer_gpu_data->egl_display,
|
||||
@@ -2076,14 +2232,12 @@ copy_shared_framebuffer_gpu (CoglOnscreen *onscreen,
|
||||
|
||||
*egl_context_changed = TRUE;
|
||||
|
||||
buffer_gbm = META_DRM_BUFFER_GBM (onscreen_native->gbm.next_fb);
|
||||
bo = meta_drm_buffer_gbm_get_bo (buffer_gbm);
|
||||
if (!meta_renderer_native_gles3_blit_shared_bo (egl,
|
||||
renderer_native->gles3,
|
||||
renderer_gpu_data->egl_display,
|
||||
renderer_gpu_data->secondary.egl_context,
|
||||
secondary_gpu_state->egl_surface,
|
||||
bo,
|
||||
onscreen_native->gbm.next_bo,
|
||||
&error))
|
||||
{
|
||||
g_warning ("Failed to blit shared framebuffer: %s", error->message);
|
||||
@@ -2101,19 +2255,69 @@ copy_shared_framebuffer_gpu (CoglOnscreen *onscreen,
|
||||
return;
|
||||
}
|
||||
|
||||
g_clear_object (&secondary_gpu_state->gbm.next_fb);
|
||||
buffer_gbm = meta_drm_buffer_gbm_new (secondary_gpu_state->gpu_kms,
|
||||
secondary_gpu_state->gbm.surface,
|
||||
renderer_native->use_modifiers,
|
||||
&error);
|
||||
secondary_gpu_state->gbm.next_fb = META_DRM_BUFFER (buffer_gbm);
|
||||
if (!secondary_gpu_state->gbm.next_fb)
|
||||
gbm_get_next_fb_id (secondary_gpu_state->gpu_kms,
|
||||
secondary_gpu_state->gbm.surface,
|
||||
&secondary_gpu_state->gbm.next_bo,
|
||||
&secondary_gpu_state->gbm.next_fb_id);
|
||||
}
|
||||
|
||||
typedef struct _PixelFormatMap {
|
||||
uint32_t drm_format;
|
||||
CoglPixelFormat cogl_format;
|
||||
CoglTextureComponents cogl_components;
|
||||
} PixelFormatMap;
|
||||
|
||||
static const PixelFormatMap pixel_format_map[] = {
|
||||
/* DRM formats are defined as little-endian, not machine endian. */
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
{ DRM_FORMAT_RGB565, COGL_PIXEL_FORMAT_RGB_565, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_ABGR8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_XBGR8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_ARGB8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_XRGB8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_BGRA8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_BGRX8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
#elif G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
/* DRM_FORMAT_RGB565 cannot be expressed. */
|
||||
{ DRM_FORMAT_ABGR8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_XBGR8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_ARGB8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_XRGB8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_BGRA8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_BGRX8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
{ DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
|
||||
{ DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
|
||||
#else
|
||||
#error "unexpected G_BYTE_ORDER"
|
||||
#endif
|
||||
};
|
||||
|
||||
static gboolean
|
||||
cogl_pixel_format_from_drm_format (uint32_t drm_format,
|
||||
CoglPixelFormat *out_format,
|
||||
CoglTextureComponents *out_components)
|
||||
{
|
||||
const size_t n = G_N_ELEMENTS (pixel_format_map);
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
g_warning ("meta_drm_buffer_gbm_new failed: %s",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
if (pixel_format_map[i].drm_format == drm_format)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == n)
|
||||
return FALSE;
|
||||
|
||||
if (out_format)
|
||||
*out_format = pixel_format_map[i].cogl_format;
|
||||
|
||||
if (out_components)
|
||||
*out_components = pixel_format_map[i].cogl_components;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2133,7 +2337,6 @@ copy_shared_framebuffer_cpu (CoglOnscreen *onscreen,
|
||||
CoglBitmap *dumb_bitmap;
|
||||
CoglPixelFormat cogl_format;
|
||||
gboolean ret;
|
||||
MetaDrmBufferDumb *buffer_dumb;
|
||||
|
||||
width = cogl_framebuffer_get_width (framebuffer);
|
||||
height = cogl_framebuffer_get_height (framebuffer);
|
||||
@@ -2174,9 +2377,7 @@ copy_shared_framebuffer_cpu (CoglOnscreen *onscreen,
|
||||
|
||||
cogl_object_unref (dumb_bitmap);
|
||||
|
||||
g_clear_object (&secondary_gpu_state->gbm.next_fb);
|
||||
buffer_dumb = meta_drm_buffer_dumb_new (target_fb_id);
|
||||
secondary_gpu_state->gbm.next_fb = META_DRM_BUFFER (buffer_dumb);
|
||||
secondary_gpu_state->gbm.next_fb_id = target_fb_id;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2263,8 +2464,6 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
||||
CoglFrameInfo *frame_info;
|
||||
gboolean egl_context_changed = FALSE;
|
||||
MetaPowerSave power_save_mode;
|
||||
g_autoptr (GError) error = NULL;
|
||||
MetaDrmBufferGbm *buffer_gbm;
|
||||
|
||||
/*
|
||||
* Wait for the flip callback before continuing, as we might have started the
|
||||
@@ -2286,20 +2485,14 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
||||
switch (renderer_gpu_data->mode)
|
||||
{
|
||||
case META_RENDERER_NATIVE_MODE_GBM:
|
||||
g_warn_if_fail (onscreen_native->gbm.next_fb == NULL);
|
||||
g_clear_object (&onscreen_native->gbm.next_fb);
|
||||
g_warn_if_fail (onscreen_native->gbm.next_bo == NULL &&
|
||||
onscreen_native->gbm.next_fb_id == 0);
|
||||
|
||||
buffer_gbm = meta_drm_buffer_gbm_new (render_gpu,
|
||||
onscreen_native->gbm.surface,
|
||||
renderer_native->use_modifiers,
|
||||
&error);
|
||||
onscreen_native->gbm.next_fb = META_DRM_BUFFER (buffer_gbm);
|
||||
if (!onscreen_native->gbm.next_fb)
|
||||
{
|
||||
g_warning ("meta_drm_buffer_gbm_new failed: %s",
|
||||
error->message);
|
||||
return;
|
||||
}
|
||||
if (!gbm_get_next_fb_id (render_gpu,
|
||||
onscreen_native->gbm.surface,
|
||||
&onscreen_native->gbm.next_bo,
|
||||
&onscreen_native->gbm.next_fb_id))
|
||||
return;
|
||||
|
||||
break;
|
||||
#ifdef HAVE_EGL_DEVICE
|
||||
@@ -2890,7 +3083,7 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
|
||||
case META_RENDERER_NATIVE_MODE_GBM:
|
||||
/* flip state takes a reference on the onscreen so there should
|
||||
* never be outstanding flips when we reach here. */
|
||||
g_return_if_fail (onscreen_native->gbm.next_fb == NULL);
|
||||
g_return_if_fail (onscreen_native->gbm.next_fb_id == 0);
|
||||
|
||||
free_current_bo (onscreen);
|
||||
|
||||
|
@@ -357,6 +357,7 @@ handle_host_xevent (MetaBackend *backend,
|
||||
{
|
||||
switch (xkb_ev->any.xkb_type)
|
||||
{
|
||||
case XkbNewKeyboardNotify:
|
||||
case XkbMapNotify:
|
||||
keymap_changed (backend);
|
||||
break;
|
||||
|
@@ -203,7 +203,7 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer,
|
||||
height = logical_monitor->rect.height;
|
||||
}
|
||||
width = roundf (width * view_scale);
|
||||
height = roundf (height * view_scale);
|
||||
height = roundf (width * view_scale);
|
||||
|
||||
fake_onscreen = create_offscreen (cogl_context, width, height);
|
||||
|
||||
|
@@ -692,8 +692,11 @@ meta_compositor_add_window (MetaCompositor *compositor,
|
||||
{
|
||||
MetaWindowActor *window_actor;
|
||||
ClutterActor *window_group;
|
||||
MetaDisplay *display = compositor->display;
|
||||
GType window_actor_type = G_TYPE_INVALID;
|
||||
|
||||
meta_x11_error_trap_push (display->x11_display);
|
||||
|
||||
switch (window->client_type)
|
||||
{
|
||||
case META_WINDOW_CLIENT_TYPE_X11:
|
||||
@@ -721,6 +724,8 @@ meta_compositor_add_window (MetaCompositor *compositor,
|
||||
*/
|
||||
compositor->windows = g_list_append (compositor->windows, window_actor);
|
||||
sync_actor_stacking (compositor);
|
||||
|
||||
meta_x11_error_trap_pop (display->x11_display);
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -55,8 +55,17 @@ meta_rectangle_free (MetaRectangle *rect)
|
||||
g_free (rect);
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE (MetaRectangle, meta_rectangle,
|
||||
meta_rectangle_copy, meta_rectangle_free);
|
||||
GType
|
||||
meta_rectangle_get_type (void)
|
||||
{
|
||||
static GType type_id = 0;
|
||||
|
||||
if (!type_id)
|
||||
type_id = g_boxed_type_register_static (g_intern_static_string ("MetaRectangle"),
|
||||
(GBoxedCopyFunc) meta_rectangle_copy,
|
||||
(GBoxedFreeFunc) meta_rectangle_free);
|
||||
return type_id;
|
||||
}
|
||||
|
||||
char*
|
||||
meta_rectangle_to_string (const MetaRectangle *rect,
|
||||
@@ -842,7 +851,10 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect,
|
||||
void
|
||||
meta_rectangle_free_list_and_elements (GList *filled_list)
|
||||
{
|
||||
g_list_free_full (filled_list, g_free);
|
||||
g_list_foreach (filled_list,
|
||||
(void (*)(gpointer,gpointer))&g_free, /* ew, for ugly */
|
||||
NULL);
|
||||
g_list_free (filled_list);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -2042,11 +2054,25 @@ meta_rectangle_scale_double (const MetaRectangle *rect,
|
||||
MetaRoundingStrategy rounding_strategy,
|
||||
MetaRectangle *dest)
|
||||
{
|
||||
ClutterRect tmp = CLUTTER_RECT_INIT (rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
|
||||
clutter_rect_scale (&tmp, scale, scale);
|
||||
meta_rectangle_from_clutter_rect (&tmp, rounding_strategy, dest);
|
||||
switch (rounding_strategy)
|
||||
{
|
||||
case META_ROUNDING_STRATEGY_SHRINK:
|
||||
*dest = (MetaRectangle) {
|
||||
.x = (int) ceil (rect->x * scale),
|
||||
.y = (int) ceil (rect->y * scale),
|
||||
.width = (int) floor (rect->width * scale),
|
||||
.height = (int) floor (rect->height * scale),
|
||||
};
|
||||
break;
|
||||
case META_ROUNDING_STRATEGY_GROW:
|
||||
*dest = (MetaRectangle) {
|
||||
.x = (int) floor (rect->x * scale),
|
||||
.y = (int) floor (rect->y * scale),
|
||||
.width = (int) ceil (rect->width * scale),
|
||||
.height = (int) ceil (rect->height * scale),
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2059,7 +2085,12 @@ meta_rectangle_transform (const MetaRectangle *rect,
|
||||
switch (transform)
|
||||
{
|
||||
case META_MONITOR_TRANSFORM_NORMAL:
|
||||
*dest = *rect;
|
||||
*dest = (MetaRectangle) {
|
||||
.x = rect->x,
|
||||
.y = rect->y,
|
||||
.width = rect->width,
|
||||
.height = rect->height,
|
||||
};
|
||||
break;
|
||||
case META_MONITOR_TRANSFORM_90:
|
||||
*dest = (MetaRectangle) {
|
||||
|
@@ -140,6 +140,14 @@ struct _MetaDisplay
|
||||
*/
|
||||
guint allow_terminal_deactivation : 1;
|
||||
|
||||
/* If true, server->focus_serial refers to us changing the focus; in
|
||||
* this case, we can ignore focus events that have exactly focus_serial,
|
||||
* since we take care to make another request immediately afterwards.
|
||||
* But if focus is being changed by another client, we have to accept
|
||||
* multiple events with the same serial.
|
||||
*/
|
||||
guint focused_by_us : 1;
|
||||
|
||||
/*< private-ish >*/
|
||||
GHashTable *stamps;
|
||||
GHashTable *wayland_windows;
|
||||
@@ -195,6 +203,10 @@ struct _MetaDisplay
|
||||
MetaEdgeResistanceData *grab_edge_resistance_data;
|
||||
unsigned int grab_last_user_action_was_snap;
|
||||
|
||||
/* we use property updates as sentinels for certain window focus events
|
||||
* to avoid some race conditions on EnterNotify events
|
||||
*/
|
||||
int sentinel_counter;
|
||||
int grab_resize_timeout_id;
|
||||
|
||||
MetaKeyBindingManager key_binding_manager;
|
||||
@@ -351,6 +363,10 @@ gboolean meta_grab_op_is_resizing (MetaGrabOp op);
|
||||
gboolean meta_grab_op_is_mouse (MetaGrabOp op);
|
||||
gboolean meta_grab_op_is_keyboard (MetaGrabOp op);
|
||||
|
||||
void meta_display_increment_focus_sentinel (MetaDisplay *display);
|
||||
void meta_display_decrement_focus_sentinel (MetaDisplay *display);
|
||||
gboolean meta_display_focus_sentinel_clear (MetaDisplay *display);
|
||||
|
||||
void meta_display_queue_autoraise_callback (MetaDisplay *display,
|
||||
MetaWindow *window);
|
||||
void meta_display_remove_autoraise_callback (MetaDisplay *display);
|
||||
@@ -363,7 +379,10 @@ gboolean meta_display_modifiers_accelerator_activate (MetaDisplay *display);
|
||||
|
||||
void meta_display_sync_wayland_input_focus (MetaDisplay *display);
|
||||
void meta_display_update_focus_window (MetaDisplay *display,
|
||||
MetaWindow *window);
|
||||
MetaWindow *window,
|
||||
Window xwindow,
|
||||
gulong serial,
|
||||
gboolean focused_by_us);
|
||||
|
||||
void meta_display_sanity_check_timestamps (MetaDisplay *display,
|
||||
guint32 timestamp);
|
||||
@@ -427,8 +446,4 @@ MetaWindow *meta_display_get_window_from_id (MetaDisplay *display,
|
||||
uint64_t window_id);
|
||||
uint64_t meta_display_generate_window_id (MetaDisplay *display);
|
||||
|
||||
gboolean meta_display_init_x11 (MetaDisplay *display,
|
||||
GError **error);
|
||||
void meta_display_shutdown_x11 (MetaDisplay *display);
|
||||
|
||||
#endif
|
||||
|
@@ -49,7 +49,6 @@
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "backends/meta-stage-private.h"
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
#include "backends/x11/cm/meta-backend-x11-cm.h"
|
||||
#include "clutter/x11/clutter-x11.h"
|
||||
#include "core/bell.h"
|
||||
#include "core/boxes-private.h"
|
||||
@@ -631,39 +630,6 @@ on_ui_scaling_factor_changed (MetaSettings *settings,
|
||||
meta_display_reload_cursor (display);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_display_init_x11 (MetaDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
MetaX11Display *x11_display;
|
||||
|
||||
g_assert (display->x11_display == NULL);
|
||||
|
||||
x11_display = meta_x11_display_new (display, error);
|
||||
if (!x11_display)
|
||||
return FALSE;
|
||||
|
||||
display->x11_display = x11_display;
|
||||
g_signal_emit (display, display_signals[X11_DISPLAY_OPENED], 0);
|
||||
meta_x11_display_create_guard_window (x11_display);
|
||||
|
||||
if (!display->display_opening)
|
||||
meta_display_manage_all_windows (display);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_shutdown_x11 (MetaDisplay *display)
|
||||
{
|
||||
if (!display->x11_display)
|
||||
return;
|
||||
|
||||
g_signal_emit (display, display_signals[X11_DISPLAY_CLOSING], 0);
|
||||
g_object_run_dispose (G_OBJECT (display->x11_display));
|
||||
g_clear_object (&display->x11_display);
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_display_open:
|
||||
*
|
||||
@@ -679,6 +645,7 @@ meta_display_open (void)
|
||||
{
|
||||
GError *error = NULL;
|
||||
MetaDisplay *display;
|
||||
MetaX11Display *x11_display;
|
||||
int i;
|
||||
guint32 timestamp;
|
||||
Window old_active_xwindow = None;
|
||||
@@ -716,6 +683,7 @@ meta_display_open (void)
|
||||
}
|
||||
|
||||
display->current_time = META_CURRENT_TIME;
|
||||
display->sentinel_counter = 0;
|
||||
|
||||
display->grab_resize_timeout_id = 0;
|
||||
display->grab_have_keyboard = FALSE;
|
||||
@@ -725,7 +693,7 @@ meta_display_open (void)
|
||||
display->grab_tile_mode = META_TILE_NONE;
|
||||
display->grab_tile_monitor_number = -1;
|
||||
|
||||
meta_display_cleanup_edges (display);
|
||||
display->grab_edge_resistance_data = NULL;
|
||||
|
||||
meta_display_init_keys (display);
|
||||
|
||||
@@ -762,8 +730,10 @@ meta_display_open (void)
|
||||
|
||||
if (meta_should_autostart_x11_display ())
|
||||
{
|
||||
if (!meta_display_init_x11 (display, &error))
|
||||
g_error ("Failed to start Xwayland: %s", error->message);
|
||||
x11_display = meta_x11_display_new (display, &error);
|
||||
g_assert (x11_display != NULL); /* Required, for now */
|
||||
display->x11_display = x11_display;
|
||||
g_signal_emit (display, display_signals[X11_DISPLAY_OPENED], 0);
|
||||
|
||||
timestamp = display->x11_display->timestamp;
|
||||
}
|
||||
@@ -809,12 +779,10 @@ meta_display_open (void)
|
||||
if (old_active_window)
|
||||
meta_window_focus (old_active_window, timestamp);
|
||||
else
|
||||
meta_display_unset_input_focus (display, timestamp);
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_display_unset_input_focus (display, timestamp);
|
||||
meta_x11_display_focus_the_no_focus_window (display->x11_display, timestamp);
|
||||
}
|
||||
else if (display->x11_display)
|
||||
meta_x11_display_focus_the_no_focus_window (display->x11_display, timestamp);
|
||||
|
||||
meta_idle_monitor_init_dbus ();
|
||||
|
||||
@@ -956,7 +924,7 @@ meta_display_close (MetaDisplay *display,
|
||||
|
||||
g_clear_object (&display->gesture_tracker);
|
||||
|
||||
g_clear_object (&display->stack);
|
||||
g_clear_pointer (&display->stack, meta_stack_free);
|
||||
g_clear_pointer (&display->stack_tracker,
|
||||
meta_stack_tracker_free);
|
||||
|
||||
@@ -985,7 +953,12 @@ meta_display_close (MetaDisplay *display,
|
||||
if (display->compositor)
|
||||
meta_compositor_destroy (display->compositor);
|
||||
|
||||
meta_display_shutdown_x11 (display);
|
||||
if (display->x11_display)
|
||||
{
|
||||
g_signal_emit (display, display_signals[X11_DISPLAY_CLOSING], 0);
|
||||
g_object_run_dispose (G_OBJECT (display->x11_display));
|
||||
g_clear_object (&display->x11_display);
|
||||
}
|
||||
|
||||
meta_display_shutdown_keys (display);
|
||||
|
||||
@@ -1265,9 +1238,16 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display)
|
||||
|
||||
void
|
||||
meta_display_update_focus_window (MetaDisplay *display,
|
||||
MetaWindow *window)
|
||||
MetaWindow *window,
|
||||
Window xwindow,
|
||||
gulong serial,
|
||||
gboolean focused_by_us)
|
||||
{
|
||||
if (display->focus_window == window)
|
||||
display->x11_display->focus_serial = serial;
|
||||
display->focused_by_us = focused_by_us;
|
||||
|
||||
if (display->x11_display->focus_xwindow == xwindow &&
|
||||
display->focus_window == window)
|
||||
return;
|
||||
|
||||
if (display->focus_window)
|
||||
@@ -1284,25 +1264,28 @@ meta_display_update_focus_window (MetaDisplay *display,
|
||||
*/
|
||||
previous = display->focus_window;
|
||||
display->focus_window = NULL;
|
||||
display->x11_display->focus_xwindow = None;
|
||||
|
||||
meta_window_set_focused_internal (previous, FALSE);
|
||||
}
|
||||
|
||||
display->focus_window = window;
|
||||
display->x11_display->focus_xwindow = xwindow;
|
||||
|
||||
if (display->focus_window)
|
||||
{
|
||||
meta_topic (META_DEBUG_FOCUS, "* Focus --> %s\n",
|
||||
display->focus_window->desc);
|
||||
meta_topic (META_DEBUG_FOCUS, "* Focus --> %s with serial %lu\n",
|
||||
display->focus_window->desc, serial);
|
||||
meta_window_set_focused_internal (display->focus_window, TRUE);
|
||||
}
|
||||
else
|
||||
meta_topic (META_DEBUG_FOCUS, "* Focus --> NULL\n");
|
||||
meta_topic (META_DEBUG_FOCUS, "* Focus --> NULL with serial %lu\n", serial);
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
meta_display_sync_wayland_input_focus (display);
|
||||
|
||||
g_object_notify (G_OBJECT (display), "focus-window");
|
||||
meta_x11_display_update_active_window_hint (display->x11_display);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -1334,51 +1317,6 @@ meta_display_timestamp_too_old (MetaDisplay *display,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_set_input_focus (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
gboolean focus_frame,
|
||||
guint32 timestamp)
|
||||
{
|
||||
if (meta_display_timestamp_too_old (display, ×tamp))
|
||||
return;
|
||||
|
||||
if (display->x11_display)
|
||||
{
|
||||
MetaX11Display *x11_display = display->x11_display;
|
||||
Window xwindow;
|
||||
gulong serial;
|
||||
|
||||
meta_x11_error_trap_push (x11_display);
|
||||
|
||||
if (window)
|
||||
xwindow = focus_frame ? window->frame->xwindow : window->xwindow;
|
||||
else
|
||||
xwindow = x11_display->no_focus_window;
|
||||
|
||||
meta_x11_display_set_input_focus (x11_display, xwindow, timestamp);
|
||||
serial = XNextRequest (x11_display->xdisplay);
|
||||
|
||||
meta_x11_display_update_focus_window (x11_display, xwindow, serial, TRUE);
|
||||
|
||||
meta_x11_error_trap_pop (display->x11_display);
|
||||
}
|
||||
|
||||
meta_display_update_focus_window (display, window);
|
||||
|
||||
display->last_focus_time = timestamp;
|
||||
|
||||
if (window == NULL || window != display->autoraise_window)
|
||||
meta_display_remove_autoraise_callback (display);
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_unset_input_focus (MetaDisplay *display,
|
||||
guint32 timestamp)
|
||||
{
|
||||
meta_display_set_input_focus (display, NULL, FALSE, timestamp);
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_register_wayland_window (MetaDisplay *display,
|
||||
MetaWindow *window)
|
||||
@@ -1740,17 +1678,14 @@ meta_display_begin_grab_op (MetaDisplay *display,
|
||||
if (pointer_already_grabbed)
|
||||
display->grab_have_pointer = TRUE;
|
||||
|
||||
if (META_IS_BACKEND_X11 (meta_get_backend ()) && display->x11_display)
|
||||
{
|
||||
/* Since grab operations often happen as a result of implicit
|
||||
* pointer operations on the display X11 connection, we need
|
||||
* to ungrab here to ensure that the backend's X11 can take
|
||||
* the device grab. */
|
||||
XIUngrabDevice (display->x11_display->xdisplay,
|
||||
META_VIRTUAL_CORE_POINTER_ID,
|
||||
timestamp);
|
||||
XSync (display->x11_display->xdisplay, False);
|
||||
}
|
||||
/* Since grab operations often happen as a result of implicit
|
||||
* pointer operations on the display X11 connection, we need
|
||||
* to ungrab here to ensure that the backend's X11 can take
|
||||
* the device grab. */
|
||||
XIUngrabDevice (display->x11_display->xdisplay,
|
||||
META_VIRTUAL_CORE_POINTER_ID,
|
||||
timestamp);
|
||||
XSync (display->x11_display->xdisplay, False);
|
||||
|
||||
if (meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
|
||||
display->grab_have_pointer = TRUE;
|
||||
@@ -2555,6 +2490,37 @@ prefs_changed_callback (MetaPreference pref,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_increment_focus_sentinel (MetaDisplay *display)
|
||||
{
|
||||
unsigned long data[1];
|
||||
|
||||
data[0] = meta_display_get_current_time (display);
|
||||
|
||||
XChangeProperty (display->x11_display->xdisplay,
|
||||
display->x11_display->xroot,
|
||||
display->x11_display->atom__MUTTER_SENTINEL,
|
||||
XA_CARDINAL,
|
||||
32, PropModeReplace, (guchar*) data, 1);
|
||||
|
||||
display->sentinel_counter += 1;
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_decrement_focus_sentinel (MetaDisplay *display)
|
||||
{
|
||||
display->sentinel_counter -= 1;
|
||||
|
||||
if (display->sentinel_counter < 0)
|
||||
display->sentinel_counter = 0;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_display_focus_sentinel_clear (MetaDisplay *display)
|
||||
{
|
||||
return (display->sentinel_counter == 0);
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_sanity_check_timestamps (MetaDisplay *display,
|
||||
guint32 timestamp)
|
||||
@@ -2660,14 +2626,13 @@ meta_display_supports_extended_barriers (MetaDisplay *display)
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
if (META_IS_BACKEND_X11_CM (meta_get_backend ()))
|
||||
if (META_IS_BACKEND_X11 (meta_get_backend ()))
|
||||
{
|
||||
if (meta_is_wayland_compositor())
|
||||
return FALSE;
|
||||
|
||||
return META_X11_DISPLAY_HAS_XINPUT_23 (display->x11_display);
|
||||
return (META_X11_DISPLAY_HAS_XINPUT_23 (display->x11_display) &&
|
||||
!meta_is_wayland_compositor());
|
||||
}
|
||||
|
||||
g_assert_not_reached ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@@ -1157,7 +1157,13 @@ compute_resistance_and_snapping_edges (MetaDisplay *display)
|
||||
g_list_free (stacked_windows);
|
||||
/* Free the memory used by the obscuring windows/docks lists */
|
||||
g_slist_free (window_stacking);
|
||||
g_slist_free_full (obscuring_windows, g_free);
|
||||
/* FIXME: Shouldn't there be a helper function to make this one line of code
|
||||
* to free a list instead of four ugly ones?
|
||||
*/
|
||||
g_slist_foreach (obscuring_windows,
|
||||
(void (*)(gpointer,gpointer))&g_free, /* ew, for ugly */
|
||||
NULL);
|
||||
g_slist_free (obscuring_windows);
|
||||
|
||||
/* Sort the list. FIXME: Should I bother with this sorting? I just
|
||||
* sort again later in cache_edges() anyway...
|
||||
|
@@ -606,6 +606,22 @@ meta_init (void)
|
||||
meta_fatal ("Can't specify both SM save file and SM client id\n");
|
||||
|
||||
meta_main_loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
/*
|
||||
* We need to make sure the first client connecting to the X server
|
||||
* (e.g. Xwayland started from meta_wayland_init() above) is a permanent one,
|
||||
* so prepare the GDK X11 connection now already. Without doing this, if
|
||||
* there are any functionality that relies on X11 after here before
|
||||
* meta_display_open(), the X server will terminate itself when such a client
|
||||
* disconnects before the permanent GDK client connects.
|
||||
*/
|
||||
if (meta_should_autostart_x11_display ())
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!meta_x11_init_gdk_display (&error))
|
||||
g_error ("Failed to open X11 display: %s", error->message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -110,24 +110,13 @@ static void
|
||||
meta_launch_context_constructed (GObject *object)
|
||||
{
|
||||
MetaLaunchContext *context = META_LAUNCH_CONTEXT (object);
|
||||
const char *x11_display, *wayland_display;
|
||||
|
||||
G_OBJECT_CLASS (meta_launch_context_parent_class)->constructed (object);
|
||||
|
||||
x11_display = getenv ("DISPLAY");
|
||||
wayland_display = getenv ("WAYLAND_DISPLAY");
|
||||
|
||||
if (x11_display)
|
||||
{
|
||||
g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (context),
|
||||
"DISPLAY", x11_display);
|
||||
}
|
||||
|
||||
if (wayland_display)
|
||||
{
|
||||
g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (context),
|
||||
"WAYLAND_DISPLAY", wayland_display);
|
||||
}
|
||||
g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (context),
|
||||
"DISPLAY", getenv ("DISPLAY"));
|
||||
g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (context),
|
||||
"WAYLAND_DISPLAY", getenv ("WAYLAND_DISPLAY"));
|
||||
}
|
||||
|
||||
static gchar *
|
||||
|
@@ -600,6 +600,8 @@ meta_workspace_manager_calc_workspace_layout (MetaWorkspaceManager *workspace_ma
|
||||
|
||||
grid = g_new (int, grid_area);
|
||||
|
||||
current_row = -1;
|
||||
current_col = -1;
|
||||
i = 0;
|
||||
|
||||
switch (workspace_manager->starting_corner)
|
||||
|
@@ -622,9 +622,12 @@ meta_window_process_placement (MetaWindow *window,
|
||||
window_height = placement_rule->height;
|
||||
meta_window_get_frame_rect (parent, &parent_rect);
|
||||
|
||||
anchor_rect = placement_rule->anchor_rect;
|
||||
anchor_rect.x += parent_rect.x;
|
||||
anchor_rect.y += parent_rect.y;
|
||||
anchor_rect = (MetaRectangle) {
|
||||
.x = parent_rect.x + placement_rule->anchor_rect.x,
|
||||
.y = parent_rect.y + placement_rule->anchor_rect.y,
|
||||
.width = placement_rule->anchor_rect.width,
|
||||
.height = placement_rule->anchor_rect.height,
|
||||
};
|
||||
|
||||
/* Place at anchor point. */
|
||||
if (placement_rule->anchor & META_PLACEMENT_ANCHOR_LEFT)
|
||||
|
409
src/core/stack.c
409
src/core/stack.c
@@ -29,13 +29,18 @@
|
||||
|
||||
#include "core/stack.h"
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "core/frame.h"
|
||||
#include "core/meta-workspace-manager-private.h"
|
||||
#include "core/window-private.h"
|
||||
#include "meta/group.h"
|
||||
#include "meta/meta-x11-errors.h"
|
||||
#include "meta/prefs.h"
|
||||
#include "meta/workspace.h"
|
||||
#include "x11/group-private.h"
|
||||
#include "x11/meta-x11-display-private.h"
|
||||
|
||||
#define WINDOW_HAS_TRANSIENT_TYPE(w) \
|
||||
(w->type == META_WINDOW_DIALOG || \
|
||||
@@ -47,141 +52,51 @@
|
||||
#define WINDOW_TRANSIENT_FOR_WHOLE_GROUP(w) \
|
||||
(WINDOW_HAS_TRANSIENT_TYPE (w) && w->transient_for == NULL)
|
||||
|
||||
static void stack_sync_to_xserver (MetaStack *stack);
|
||||
static void meta_window_set_stack_position_no_sync (MetaWindow *window,
|
||||
int position);
|
||||
static void stack_do_window_deletions (MetaStack *stack);
|
||||
static void stack_do_window_additions (MetaStack *stack);
|
||||
static void stack_do_relayer (MetaStack *stack);
|
||||
static void stack_do_constrain (MetaStack *stack);
|
||||
static void stack_do_resort (MetaStack *stack);
|
||||
|
||||
static void stack_ensure_sorted (MetaStack *stack);
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_DISPLAY = 1,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CHANGED,
|
||||
WINDOW_ADDED,
|
||||
WINDOW_REMOVED,
|
||||
N_SIGNALS
|
||||
};
|
||||
|
||||
static GParamSpec *pspecs[N_PROPS] = { 0 };
|
||||
static guint signals[N_SIGNALS] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (MetaStack, meta_stack, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
meta_stack_init (MetaStack *stack)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
meta_stack_finalize (GObject *object)
|
||||
{
|
||||
MetaStack *stack = META_STACK (object);
|
||||
|
||||
g_list_free (stack->sorted);
|
||||
|
||||
G_OBJECT_CLASS (meta_stack_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_stack_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaStack *stack = META_STACK (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
stack->display = g_value_get_object (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_stack_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaStack *stack = META_STACK (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
g_value_set_object (value, stack->display);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_stack_class_init (MetaStackClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = meta_stack_set_property;
|
||||
object_class->get_property = meta_stack_get_property;
|
||||
object_class->finalize = meta_stack_finalize;
|
||||
|
||||
signals[CHANGED] =
|
||||
g_signal_new ("changed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
signals[WINDOW_ADDED] =
|
||||
g_signal_new ("window-added",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, META_TYPE_WINDOW);
|
||||
signals[WINDOW_REMOVED] =
|
||||
g_signal_new ("window-removed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, META_TYPE_WINDOW);
|
||||
|
||||
pspecs[PROP_DISPLAY] =
|
||||
g_param_spec_object ("display",
|
||||
"Display",
|
||||
"Display",
|
||||
META_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, pspecs);
|
||||
}
|
||||
|
||||
MetaStack *
|
||||
meta_stack_new (MetaDisplay *display)
|
||||
{
|
||||
return g_object_new (META_TYPE_STACK,
|
||||
"display", display,
|
||||
NULL);
|
||||
MetaStack *stack;
|
||||
|
||||
stack = g_new (MetaStack, 1);
|
||||
|
||||
stack->display = display;
|
||||
stack->xwindows = g_array_new (FALSE, FALSE, sizeof (Window));
|
||||
|
||||
stack->sorted = NULL;
|
||||
stack->added = NULL;
|
||||
stack->removed = NULL;
|
||||
|
||||
stack->freeze_count = 0;
|
||||
stack->n_positions = 0;
|
||||
|
||||
stack->need_resort = FALSE;
|
||||
stack->need_relayer = FALSE;
|
||||
stack->need_constrain = FALSE;
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_stack_changed (MetaStack *stack)
|
||||
void
|
||||
meta_stack_free (MetaStack *stack)
|
||||
{
|
||||
/* Bail out if frozen */
|
||||
if (stack->freeze_count > 0)
|
||||
return;
|
||||
g_array_free (stack->xwindows, TRUE);
|
||||
|
||||
stack_ensure_sorted (stack);
|
||||
g_signal_emit (stack, signals[CHANGED], 0);
|
||||
g_list_free (stack->sorted);
|
||||
g_list_free (stack->added);
|
||||
g_list_free (stack->removed);
|
||||
|
||||
g_free (stack);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -197,12 +112,7 @@ meta_stack_add (MetaStack *stack,
|
||||
if (meta_window_is_in_stack (window))
|
||||
meta_bug ("Window %s had stack position already\n", window->desc);
|
||||
|
||||
stack->sorted = g_list_prepend (stack->sorted, window);
|
||||
stack->need_resort = TRUE; /* may not be needed as we add to top */
|
||||
stack->need_constrain = TRUE;
|
||||
stack->need_relayer = TRUE;
|
||||
|
||||
g_signal_emit (stack, signals[WINDOW_ADDED], 0, window);
|
||||
stack->added = g_list_prepend (stack->added, window);
|
||||
|
||||
window->stack_position = stack->n_positions;
|
||||
stack->n_positions += 1;
|
||||
@@ -210,7 +120,7 @@ meta_stack_add (MetaStack *stack,
|
||||
"Window %s has stack_position initialized to %d\n",
|
||||
window->desc, window->stack_position);
|
||||
|
||||
meta_stack_changed (stack);
|
||||
stack_sync_to_xserver (stack);
|
||||
meta_stack_update_window_tile_matches (stack, workspace_manager->active_workspace);
|
||||
}
|
||||
|
||||
@@ -230,11 +140,25 @@ meta_stack_remove (MetaStack *stack,
|
||||
window->stack_position = -1;
|
||||
stack->n_positions -= 1;
|
||||
|
||||
/* We don't know if it's been moved from "added" to "stack" yet */
|
||||
stack->added = g_list_remove (stack->added, window);
|
||||
stack->sorted = g_list_remove (stack->sorted, window);
|
||||
|
||||
g_signal_emit (stack, signals[WINDOW_REMOVED], 0, window);
|
||||
/* stack->removed is only used to update stack->xwindows */
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
{
|
||||
/* Remember the window ID to remove it from the stack array.
|
||||
* The macro is safe to use: Window is guaranteed to be 32 bits, and
|
||||
* GUINT_TO_POINTER says it only works on 32 bits.
|
||||
*/
|
||||
stack->removed = g_list_prepend (stack->removed,
|
||||
GUINT_TO_POINTER (window->xwindow));
|
||||
if (window->frame)
|
||||
stack->removed = g_list_prepend (stack->removed,
|
||||
GUINT_TO_POINTER (window->frame->xwindow));
|
||||
}
|
||||
|
||||
meta_stack_changed (stack);
|
||||
stack_sync_to_xserver (stack);
|
||||
meta_stack_update_window_tile_matches (stack, workspace_manager->active_workspace);
|
||||
}
|
||||
|
||||
@@ -245,7 +169,7 @@ meta_stack_update_layer (MetaStack *stack,
|
||||
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
|
||||
stack->need_relayer = TRUE;
|
||||
|
||||
meta_stack_changed (stack);
|
||||
stack_sync_to_xserver (stack);
|
||||
meta_stack_update_window_tile_matches (stack, workspace_manager->active_workspace);
|
||||
}
|
||||
|
||||
@@ -256,7 +180,7 @@ meta_stack_update_transient (MetaStack *stack,
|
||||
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
|
||||
stack->need_constrain = TRUE;
|
||||
|
||||
meta_stack_changed (stack);
|
||||
stack_sync_to_xserver (stack);
|
||||
meta_stack_update_window_tile_matches (stack, workspace_manager->active_workspace);
|
||||
}
|
||||
|
||||
@@ -286,7 +210,7 @@ meta_stack_raise (MetaStack *stack,
|
||||
|
||||
meta_window_set_stack_position_no_sync (window, max_stack_position);
|
||||
|
||||
meta_stack_changed (stack);
|
||||
stack_sync_to_xserver (stack);
|
||||
meta_stack_update_window_tile_matches (stack, workspace_manager->active_workspace);
|
||||
}
|
||||
|
||||
@@ -315,7 +239,7 @@ meta_stack_lower (MetaStack *stack,
|
||||
|
||||
meta_window_set_stack_position_no_sync (window, min_stack_position);
|
||||
|
||||
meta_stack_changed (stack);
|
||||
stack_sync_to_xserver (stack);
|
||||
meta_stack_update_window_tile_matches (stack, workspace_manager->active_workspace);
|
||||
}
|
||||
|
||||
@@ -331,7 +255,7 @@ meta_stack_thaw (MetaStack *stack)
|
||||
g_return_if_fail (stack->freeze_count > 0);
|
||||
|
||||
stack->freeze_count -= 1;
|
||||
meta_stack_changed (stack);
|
||||
stack_sync_to_xserver (stack);
|
||||
meta_stack_update_window_tile_matches (stack, NULL);
|
||||
}
|
||||
|
||||
@@ -847,6 +771,99 @@ apply_constraints (Constraint **constraints,
|
||||
g_slist_free (heads);
|
||||
}
|
||||
|
||||
/**
|
||||
* stack_do_window_deletions:
|
||||
*
|
||||
* Go through "deleted" and take the matching windows
|
||||
* out of "windows".
|
||||
*/
|
||||
static void
|
||||
stack_do_window_deletions (MetaStack *stack)
|
||||
{
|
||||
/* Do removals before adds, with paranoid idea that we might re-add
|
||||
* the same window IDs.
|
||||
*/
|
||||
GList *tmp;
|
||||
int i;
|
||||
|
||||
tmp = stack->removed;
|
||||
while (tmp != NULL)
|
||||
{
|
||||
Window xwindow;
|
||||
xwindow = GPOINTER_TO_UINT (tmp->data);
|
||||
|
||||
/* We go from the end figuring removals are more
|
||||
* likely to be recent.
|
||||
*/
|
||||
i = stack->xwindows->len;
|
||||
while (i > 0)
|
||||
{
|
||||
--i;
|
||||
|
||||
/* there's no guarantee we'll actually find windows to
|
||||
* remove, e.g. the same xwindow could have been
|
||||
* added/removed before we ever synced, and we put
|
||||
* both the window->xwindow and window->frame->xwindow
|
||||
* in the removal list.
|
||||
*/
|
||||
if (xwindow == g_array_index (stack->xwindows, Window, i))
|
||||
{
|
||||
g_array_remove_index (stack->xwindows, i);
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
|
||||
next:
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
g_list_free (stack->removed);
|
||||
stack->removed = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
stack_do_window_additions (MetaStack *stack)
|
||||
{
|
||||
GList *tmp;
|
||||
gint n_added;
|
||||
|
||||
n_added = g_list_length (stack->added);
|
||||
if (n_added > 0)
|
||||
{
|
||||
meta_topic (META_DEBUG_STACK,
|
||||
"Adding %d windows to sorted list\n",
|
||||
n_added);
|
||||
|
||||
/* stack->added has the most recent additions at the
|
||||
* front of the list, so we need to reverse it
|
||||
*/
|
||||
stack->added = g_list_reverse (stack->added);
|
||||
|
||||
tmp = stack->added;
|
||||
while (tmp != NULL)
|
||||
{
|
||||
MetaWindow *w;
|
||||
|
||||
w = tmp->data;
|
||||
|
||||
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
g_array_append_val (stack->xwindows, w->xwindow);
|
||||
|
||||
/* add to the main list */
|
||||
stack->sorted = g_list_prepend (stack->sorted, w);
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
stack->need_resort = TRUE; /* may not be needed as we add to top */
|
||||
stack->need_constrain = TRUE;
|
||||
stack->need_relayer = TRUE;
|
||||
}
|
||||
|
||||
g_list_free (stack->added);
|
||||
stack->added = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* stack_do_relayer:
|
||||
*
|
||||
@@ -964,11 +981,131 @@ stack_do_resort (MetaStack *stack)
|
||||
static void
|
||||
stack_ensure_sorted (MetaStack *stack)
|
||||
{
|
||||
stack_do_window_deletions (stack);
|
||||
stack_do_window_additions (stack);
|
||||
stack_do_relayer (stack);
|
||||
stack_do_constrain (stack);
|
||||
stack_do_resort (stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* stack_sync_to_server:
|
||||
*
|
||||
* Order the windows on the X server to be the same as in our structure.
|
||||
* We do this using XRestackWindows if we don't know the previous order,
|
||||
* or XConfigureWindow on a few particular windows if we do and can figure
|
||||
* out the minimum set of changes. After that, we set __NET_CLIENT_LIST
|
||||
* and __NET_CLIENT_LIST_STACKING.
|
||||
*
|
||||
* FIXME: Now that we have a good view of the stacking order on the server
|
||||
* with MetaStackTracker it should be possible to do a simpler and better
|
||||
* job of computing the minimal set of stacking requests needed.
|
||||
*/
|
||||
static void
|
||||
stack_sync_to_xserver (MetaStack *stack)
|
||||
{
|
||||
GArray *x11_stacked;
|
||||
GArray *all_root_children_stacked; /* wayland OR x11 */
|
||||
GList *tmp;
|
||||
GArray *hidden_stack_ids;
|
||||
|
||||
/* Bail out if frozen */
|
||||
if (stack->freeze_count > 0)
|
||||
return;
|
||||
|
||||
meta_topic (META_DEBUG_STACK, "Syncing window stack to server\n");
|
||||
|
||||
stack_ensure_sorted (stack);
|
||||
|
||||
/* Create stacked xwindow arrays, in bottom-to-top order
|
||||
*/
|
||||
x11_stacked = g_array_new (FALSE, FALSE, sizeof (Window));
|
||||
|
||||
all_root_children_stacked = g_array_new (FALSE, FALSE, sizeof (guint64));
|
||||
hidden_stack_ids = g_array_new (FALSE, FALSE, sizeof (guint64));
|
||||
|
||||
meta_topic (META_DEBUG_STACK, "Bottom to top: ");
|
||||
meta_push_no_msg_prefix ();
|
||||
|
||||
for (tmp = g_list_last(stack->sorted); tmp != NULL; tmp = tmp->prev)
|
||||
{
|
||||
MetaWindow *w = tmp->data;
|
||||
guint64 top_level_window;
|
||||
guint64 stack_id;
|
||||
|
||||
if (w->unmanaging)
|
||||
continue;
|
||||
|
||||
meta_topic (META_DEBUG_STACK, "%u:%d - %s ",
|
||||
w->layer, w->stack_position, w->desc);
|
||||
|
||||
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
g_array_append_val (x11_stacked, w->xwindow);
|
||||
|
||||
if (w->frame)
|
||||
top_level_window = w->frame->xwindow;
|
||||
else
|
||||
top_level_window = w->xwindow;
|
||||
|
||||
if (w->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
stack_id = top_level_window;
|
||||
else
|
||||
stack_id = w->stamp;
|
||||
|
||||
/* We don't restack hidden windows along with the rest, though they are
|
||||
* reflected in the _NET hints. Hidden windows all get pushed below
|
||||
* the screens fullscreen guard_window. */
|
||||
if (w->hidden)
|
||||
{
|
||||
g_array_append_val (hidden_stack_ids, stack_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
g_array_append_val (all_root_children_stacked, stack_id);
|
||||
}
|
||||
|
||||
meta_topic (META_DEBUG_STACK, "\n");
|
||||
meta_pop_no_msg_prefix ();
|
||||
|
||||
/* The screen guard window sits above all hidden windows and acts as
|
||||
* a barrier to input reaching these windows. */
|
||||
guint64 guard_window_id = stack->display->x11_display->guard_window;
|
||||
g_array_append_val (hidden_stack_ids, guard_window_id);
|
||||
|
||||
/* Sync to server */
|
||||
|
||||
meta_topic (META_DEBUG_STACK, "Restacking %u windows\n",
|
||||
all_root_children_stacked->len);
|
||||
|
||||
meta_stack_tracker_restack_managed (stack->display->stack_tracker,
|
||||
(guint64 *)all_root_children_stacked->data,
|
||||
all_root_children_stacked->len);
|
||||
meta_stack_tracker_restack_at_bottom (stack->display->stack_tracker,
|
||||
(guint64 *)hidden_stack_ids->data,
|
||||
hidden_stack_ids->len);
|
||||
|
||||
/* Sync _NET_CLIENT_LIST and _NET_CLIENT_LIST_STACKING */
|
||||
|
||||
XChangeProperty (stack->display->x11_display->xdisplay,
|
||||
stack->display->x11_display->xroot,
|
||||
stack->display->x11_display->atom__NET_CLIENT_LIST,
|
||||
XA_WINDOW,
|
||||
32, PropModeReplace,
|
||||
(unsigned char *)stack->xwindows->data,
|
||||
stack->xwindows->len);
|
||||
XChangeProperty (stack->display->x11_display->xdisplay,
|
||||
stack->display->x11_display->xroot,
|
||||
stack->display->x11_display->atom__NET_CLIENT_LIST_STACKING,
|
||||
XA_WINDOW,
|
||||
32, PropModeReplace,
|
||||
(unsigned char *)x11_stacked->data,
|
||||
x11_stacked->len);
|
||||
|
||||
g_array_free (x11_stacked, TRUE);
|
||||
g_array_free (hidden_stack_ids, TRUE);
|
||||
g_array_free (all_root_children_stacked, TRUE);
|
||||
}
|
||||
|
||||
MetaWindow*
|
||||
meta_stack_get_top (MetaStack *stack)
|
||||
{
|
||||
@@ -1278,7 +1415,7 @@ meta_stack_set_positions (MetaStack *stack,
|
||||
meta_topic (META_DEBUG_STACK,
|
||||
"Reset the stack positions of (nearly) all windows\n");
|
||||
|
||||
meta_stack_changed (stack);
|
||||
stack_sync_to_xserver (stack);
|
||||
meta_stack_update_window_tile_matches (stack, NULL);
|
||||
}
|
||||
|
||||
@@ -1343,7 +1480,7 @@ meta_window_set_stack_position (MetaWindow *window,
|
||||
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
|
||||
|
||||
meta_window_set_stack_position_no_sync (window, position);
|
||||
meta_stack_changed (window->display->stack);
|
||||
stack_sync_to_xserver (window->display->stack);
|
||||
meta_stack_update_window_tile_matches (window->display->stack,
|
||||
workspace_manager->active_workspace);
|
||||
}
|
||||
|
@@ -51,14 +51,38 @@
|
||||
*/
|
||||
struct _MetaStack
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
/** The MetaDisplay containing this stack. */
|
||||
MetaDisplay *display;
|
||||
|
||||
/**
|
||||
* A sequence of all the Windows (X handles, not MetaWindows) of the windows
|
||||
* we manage, sorted in order. Suitable to be passed into _NET_CLIENT_LIST.
|
||||
*/
|
||||
GArray *xwindows;
|
||||
|
||||
/** The MetaWindows of the windows we manage, sorted in order. */
|
||||
GList *sorted;
|
||||
|
||||
/**
|
||||
* MetaWindows waiting to be added to the "sorted" and "windows" list, after
|
||||
* being added by meta_stack_add() and before being assimilated by
|
||||
* stack_ensure_sorted().
|
||||
*
|
||||
* The order of the elements in this list is not important; what is important
|
||||
* is the stack_position element of each window.
|
||||
*/
|
||||
GList *added;
|
||||
|
||||
/**
|
||||
* Windows (X handles, not MetaWindows) waiting to be removed from the
|
||||
* "windows" list, after being removed by meta_stack_remove() and before
|
||||
* being assimilated by stack_ensure_sorted(). (We already removed them
|
||||
* from the "sorted" list.)
|
||||
*
|
||||
* The order of the elements in this list is not important.
|
||||
*/
|
||||
GList *removed;
|
||||
|
||||
/**
|
||||
* If this is zero, the local stack oughtn't to be brought up to date with
|
||||
* the X server's stack, because it is in the middle of being updated.
|
||||
@@ -97,9 +121,6 @@ struct _MetaStack
|
||||
unsigned int need_constrain : 1;
|
||||
};
|
||||
|
||||
#define META_TYPE_STACK (meta_stack_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaStack, meta_stack, META, STACK, GObject)
|
||||
|
||||
/**
|
||||
* meta_stack_new:
|
||||
* @display: The MetaDisplay which will be the parent of this stack.
|
||||
@@ -110,6 +131,14 @@ G_DECLARE_FINAL_TYPE (MetaStack, meta_stack, META, STACK, GObject)
|
||||
*/
|
||||
MetaStack *meta_stack_new (MetaDisplay *display);
|
||||
|
||||
/**
|
||||
* meta_stack_free:
|
||||
* @stack: The stack to destroy.
|
||||
*
|
||||
* Destroys and frees a MetaStack.
|
||||
*/
|
||||
void meta_stack_free (MetaStack *stack);
|
||||
|
||||
/**
|
||||
* meta_stack_add:
|
||||
* @stack: The stack to add it to
|
||||
|
@@ -575,7 +575,8 @@ meta_startup_notification_finalize (GObject *object)
|
||||
if (sn->startup_sequence_timeout)
|
||||
g_source_remove (sn->startup_sequence_timeout);
|
||||
|
||||
g_slist_free_full (sn->startup_sequences, g_object_unref);
|
||||
g_slist_foreach (sn->startup_sequences, (GFunc) g_object_unref, NULL);
|
||||
g_slist_free (sn->startup_sequences);
|
||||
sn->startup_sequences = NULL;
|
||||
|
||||
G_OBJECT_CLASS (meta_startup_notification_parent_class)->finalize (object);
|
||||
|
@@ -241,6 +241,20 @@ utf8_fputs (const char *str,
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_free_gslist_and_elements: (skip)
|
||||
* @list_to_deep_free: list to deep free
|
||||
*
|
||||
*/
|
||||
void
|
||||
meta_free_gslist_and_elements (GSList *list_to_deep_free)
|
||||
{
|
||||
g_slist_foreach (list_to_deep_free,
|
||||
(void (*)(gpointer,gpointer))&g_free, /* ew, for ugly */
|
||||
NULL);
|
||||
g_slist_free (list_to_deep_free);
|
||||
}
|
||||
|
||||
#ifdef WITH_VERBOSE_MODE
|
||||
void
|
||||
meta_debug_spew_real (const char *format, ...)
|
||||
|
@@ -581,9 +581,6 @@ struct _MetaWindowClass
|
||||
gboolean (*is_stackable) (MetaWindow *window);
|
||||
gboolean (*can_ping) (MetaWindow *window);
|
||||
gboolean (*are_updates_frozen) (MetaWindow *window);
|
||||
|
||||
void (* map) (MetaWindow *window);
|
||||
void (* unmap) (MetaWindow *window);
|
||||
};
|
||||
|
||||
/* These differ from window->has_foo_func in that they consider
|
||||
|
@@ -692,7 +692,7 @@ meta_window_class_init (MetaWindowClass *klass)
|
||||
* MetaWindow::size-changed:
|
||||
* @window: a #MetaWindow
|
||||
*
|
||||
* This is emitted when the size of a window might
|
||||
* This is emitted when the position of a window might
|
||||
* have changed. Specifically, this is emitted when the
|
||||
* size of the toplevel window has changed, or when the
|
||||
* size of the client window has changed.
|
||||
@@ -809,10 +809,17 @@ sync_client_window_mapped (MetaWindow *window)
|
||||
|
||||
window->mapped = should_be_mapped;
|
||||
|
||||
if (window->mapped)
|
||||
META_WINDOW_GET_CLASS (window)->map (window);
|
||||
meta_x11_error_trap_push (window->display->x11_display);
|
||||
if (should_be_mapped)
|
||||
{
|
||||
XMapWindow (window->display->x11_display->xdisplay, window->xwindow);
|
||||
}
|
||||
else
|
||||
META_WINDOW_GET_CLASS (window)->unmap (window);
|
||||
{
|
||||
XUnmapWindow (window->display->x11_display->xdisplay, window->xwindow);
|
||||
window->unmaps_pending ++;
|
||||
}
|
||||
meta_x11_error_trap_pop (window->display->x11_display);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1518,7 +1525,7 @@ meta_window_unmanage (MetaWindow *window,
|
||||
|
||||
if (window->struts)
|
||||
{
|
||||
g_slist_free_full (window->struts, g_free);
|
||||
meta_free_gslist_and_elements (window->struts);
|
||||
window->struts = NULL;
|
||||
|
||||
meta_topic (META_DEBUG_WORKAREA,
|
||||
@@ -1932,10 +1939,9 @@ idle_calc_showing (gpointer data)
|
||||
while (tmp != NULL)
|
||||
{
|
||||
MetaWindow *window = tmp->data;
|
||||
MetaDisplay *display = window->display;
|
||||
|
||||
if (display->x11_display && !display->mouse_mode)
|
||||
meta_x11_display_increment_focus_sentinel (display->x11_display);
|
||||
if (!window->display->mouse_mode)
|
||||
meta_display_increment_focus_sentinel (window->display);
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
@@ -2405,7 +2411,6 @@ meta_window_show (MetaWindow *window)
|
||||
gboolean needs_stacking_adjustment;
|
||||
MetaWindow *focus_window;
|
||||
gboolean notify_demands_attention = FALSE;
|
||||
MetaDisplay *display = window->display;
|
||||
|
||||
meta_topic (META_DEBUG_WINDOW_STATE,
|
||||
"Showing window %s, shaded: %d iconic: %d placed: %d\n",
|
||||
@@ -2572,7 +2577,7 @@ meta_window_show (MetaWindow *window)
|
||||
|
||||
meta_window_focus (window, timestamp);
|
||||
}
|
||||
else if (display->x11_display)
|
||||
else
|
||||
{
|
||||
/* Prevent EnterNotify events in sloppy/mouse focus from
|
||||
* erroneously focusing the window that had been denied
|
||||
@@ -2580,7 +2585,7 @@ meta_window_show (MetaWindow *window)
|
||||
* ideas for a better way to accomplish the same thing, but
|
||||
* they're more involved so do it this way for now.
|
||||
*/
|
||||
meta_x11_display_increment_focus_sentinel (display->x11_display);
|
||||
meta_display_increment_focus_sentinel (window->display);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3807,13 +3812,13 @@ maybe_move_attached_window (MetaWindow *window,
|
||||
void *data)
|
||||
{
|
||||
if (window->hidden)
|
||||
return G_SOURCE_CONTINUE;
|
||||
return FALSE;
|
||||
|
||||
if (meta_window_is_attached_dialog (window) ||
|
||||
meta_window_get_placement_rule (window))
|
||||
meta_window_reposition (window);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5373,6 +5378,50 @@ redraw_icon (MetaWindow *window)
|
||||
meta_frame_queue_draw (window->frame);
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
load_default_window_icon (int size)
|
||||
{
|
||||
GtkIconTheme *theme = gtk_icon_theme_get_default ();
|
||||
g_autoptr (GdkPixbuf) pixbuf = NULL;
|
||||
const char *icon_name;
|
||||
|
||||
if (gtk_icon_theme_has_icon (theme, META_DEFAULT_ICON_NAME))
|
||||
icon_name = META_DEFAULT_ICON_NAME;
|
||||
else
|
||||
icon_name = "image-missing";
|
||||
|
||||
pixbuf = gtk_icon_theme_load_icon (theme, icon_name, size, 0, NULL);
|
||||
return gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
get_default_window_icon (void)
|
||||
{
|
||||
static cairo_surface_t *default_icon = NULL;
|
||||
|
||||
if (default_icon == NULL)
|
||||
{
|
||||
default_icon = load_default_window_icon (META_ICON_WIDTH);
|
||||
g_assert (default_icon);
|
||||
}
|
||||
|
||||
return cairo_surface_reference (default_icon);
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
get_default_mini_icon (void)
|
||||
{
|
||||
static cairo_surface_t *default_icon = NULL;
|
||||
|
||||
if (default_icon == NULL)
|
||||
{
|
||||
default_icon = load_default_window_icon (META_MINI_ICON_WIDTH);
|
||||
g_assert (default_icon);
|
||||
}
|
||||
|
||||
return cairo_surface_reference (default_icon);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_update_icon_now (MetaWindow *window,
|
||||
gboolean force)
|
||||
@@ -5389,11 +5438,17 @@ meta_window_update_icon_now (MetaWindow *window,
|
||||
{
|
||||
if (window->icon)
|
||||
cairo_surface_destroy (window->icon);
|
||||
window->icon = icon;
|
||||
if (icon)
|
||||
window->icon = icon;
|
||||
else
|
||||
window->icon = get_default_window_icon ();
|
||||
|
||||
if (window->mini_icon)
|
||||
cairo_surface_destroy (window->mini_icon);
|
||||
window->mini_icon = mini_icon;
|
||||
if (mini_icon)
|
||||
window->mini_icon = mini_icon;
|
||||
else
|
||||
window->mini_icon = get_default_mini_icon ();
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (window));
|
||||
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_ICON]);
|
||||
@@ -5402,6 +5457,9 @@ meta_window_update_icon_now (MetaWindow *window,
|
||||
|
||||
redraw_icon (window);
|
||||
}
|
||||
|
||||
g_assert (window->icon);
|
||||
g_assert (window->mini_icon);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -8088,7 +8146,8 @@ mouse_mode_focus (MetaWindow *window,
|
||||
"Unsetting focus from %s due to mouse entering "
|
||||
"the DESKTOP window\n",
|
||||
display->focus_window->desc);
|
||||
meta_display_unset_input_focus (display, timestamp);
|
||||
meta_x11_display_focus_the_no_focus_window (display->x11_display,
|
||||
timestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -52,6 +52,8 @@ void meta_workspace_queue_calc_showing (MetaWorkspace *workspace);
|
||||
static void focus_ancestor_or_top_window (MetaWorkspace *workspace,
|
||||
MetaWindow *not_this_one,
|
||||
guint32 timestamp);
|
||||
static void free_this (gpointer candidate,
|
||||
gpointer dummy);
|
||||
|
||||
G_DEFINE_TYPE (MetaWorkspace, meta_workspace, G_TYPE_OBJECT);
|
||||
|
||||
@@ -263,6 +265,13 @@ meta_workspace_new (MetaWorkspaceManager *workspace_manager)
|
||||
return workspace;
|
||||
}
|
||||
|
||||
/* Foreach function for workspace_free_struts() */
|
||||
static void
|
||||
free_this (gpointer candidate, gpointer dummy)
|
||||
{
|
||||
g_free (candidate);
|
||||
}
|
||||
|
||||
/**
|
||||
* workspace_free_all_struts:
|
||||
* @workspace: The workspace.
|
||||
@@ -275,7 +284,8 @@ workspace_free_all_struts (MetaWorkspace *workspace)
|
||||
if (workspace->all_struts == NULL)
|
||||
return;
|
||||
|
||||
g_slist_free_full (workspace->all_struts, g_free);
|
||||
g_slist_foreach (workspace->all_struts, free_this, NULL);
|
||||
g_slist_free (workspace->all_struts);
|
||||
workspace->all_struts = NULL;
|
||||
}
|
||||
|
||||
@@ -291,7 +301,8 @@ workspace_free_builtin_struts (MetaWorkspace *workspace)
|
||||
if (workspace->builtin_struts == NULL)
|
||||
return;
|
||||
|
||||
g_slist_free_full (workspace->builtin_struts, g_free);
|
||||
g_slist_foreach (workspace->builtin_struts, free_this, NULL);
|
||||
g_slist_free (workspace->builtin_struts);
|
||||
workspace->builtin_struts = NULL;
|
||||
}
|
||||
|
||||
@@ -1308,7 +1319,8 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace,
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Setting focus to no_focus_window, since no valid "
|
||||
"window to focus found.\n");
|
||||
meta_display_unset_input_focus (workspace->display, timestamp);
|
||||
meta_x11_display_focus_the_no_focus_window (workspace->display->x11_display,
|
||||
timestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1380,7 +1392,8 @@ focus_ancestor_or_top_window (MetaWorkspace *workspace,
|
||||
else
|
||||
{
|
||||
meta_topic (META_DEBUG_FOCUS, "No MRU window to focus found; focusing no_focus_window.\n");
|
||||
meta_display_unset_input_focus (workspace->display, timestamp);
|
||||
meta_x11_display_focus_the_no_focus_window (workspace->display->x11_display,
|
||||
timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -392,8 +392,6 @@ mutter_sources = [
|
||||
'x11/meta-x11-selection-input-stream-private.h',
|
||||
'x11/meta-x11-selection-output-stream.c',
|
||||
'x11/meta-x11-selection-output-stream-private.h',
|
||||
'x11/meta-x11-stack.c',
|
||||
'x11/meta-x11-stack-private.h',
|
||||
'x11/mutter-Xatomtype.h',
|
||||
'x11/session.c',
|
||||
'x11/session.h',
|
||||
@@ -576,12 +574,6 @@ if have_native_backend
|
||||
'backends/native/meta-crtc-kms.h',
|
||||
'backends/native/meta-cursor-renderer-native.c',
|
||||
'backends/native/meta-cursor-renderer-native.h',
|
||||
'backends/native/meta-drm-buffer-dumb.c',
|
||||
'backends/native/meta-drm-buffer-dumb.h',
|
||||
'backends/native/meta-drm-buffer-gbm.c',
|
||||
'backends/native/meta-drm-buffer-gbm.h',
|
||||
'backends/native/meta-drm-buffer.c',
|
||||
'backends/native/meta-drm-buffer.h',
|
||||
'backends/native/meta-gpu-kms.c',
|
||||
'backends/native/meta-gpu-kms.h',
|
||||
'backends/native/meta-input-settings-native.c',
|
||||
|
@@ -297,13 +297,4 @@ MetaSoundPlayer * meta_display_get_sound_player (MetaDisplay *display);
|
||||
META_EXPORT
|
||||
MetaSelection * meta_display_get_selection (MetaDisplay *display);
|
||||
|
||||
META_EXPORT
|
||||
void meta_display_set_input_focus (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
gboolean focus_frame,
|
||||
guint32 timestamp);
|
||||
META_EXPORT
|
||||
void meta_display_unset_input_focus (MetaDisplay *display,
|
||||
guint32 timestamp);
|
||||
|
||||
#endif
|
||||
|
@@ -63,4 +63,27 @@ META_EXPORT
|
||||
gboolean meta_x11_display_xwindow_is_a_no_focus_window (MetaX11Display *x11_display,
|
||||
Window xwindow);
|
||||
|
||||
/* meta_x11_display_set_input_focus_window is like XSetInputFocus, except
|
||||
* that (a) it can't detect timestamps later than the current time,
|
||||
* since Mutter isn't part of the XServer, and thus gives erroneous
|
||||
* behavior in this circumstance (so don't do it), (b) it uses
|
||||
* display->last_focus_time since we don't have access to the true
|
||||
* Xserver one, (c) it makes use of display->user_time since checking
|
||||
* whether a window should be allowed to be focused should depend
|
||||
* on user_time events (see bug 167358, comment 15 in particular)
|
||||
*/
|
||||
META_EXPORT
|
||||
void meta_x11_display_set_input_focus_window (MetaX11Display *x11_display,
|
||||
MetaWindow *window,
|
||||
gboolean focus_frame,
|
||||
guint32 timestamp);
|
||||
|
||||
/* meta_x11_display_focus_the_no_focus_window is called when the
|
||||
* designated no_focus_window should be focused, but is otherwise the
|
||||
* same as meta_display_set_input_focus_window
|
||||
*/
|
||||
META_EXPORT
|
||||
void meta_x11_display_focus_the_no_focus_window (MetaX11Display *x11_display,
|
||||
guint32 timestamp);
|
||||
|
||||
#endif /* META_X11_DISPLAY_H */
|
||||
|
@@ -149,6 +149,9 @@ char* meta_external_binding_name_for_action (guint keybinding_action);
|
||||
META_EXPORT
|
||||
char* meta_g_utf8_strndup (const gchar *src, gsize n);
|
||||
|
||||
META_EXPORT
|
||||
void meta_free_gslist_and_elements (GSList *list_to_deep_free);
|
||||
|
||||
META_EXPORT
|
||||
GPid meta_show_dialog (const char *type,
|
||||
const char *message,
|
||||
|
@@ -121,7 +121,6 @@
|
||||
<arg name="dy" type="d" direction="in" />
|
||||
<arg name="flags" type="u" direction="in" />
|
||||
</method>
|
||||
|
||||
<!--
|
||||
NotifyPointerAxisDiscrete:
|
||||
|
||||
@@ -135,7 +134,7 @@
|
||||
<!--
|
||||
NotifyPointerMotionRelative:
|
||||
|
||||
A relative pointer motion event notification
|
||||
A absolute pointer motion event notification
|
||||
-->
|
||||
<method name="NotifyPointerMotionRelative">
|
||||
<arg name="dx" type="d" direction="in" />
|
||||
|
@@ -221,7 +221,13 @@ test_basic_fitting (void)
|
||||
static void
|
||||
free_strut_list (GSList *struts)
|
||||
{
|
||||
g_slist_free_full (struts, g_free);
|
||||
GSList *tmp = struts;
|
||||
while (tmp)
|
||||
{
|
||||
g_free (tmp->data);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
g_slist_free (struts);
|
||||
}
|
||||
|
||||
static GSList*
|
||||
|
@@ -32,7 +32,6 @@
|
||||
#include "wayland/meta-wayland.h"
|
||||
|
||||
#define ALL_TRANSFORMS ((1 << (META_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
|
||||
#define FRAME_WARNING "Frame has assigned frame counter but no frame drawn time"
|
||||
|
||||
static gboolean
|
||||
run_tests (gpointer data)
|
||||
@@ -41,8 +40,6 @@ run_tests (gpointer data)
|
||||
MetaSettings *settings = meta_backend_get_settings (backend);
|
||||
gboolean ret;
|
||||
|
||||
g_test_log_set_fatal_handler (NULL, NULL);
|
||||
|
||||
meta_settings_override_experimental_features (settings);
|
||||
|
||||
meta_settings_enable_experimental_feature (
|
||||
@@ -56,20 +53,6 @@ run_tests (gpointer data)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
ignore_frame_counter_warning (const gchar *log_domain,
|
||||
GLogLevelFlags log_level,
|
||||
const gchar *message,
|
||||
gpointer user_data)
|
||||
{
|
||||
if ((log_level & G_LOG_LEVEL_WARNING) &&
|
||||
g_strcmp0 (log_domain, "mutter") == 0 &&
|
||||
g_str_has_suffix (message, FRAME_WARNING))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_test_headless_start (void)
|
||||
{
|
||||
@@ -210,8 +193,6 @@ main (int argc, char *argv[])
|
||||
meta_init ();
|
||||
meta_register_with_session ();
|
||||
|
||||
g_test_log_set_fatal_handler (ignore_frame_counter_warning, NULL);
|
||||
|
||||
g_idle_add (run_tests, NULL);
|
||||
|
||||
return meta_run ();
|
||||
|
@@ -385,9 +385,6 @@ test_case_do (TestCase *test,
|
||||
argc == 3 ? argv[2] : NULL,
|
||||
NULL))
|
||||
return FALSE;
|
||||
|
||||
if (!test_client_wait (client, error))
|
||||
return FALSE;
|
||||
}
|
||||
else if (strcmp (argv[0], "set_parent") == 0 ||
|
||||
strcmp (argv[0], "set_parent_exported") == 0)
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include "meta/prefs.h"
|
||||
#include "ui/frames.h"
|
||||
|
||||
#define DEBUG_FILL_STRUCT(s) memset ((s), 0xef, sizeof (*(s)))
|
||||
|
||||
static void scale_border (GtkBorder *border, double factor);
|
||||
|
||||
static MetaFrameLayout *
|
||||
@@ -56,6 +58,7 @@ meta_frame_layout_free (MetaFrameLayout *layout)
|
||||
{
|
||||
g_return_if_fail (layout != NULL);
|
||||
|
||||
DEBUG_FILL_STRUCT (layout);
|
||||
g_free (layout);
|
||||
}
|
||||
|
||||
@@ -964,6 +967,7 @@ meta_theme_free (MetaTheme *theme)
|
||||
if (theme->layouts[i])
|
||||
meta_frame_layout_free (theme->layouts[i]);
|
||||
|
||||
DEBUG_FILL_STRUCT (theme);
|
||||
g_free (theme);
|
||||
}
|
||||
|
||||
|
@@ -253,9 +253,16 @@ meta_wayland_actor_surface_commit (MetaWaylandSurfaceRole *surface_role,
|
||||
{
|
||||
MetaWaylandActorSurface *actor_surface =
|
||||
META_WAYLAND_ACTOR_SURFACE (surface_role);
|
||||
MetaWaylandSurface *surface =
|
||||
meta_wayland_surface_role_get_surface (surface_role);
|
||||
MetaWaylandSurface *toplevel_surface;
|
||||
|
||||
meta_wayland_actor_surface_queue_frame_callbacks (actor_surface, pending);
|
||||
|
||||
toplevel_surface = meta_wayland_surface_get_toplevel (surface);
|
||||
if (!toplevel_surface || !toplevel_surface->window)
|
||||
return;
|
||||
|
||||
meta_wayland_actor_surface_sync_actor_state (actor_surface);
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,10 @@
|
||||
|
||||
#include "linux-dmabuf-unstable-v1-server-protocol.h"
|
||||
|
||||
#ifndef DRM_FORMAT_MOD_INVALID
|
||||
#define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)
|
||||
#endif
|
||||
|
||||
#define META_WAYLAND_DMA_BUF_MAX_FDS 4
|
||||
|
||||
struct _MetaWaylandDmaBufBuffer
|
||||
@@ -80,15 +84,28 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer *buffer,
|
||||
if (buffer->dma_buf.texture)
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
* NOTE: The cogl_format here is only used for texture color channel
|
||||
* swizzling as compared to COGL_PIXEL_FORMAT_ARGB. It is *not* used
|
||||
* for accessing the buffer memory. EGL will access the buffer
|
||||
* memory according to the DRM fourcc code. Cogl will not mmap
|
||||
* and access the buffer memory at all.
|
||||
*/
|
||||
if (!cogl_pixel_format_from_drm_format (dma_buf->drm_format, &cogl_format, NULL))
|
||||
switch (dma_buf->drm_format)
|
||||
{
|
||||
/*
|
||||
* NOTE: The cogl_format here is only used for texture color channel
|
||||
* swizzling as compared to COGL_PIXEL_FORMAT_ARGB. It is *not* used
|
||||
* for accessing the buffer memory. EGL will access the buffer
|
||||
* memory according to the DRM fourcc code. Cogl will not mmap
|
||||
* and access the buffer memory at all.
|
||||
*/
|
||||
case DRM_FORMAT_XRGB8888:
|
||||
cogl_format = COGL_PIXEL_FORMAT_RGB_888;
|
||||
break;
|
||||
case DRM_FORMAT_ARGB8888:
|
||||
cogl_format = COGL_PIXEL_FORMAT_ARGB_8888_PRE;
|
||||
break;
|
||||
case DRM_FORMAT_ARGB2101010:
|
||||
cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010_PRE;
|
||||
break;
|
||||
case DRM_FORMAT_RGB565:
|
||||
cogl_format = COGL_PIXEL_FORMAT_RGB_565;
|
||||
break;
|
||||
default:
|
||||
g_set_error (error, G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"Unsupported buffer format %d", dma_buf->drm_format);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user