Compare commits
398 Commits
subsurface
...
testsuite-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa91c59bd7 | ||
|
|
3ee4dba206 | ||
|
|
55c2965dc7 | ||
|
|
312c0f0b3b | ||
|
|
adc9cc568e | ||
|
|
3e59b0b582 | ||
|
|
6a5ee99c23 | ||
|
|
8fda63c85e | ||
|
|
cfa9dc6162 | ||
|
|
9f068866e2 | ||
|
|
0d03e570b0 | ||
|
|
0dcf31292d | ||
|
|
4ab18b6657 | ||
|
|
957d96102a | ||
|
|
d21a691f44 | ||
|
|
ae5ea8e495 | ||
|
|
bbabb1973c | ||
|
|
d2a85abf79 | ||
|
|
74620ffc46 | ||
|
|
ce04dfad41 | ||
|
|
568eed9477 | ||
|
|
26561ab2e7 | ||
|
|
26060b1be2 | ||
|
|
210c71b856 | ||
|
|
7206060450 | ||
|
|
31cd2b19cd | ||
|
|
857de33937 | ||
|
|
3d9d4031d6 | ||
|
|
738b48c660 | ||
|
|
cce5f691e2 | ||
|
|
ad4f2de86c | ||
|
|
9166e90bd4 | ||
|
|
6ad15fe6d0 | ||
|
|
66b992c3c0 | ||
|
|
b19f71dd24 | ||
|
|
cccec91b66 | ||
|
|
cd6e8d9e5b | ||
|
|
00566261b2 | ||
|
|
888b9ee352 | ||
|
|
f0eceb4aa3 | ||
|
|
ff082a7758 | ||
|
|
f357623170 | ||
|
|
bd3afd1006 | ||
|
|
79009d4158 | ||
|
|
b782f80311 | ||
|
|
c48a3152f0 | ||
|
|
d2d2fb4b50 | ||
|
|
81adf6be22 | ||
|
|
ff9c9e05c3 | ||
|
|
e3f39bf0c3 | ||
|
|
d692243727 | ||
|
|
6ad9db0bf0 | ||
|
|
486157f6bf | ||
|
|
5ca4ab3aaa | ||
|
|
a37b3fb691 | ||
|
|
c414889cfa | ||
|
|
4dfc07ef57 | ||
|
|
cf4b0a27f8 | ||
|
|
393ee574b6 | ||
|
|
e3c85be53f | ||
|
|
0f5fda2277 | ||
|
|
0889037959 | ||
|
|
ee56ad792c | ||
|
|
5688b7b4bb | ||
|
|
df1802f756 | ||
|
|
84de90756d | ||
|
|
cb5a8a76da | ||
|
|
26c35c00e1 | ||
|
|
5d4879aae7 | ||
|
|
39b08b82ca | ||
|
|
2b6e7147d6 | ||
|
|
3a1349e8ef | ||
|
|
5485d806c5 | ||
|
|
6e7c499408 | ||
|
|
c341da32aa | ||
|
|
d39ec8c09e | ||
|
|
e3299e38df | ||
|
|
8fd02f6fa2 | ||
|
|
9bc0ad9a13 | ||
|
|
19171c7a89 | ||
|
|
abf942efe5 | ||
|
|
dfe7afdb04 | ||
|
|
1629b072fe | ||
|
|
0b0a5a52af | ||
|
|
75d259eedf | ||
|
|
6fec018cbd | ||
|
|
6d9c950b82 | ||
|
|
0933ea63c5 | ||
|
|
8cb594696e | ||
|
|
ab7592ee4f | ||
|
|
9d7389aea7 | ||
|
|
994644ffe7 | ||
|
|
76a1f1714d | ||
|
|
9af08e17e0 | ||
|
|
276afbca92 | ||
|
|
0342d23dbe | ||
|
|
1c10837b21 | ||
|
|
7cc5d5c7a5 | ||
|
|
6a59326dbf | ||
|
|
1968f331d9 | ||
|
|
bf35836350 | ||
|
|
036629a491 | ||
|
|
8cabf59cf3 | ||
|
|
6a4b238641 | ||
|
|
d4d0239ae7 | ||
|
|
a30f32db8d | ||
|
|
6948a74d72 | ||
|
|
14ec255812 | ||
|
|
00ebd51d06 | ||
|
|
7de528b487 | ||
|
|
77f40d7508 | ||
|
|
b969f4649d | ||
|
|
f4f25e584c | ||
|
|
b049a3501a | ||
|
|
0114fad8a5 | ||
|
|
afafac6878 | ||
|
|
108eb43b01 | ||
|
|
6961c1fe4a | ||
|
|
606d150e0b | ||
|
|
96f7bb99a7 | ||
|
|
b937c17985 | ||
|
|
79cb370f81 | ||
|
|
154b73723f | ||
|
|
c0efed4e4a | ||
|
|
4402676aa2 | ||
|
|
9bf4a45d47 | ||
|
|
85ce343816 | ||
|
|
114d0621aa | ||
|
|
d595aff52d | ||
|
|
d72fd951e1 | ||
|
|
78706e3fbe | ||
|
|
98b796a371 | ||
|
|
c99f62aef1 | ||
|
|
8754247a90 | ||
|
|
fd12707162 | ||
|
|
34bca0ff56 | ||
|
|
c668519d07 | ||
|
|
454e6eadc6 | ||
|
|
e248a01fbd | ||
|
|
e2bd7defa4 | ||
|
|
855fa6d523 | ||
|
|
7c620ac2b7 | ||
|
|
d96f2f54e9 | ||
|
|
71c2ee3530 | ||
|
|
5e415ee916 | ||
|
|
e163021b8f | ||
|
|
1bf88f1d81 | ||
|
|
72d2b8e546 | ||
|
|
37f7f3d60c | ||
|
|
8d1443994b | ||
|
|
39db73dff1 | ||
|
|
68cf5f2cf3 | ||
|
|
77c4097c86 | ||
|
|
d7bc4c719b | ||
|
|
725857e15b | ||
|
|
50ee872978 | ||
|
|
b6c82c6b54 | ||
|
|
1bf94b045c | ||
|
|
13bfe188b5 | ||
|
|
f21175b3d0 | ||
|
|
d78475372f | ||
|
|
988b9de210 | ||
|
|
0c19ef6c2c | ||
|
|
2bfd4a88d6 | ||
|
|
de3eeb4970 | ||
|
|
5c2e2977e0 | ||
|
|
24f3ec0949 | ||
|
|
bcab0e4254 | ||
|
|
253955c017 | ||
|
|
3a8834a437 | ||
|
|
48ea2ecac3 | ||
|
|
6d0b31128b | ||
|
|
0b519bc353 | ||
|
|
bb756b35a2 | ||
|
|
7ba7ab1e3d | ||
|
|
f73a7e29ca | ||
|
|
2eb6e3d4c5 | ||
|
|
b28cf76f11 | ||
|
|
36314f28e2 | ||
|
|
b7a1b1d7ee | ||
|
|
57e382b59c | ||
|
|
a35a885902 | ||
|
|
5fa3a2a39f | ||
|
|
7f53b3d3f4 | ||
|
|
9b25257cbf | ||
|
|
a90a6c4517 | ||
|
|
e69f062c99 | ||
|
|
210c7f25ad | ||
|
|
9695791f7b | ||
|
|
ca0da0dd83 | ||
|
|
5a8a839921 | ||
|
|
eb84171cda | ||
|
|
5608a8978e | ||
|
|
efefdbd5c0 | ||
|
|
6bea059424 | ||
|
|
c99c06f0da | ||
|
|
bda8f5393d | ||
|
|
160fa969d4 | ||
|
|
edf33a6617 | ||
|
|
86587a9328 | ||
|
|
8691d471d0 | ||
|
|
463b6dd1fd | ||
|
|
88e1f77f90 | ||
|
|
1ee488f445 | ||
|
|
eae0e15b9d | ||
|
|
00d551bda8 | ||
|
|
2dcec44714 | ||
|
|
f04c819439 | ||
|
|
c679ba9ebf | ||
|
|
9aadc2b860 | ||
|
|
e4370cc95e | ||
|
|
22ceb018fb | ||
|
|
833d307695 | ||
|
|
e8afb5e210 | ||
|
|
b916c4dac1 | ||
|
|
699c6d6159 | ||
|
|
025b846fce | ||
|
|
fcdbab3f69 | ||
|
|
d7eac7a6ad | ||
|
|
52dbb3f372 | ||
|
|
7dc38ca12f | ||
|
|
e858924d03 | ||
|
|
852aab1576 | ||
|
|
5eb42815ed | ||
|
|
0b853f62ed | ||
|
|
fb969f5431 | ||
|
|
ef6ed31853 | ||
|
|
c57245b73c | ||
|
|
f9fd78b67e | ||
|
|
00a63a9fcf | ||
|
|
b4ae2377b3 | ||
|
|
392977d670 | ||
|
|
5a29e2704c | ||
|
|
ec6c52680e | ||
|
|
d850161b2f | ||
|
|
1a3504469d | ||
|
|
be0546bb39 | ||
|
|
d4a569057f | ||
|
|
c5727df568 | ||
|
|
7406cea257 | ||
|
|
de3f55fc5f | ||
|
|
010ff81b2f | ||
|
|
c94ec8b658 | ||
|
|
9c1ae5374d | ||
|
|
4a018de0a1 | ||
|
|
23e50bb21d | ||
|
|
a8e3e747df | ||
|
|
7fd90853f8 | ||
|
|
01aa4989f8 | ||
|
|
d4fee23ff6 | ||
|
|
b878949f00 | ||
|
|
3a88522a19 | ||
|
|
358cd28d09 | ||
|
|
6eb6b0cb50 | ||
|
|
c81954120a | ||
|
|
4bdc44f4af | ||
|
|
3ab7b2d7ce | ||
|
|
429056c214 | ||
|
|
acecf519bc | ||
|
|
b2fbdcda41 | ||
|
|
1b08fda93e | ||
|
|
f6b6176ec0 | ||
|
|
2803189afd | ||
|
|
ad08c1444a | ||
|
|
ef77a6fa73 | ||
|
|
667f02ecd8 | ||
|
|
160f632668 | ||
|
|
653bf46494 | ||
|
|
46d4c70cd7 | ||
|
|
4920ac4a57 | ||
|
|
5bdc9f71fd | ||
|
|
c92761b184 | ||
|
|
9185f15cd9 | ||
|
|
efec30babb | ||
|
|
190e7da317 | ||
|
|
28d38cd730 | ||
|
|
d7a72493ae | ||
|
|
7299c9baa9 | ||
|
|
540a83327f | ||
|
|
04d41eaa66 | ||
|
|
524d681496 | ||
|
|
44d977844b | ||
|
|
6259800f5a | ||
|
|
d3a5aa5304 | ||
|
|
d32ab7544d | ||
|
|
e2e7c931c5 | ||
|
|
e202348380 | ||
|
|
ba5403da17 | ||
|
|
904d44074f | ||
|
|
c636baf6f5 | ||
|
|
b7c2528ad1 | ||
|
|
48740de71a | ||
|
|
34c16b0df2 | ||
|
|
d0a675ab01 | ||
|
|
0e0bf8ed47 | ||
|
|
00d7d4b17b | ||
|
|
9eef566b54 | ||
|
|
272168c94b | ||
|
|
ca054bfdc9 | ||
|
|
59dbfb0843 | ||
|
|
223e27e7dc | ||
|
|
efe1415429 | ||
|
|
489723916d | ||
|
|
e8894ad383 | ||
|
|
9423d6261a | ||
|
|
b766f92026 | ||
|
|
a37aacf4e4 | ||
|
|
93959ef7df | ||
|
|
209a1a69cc | ||
|
|
982f965ea8 | ||
|
|
f7fc90daa0 | ||
|
|
a58424588f | ||
|
|
f8c9b3394b | ||
|
|
ce4d8cc6d9 | ||
|
|
c85766ac71 | ||
|
|
b24ae31716 | ||
|
|
7cf805c8b3 | ||
|
|
1f62c693cd | ||
|
|
6ae9cbfe0f | ||
|
|
7803aad872 | ||
|
|
cc2d3fa7d6 | ||
|
|
a9e4993184 | ||
|
|
33703bfe01 | ||
|
|
7ba5cf5309 | ||
|
|
bb890f6004 | ||
|
|
1c7a0e7a15 | ||
|
|
cd7e1c1387 | ||
|
|
a2e1e727c5 | ||
|
|
61207f81c3 | ||
|
|
f624586a75 | ||
|
|
1a93967e1f | ||
|
|
310ab7b531 | ||
|
|
d55801c8ba | ||
|
|
b1809bfd88 | ||
|
|
deb8a35ea0 | ||
|
|
c5ce24c82c | ||
|
|
54815e4771 | ||
|
|
5a99790a87 | ||
|
|
8aa7174bfb | ||
|
|
9df5e3cbd6 | ||
|
|
8b5194c016 | ||
|
|
9a63172cf5 | ||
|
|
3ade9ae184 | ||
|
|
76349ff6e5 | ||
|
|
dd530b45e2 | ||
|
|
00ce51472c | ||
|
|
b6bcbeae23 | ||
|
|
cf86cc1184 | ||
|
|
b503b60a49 | ||
|
|
5850055b68 | ||
|
|
b224e66a9f | ||
|
|
bbb0150383 | ||
|
|
8aef682079 | ||
|
|
fe4b7a5159 | ||
|
|
7ba4ba05e1 | ||
|
|
85e1088171 | ||
|
|
c1ed034367 | ||
|
|
cc3e25b163 | ||
|
|
bdb3e345c8 | ||
|
|
a30e9dcfeb | ||
|
|
76007c4d09 | ||
|
|
020ef51cb0 | ||
|
|
1914adc344 | ||
|
|
6e236b9459 | ||
|
|
11715760f9 | ||
|
|
f19c08ffda | ||
|
|
d0f76b6ab4 | ||
|
|
4c7206343a | ||
|
|
dfae2cb3a5 | ||
|
|
de74d38039 | ||
|
|
fb20542fcc | ||
|
|
a26e289d5c | ||
|
|
892d3b9530 | ||
|
|
8477dcfeff | ||
|
|
25835afd9c | ||
|
|
06dda4e12b | ||
|
|
26edfe6d18 | ||
|
|
4a749aee6e | ||
|
|
99a8417142 | ||
|
|
20e2075a10 | ||
|
|
d8c649b57f | ||
|
|
bb2b8bf2c3 | ||
|
|
eb048c91be | ||
|
|
358779dfb2 | ||
|
|
8f90ddb906 | ||
|
|
ed54aa8acf | ||
|
|
a90ffb117f | ||
|
|
29681717ed | ||
|
|
e0cd2b756f | ||
|
|
2c85060b5f | ||
|
|
864c5b4608 | ||
|
|
1ab501649e | ||
|
|
677e78bdce | ||
|
|
37a5ad3a53 | ||
|
|
00e4dab1ef | ||
|
|
8367411785 | ||
|
|
17e37dc42a | ||
|
|
90183b3588 |
@@ -26,7 +26,7 @@ variables:
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-testsuite=true -Dintrospection=enabled"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v48"
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v49"
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
@@ -66,7 +66,8 @@ style-check-diff:
|
||||
junit:
|
||||
- "${CI_PROJECT_DIR}/_build/report-x11.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland_gles.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland_gl.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland_gles2.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-broadway.xml"
|
||||
name: "gtk-${CI_COMMIT_REF_NAME}"
|
||||
paths:
|
||||
@@ -103,8 +104,9 @@ fedora-x86_64:
|
||||
${FEATURE_FLAGS}
|
||||
_build
|
||||
- meson compile -C _build
|
||||
- .gitlab-ci/run-tests.sh _build wayland
|
||||
- .gitlab-ci/run-tests.sh _build wayland_gles
|
||||
- .gitlab-ci/run-tests.sh _build x11 gtk
|
||||
# only repeat test runs that are likely affected by test setups
|
||||
- .gitlab-ci/run-tests.sh _build wayland_gl gtk:gdk,gtk:gsk-gl
|
||||
|
||||
release-build:
|
||||
extends: .build-fedora-default
|
||||
@@ -129,7 +131,9 @@ release-build:
|
||||
- meson install -C _build
|
||||
- PKG_CONFIG_PATH=${CI_PROJECT_DIR}/_install/lib64/pkgconfig:${CI_PROJECT_DIR}/_install/share/pkgconfig meson setup _build_hello examples/hello
|
||||
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
- .gitlab-ci/run-tests.sh _build wayland gtk
|
||||
# only repeat test runs that are likely affected by test setups
|
||||
- .gitlab-ci/run-tests.sh _build wayland_gles2 gtk:gdk,gtk:gsk-gl
|
||||
|
||||
fedora-clang:
|
||||
extends: .build-fedora-default
|
||||
@@ -423,11 +427,12 @@ asan-build:
|
||||
-Df16c=disabled
|
||||
_build
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build wayland
|
||||
- .gitlab-ci/run-tests.sh _build wayland_gles
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
- .gitlab-ci/run-tests.sh _build wayland gtk
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
|
||||
|
||||
BIN
.gitlab-ci/.fedora.Dockerfile.swp
Normal file
BIN
.gitlab-ci/.fedora.Dockerfile.swp
Normal file
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
FROM fedora:38
|
||||
FROM fedora:39
|
||||
|
||||
RUN dnf -y install \
|
||||
adwaita-icon-theme \
|
||||
|
||||
@@ -324,7 +324,7 @@ for line in args.infile:
|
||||
units.append(unit)
|
||||
|
||||
report = {}
|
||||
report['date'] = datetime.datetime.utcnow()
|
||||
report['date'] = datetime.datetime.now(datetime.UTC)
|
||||
report['locale_date'] = report['date'].strftime("%c")
|
||||
report['project_name'] = args.project_name
|
||||
report['backend'] = args.backend
|
||||
|
||||
@@ -44,7 +44,7 @@ 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'))
|
||||
testsuites.set('timestamp', datetime.datetime.now(datetime.UTC).isoformat(timespec='minutes'))
|
||||
|
||||
suites = {}
|
||||
for line in args.infile:
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
set +x
|
||||
set -x
|
||||
set +e
|
||||
|
||||
srcdir=$( pwd )
|
||||
builddir=$1
|
||||
backend=$2
|
||||
setup=$2
|
||||
suite=$3
|
||||
multiplier=${MESON_TEST_TIMEOUT_MULTIPLIER:-1}
|
||||
|
||||
# Ignore memory leaks lower in dependencies
|
||||
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:detect_leaks=0:allocator_may_return_null=1
|
||||
export G_SLICE=always-malloc
|
||||
|
||||
case "${backend}" in
|
||||
x11)
|
||||
case "${setup}" in
|
||||
x11*)
|
||||
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
|
||||
meson test -C ${builddir} \
|
||||
--quiet \
|
||||
--timeout-multiplier "${multiplier}" \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--suite=gtk \
|
||||
--setup=${setup} \
|
||||
--suite=${suite//,/ --suite=} \
|
||||
--no-suite=failing \
|
||||
--no-suite=${setup}_failing \
|
||||
--no-suite=flaky \
|
||||
--no-suite=headless \
|
||||
--no-suite=gsk-compare-broadway
|
||||
@@ -42,19 +44,19 @@ case "${backend}" in
|
||||
--quiet \
|
||||
--timeout-multiplier "${multiplier}" \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--suite=gtk \
|
||||
--setup=${setup} \
|
||||
--suite=${suite//,/ --suite=} \
|
||||
--no-suite=failing \
|
||||
--no-suite=${setup}_failing \
|
||||
--no-suite=flaky \
|
||||
--no-suite=headless \
|
||||
--no-suite=${backend}_failing \
|
||||
--no-suite=gsk-compare-broadway
|
||||
exit_code=$?
|
||||
|
||||
kill ${compositor}
|
||||
;;
|
||||
|
||||
broadway)
|
||||
broadway*)
|
||||
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
|
||||
|
||||
${builddir}/gdk/broadway/gtk4-broadwayd :5 &
|
||||
@@ -65,9 +67,10 @@ case "${backend}" in
|
||||
--quiet \
|
||||
--timeout-multiplier "${multiplier}" \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--suite=gtk \
|
||||
--setup=${setup} \
|
||||
--suite=${suite//,/ --suite=} \
|
||||
--no-suite=failing \
|
||||
--no-suite=${setup}_failing \
|
||||
--no-suite=flaky \
|
||||
--no-suite=headless \
|
||||
--no-suite=gsk-compare-opengl
|
||||
@@ -76,7 +79,7 @@ case "${backend}" in
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Failed to add ${backend} to .gitlab-ci/run-tests.sh"
|
||||
echo "Failed to add ${setup} to .gitlab-ci/run-tests.sh"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
@@ -86,17 +89,17 @@ cd ${builddir}
|
||||
|
||||
$srcdir/.gitlab-ci/meson-junit-report.py \
|
||||
--project-name=gtk \
|
||||
--backend="${backend}" \
|
||||
--backend="${setup}" \
|
||||
--job-id="${CI_JOB_NAME}" \
|
||||
--output="report-${backend}.xml" \
|
||||
"meson-logs/testlog-${backend}.json"
|
||||
--output="report-${setup}.xml" \
|
||||
"meson-logs/testlog-${setup}.json"
|
||||
|
||||
$srcdir/.gitlab-ci/meson-html-report.py \
|
||||
--project-name=gtk \
|
||||
--backend="${backend}" \
|
||||
--backend="${setup}" \
|
||||
--job-id="${CI_JOB_NAME}" \
|
||||
--reftest-output-dir="testsuite/reftests/output/${backend}" \
|
||||
--output="report-${backend}.html" \
|
||||
"meson-logs/testlog-${backend}.json"
|
||||
--reftest-output-dir="testsuite/reftests/output/${setup}" \
|
||||
--output="report-${setup}.html" \
|
||||
"meson-logs/testlog-${setup}.json"
|
||||
|
||||
exit $exit_code
|
||||
|
||||
38
NEWS
38
NEWS
@@ -1,6 +1,42 @@
|
||||
Overview of Changes in 4.13.3, xx-xx-xxxx
|
||||
Overview of Changes in 4.13.4, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
Overview of Changes in 4.13.3, 15-11-2023
|
||||
=========================================
|
||||
|
||||
* GtkGraphicsOffload: A new widget to support passthrough
|
||||
of dmabuf textures with subsurfaces on Wayland
|
||||
|
||||
* GtkListView:
|
||||
- reduce tree indentation
|
||||
|
||||
* GtkInspector:
|
||||
- Show more GL information
|
||||
- Add a subsurface overlay
|
||||
- Improve the fps overlay
|
||||
|
||||
* GDK
|
||||
- Allow implicit modifiers for dmabufs
|
||||
- Support more dmabuf formats: NV16, NV61, NV24, NV42
|
||||
and 3-plane YUV formats
|
||||
|
||||
* GSK
|
||||
- Fix padding of icons in the GL atlas
|
||||
- Fix handling of texture-scale nodes in cairo
|
||||
- Treat texture-scale nodes more faithfully in GL
|
||||
|
||||
* Accessibility:
|
||||
- Tweak the accessible name computation for corner cases
|
||||
|
||||
* The GTK/GDK/GSK_DEBUG environment variables now
|
||||
work in productions as well as in debug builds
|
||||
|
||||
* Translation updates
|
||||
Catalan
|
||||
French
|
||||
Russian
|
||||
|
||||
|
||||
Overview of Changes in 4.13.2, 22-10-2023
|
||||
=========================================
|
||||
|
||||
|
||||
41
build-aux/msvc/msvc_recommended_pragmas.h
Normal file
41
build-aux/msvc/msvc_recommended_pragmas.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef _MSC_VER
|
||||
#pragma error "This header is for Microsoft VC or clang-cl only."
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* Make MSVC more pedantic, this is a recommended pragma list
|
||||
* from _Win32_Programming_ by Rector and Newcomer.
|
||||
*/
|
||||
#ifndef __clang__
|
||||
#pragma warning(error:4002) /* too many actual parameters for macro */
|
||||
#pragma warning(error:4003) /* not enough actual parameters for macro */
|
||||
#pragma warning(1:4010) /* single-line comment contains line-continuation character */
|
||||
#pragma warning(error:4013) /* 'function' undefined; assuming extern returning int */
|
||||
#pragma warning(1:4016) /* no function return type; using int as default */
|
||||
#pragma warning(error:4020) /* too many actual parameters */
|
||||
#pragma warning(error:4021) /* too few actual parameters */
|
||||
#pragma warning(error:4027) /* function declared without formal parameter list */
|
||||
#pragma warning(error:4029) /* declared formal parameter list different from definition */
|
||||
#pragma warning(error:4033) /* 'function' must return a value */
|
||||
#pragma warning(error:4035) /* 'function' : no return value */
|
||||
#pragma warning(error:4045) /* array bounds overflow */
|
||||
#pragma warning(error:4047) /* different levels of indirection */
|
||||
#pragma warning(error:4049) /* terminating line number emission */
|
||||
#pragma warning(error:4053) /* An expression of type void was used as an operand */
|
||||
#pragma warning(error:4071) /* no function prototype given */
|
||||
#pragma warning(disable:4101) /* unreferenced local variable */
|
||||
#pragma warning(error:4150)
|
||||
|
||||
/* G_NORETURN */
|
||||
#pragma warning(error:4646) /* function declared with __declspec(noreturn) has non-void return type */
|
||||
#pragma warning(error:4715) /* 'function': not all control paths return a value */
|
||||
#pragma warning(error:4098) /* 'void' function returning a value */
|
||||
|
||||
#pragma warning(disable:4244) /* No possible loss of data warnings */
|
||||
#pragma warning(disable:4305) /* No truncation from int to char warnings */
|
||||
|
||||
#pragma warning(error:4819) /* The file contains a character that cannot be represented in the current code page */
|
||||
#endif /* __clang__ */
|
||||
|
||||
/* work around Microsoft's premature attempt to deprecate the C-Library */
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_NONSTDC_NO_WARNINGS
|
||||
@@ -35,7 +35,7 @@ show_action_dialog (GSimpleAction *action)
|
||||
{
|
||||
GtkAlertDialog *dialog;
|
||||
|
||||
dialog = gtk_alert_dialog_new ("You activated action: \"%s\n",
|
||||
dialog = gtk_alert_dialog_new ("You activated action: \"%s\"",
|
||||
g_action_get_name (G_ACTION (action)));
|
||||
gtk_alert_dialog_show (dialog, NULL);
|
||||
g_object_unref (dialog);
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __BLUR_OVERLAY_H__
|
||||
#define __BLUR_OVERLAY_H__
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -60,5 +59,3 @@ void blur_overlay_set_child (BlurOverlay *overlay,
|
||||
GtkWidget *widget);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __BLUR_OVERLAY_H__ */
|
||||
|
||||
@@ -75,7 +75,9 @@ query_tooltip (GtkWidget *widget,
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
|
||||
|
||||
precision = 1;
|
||||
s = NULL;
|
||||
do {
|
||||
g_free (s);
|
||||
s = g_strdup_printf ("%.*f", precision, self->scale);
|
||||
l = strlen (s) - 1;
|
||||
while (s[l] == '0')
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __DEMO_TAGGED_ENTRY_H__
|
||||
#define __DEMO_TAGGED_ENTRY_H__
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -57,5 +56,3 @@ void demo_tagged_entry_tag_set_has_close_button (DemoTaggedEntryTag *
|
||||
gboolean has_close_button);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __DEMO_TAGGED_ENTRY_H__ */
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_FONT_PLANE_H__
|
||||
#define __GTK_FONT_PLANE_H__
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -60,5 +59,3 @@ GtkWidget * gtk_font_plane_new (GtkAdjustment *width_adj,
|
||||
GtkAdjustment *weight_adj);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_FONT_PLANE_H__ */
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
* Authors: Matthias Clasen <mclasen@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef __GSK_SHADER_PAINTABLE_H__
|
||||
#define __GSK_SHADER_PAINTABLE_H__
|
||||
#pragma once
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gsk/gsk.h>
|
||||
@@ -42,5 +41,3 @@ void gsk_shader_paintable_update_time (GskShaderPaintable *self
|
||||
int time_idx,
|
||||
gint64 frame_time);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GSK_SHADER_PAINTABLE_H__ */
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_FISHBOWL_H__
|
||||
#define __GTK_FISHBOWL_H__
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -65,5 +64,3 @@ void gtk_fishbowl_set_creation_func (GtkFishbowl *fishbowl,
|
||||
GtkFishCreationFunc creation_func);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_FISHBOWL_H__ */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __GTK_GEARS_H__
|
||||
#define __GTK_GEARS_H__
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -44,5 +43,3 @@ void gtk_gears_set_fps_label (GtkGears *gears,
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_GEARS_H__ */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __GTK_SHADER_BIN_H__
|
||||
#define __GTK_SHADER_BIN_H__
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -19,5 +18,3 @@ void gtk_shader_bin_set_child (GtkShaderBin *self,
|
||||
GtkWidget *gtk_shader_bin_get_child (GtkShaderBin *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_SHADER_BIN_H__ */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __GTK_SHADER_STACK_H__
|
||||
#define __GTK_SHADER_STACK_H__
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -19,5 +18,3 @@ void gtk_shader_stack_set_active (GtkShaderStack *self,
|
||||
int index);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_SHADER_STACK_H__ */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __GTK_SHADERTOY_H__
|
||||
#define __GTK_SHADERTOY_H__
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -30,5 +29,3 @@ void gtk_shadertoy_set_image_shader (GtkShadertoy *shadertoy,
|
||||
const char *shader);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_SHADERTOY_H__ */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef LANGUAGE_NAMES_H
|
||||
#define LANGUAGE_NAMES_H
|
||||
#pragma once
|
||||
|
||||
#include <pango/pango.h>
|
||||
|
||||
@@ -9,5 +8,3 @@ const char * get_language_name (PangoLanguage *language);
|
||||
const char * get_language_name_for_tag (guint32 tag);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __PAINTABLE_H__
|
||||
#define __PAINTABLE_H__
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -13,5 +12,3 @@ void gtk_nuclear_snapshot (GtkSnapshot *snapshot,
|
||||
GdkPaintable * gtk_nuclear_icon_new (double rotation);
|
||||
GdkPaintable * gtk_nuclear_animation_new (gboolean draw_background);
|
||||
GtkMediaStream *gtk_nuclear_media_stream_new (void);
|
||||
|
||||
#endif /* __PAINTABLE_H__ */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __PUZZLE_PIECE_H__
|
||||
#define __PUZZLE_PIECE_H__
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -19,5 +18,3 @@ GdkPaintable * gtk_puzzle_piece_new (GdkPaintable *puzzle,
|
||||
GdkPaintable * gtk_puzzle_piece_get_puzzle (GtkPuzzlePiece *self);
|
||||
guint gtk_puzzle_piece_get_x (GtkPuzzlePiece *self);
|
||||
guint gtk_puzzle_piece_get_y (GtkPuzzlePiece *self);
|
||||
|
||||
#endif /* __PUZZLE_PIECE_H__ */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef SCRIPT_NAMES_H
|
||||
#define SCRIPT_NAMES_H
|
||||
#pragma once
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
@@ -9,5 +8,3 @@ const char * get_script_name (GUnicodeScript script);
|
||||
const char * get_script_name_for_tag (guint32 tag);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
@@ -139,6 +139,7 @@ do_video_player (GtkWidget *do_widget)
|
||||
|
||||
video = gtk_video_new ();
|
||||
gtk_video_set_autoplay (GTK_VIDEO (video), TRUE);
|
||||
gtk_video_set_graphics_offload (GTK_VIDEO (video), GTK_GRAPHICS_OFFLOAD_ENABLED);
|
||||
gtk_window_set_child (GTK_WINDOW (window), video);
|
||||
|
||||
title = gtk_header_bar_new ();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __ICON_BROWSER_APP_H
|
||||
#define __ICON_BROWSER_APP_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -14,6 +13,3 @@ typedef struct _IconBrowserAppClass IconBrowserAppClass;
|
||||
|
||||
GType icon_browser_app_get_type (void);
|
||||
IconBrowserApp *icon_browser_app_new (void);
|
||||
|
||||
|
||||
#endif /* __ICON_BROWSER_APP_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __ICON_BROWSER_WIN_H
|
||||
#define __ICON_BROWSER_WIN_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "iconbrowserapp.h"
|
||||
@@ -15,6 +14,3 @@ typedef struct _IconBrowserWindowClass IconBrowserWindowClass;
|
||||
|
||||
GType icon_browser_window_get_type (void);
|
||||
IconBrowserWindow *icon_browser_window_new (IconBrowserApp *app);
|
||||
|
||||
|
||||
#endif /* __ICON_BROWSER_WIN_H */
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __GTK_RENDERER_PAINTABLE_H__
|
||||
#define __GTK_RENDERER_PAINTABLE_H__
|
||||
#pragma once
|
||||
|
||||
#include <gsk/gsk.h>
|
||||
|
||||
@@ -39,5 +38,3 @@ void gtk_renderer_paintable_set_paintable (GtkRendererPaintable
|
||||
GdkPaintable * gtk_renderer_paintable_get_paintable (GtkRendererPaintable *self) G_GNUC_PURE;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_RENDERER_PAINTABLE_H__ */
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __NODE_EDITOR_APPLICATION_H__
|
||||
#define __NODE_EDITOR_APPLICATION_H__
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -33,6 +32,3 @@ typedef struct _NodeEditorApplicationClass NodeEditorApplicationClass;
|
||||
|
||||
GType node_editor_application_get_type (void);
|
||||
NodeEditorApplication *node_editor_application_new (void);
|
||||
|
||||
|
||||
#endif /* __NODE_EDITOR_APPLICATION_H__ */
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __NODE_EDITOR_WINDOW_H__
|
||||
#define __NODE_EDITOR_WINDOW_H__
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -38,5 +37,3 @@ NodeEditorWindow * node_editor_window_new (NodeEditorApplication
|
||||
|
||||
gboolean node_editor_window_load (NodeEditorWindow *self,
|
||||
GFile *file);
|
||||
|
||||
#endif /* __NODE_EDITOR_WINDOW_H__ */
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 533 B |
Binary file not shown.
|
Before Width: | Height: | Size: 127 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M3.384 3h3.231c.213 0 .385.224.385.502v2.996C7 6.776 6.828 7 6.615 7h-3.23C3.17 7 3 6.776 3 6.498V3.502C3 3.224 3.17 3 3.384 3zm6 0h3.231c.213 0 .385.224.385.502v2.996c0 .278-.172.502-.385.502h-3.23C9.17 7 9 6.776 9 6.498V3.502C9 3.224 9.17 3 9.384 3zm-6 6h3.231c.213 0 .385.224.385.502v2.996c0 .278-.172.502-.385.502h-3.23C3.17 13 3 12.776 3 12.498V9.502C3 9.224 3.17 9 3.384 9zm6 0h3.231c.213 0 .385.224.385.502v2.996c0 .278-.172.502-.385.502h-3.23C9.17 13 9 12.776 9 12.498V9.502C9 9.224 9.17 9 9.384 9z" style="marker:none" overflow="visible" color="#000" fill="#474747"/></svg>
|
||||
|
Before Width: | Height: | Size: 654 B |
@@ -25,14 +25,12 @@
|
||||
<file>icons/16x16/actions/format-justify-fill-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/format-justify-left-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/format-justify-right-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/insert-image.png</file>
|
||||
<file>icons/16x16/actions/insert-link-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/send-to-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/star-new-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/view-continuous-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/view-dual-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/view-fullscreen-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/view-grid-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/view-paged-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/zoom-in-symbolic.symbolic.png</file>
|
||||
<file>icons/16x16/actions/zoom-in.png</file>
|
||||
@@ -88,7 +86,6 @@
|
||||
<file>icons/scalable/actions/view-dual-symbolic.svg</file>
|
||||
<file>icons/scalable/actions/view-paged-symbolic.svg</file>
|
||||
<file>icons/scalable/actions/view-fullscreen-symbolic.svg</file>
|
||||
<file>icons/scalable/actions/view-grid-symbolic.svg</file>
|
||||
<file>icons/scalable/actions/zoom-in-symbolic.svg</file>
|
||||
<file>icons/scalable/actions/zoom-original-symbolic.svg</file>
|
||||
<file>icons/scalable/actions/zoom-out-symbolic.svg</file>
|
||||
|
||||
@@ -685,6 +685,8 @@ stack-allocated using `g_newa()` or `g_alloca()`. But limit the amount
|
||||
of stack memory that you consume this way, in particular in recursive
|
||||
functions.
|
||||
|
||||
On Windows, the default stack size we have to work with is 1M.
|
||||
|
||||
### Macros
|
||||
|
||||
Try to avoid private macros unless strictly necessary. Remember to #undef
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
----
|
||||
Title: Cairo interaction
|
||||
----
|
||||
|
||||
## Functions to support using cairo
|
||||
|
||||
|
||||
@@ -107,4 +107,5 @@ content_images = [
|
||||
"images/popup-flip.png",
|
||||
"images/popup-slide.png",
|
||||
]
|
||||
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gdk/"
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Title: Key Values
|
||||
Title: Keyboard Codes, Groups, And Modifiers
|
||||
|
||||
## Functions for manipulating keyboard codes
|
||||
|
||||
@@ -8,19 +8,19 @@ The complete list of key values can be found in the [`gdk/gdkkeysyms.h`](https:/
|
||||
file.
|
||||
|
||||
Key values are regularly updated from the upstream X.org X11 implementation,
|
||||
so new values are added regularly. They will be prefixed with GDK_KEY_ rather
|
||||
than XF86XK_ or XK_ (for older symbols).
|
||||
so new values are added regularly. They will be prefixed with `GDK_KEY_` rather
|
||||
than `XF86XK_` or `XK_` (for older symbols).
|
||||
|
||||
Key values can be converted into a string representation using
|
||||
gdk_keyval_name(). The reverse function, converting a string to a key value,
|
||||
is provided by gdk_keyval_from_name().
|
||||
[`func@Gdk.keyval_name`]. The reverse function, converting a string to a key
|
||||
value, is provided by [`func@Gdk.keyval_from_name`].
|
||||
|
||||
The case of key values can be determined using gdk_keyval_is_upper() and
|
||||
gdk_keyval_is_lower(). Key values can be converted to upper or lower case
|
||||
using gdk_keyval_to_upper() and gdk_keyval_to_lower().
|
||||
The case of key values can be determined using [`func@Gdk.keyval_is_upper`]
|
||||
and [`func@Gdk.keyval_is_lower`]. Key values can be converted to upper or lower
|
||||
case using [`func@Gdk.keyval_to_upper`] and [`func@Gdk.keyval_to_lower`].
|
||||
|
||||
When it makes sense, key values can be converted to and from
|
||||
Unicode characters with gdk_keyval_to_unicode() and gdk_unicode_to_keyval().
|
||||
When it makes sense, key values can be converted to and from Unicode characters
|
||||
with [`func@Gdk.keyval_to_unicode`] and [`func@Gdk.unicode_to_keyval`].
|
||||
|
||||
## Key groups
|
||||
|
||||
@@ -36,23 +36,23 @@ You can think of a [struct@Gdk.KeymapKey] as a representation of a symbol
|
||||
printed on a physical keyboard key. That is, it contains three pieces of
|
||||
information:
|
||||
|
||||
1. first, it contains the hardware keycode; this is an identifying number
|
||||
for a physical key
|
||||
1. second, it contains the “level” of the key. The level indicates which
|
||||
symbol on the key will be used, in a vertical direction. So on a standard
|
||||
US keyboard, the key with the number “1“ on it also has the exclamation
|
||||
point (”!”) character on it. The level indicates whether to use the “1”
|
||||
or the “!” symbol. The letter keys are considered to have a lowercase
|
||||
letter at level 0, and an uppercase letter at level 1, though normally
|
||||
only the uppercase letter is printed on the key
|
||||
1. third, the [struct@Gdk.KeymapKey] contains a group; groups are not used on
|
||||
standard US keyboards, but are used in many other countries. On a
|
||||
keyboard with groups, there can be 3 or 4 symbols printed on a single
|
||||
key. The group indicates movement in a horizontal direction. Usually
|
||||
groups are used for two different languages. In group 0, a key might
|
||||
have two English characters, and in group 1 it might have two Hebrew
|
||||
characters. The Hebrew characters will be printed on the key next to
|
||||
the English characters.
|
||||
1. first, it contains the hardware keycode; this is an identifying number
|
||||
for a physical key
|
||||
1. second, it contains the “level” of the key. The level indicates which
|
||||
symbol on the key will be used, in a vertical direction. So on a standard
|
||||
US keyboard, the key with the number “1“ on it also has the exclamation
|
||||
point (”!”) character on it. The level indicates whether to use the “1”
|
||||
or the “!” symbol. The letter keys are considered to have a lowercase
|
||||
letter at level 0, and an uppercase letter at level 1, though normally
|
||||
only the uppercase letter is printed on the key
|
||||
1. third, the [struct@Gdk.KeymapKey] contains a group; groups are not used on
|
||||
standard US keyboards, but are used in many other countries. On a
|
||||
keyboard with groups, there can be 3 or 4 symbols printed on a single
|
||||
key. The group indicates movement in a horizontal direction. Usually
|
||||
groups are used for two different languages. In group 0, a key might
|
||||
have two English characters, and in group 1 it might have two Hebrew
|
||||
characters. The Hebrew characters will be printed on the key next to
|
||||
the English characters.
|
||||
|
||||
When GDK creates a key event in order to deliver a key press or release,
|
||||
it first converts the current keyboard state into an effective group and
|
||||
@@ -72,7 +72,7 @@ in the key event and can be obtained via [class@Gdk.KeyEvent] getters.
|
||||
### Consumed modifiers
|
||||
|
||||
The `consumed_modifiers` in a key event are modifiers that should be masked
|
||||
out from @state when comparing this key press to a hot key. For instance,
|
||||
out from `@state` when comparing this key press to a hot key. For instance,
|
||||
on a US keyboard, the `plus` symbol is shifted, so when comparing a key
|
||||
press to a `<Control>plus` accelerator `<Shift>` should be masked out.
|
||||
|
||||
@@ -91,9 +91,8 @@ if (keyval == GDK_PLUS &&
|
||||
```
|
||||
|
||||
An older interpretation of `consumed_modifiers` was that it contained
|
||||
all modifiers that might affect the translation of the key;
|
||||
this allowed accelerators to be stored with irrelevant consumed
|
||||
modifiers, by doing:
|
||||
all modifiers that might affect the translation of the key; this allowed
|
||||
accelerators to be stored with irrelevant consumed modifiers, by doing:
|
||||
|
||||
```c
|
||||
// XXX Don’t do this XXX
|
||||
@@ -102,12 +101,11 @@ if (keyval == accel_keyval &&
|
||||
// Accelerator was pressed
|
||||
```
|
||||
|
||||
However, this did not work if multi-modifier combinations were
|
||||
used in the keymap, since, for instance, `<Control>` would be
|
||||
masked out even if only `<Control><Alt>` was used in
|
||||
the keymap. To support this usage as well as well as possible, all single
|
||||
modifier combinations that could affect the key for any combination
|
||||
of modifiers will be returned in `consumed_modifiers`; multi-modifier
|
||||
combinations are returned only when actually found in `state`. When
|
||||
you store accelerators, you should always store them with consumed
|
||||
However, this did not work if multi-modifier combinations were used in the
|
||||
keymap, since, for instance, `<Control>` would be masked out even if only
|
||||
`<Control><Alt>` was used in the keymap. To support this usage as well as
|
||||
well as possible, all single modifier combinations that could affect the key
|
||||
for any combination of modifiers will be returned in `consumed_modifiers`;
|
||||
multi-modifier combinations are returned only when actually found in `state`.
|
||||
When you store accelerators, you should always store them with consumed
|
||||
modifiers removed. Store `<Control>plus`, not `<Control><Shift>plus`.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Title: Pango Interaction
|
||||
Title: Pango Interaction
|
||||
|
||||
Pango is the text layout system used by GDK and GTK. The functions
|
||||
and types in this section are used to obtain clip regions for
|
||||
|
||||
@@ -62,4 +62,5 @@ content_images = [
|
||||
"images/stroke-miter.png",
|
||||
"images/stroke-round.png",
|
||||
]
|
||||
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gsk/"
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
Title: Compiling the GTK Libraries
|
||||
Title: Building GTK
|
||||
Slug: gtk-building
|
||||
|
||||
## Building GTK
|
||||
|
||||
Before we get into the details of how to compile GTK, we should
|
||||
mention that in many cases, binary packages of GTK prebuilt for
|
||||
your operating system will be available, either from your
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
Title: Coordinate systems
|
||||
Title: Coordinate systems in GTK
|
||||
Slug: gtk-coordinates
|
||||
|
||||
## Coordinate systems in GTK
|
||||
|
||||
All coordinate systems in GTK have the origin at the top left, with the X axis
|
||||
pointing right, and the Y axis pointing down. This matches the convention used
|
||||
in X11, Wayland and cairo, but differs from OpenGL and PostScript, where the origin
|
||||
|
||||
@@ -41,7 +41,7 @@ activate (GtkApplication* app,
|
||||
window = gtk_application_window_new (app);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Window");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
|
||||
gtk_widget_show (window);
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
int
|
||||
@@ -183,7 +183,7 @@ activate (GtkApplication *app,
|
||||
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
gtk_widget_show (window);
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
int
|
||||
@@ -331,8 +331,7 @@ activate (GtkApplication *app,
|
||||
*/
|
||||
gtk_grid_attach (GTK_GRID (grid), button, 0, 1, 2, 1);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
int
|
||||
@@ -554,7 +553,7 @@ activate (GtkApplication *app,
|
||||
|
||||
g_signal_connect (press, "pressed", G_CALLBACK (pressed), drawing_area);
|
||||
|
||||
gtk_widget_show (window);
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
int
|
||||
@@ -631,7 +630,7 @@ activate (GtkApplication *app,
|
||||
button = gtk_builder_get_object (builder, "quit");
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (quit_cb), window);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (window));
|
||||
gtk_widget_set_visible (GTK_WIDGET (window), TRUE);
|
||||
|
||||
/* We do not need the builder any more */
|
||||
g_object_unref (builder);
|
||||
|
||||
@@ -35,6 +35,11 @@ Showing
|
||||
|
||||
The ``show`` command displays the rendernode.
|
||||
|
||||
``--undecorated``
|
||||
|
||||
Removes window decorations. This is meant for rendering of exactly the rendernode
|
||||
without any titlebar.
|
||||
|
||||
Rendering
|
||||
^^^^^^^^^
|
||||
|
||||
|
||||
@@ -245,4 +245,5 @@ content_images = [
|
||||
"images/box-model-light.png",
|
||||
"images/box-model-dark.png",
|
||||
]
|
||||
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gtk/"
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
----
|
||||
Title: Initialization
|
||||
----
|
||||
Title: Initializing GTK
|
||||
|
||||
# Library initialization and main loop
|
||||
## Library initialization and main loop
|
||||
|
||||
Before using GTK, you need to initialize it using [func@Gtk.init]; this
|
||||
connects to the windowing system, sets up the locale and performs other
|
||||
@@ -49,7 +47,7 @@ main (int argc, char **argv)
|
||||
// ...
|
||||
|
||||
// Show the application window
|
||||
gtk_widget_show (window);
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
|
||||
// Enter the main event loop, and wait for user interaction
|
||||
while (!done)
|
||||
@@ -66,5 +64,5 @@ as spinning the main loop.
|
||||
|
||||
### See also
|
||||
|
||||
- the GLib manual, especially `GMainLoop`
|
||||
- signal-related functions, such as `g_signal_connect()` in GObject
|
||||
- the GLib manual, especially `GMainLoop`
|
||||
- signal-related functions, such as `g_signal_connect()` in GObject
|
||||
|
||||
@@ -2,5 +2,6 @@ Title: Migrating from GTK 2.x to GTK 4
|
||||
Slug: gtk-migrating-2-to-4
|
||||
|
||||
If your application is still using GTK 2, you should first convert it to GTK 3,
|
||||
by following the [migration guide](https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html)
|
||||
in the GTK 3 documentation, and then follow [these instructions](#gtk-migrating-3-to-4).
|
||||
by following the [migration guide](https://docs.gtk.org/gtk3/migrating-2to3.html)
|
||||
in the GTK 3 documentation, and then follow [the GTK 3 to 4 migration
|
||||
guide](migrating-3to4.html).
|
||||
|
||||
@@ -31,10 +31,11 @@ for GTK, available on GitLab.
|
||||
|
||||
If you want to discuss your approach before or after working on it,
|
||||
good ways to contact the GTK developers, apart from GitLab issues,
|
||||
are
|
||||
are:
|
||||
|
||||
- the #gtk IRC channel on irc.gnome.org
|
||||
- the gtk tag on the [GNOME Discourse instance](https://discourse.gnome.org/tag/gtk)
|
||||
- the `#gtk:gnome.org` Matrix room
|
||||
- the `#gtk` IRC channel on `irc.libera.chat`
|
||||
|
||||
You should not send patches by email, as they will inevitably get lost,
|
||||
or forgotten. Always open a merge request.
|
||||
|
||||
@@ -206,10 +206,10 @@ are only available when GTK has been configured with `-Ddebug=true`.
|
||||
`dmabuf`
|
||||
: Information about dmabuf handling (Linux-only)
|
||||
|
||||
A number of options affect behavior instead of logging:
|
||||
`offload`
|
||||
: Information about subsurfaces and graphics offload (Wayland-only)
|
||||
|
||||
`nograbs`
|
||||
: Turn off all pointer and keyboard grabs
|
||||
A number of options affect behavior instead of logging:
|
||||
|
||||
`portals`
|
||||
: Force the use of [portals](https://docs.flatpak.org/en/latest/portals.html)
|
||||
@@ -226,11 +226,14 @@ A number of options affect behavior instead of logging:
|
||||
`gl-debug`
|
||||
: Insert debugging information in OpenGL
|
||||
|
||||
`gl-legacy`
|
||||
: Use a legacy OpenGL context
|
||||
`gl-disable-gl`
|
||||
: Don't allow the use of OpenGL GL API. This forces GLES to be used
|
||||
|
||||
`gl-gles`
|
||||
: Use a GLES OpenGL context
|
||||
`gl-disable-gles`
|
||||
: Don't allow the use of OpenGL GLES API. This forces GL to be used
|
||||
|
||||
`gl-prefer-gl`
|
||||
: Prefer OpenGL over OpenGL ES. This was the default behavior before GTK 4.14.
|
||||
|
||||
`gl-egl`
|
||||
: Use an EGL context on X11 or Windows
|
||||
@@ -306,6 +309,9 @@ A number of options affect behavior instead of logging:
|
||||
`sync`
|
||||
: Sync after each frame
|
||||
|
||||
`offload-disable`
|
||||
: Disable graphics offload to subsurfaces
|
||||
|
||||
`vulkan-staging-image`
|
||||
: Use a staging image for Vulkan texture upload
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPP_H
|
||||
#define __EXAMPLEAPP_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -8,6 +7,3 @@
|
||||
G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
|
||||
|
||||
ExampleApp *example_app_new (void);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPP_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPPWIN_H
|
||||
#define __EXAMPLEAPPWIN_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "exampleapp.h"
|
||||
@@ -12,6 +11,3 @@ G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW,
|
||||
ExampleAppWindow *example_app_window_new (ExampleApp *app);
|
||||
void example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPPWIN_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPP_H
|
||||
#define __EXAMPLEAPP_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -9,6 +8,3 @@ G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
|
||||
|
||||
|
||||
ExampleApp *example_app_new (void);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPP_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPPWIN_H
|
||||
#define __EXAMPLEAPPWIN_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "exampleapp.h"
|
||||
@@ -12,6 +11,3 @@ G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW,
|
||||
ExampleAppWindow *example_app_window_new (ExampleApp *app);
|
||||
void example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPPWIN_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPP_H
|
||||
#define __EXAMPLEAPP_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -9,6 +8,3 @@ G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
|
||||
|
||||
|
||||
ExampleApp *example_app_new (void);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPP_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPPWIN_H
|
||||
#define __EXAMPLEAPPWIN_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "exampleapp.h"
|
||||
@@ -12,6 +11,3 @@ G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW,
|
||||
ExampleAppWindow *example_app_window_new (ExampleApp *app);
|
||||
void example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPPWIN_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPP_H
|
||||
#define __EXAMPLEAPP_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -9,6 +8,3 @@ G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
|
||||
|
||||
|
||||
ExampleApp *example_app_new (void);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPP_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPPWIN_H
|
||||
#define __EXAMPLEAPPWIN_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "exampleapp.h"
|
||||
@@ -12,6 +11,3 @@ G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW,
|
||||
ExampleAppWindow *example_app_window_new (ExampleApp *app);
|
||||
void example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPPWIN_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPP_H
|
||||
#define __EXAMPLEAPP_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -9,6 +8,3 @@ G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
|
||||
|
||||
|
||||
ExampleApp *example_app_new (void);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPP_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPPWIN_H
|
||||
#define __EXAMPLEAPPWIN_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "exampleapp.h"
|
||||
@@ -12,6 +11,3 @@ G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW,
|
||||
ExampleAppWindow *example_app_window_new (ExampleApp *app);
|
||||
void example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPPWIN_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPP_H
|
||||
#define __EXAMPLEAPP_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -9,6 +8,3 @@ G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
|
||||
|
||||
|
||||
ExampleApp *example_app_new (void);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPP_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPPPREFS_H
|
||||
#define __EXAMPLEAPPPREFS_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "exampleappwin.h"
|
||||
@@ -10,6 +9,3 @@ G_DECLARE_FINAL_TYPE (ExampleAppPrefs, example_app_prefs, EXAMPLE, APP_PREFS, Gt
|
||||
|
||||
|
||||
ExampleAppPrefs *example_app_prefs_new (ExampleAppWindow *win);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPPPREFS_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPPWIN_H
|
||||
#define __EXAMPLEAPPWIN_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "exampleapp.h"
|
||||
@@ -12,6 +11,3 @@ G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW,
|
||||
ExampleAppWindow *example_app_window_new (ExampleApp *app);
|
||||
void example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPPWIN_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPP_H
|
||||
#define __EXAMPLEAPP_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -9,6 +8,3 @@ G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
|
||||
|
||||
|
||||
ExampleApp *example_app_new (void);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPP_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPPPREFS_H
|
||||
#define __EXAMPLEAPPPREFS_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "exampleappwin.h"
|
||||
@@ -10,6 +9,3 @@ G_DECLARE_FINAL_TYPE (ExampleAppPrefs, example_app_prefs, EXAMPLE, APP_PREFS, Gt
|
||||
|
||||
|
||||
ExampleAppPrefs *example_app_prefs_new (ExampleAppWindow *win);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPPPREFS_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPPWIN_H
|
||||
#define __EXAMPLEAPPWIN_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "exampleapp.h"
|
||||
@@ -12,6 +11,3 @@ G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW,
|
||||
ExampleAppWindow *example_app_window_new (ExampleApp *app);
|
||||
void example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPPWIN_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPP_H
|
||||
#define __EXAMPLEAPP_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -9,6 +8,3 @@ G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
|
||||
|
||||
|
||||
ExampleApp *example_app_new (void);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPP_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPPPREFS_H
|
||||
#define __EXAMPLEAPPPREFS_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "exampleappwin.h"
|
||||
@@ -10,6 +9,3 @@ G_DECLARE_FINAL_TYPE (ExampleAppPrefs, example_app_prefs, EXAMPLE, APP_PREFS, Gt
|
||||
|
||||
|
||||
ExampleAppPrefs *example_app_prefs_new (ExampleAppWindow *win);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPPPREFS_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPPWIN_H
|
||||
#define __EXAMPLEAPPWIN_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "exampleapp.h"
|
||||
@@ -12,6 +11,3 @@ G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW,
|
||||
ExampleAppWindow *example_app_window_new (ExampleApp *app);
|
||||
void example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPPWIN_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPP_H
|
||||
#define __EXAMPLEAPP_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
@@ -9,6 +8,3 @@ G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
|
||||
|
||||
|
||||
ExampleApp *example_app_new (void);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPP_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPPPREFS_H
|
||||
#define __EXAMPLEAPPPREFS_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "exampleappwin.h"
|
||||
@@ -10,6 +9,3 @@ G_DECLARE_FINAL_TYPE (ExampleAppPrefs, example_app_prefs, EXAMPLE, APP_PREFS, Gt
|
||||
|
||||
|
||||
ExampleAppPrefs *example_app_prefs_new (ExampleAppWindow *win);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPPPREFS_H */
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef __EXAMPLEAPPWIN_H
|
||||
#define __EXAMPLEAPPWIN_H
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "exampleapp.h"
|
||||
@@ -12,6 +11,3 @@ G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW,
|
||||
ExampleAppWindow *example_app_window_new (ExampleApp *app);
|
||||
void example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file);
|
||||
|
||||
|
||||
#endif /* __EXAMPLEAPPWIN_H */
|
||||
|
||||
@@ -209,13 +209,11 @@ _gdk_broadway_roundtrip_notify (GdkSurface *surface,
|
||||
timings->complete = TRUE;
|
||||
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
|
||||
_gdk_frame_clock_debug_print_timings (clock, timings);
|
||||
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
_gdk_frame_clock_add_timings_to_profiler (clock, timings);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -369,14 +369,12 @@ portal_file_serializer (GdkContentSerializer *serializer)
|
||||
GDK_DEBUG (DND, "file transfer portal: Adding %s", g_file_peek_path (file));
|
||||
g_ptr_array_add (files, g_file_get_path (file));
|
||||
}
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
else if (GDK_DEBUG_CHECK (DND))
|
||||
{
|
||||
char *uri = g_file_get_uri (file);
|
||||
gdk_debug_message ("file transfer portal: %s has no path, dropping\n", uri);
|
||||
g_free (uri);
|
||||
}
|
||||
#endif
|
||||
|
||||
g_ptr_array_add (files, NULL);
|
||||
}
|
||||
@@ -426,14 +424,12 @@ portal_finish (GObject *object,
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (DND))
|
||||
{
|
||||
char *s = g_strjoinv (", ", files);
|
||||
gdk_debug_message ("file transfer portal: Receiving files: %s", s);
|
||||
g_free (s);
|
||||
}
|
||||
#endif
|
||||
|
||||
value = gdk_content_deserializer_get_value (deserializer);
|
||||
if (G_VALUE_HOLDS (value, G_TYPE_FILE))
|
||||
|
||||
54
gdk/gdk.c
54
gdk/gdk.c
@@ -118,24 +118,25 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "selection", GDK_DEBUG_SELECTION, "Information about selections" },
|
||||
{ "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" },
|
||||
{ "dmabuf", GDK_DEBUG_DMABUF, "Information about dmabuf buffers" },
|
||||
{ "offload", GDK_DEBUG_OFFLOAD, "Information about subsurfaces and graphics offload" },
|
||||
|
||||
{ "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE },
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals", TRUE },
|
||||
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals", TRUE },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support", TRUE },
|
||||
{ "gl-fractional", GDK_DEBUG_GL_FRACTIONAL, "Enable fractional scaling for OpenGL (experimental)", TRUE },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL", TRUE },
|
||||
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context", TRUE },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API", TRUE },
|
||||
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows", TRUE },
|
||||
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11", TRUE },
|
||||
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows", TRUE },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support", TRUE },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer", TRUE },
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
|
||||
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE },
|
||||
{ "no-vsync", GDK_DEBUG_NO_VSYNC, "Repaint instantly (uses 100% CPU with animations)", TRUE },
|
||||
{ "dmabuf-disable", GDK_DEBUG_DMABUF_DISABLE, "Disable dmabuf support", TRUE },
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
|
||||
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||
{ "gl-fractional", GDK_DEBUG_GL_FRACTIONAL, "Enable fractional scaling for OpenGL (experimental)" },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||
{ "gl-disable-gl", GDK_DEBUG_GL_DISABLE_GL, "Only allow OpenGL GLES API" },
|
||||
{ "gl-disable-gles", GDK_DEBUG_GL_DISABLE_GLES, "Don't allow OpenGL GLES API" },
|
||||
{ "gl-prefer-gl", GDK_DEBUG_GL_PREFER_GL, "Prefer GL over GLES API" },
|
||||
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" },
|
||||
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" },
|
||||
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings" },
|
||||
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible" },
|
||||
{ "no-vsync", GDK_DEBUG_NO_VSYNC, "Repaint instantly (uses 100% CPU with animations)" },
|
||||
{ "dmabuf-disable", GDK_DEBUG_DMABUF_DISABLE, "Disable dmabuf support" },
|
||||
};
|
||||
|
||||
|
||||
@@ -196,13 +197,6 @@ gdk_parse_debug_var (const char *variable,
|
||||
const char *q;
|
||||
gboolean invert;
|
||||
gboolean help;
|
||||
gboolean debug_enabled;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
debug_enabled = TRUE;
|
||||
#else
|
||||
debug_enabled = FALSE;
|
||||
#endif
|
||||
|
||||
string = g_getenv (variable);
|
||||
if (string == NULL)
|
||||
@@ -234,12 +228,6 @@ gdk_parse_debug_var (const char *variable,
|
||||
if (strlen (keys[i].key) == q - p &&
|
||||
g_ascii_strncasecmp (keys[i].key, p, q - p) == 0)
|
||||
{
|
||||
if (!debug_enabled && !keys[i].always_enabled)
|
||||
{
|
||||
fprintf (stderr, "\"%s\" is only available when building GTK with G_ENABLE_DEBUG. See %s=help\n",
|
||||
val, variable);
|
||||
break;
|
||||
}
|
||||
result |= keys[i].value;
|
||||
break;
|
||||
}
|
||||
@@ -263,8 +251,7 @@ gdk_parse_debug_var (const char *variable,
|
||||
|
||||
fprintf (stderr, "Supported %s values:\n", variable);
|
||||
for (i = 0; i < nkeys; i++) {
|
||||
if (debug_enabled || keys[i].always_enabled)
|
||||
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
}
|
||||
fprintf (stderr, " %s%*s%s\n", "all", max_width - 3, " ", "Enable all values. Other given values are subtracted");
|
||||
fprintf (stderr, " %s%*s%s\n", "help", max_width - 4, " ", "Print this help");
|
||||
@@ -277,8 +264,7 @@ gdk_parse_debug_var (const char *variable,
|
||||
|
||||
for (i = 0; i < nkeys; i++)
|
||||
{
|
||||
if (debug_enabled || keys[i].always_enabled)
|
||||
all_flags |= keys[i].value;
|
||||
all_flags |= keys[i].value;
|
||||
}
|
||||
|
||||
result = all_flags & (~result);
|
||||
|
||||
@@ -37,25 +37,27 @@ typedef enum {
|
||||
GDK_DEBUG_SELECTION = 1 << 9,
|
||||
GDK_DEBUG_CLIPBOARD = 1 << 10,
|
||||
GDK_DEBUG_DMABUF = 1 << 11,
|
||||
GDK_DEBUG_OFFLOAD = 1 << 12,
|
||||
|
||||
/* flags below are influencing behavior */
|
||||
GDK_DEBUG_NOGRABS = 1 << 12,
|
||||
GDK_DEBUG_PORTALS = 1 << 13,
|
||||
GDK_DEBUG_NO_PORTALS = 1 << 14,
|
||||
GDK_DEBUG_GL_DISABLE = 1 << 15,
|
||||
GDK_DEBUG_GL_FRACTIONAL = 1 << 16,
|
||||
GDK_DEBUG_GL_LEGACY = 1 << 17,
|
||||
GDK_DEBUG_GL_GLES = 1 << 18,
|
||||
GDK_DEBUG_GL_DEBUG = 1 << 19,
|
||||
GDK_DEBUG_GL_EGL = 1 << 20,
|
||||
GDK_DEBUG_GL_GLX = 1 << 21,
|
||||
GDK_DEBUG_GL_WGL = 1 << 22,
|
||||
GDK_DEBUG_VULKAN_DISABLE = 1 << 23,
|
||||
GDK_DEBUG_VULKAN_VALIDATE = 1 << 24,
|
||||
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 25,
|
||||
GDK_DEBUG_HIGH_DEPTH = 1 << 26,
|
||||
GDK_DEBUG_NO_VSYNC = 1 << 27,
|
||||
GDK_DEBUG_DMABUF_DISABLE = 1 << 28,
|
||||
GDK_DEBUG_PORTALS = 1 << 14,
|
||||
GDK_DEBUG_NO_PORTALS = 1 << 15,
|
||||
GDK_DEBUG_GL_DISABLE = 1 << 16,
|
||||
GDK_DEBUG_GL_FRACTIONAL = 1 << 17,
|
||||
|
||||
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
|
||||
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
|
||||
GDK_DEBUG_GL_PREFER_GL = 1 << 21,
|
||||
GDK_DEBUG_GL_DEBUG = 1 << 22,
|
||||
GDK_DEBUG_GL_EGL = 1 << 23,
|
||||
GDK_DEBUG_GL_GLX = 1 << 24,
|
||||
GDK_DEBUG_GL_WGL = 1 << 25,
|
||||
GDK_DEBUG_VULKAN_DISABLE = 1 << 26,
|
||||
GDK_DEBUG_VULKAN_VALIDATE = 1 << 27,
|
||||
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 28,
|
||||
GDK_DEBUG_HIGH_DEPTH = 1 << 29,
|
||||
GDK_DEBUG_NO_VSYNC = 1 << 30,
|
||||
GDK_DEBUG_DMABUF_DISABLE = 1 << 31,
|
||||
} GdkDebugFlags;
|
||||
|
||||
extern guint _gdk_debug_flags;
|
||||
@@ -64,13 +66,24 @@ GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display);
|
||||
void gdk_display_set_debug_flags (GdkDisplay *display,
|
||||
GdkDebugFlags flags);
|
||||
|
||||
#ifdef GLIB_USING_SYSTEM_PRINTF
|
||||
#define gdk_debug_message(format, ...) fprintf (stderr, format "\n", ##__VA_ARGS__)
|
||||
#else
|
||||
#define gdk_debug_message(format, ...) g_fprintf (stderr, format "\n", ##__VA_ARGS__)
|
||||
#endif
|
||||
static inline void
|
||||
gdk_debug_message (const char *format, ...) G_GNUC_PRINTF(1, 2);
|
||||
static inline void
|
||||
gdk_debug_message (const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char *s;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
va_start (args, format);
|
||||
s = g_strdup_vprintf (format, args);
|
||||
va_end (args);
|
||||
#ifdef GLIB_USING_SYSTEM_PRINTF
|
||||
fprintf (stderr, "%s\n", s);
|
||||
#else
|
||||
g_fprintf (stderr, "%s\n", s);
|
||||
#endif
|
||||
g_free (s);
|
||||
}
|
||||
|
||||
#define GDK_DISPLAY_DEBUG_CHECK(display,type) \
|
||||
G_UNLIKELY (gdk_display_get_debug_flags (display) & GDK_DEBUG_##type)
|
||||
@@ -81,13 +94,6 @@ void gdk_display_set_debug_flags (GdkDisplay *display,
|
||||
gdk_debug_message (__VA_ARGS__); \
|
||||
} G_STMT_END
|
||||
|
||||
#else /* !G_ENABLE_DEBUG */
|
||||
|
||||
#define GDK_DISPLAY_DEBUG_CHECK(display,type) 0
|
||||
#define GDK_DISPLAY_DEBUG(display,type,...)
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
#define GDK_DEBUG_CHECK(type) GDK_DISPLAY_DEBUG_CHECK (NULL,type)
|
||||
#define GDK_DEBUG(type,...) GDK_DISPLAY_DEBUG (NULL,type,__VA_ARGS__)
|
||||
|
||||
@@ -96,7 +102,6 @@ typedef struct
|
||||
const char *key;
|
||||
guint value;
|
||||
const char *help;
|
||||
gboolean always_enabled;
|
||||
} GdkDebugKey;
|
||||
|
||||
guint gdk_parse_debug_var (const char *variable,
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "gdkclipboardprivate.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdisplaymanagerprivate.h"
|
||||
#include "gdkdmabufeglprivate.h"
|
||||
#include "gdkdmabufformatsbuilderprivate.h"
|
||||
#include "gdkdmabufformatsprivate.h"
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
@@ -44,6 +45,11 @@
|
||||
#ifdef HAVE_EGL
|
||||
#include <epoxy/egl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SYSMACROS_H
|
||||
#include <sys/sysmacros.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -386,12 +392,22 @@ gdk_display_dispose (GObject *object)
|
||||
{
|
||||
GdkDisplay *display = GDK_DISPLAY (object);
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
|
||||
gsize i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (display->dmabuf_downloaders); i++)
|
||||
{
|
||||
if (display->dmabuf_downloaders[i] == NULL)
|
||||
continue;
|
||||
|
||||
gdk_dmabuf_downloader_close (display->dmabuf_downloaders[i]);
|
||||
g_clear_object (&display->dmabuf_downloaders[i]);
|
||||
}
|
||||
|
||||
_gdk_display_manager_remove_display (gdk_display_manager_get (), display);
|
||||
|
||||
g_queue_clear (&display->queued_events);
|
||||
|
||||
g_clear_object (&display->egl_gsk_renderer);
|
||||
g_clear_pointer (&display->egl_dmabuf_formats, gdk_dmabuf_formats_unref);
|
||||
g_clear_pointer (&display->egl_external_formats, gdk_dmabuf_formats_unref);
|
||||
|
||||
g_clear_object (&priv->gl_context);
|
||||
@@ -1427,7 +1443,6 @@ gdk_display_get_gl_context (GdkDisplay *self)
|
||||
}
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static int
|
||||
strvcmp (gconstpointer p1,
|
||||
gconstpointer p2)
|
||||
@@ -1484,7 +1499,6 @@ describe_egl_config (EGLDisplay egl_display,
|
||||
|
||||
return g_strdup_printf ("R%dG%dB%dA%d%s", red, green, blue, alpha, type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float");
|
||||
}
|
||||
#endif
|
||||
|
||||
gpointer
|
||||
gdk_display_get_egl_config (GdkDisplay *self)
|
||||
@@ -1688,6 +1702,23 @@ gdk_display_check_egl_extensions (EGLDisplay egl_display,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
find_egl_device (EGLDisplay egl_display)
|
||||
{
|
||||
EGLAttrib value;
|
||||
EGLDeviceEXT egl_device;
|
||||
|
||||
eglQueryDisplayAttribEXT (egl_display, EGL_DEVICE_EXT, &value);
|
||||
|
||||
egl_device = (EGLDeviceEXT)value;
|
||||
|
||||
#ifndef EGL_DRM_RENDER_NODE_FILE_EXT
|
||||
#define EGL_DRM_RENDER_NODE_FILE_EXT 0x3377
|
||||
#endif
|
||||
|
||||
return eglQueryDeviceStringEXT (egl_device, EGL_DRM_RENDER_NODE_FILE_EXT);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_display_init_egl (GdkDisplay *self,
|
||||
int platform,
|
||||
@@ -1785,15 +1816,22 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
if (priv->egl_config_high_depth == NULL)
|
||||
priv->egl_config_high_depth = priv->egl_config;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (self, OPENGL))
|
||||
{
|
||||
char *ext = describe_extensions (priv->egl_display);
|
||||
char *std_cfg = describe_egl_config (priv->egl_display, priv->egl_config);
|
||||
char *hd_cfg = describe_egl_config (priv->egl_display, priv->egl_config_high_depth);
|
||||
const char *path;
|
||||
struct stat buf = { .st_rdev = 0, };
|
||||
|
||||
path = find_egl_device (priv->egl_display);
|
||||
if (path)
|
||||
stat (path, &buf);
|
||||
|
||||
gdk_debug_message ("EGL API version %d.%d found\n"
|
||||
" - Vendor: %s\n"
|
||||
" - Version: %s\n"
|
||||
" - Device: %s, %d %d\n"
|
||||
" - Client APIs: %s\n"
|
||||
" - Extensions:\n"
|
||||
"\t%s\n"
|
||||
@@ -1802,6 +1840,12 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
major, minor,
|
||||
eglQueryString (priv->egl_display, EGL_VENDOR),
|
||||
eglQueryString (priv->egl_display, EGL_VERSION),
|
||||
path ? path : "unknown",
|
||||
#ifdef HAVE_SYS_SYSMACROS_H
|
||||
major (buf.st_rdev), minor (buf.st_rdev),
|
||||
#else
|
||||
0, 0,
|
||||
#endif
|
||||
eglQueryString (priv->egl_display, EGL_CLIENT_APIS),
|
||||
ext, std_cfg,
|
||||
priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg);
|
||||
@@ -1809,7 +1853,6 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
g_free (std_cfg);
|
||||
g_free (ext);
|
||||
}
|
||||
#endif
|
||||
|
||||
gdk_profiler_end_mark (start_time, "init EGL", NULL);
|
||||
|
||||
@@ -1848,13 +1891,12 @@ gdk_display_get_egl_display (GdkDisplay *self)
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
static void
|
||||
gdk_display_add_dmabuf_downloader (GdkDisplay *display,
|
||||
const GdkDmabufDownloader *downloader,
|
||||
GdkDmabufFormatsBuilder *builder)
|
||||
gdk_display_add_dmabuf_downloader (GdkDisplay *display,
|
||||
GdkDmabufDownloader *downloader)
|
||||
{
|
||||
gsize i;
|
||||
|
||||
if (!downloader->add_formats (downloader, display, builder))
|
||||
if (downloader == NULL)
|
||||
return;
|
||||
|
||||
/* dmabuf_downloaders is NULL-terminated */
|
||||
@@ -1864,7 +1906,7 @@ gdk_display_add_dmabuf_downloader (GdkDisplay *display,
|
||||
break;
|
||||
}
|
||||
|
||||
g_assert (i < G_N_ELEMENTS (display->dmabuf_downloaders));
|
||||
g_assert (i < G_N_ELEMENTS (display->dmabuf_downloaders) - 1);
|
||||
|
||||
display->dmabuf_downloaders[i] = downloader;
|
||||
}
|
||||
@@ -1888,16 +1930,16 @@ gdk_display_init_dmabuf (GdkDisplay *self)
|
||||
builder = gdk_dmabuf_formats_builder_new ();
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
if (!GDK_DEBUG_CHECK (DMABUF_DISABLE))
|
||||
if (!GDK_DISPLAY_DEBUG_CHECK (self, DMABUF_DISABLE))
|
||||
{
|
||||
gdk_display_prepare_gl (self, NULL);
|
||||
|
||||
gdk_display_add_dmabuf_downloader (self, gdk_dmabuf_get_direct_downloader (), builder);
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (gdk_display_prepare_gl (self, NULL))
|
||||
gdk_display_add_dmabuf_downloader (self, gdk_dmabuf_get_egl_downloader (), builder);
|
||||
gdk_display_add_dmabuf_downloader (self, gdk_dmabuf_get_egl_downloader (self, builder));
|
||||
#endif
|
||||
|
||||
gdk_dmabuf_formats_builder_add_formats (builder,
|
||||
gdk_dmabuf_get_mmap_formats ());
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1920,6 +1962,8 @@ gdk_display_init_dmabuf (GdkDisplay *self)
|
||||
* The formats returned by this function can be used for negotiating
|
||||
* buffer formats with producers such as v4l, pipewire or GStreamer.
|
||||
*
|
||||
* To learn more about dma-bufs, see [class@Gdk.DmabufTextureBuilder].
|
||||
*
|
||||
* Returns: (transfer none): a `GdkDmabufFormats` object
|
||||
*
|
||||
* Since: 4.14
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdmabufprivate.h"
|
||||
#include "gdkdmabufdownloaderprivate.h"
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
#include <vulkan/vulkan.h>
|
||||
@@ -118,10 +119,10 @@ struct _GdkDisplay
|
||||
guint have_egl_dma_buf_export : 1;
|
||||
|
||||
GdkDmabufFormats *dmabuf_formats;
|
||||
const GdkDmabufDownloader *dmabuf_downloaders[4];
|
||||
GdkDmabufDownloader *dmabuf_downloaders[4];
|
||||
|
||||
/* Cached data the EGL dmabuf downloader */
|
||||
gpointer egl_gsk_renderer;
|
||||
GdkDmabufFormats *egl_dmabuf_formats;
|
||||
GdkDmabufFormats *egl_external_formats;
|
||||
};
|
||||
|
||||
|
||||
1820
gdk/gdkdmabuf.c
1820
gdk/gdkdmabuf.c
File diff suppressed because it is too large
Load Diff
48
gdk/gdkdmabufdownloader.c
Normal file
48
gdk/gdkdmabufdownloader.c
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdmabufdownloaderprivate.h"
|
||||
|
||||
G_DEFINE_INTERFACE (GdkDmabufDownloader, gdk_dmabuf_downloader, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
gdk_dmabuf_downloader_default_init (GdkDmabufDownloaderInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gdk_dmabuf_downloader_close (GdkDmabufDownloader *self)
|
||||
{
|
||||
GdkDmabufDownloaderInterface *iface;
|
||||
|
||||
iface = GDK_DMABUF_DOWNLOADER_GET_IFACE (self);
|
||||
iface->close (self);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_dmabuf_downloader_supports (GdkDmabufDownloader *self,
|
||||
GdkDmabufTexture *texture,
|
||||
GError **error)
|
||||
{
|
||||
GdkDmabufDownloaderInterface *iface;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DMABUF_DOWNLOADER (self), FALSE);
|
||||
|
||||
iface = GDK_DMABUF_DOWNLOADER_GET_IFACE (self);
|
||||
return iface->supports (self, texture, error);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_dmabuf_downloader_download (GdkDmabufDownloader *self,
|
||||
GdkDmabufTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
guchar *data,
|
||||
gsize stride)
|
||||
{
|
||||
GdkDmabufDownloaderInterface *iface;
|
||||
|
||||
g_return_if_fail (GDK_IS_DMABUF_DOWNLOADER (self));
|
||||
|
||||
iface = GDK_DMABUF_DOWNLOADER_GET_IFACE (self);
|
||||
iface->download (self, texture, format, data, stride);
|
||||
}
|
||||
|
||||
39
gdk/gdkdmabufdownloaderprivate.h
Normal file
39
gdk/gdkdmabufdownloaderprivate.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_DMABUF_DOWNLOADER (gdk_dmabuf_downloader_get_type ())
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
G_DECLARE_INTERFACE (GdkDmabufDownloader, gdk_dmabuf_downloader, GDK, DMABUF_DOWNLOADER, GObject)
|
||||
|
||||
struct _GdkDmabufDownloaderInterface
|
||||
{
|
||||
GTypeInterface g_iface;
|
||||
|
||||
void (* close) (GdkDmabufDownloader *downloader);
|
||||
gboolean (* supports) (GdkDmabufDownloader *downloader,
|
||||
GdkDmabufTexture *texture,
|
||||
GError **error);
|
||||
void (* download) (GdkDmabufDownloader *downloader,
|
||||
GdkDmabufTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
guchar *data,
|
||||
gsize stride);
|
||||
};
|
||||
|
||||
void gdk_dmabuf_downloader_close (GdkDmabufDownloader *downloader);
|
||||
gboolean gdk_dmabuf_downloader_supports (GdkDmabufDownloader *downloader,
|
||||
GdkDmabufTexture *texture,
|
||||
GError **error);
|
||||
void gdk_dmabuf_downloader_download (GdkDmabufDownloader *downloader,
|
||||
GdkDmabufTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
guchar *data,
|
||||
gsize stride);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -19,10 +19,11 @@
|
||||
#include "config.h"
|
||||
|
||||
#if defined(HAVE_DMABUF) && defined (HAVE_EGL)
|
||||
#include "gdkdmabufprivate.h"
|
||||
#include "gdkdmabufeglprivate.h"
|
||||
|
||||
#include "gdkdmabufformatsbuilderprivate.h"
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gdkdmabuffourccprivate.h"
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
@@ -30,237 +31,106 @@
|
||||
#include "gdktexturedownloader.h"
|
||||
|
||||
#include <graphene.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/dma-buf.h>
|
||||
#include <drm_fourcc.h>
|
||||
#include <epoxy/egl.h>
|
||||
|
||||
/* A dmabuf downloader implementation that downloads buffers via
|
||||
* gsk_renderer_render_texture + GL texture download.
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
gdk_dmabuf_egl_downloader_add_formats (const GdkDmabufDownloader *downloader,
|
||||
GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *builder)
|
||||
gdk_dmabuf_egl_downloader_collect_formats (GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *formats,
|
||||
GdkDmabufFormatsBuilder *external)
|
||||
{
|
||||
GdkGLContext *context = gdk_display_get_gl_context (display);
|
||||
EGLDisplay egl_display = gdk_display_get_egl_display (display);
|
||||
GdkDmabufFormatsBuilder *external;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
g_assert (display->egl_external_formats == NULL);
|
||||
|
||||
external = gdk_dmabuf_formats_builder_new ();
|
||||
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
if (egl_display != EGL_NO_DISPLAY &&
|
||||
display->have_egl_dma_buf_import &&
|
||||
gdk_gl_context_has_image_storage (context))
|
||||
{
|
||||
int num_fourccs;
|
||||
int *fourccs;
|
||||
guint64 *modifiers;
|
||||
unsigned int *external_only;
|
||||
int n_mods;
|
||||
|
||||
eglQueryDmaBufFormatsEXT (egl_display, 0, NULL, &num_fourccs);
|
||||
fourccs = g_new (int, num_fourccs);
|
||||
eglQueryDmaBufFormatsEXT (egl_display, num_fourccs, fourccs, &num_fourccs);
|
||||
|
||||
n_mods = 80;
|
||||
modifiers = g_new (guint64, n_mods);
|
||||
external_only = g_new (unsigned int, n_mods);
|
||||
|
||||
for (int i = 0; i < num_fourccs; i++)
|
||||
{
|
||||
int num_modifiers;
|
||||
|
||||
eglQueryDmaBufModifiersEXT (egl_display,
|
||||
fourccs[i],
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
&num_modifiers);
|
||||
|
||||
if (num_modifiers > n_mods)
|
||||
{
|
||||
n_mods = num_modifiers;
|
||||
modifiers = g_renew (guint64, modifiers, n_mods);
|
||||
external_only = g_renew (unsigned int, external_only, n_mods);
|
||||
}
|
||||
|
||||
eglQueryDmaBufModifiersEXT (egl_display,
|
||||
fourccs[i],
|
||||
num_modifiers,
|
||||
modifiers,
|
||||
external_only,
|
||||
&num_modifiers);
|
||||
|
||||
for (int j = 0; j < num_modifiers; j++)
|
||||
{
|
||||
/* All linear formats we support are already added my the mmap downloader.
|
||||
* We don't add external formats, unless we can use them (via GLES)
|
||||
*/
|
||||
if (modifiers[j] != DRM_FORMAT_MOD_LINEAR &&
|
||||
(!external_only[j] || gdk_gl_context_get_use_es (context)))
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "%s%s dmabuf format %.4s:%#" G_GINT64_MODIFIER "x",
|
||||
external_only[j] ? "external " : "",
|
||||
downloader->name,
|
||||
(char *) &fourccs[i],
|
||||
modifiers[j]);
|
||||
|
||||
gdk_dmabuf_formats_builder_add_format (builder, fourccs[i], modifiers[j]);
|
||||
}
|
||||
if (external_only[j])
|
||||
gdk_dmabuf_formats_builder_add_format (external, fourccs[i], modifiers[j]);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (modifiers);
|
||||
g_free (external_only);
|
||||
g_free (fourccs);
|
||||
|
||||
retval = TRUE;
|
||||
}
|
||||
|
||||
display->egl_external_formats = gdk_dmabuf_formats_builder_free_to_formats (external);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GdkMemoryFormat
|
||||
get_memory_format (guint32 fourcc,
|
||||
gboolean premultiplied)
|
||||
{
|
||||
switch (fourcc)
|
||||
{
|
||||
case DRM_FORMAT_ARGB8888:
|
||||
case DRM_FORMAT_ABGR8888:
|
||||
case DRM_FORMAT_XRGB8888_A8:
|
||||
case DRM_FORMAT_XBGR8888_A8:
|
||||
return premultiplied ? GDK_MEMORY_A8R8G8B8_PREMULTIPLIED : GDK_MEMORY_A8R8G8B8;
|
||||
|
||||
case DRM_FORMAT_RGBA8888:
|
||||
case DRM_FORMAT_RGBX8888_A8:
|
||||
return premultiplied ? GDK_MEMORY_R8G8B8A8_PREMULTIPLIED : GDK_MEMORY_R8G8B8A8;
|
||||
|
||||
case DRM_FORMAT_BGRA8888:
|
||||
return premultiplied ? GDK_MEMORY_B8G8R8A8_PREMULTIPLIED : GDK_MEMORY_B8G8R8A8;
|
||||
|
||||
case DRM_FORMAT_RGB888:
|
||||
case DRM_FORMAT_XRGB8888:
|
||||
case DRM_FORMAT_XBGR8888:
|
||||
case DRM_FORMAT_RGBX8888:
|
||||
case DRM_FORMAT_BGRX8888:
|
||||
return GDK_MEMORY_R8G8B8;
|
||||
|
||||
case DRM_FORMAT_BGR888:
|
||||
return GDK_MEMORY_B8G8R8;
|
||||
|
||||
case DRM_FORMAT_XRGB2101010:
|
||||
case DRM_FORMAT_XBGR2101010:
|
||||
case DRM_FORMAT_RGBX1010102:
|
||||
case DRM_FORMAT_BGRX1010102:
|
||||
case DRM_FORMAT_XRGB16161616:
|
||||
case DRM_FORMAT_XBGR16161616:
|
||||
return GDK_MEMORY_R16G16B16;
|
||||
|
||||
case DRM_FORMAT_ARGB2101010:
|
||||
case DRM_FORMAT_ABGR2101010:
|
||||
case DRM_FORMAT_RGBA1010102:
|
||||
case DRM_FORMAT_BGRA1010102:
|
||||
case DRM_FORMAT_ARGB16161616:
|
||||
case DRM_FORMAT_ABGR16161616:
|
||||
return premultiplied ? GDK_MEMORY_R16G16B16A16_PREMULTIPLIED : GDK_MEMORY_R16G16B16A16;
|
||||
|
||||
case DRM_FORMAT_ARGB16161616F:
|
||||
case DRM_FORMAT_ABGR16161616F:
|
||||
return premultiplied ? GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED : GDK_MEMORY_R16G16B16A16_FLOAT;
|
||||
|
||||
case DRM_FORMAT_XRGB16161616F:
|
||||
case DRM_FORMAT_XBGR16161616F:
|
||||
return GDK_MEMORY_R16G16B16_FLOAT;
|
||||
|
||||
case DRM_FORMAT_YUYV:
|
||||
case DRM_FORMAT_YVYU:
|
||||
case DRM_FORMAT_UYVY:
|
||||
case DRM_FORMAT_VYUY:
|
||||
case DRM_FORMAT_XYUV8888:
|
||||
#ifdef DRM_FORMAT_XVUY8888
|
||||
case DRM_FORMAT_XVUY8888:
|
||||
#endif
|
||||
case DRM_FORMAT_VUY888:
|
||||
return GDK_MEMORY_R8G8B8;
|
||||
|
||||
/* Add more formats here */
|
||||
default:
|
||||
return premultiplied ? GDK_MEMORY_A8R8G8B8_PREMULTIPLIED : GDK_MEMORY_A8R8G8B8;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dmabuf_egl_downloader_supports (const GdkDmabufDownloader *downloader,
|
||||
GdkDisplay *display,
|
||||
const GdkDmabuf *dmabuf,
|
||||
gboolean premultiplied,
|
||||
GdkMemoryFormat *out_format,
|
||||
GError **error)
|
||||
{
|
||||
EGLDisplay egl_display;
|
||||
GdkGLContext *context;
|
||||
int num_modifiers;
|
||||
int num_fourccs;
|
||||
int *fourccs;
|
||||
guint64 *modifiers;
|
||||
unsigned int *external_only;
|
||||
int n_mods;
|
||||
|
||||
egl_display = gdk_display_get_egl_display (display);
|
||||
if (egl_display == EGL_NO_DISPLAY)
|
||||
{
|
||||
g_set_error_literal (error,
|
||||
GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_UNSUPPORTED_FORMAT,
|
||||
"EGL not available");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
context = gdk_display_get_gl_context (display);
|
||||
if (egl_display == EGL_NO_DISPLAY ||
|
||||
!display->have_egl_dma_buf_import)
|
||||
return FALSE;
|
||||
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
eglQueryDmaBufModifiersEXT (egl_display,
|
||||
dmabuf->fourcc,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
&num_modifiers);
|
||||
eglQueryDmaBufFormatsEXT (egl_display, 0, NULL, &num_fourccs);
|
||||
fourccs = g_new (int, num_fourccs);
|
||||
eglQueryDmaBufFormatsEXT (egl_display, num_fourccs, fourccs, &num_fourccs);
|
||||
|
||||
modifiers = g_newa (uint64_t, num_modifiers);
|
||||
external_only = g_newa (unsigned int, num_modifiers);
|
||||
n_mods = 80;
|
||||
modifiers = g_new (guint64, n_mods);
|
||||
external_only = g_new (unsigned int, n_mods);
|
||||
|
||||
eglQueryDmaBufModifiersEXT (egl_display,
|
||||
dmabuf->fourcc,
|
||||
num_modifiers,
|
||||
modifiers,
|
||||
external_only,
|
||||
&num_modifiers);
|
||||
|
||||
for (int i = 0; i < num_modifiers; i++)
|
||||
for (int i = 0; i < num_fourccs; i++)
|
||||
{
|
||||
if (modifiers[i] == dmabuf->modifier)
|
||||
int num_modifiers;
|
||||
gboolean all_external;
|
||||
|
||||
eglQueryDmaBufModifiersEXT (egl_display,
|
||||
fourccs[i],
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
&num_modifiers);
|
||||
|
||||
if (num_modifiers > n_mods)
|
||||
{
|
||||
*out_format = get_memory_format (dmabuf->fourcc, premultiplied);
|
||||
return TRUE;
|
||||
n_mods = num_modifiers;
|
||||
modifiers = g_renew (guint64, modifiers, n_mods);
|
||||
external_only = g_renew (unsigned int, external_only, n_mods);
|
||||
}
|
||||
|
||||
eglQueryDmaBufModifiersEXT (egl_display,
|
||||
fourccs[i],
|
||||
num_modifiers,
|
||||
modifiers,
|
||||
external_only,
|
||||
&num_modifiers);
|
||||
|
||||
all_external = TRUE;
|
||||
|
||||
for (int j = 0; j < num_modifiers; j++)
|
||||
{
|
||||
/* All linear formats we support are already added my the mmap downloader.
|
||||
* We don't add external formats, unless we can use them (via GLES)
|
||||
*/
|
||||
if (modifiers[j] != DRM_FORMAT_MOD_LINEAR &&
|
||||
(!external_only[j] || gdk_gl_context_get_use_es (context)))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"%s EGL dmabuf format %.4s:%#" G_GINT64_MODIFIER "x",
|
||||
external_only[j] ? "external " : "",
|
||||
(char *) &fourccs[i],
|
||||
modifiers[j]);
|
||||
|
||||
gdk_dmabuf_formats_builder_add_format (formats, fourccs[i], modifiers[j]);
|
||||
}
|
||||
if (external_only[j])
|
||||
gdk_dmabuf_formats_builder_add_format (external, fourccs[i], modifiers[j]);
|
||||
else
|
||||
all_external = FALSE;
|
||||
}
|
||||
|
||||
/* Accept implicit modifiers as long as we accept the format at all.
|
||||
* This is a bit of a crapshot, but unfortunately needed for a bunch
|
||||
* of drivers.
|
||||
*
|
||||
* As an extra wrinkle, treat the implicit modifier as 'external only'
|
||||
* if all formats with the same fourcc are 'external only'.
|
||||
*/
|
||||
if (!all_external || gdk_gl_context_get_use_es (context))
|
||||
gdk_dmabuf_formats_builder_add_format (formats, fourccs[i], DRM_FORMAT_MOD_INVALID);
|
||||
if (all_external)
|
||||
gdk_dmabuf_formats_builder_add_format (external, fourccs[i], DRM_FORMAT_MOD_INVALID);
|
||||
}
|
||||
|
||||
g_set_error (error,
|
||||
GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_UNSUPPORTED_FORMAT,
|
||||
"Unsupported dmabuf format: %.4s:%#" G_GINT64_MODIFIER "x",
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
g_free (modifiers);
|
||||
g_free (external_only);
|
||||
g_free (fourccs);
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Hack. We don't include gsk/gsk.h here to avoid a build order problem
|
||||
@@ -268,146 +138,138 @@ gdk_dmabuf_egl_downloader_supports (const GdkDmabufDownloader *downloader,
|
||||
* a bit to access the gsk api we need.
|
||||
*/
|
||||
|
||||
typedef gpointer GskRenderer;
|
||||
typedef struct _GskRenderer GskRenderer;
|
||||
|
||||
extern GskRenderer * gsk_gl_renderer_new (void);
|
||||
extern gboolean gsk_renderer_realize (GskRenderer *renderer,
|
||||
GdkSurface *surface,
|
||||
GError **error);
|
||||
extern GdkTexture * gsk_renderer_convert_texture (GskRenderer *renderer,
|
||||
GdkTexture *texture);
|
||||
|
||||
typedef void (* InvokeFunc) (gpointer data);
|
||||
|
||||
typedef struct _InvokeData
|
||||
GdkDmabufDownloader *
|
||||
gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *builder)
|
||||
{
|
||||
volatile int spinlock;
|
||||
InvokeFunc func;
|
||||
gpointer data;
|
||||
} InvokeData;
|
||||
GdkDmabufFormatsBuilder *formats;
|
||||
GdkDmabufFormatsBuilder *external;
|
||||
gboolean retval = FALSE;
|
||||
GError *error = NULL;
|
||||
GskRenderer *renderer;
|
||||
|
||||
static gboolean
|
||||
gdk_dmabuf_egl_downloader_invoke_callback (gpointer data)
|
||||
{
|
||||
InvokeData *invoke = data;
|
||||
GdkGLContext *previous;
|
||||
g_assert (display->egl_dmabuf_formats == NULL);
|
||||
g_assert (display->egl_external_formats == NULL);
|
||||
|
||||
previous = gdk_gl_context_get_current ();
|
||||
if (!gdk_display_prepare_gl (display, NULL))
|
||||
return NULL;
|
||||
|
||||
invoke->func (invoke->data);
|
||||
formats = gdk_dmabuf_formats_builder_new ();
|
||||
external = gdk_dmabuf_formats_builder_new ();
|
||||
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
else
|
||||
gdk_gl_context_clear_current ();
|
||||
retval = gdk_dmabuf_egl_downloader_collect_formats (display, formats, external);
|
||||
|
||||
g_atomic_int_set (&invoke->spinlock, 1);
|
||||
display->egl_dmabuf_formats = gdk_dmabuf_formats_builder_free_to_formats (formats);
|
||||
display->egl_external_formats = gdk_dmabuf_formats_builder_free_to_formats (external);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
gdk_dmabuf_formats_builder_add_formats (builder, display->egl_dmabuf_formats);
|
||||
|
||||
/* Run func in the main thread, taking care not to disturb
|
||||
* the current GL context of the caller.
|
||||
*/
|
||||
static void
|
||||
gdk_dmabuf_egl_downloader_run (InvokeFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
InvokeData invoke = { 0, func, data };
|
||||
if (!retval)
|
||||
return NULL;
|
||||
|
||||
g_main_context_invoke (NULL, gdk_dmabuf_egl_downloader_invoke_callback, &invoke);
|
||||
renderer = gsk_gl_renderer_new ();
|
||||
|
||||
while (g_atomic_int_get (&invoke.spinlock) == 0) ;
|
||||
}
|
||||
|
||||
typedef struct _Download Download;
|
||||
|
||||
struct _Download
|
||||
{
|
||||
GdkDmabufTexture *texture;
|
||||
GdkMemoryFormat format;
|
||||
guchar *data;
|
||||
gsize stride;
|
||||
};
|
||||
|
||||
static GskRenderer *
|
||||
get_gsk_renderer (GdkDisplay *display)
|
||||
{
|
||||
if (!display->egl_gsk_renderer)
|
||||
if (!gsk_renderer_realize (renderer, NULL, &error))
|
||||
{
|
||||
GskRenderer *renderer;
|
||||
GError *error = NULL;
|
||||
g_warning ("Failed to realize GL renderer: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_object_unref (renderer);
|
||||
|
||||
renderer = gsk_gl_renderer_new ();
|
||||
|
||||
if (!gsk_renderer_realize (renderer, NULL, &error))
|
||||
{
|
||||
g_warning ("Failed to realize GL renderer: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_object_unref (renderer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
display->egl_gsk_renderer = renderer;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return display->egl_gsk_renderer;
|
||||
return GDK_DMABUF_DOWNLOADER (renderer);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_dmabuf_egl_downloader_do_download (gpointer data)
|
||||
EGLImage
|
||||
gdk_dmabuf_egl_create_image (GdkDisplay *display,
|
||||
int width,
|
||||
int height,
|
||||
const GdkDmabuf *dmabuf,
|
||||
int target)
|
||||
{
|
||||
Download *download = data;
|
||||
GdkDisplay *display;
|
||||
GskRenderer *renderer;
|
||||
GdkTexture *native;
|
||||
GdkTextureDownloader *downloader;
|
||||
EGLDisplay egl_display = gdk_display_get_egl_display (display);
|
||||
EGLint attribs[64];
|
||||
int i;
|
||||
EGLImage image;
|
||||
|
||||
display = gdk_dmabuf_texture_get_display (download->texture);
|
||||
g_return_val_if_fail (width > 0, 0);
|
||||
g_return_val_if_fail (height > 0, 0);
|
||||
g_return_val_if_fail (1 <= dmabuf->n_planes && dmabuf->n_planes <= 4, 0);
|
||||
g_return_val_if_fail (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES, 0);
|
||||
|
||||
renderer = get_gsk_renderer (display);
|
||||
if (egl_display == EGL_NO_DISPLAY || !display->have_egl_dma_buf_import)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Can't import dmabufs into GL, missing EGL or EGL_EXT_image_dma_buf_import_modifiers");
|
||||
return EGL_NO_IMAGE;
|
||||
}
|
||||
|
||||
native = gsk_renderer_convert_texture (renderer, GDK_TEXTURE (download->texture));
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Importing dmabuf (format: %.4s:%#" G_GINT64_MODIFIER "x, planes: %u) into GL",
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier, dmabuf->n_planes);
|
||||
|
||||
downloader = gdk_texture_downloader_new (native);
|
||||
gdk_texture_downloader_set_format (downloader, download->format);
|
||||
gdk_texture_downloader_download_into (downloader, download->data, download->stride);
|
||||
gdk_texture_downloader_free (downloader);
|
||||
i = 0;
|
||||
attribs[i++] = EGL_IMAGE_PRESERVED_KHR;
|
||||
attribs[i++] = EGL_TRUE;
|
||||
attribs[i++] = EGL_WIDTH;
|
||||
attribs[i++] = width;
|
||||
attribs[i++] = EGL_HEIGHT;
|
||||
attribs[i++] = height;
|
||||
attribs[i++] = EGL_LINUX_DRM_FOURCC_EXT;
|
||||
attribs[i++] = dmabuf->fourcc;
|
||||
attribs[i++] = EGL_YUV_COLOR_SPACE_HINT_EXT;
|
||||
attribs[i++] = EGL_ITU_REC601_EXT;
|
||||
attribs[i++] = EGL_SAMPLE_RANGE_HINT_EXT;
|
||||
attribs[i++] = EGL_YUV_FULL_RANGE_EXT;
|
||||
|
||||
g_object_unref (native);
|
||||
}
|
||||
#define ADD_PLANE(plane) \
|
||||
{ \
|
||||
if (dmabuf->modifier != DRM_FORMAT_MOD_INVALID) \
|
||||
{ \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ##_MODIFIER_LO_EXT; \
|
||||
attribs[i++] = dmabuf->modifier & 0xFFFFFFFF; \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ## _MODIFIER_HI_EXT; \
|
||||
attribs[i++] = dmabuf->modifier >> 32; \
|
||||
} \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ##_FD_EXT; \
|
||||
attribs[i++] = dmabuf->planes[plane].fd; \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ##_PITCH_EXT; \
|
||||
attribs[i++] = dmabuf->planes[plane].stride; \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ##_OFFSET_EXT; \
|
||||
attribs[i++] = dmabuf->planes[plane].offset; \
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_dmabuf_egl_downloader_download (const GdkDmabufDownloader *downloader,
|
||||
GdkTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
guchar *data,
|
||||
gsize stride)
|
||||
{
|
||||
Download download;
|
||||
ADD_PLANE (0);
|
||||
|
||||
GDK_DEBUG (DMABUF, "Using %s for downloading a dmabuf", downloader->name);
|
||||
if (dmabuf->n_planes > 1) ADD_PLANE (1);
|
||||
if (dmabuf->n_planes > 2) ADD_PLANE (2);
|
||||
if (dmabuf->n_planes > 3) ADD_PLANE (3);
|
||||
|
||||
download.texture = GDK_DMABUF_TEXTURE (texture);
|
||||
download.format = format;
|
||||
download.data = data;
|
||||
download.stride = stride;
|
||||
attribs[i++] = EGL_NONE;
|
||||
|
||||
gdk_dmabuf_egl_downloader_run (gdk_dmabuf_egl_downloader_do_download, &download);
|
||||
}
|
||||
image = eglCreateImageKHR (egl_display,
|
||||
EGL_NO_CONTEXT,
|
||||
EGL_LINUX_DMA_BUF_EXT,
|
||||
(EGLClientBuffer)NULL,
|
||||
attribs);
|
||||
|
||||
const GdkDmabufDownloader *
|
||||
gdk_dmabuf_get_egl_downloader (void)
|
||||
{
|
||||
static const GdkDmabufDownloader downloader = {
|
||||
"egl",
|
||||
gdk_dmabuf_egl_downloader_add_formats,
|
||||
gdk_dmabuf_egl_downloader_supports,
|
||||
gdk_dmabuf_egl_downloader_download,
|
||||
};
|
||||
if (image == EGL_NO_IMAGE)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Creating EGLImage for dmabuf failed: %#x",
|
||||
eglGetError ());
|
||||
return 0;
|
||||
}
|
||||
|
||||
return &downloader;
|
||||
return image;
|
||||
}
|
||||
|
||||
#endif /* HAVE_DMABUF && HAVE_EGL */
|
||||
|
||||
18
gdk/gdkdmabufeglprivate.h
Normal file
18
gdk/gdkdmabufeglprivate.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(HAVE_DMABUF) && defined (HAVE_EGL)
|
||||
|
||||
#include "gdkdmabufprivate.h"
|
||||
#include "gdkdmabufdownloaderprivate.h"
|
||||
|
||||
#include <epoxy/egl.h>
|
||||
|
||||
GdkDmabufDownloader * gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *builder);
|
||||
EGLImage gdk_dmabuf_egl_create_image (GdkDisplay *display,
|
||||
int width,
|
||||
int height,
|
||||
const GdkDmabuf *dmabuf,
|
||||
int target);
|
||||
|
||||
#endif /* HAVE_DMABUF && HAVE_EGL */
|
||||
@@ -37,6 +37,10 @@
|
||||
* The list of supported formats is sorted by preference,
|
||||
* with the best formats coming first.
|
||||
*
|
||||
* The list may contains (format, modfier) pairs where the modifier
|
||||
* is `DMA_FORMAT_MOD_INVALID`, indicating that **_implicit modifiers_**
|
||||
* may be used with this format.
|
||||
*
|
||||
* See [class@Gdk.DmabufTextureBuilder] for more information
|
||||
* about DMA buffers.
|
||||
*
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
|
||||
#include "gdkdmabufformatsprivate.h"
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
#include <drm_fourcc.h>
|
||||
#endif
|
||||
|
||||
#define GDK_ARRAY_NAME gdk_dmabuf_formats_builder
|
||||
#define GDK_ARRAY_TYPE_NAME GdkDmabufFormatsBuilder
|
||||
@@ -121,12 +118,6 @@ gdk_dmabuf_formats_builder_add_format (GdkDmabufFormatsBuilder *self,
|
||||
guint32 fourcc,
|
||||
guint64 modifier)
|
||||
{
|
||||
#ifdef HAVE_DMABUF
|
||||
g_return_if_fail (modifier != DRM_FORMAT_MOD_INVALID);
|
||||
#else
|
||||
g_return_if_reached ();
|
||||
#endif
|
||||
|
||||
gdk_dmabuf_formats_builder_append (self, &(GdkDmabufFormat) { fourcc, modifier });
|
||||
}
|
||||
|
||||
|
||||
380
gdk/gdkdmabuffourccprivate.h
Normal file
380
gdk/gdkdmabuffourccprivate.h
Normal file
@@ -0,0 +1,380 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
#include <drm_fourcc.h>
|
||||
#endif
|
||||
|
||||
#ifndef fourcc_code
|
||||
#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \
|
||||
((__u32)(c) << 16) | ((__u32)(d) << 24))
|
||||
#endif
|
||||
|
||||
#ifndef DRM_FORMAT_C1
|
||||
#define DRM_FORMAT_C1 fourcc_code('C', '1', ' ', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_C2
|
||||
#define DRM_FORMAT_C2 fourcc_code('C', '2', ' ', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_C4
|
||||
#define DRM_FORMAT_C4 fourcc_code('C', '4', ' ', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_C8
|
||||
#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_D1
|
||||
#define DRM_FORMAT_D1 fourcc_code('D', '1', ' ', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_D2
|
||||
#define DRM_FORMAT_D2 fourcc_code('D', '2', ' ', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_D4
|
||||
#define DRM_FORMAT_D4 fourcc_code('D', '4', ' ', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_D8
|
||||
#define DRM_FORMAT_D8 fourcc_code('D', '8', ' ', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_R1
|
||||
#define DRM_FORMAT_R1 fourcc_code('R', '1', ' ', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_R2
|
||||
#define DRM_FORMAT_R2 fourcc_code('R', '2', ' ', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_R4
|
||||
#define DRM_FORMAT_R4 fourcc_code('R', '4', ' ', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_R8
|
||||
#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_R10
|
||||
#define DRM_FORMAT_R10 fourcc_code('R', '1', '0', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_R12
|
||||
#define DRM_FORMAT_R12 fourcc_code('R', '1', '2', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_R16
|
||||
#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RG88
|
||||
#define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_GR88
|
||||
#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RG1616
|
||||
#define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_GR1616
|
||||
#define DRM_FORMAT_GR1616 fourcc_code('G', 'R', '3', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGB332
|
||||
#define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGR233
|
||||
#define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XRGB4444
|
||||
#define DRM_FORMAT_XRGB4444 fourcc_code('X', 'R', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XBGR4444
|
||||
#define DRM_FORMAT_XBGR4444 fourcc_code('X', 'B', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGBX4444
|
||||
#define DRM_FORMAT_RGBX4444 fourcc_code('R', 'X', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGRX4444
|
||||
#define DRM_FORMAT_BGRX4444 fourcc_code('B', 'X', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ARGB4444
|
||||
#define DRM_FORMAT_ARGB4444 fourcc_code('A', 'R', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ABGR4444
|
||||
#define DRM_FORMAT_ABGR4444 fourcc_code('A', 'B', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGBA4444
|
||||
#define DRM_FORMAT_RGBA4444 fourcc_code('R', 'A', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGRA4444
|
||||
#define DRM_FORMAT_BGRA4444 fourcc_code('B', 'A', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XRGB1555
|
||||
#define DRM_FORMAT_XRGB1555 fourcc_code('X', 'R', '1', '5')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XBGR1555
|
||||
#define DRM_FORMAT_XBGR1555 fourcc_code('X', 'B', '1', '5')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGBX5551
|
||||
#define DRM_FORMAT_RGBX5551 fourcc_code('R', 'X', '1', '5')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGRX5551
|
||||
#define DRM_FORMAT_BGRX5551 fourcc_code('B', 'X', '1', '5')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ARGB1555
|
||||
#define DRM_FORMAT_ARGB1555 fourcc_code('A', 'R', '1', '5')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ABGR1555
|
||||
#define DRM_FORMAT_ABGR1555 fourcc_code('A', 'B', '1', '5')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGBA5551
|
||||
#define DRM_FORMAT_RGBA5551 fourcc_code('R', 'A', '1', '5')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGRA5551
|
||||
#define DRM_FORMAT_BGRA5551 fourcc_code('B', 'A', '1', '5')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGB565
|
||||
#define DRM_FORMAT_RGB565 fourcc_code('R', 'G', '1', '6')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGR565
|
||||
#define DRM_FORMAT_BGR565 fourcc_code('B', 'G', '1', '6')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGB888
|
||||
#define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGR888
|
||||
#define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XRGB8888
|
||||
#define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XBGR8888
|
||||
#define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGBX8888
|
||||
#define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGRX8888
|
||||
#define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ARGB8888
|
||||
#define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ABGR8888
|
||||
#define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGBA8888
|
||||
#define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGRA8888
|
||||
#define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XRGB2101010
|
||||
#define DRM_FORMAT_XRGB2101010 fourcc_code('X', 'R', '3', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XBGR2101010
|
||||
#define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGBX1010102
|
||||
#define DRM_FORMAT_RGBX1010102 fourcc_code('R', 'X', '3', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGRX1010102
|
||||
#define DRM_FORMAT_BGRX1010102 fourcc_code('B', 'X', '3', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ARGB2101010
|
||||
#define DRM_FORMAT_ARGB2101010 fourcc_code('A', 'R', '3', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ABGR2101010
|
||||
#define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGBA1010102
|
||||
#define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGRA1010102
|
||||
#define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XRGB16161616
|
||||
#define DRM_FORMAT_XRGB16161616 fourcc_code('X', 'R', '4', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XBGR16161616
|
||||
#define DRM_FORMAT_XBGR16161616 fourcc_code('X', 'B', '4', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ARGB16161616
|
||||
#define DRM_FORMAT_ARGB16161616 fourcc_code('A', 'R', '4', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ABGR16161616
|
||||
#define DRM_FORMAT_ABGR16161616 fourcc_code('A', 'B', '4', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XRGB16161616F
|
||||
#define DRM_FORMAT_XRGB16161616F fourcc_code('X', 'R', '4', 'H')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XBGR16161616F
|
||||
#define DRM_FORMAT_XBGR16161616F fourcc_code('X', 'B', '4', 'H')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ARGB16161616F
|
||||
#define DRM_FORMAT_ARGB16161616F fourcc_code('A', 'R', '4', 'H')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ABGR16161616F
|
||||
#define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_AXBXGXRX106106106106
|
||||
#define DRM_FORMAT_AXBXGXRX106106106106 fourcc_code('A', 'B', '1', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YUYV
|
||||
#define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YVYU
|
||||
#define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_UYVY
|
||||
#define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_VYUY
|
||||
#define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_AYUV
|
||||
#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_AVUY8888
|
||||
#define DRM_FORMAT_AVUY8888 fourcc_code('A', 'V', 'U', 'Y')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XYUV8888
|
||||
#define DRM_FORMAT_XYUV8888 fourcc_code('X', 'Y', 'U', 'V')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XVUY8888
|
||||
#define DRM_FORMAT_XVUY8888 fourcc_code('X', 'V', 'U', 'Y')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_VUY888
|
||||
#define DRM_FORMAT_VUY888 fourcc_code('V', 'U', '2', '4')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_VUY101010
|
||||
#define DRM_FORMAT_VUY101010 fourcc_code('V', 'U', '3', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_Y210
|
||||
#define DRM_FORMAT_Y210 fourcc_code('Y', '2', '1', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_Y212
|
||||
#define DRM_FORMAT_Y212 fourcc_code('Y', '2', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_Y216
|
||||
#define DRM_FORMAT_Y216 fourcc_code('Y', '2', '1', '6')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_Y410
|
||||
#define DRM_FORMAT_Y410 fourcc_code('Y', '4', '1', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_Y412
|
||||
#define DRM_FORMAT_Y412 fourcc_code('Y', '4', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_Y416
|
||||
#define DRM_FORMAT_Y416 fourcc_code('Y', '4', '1', '6')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XVYU2101010
|
||||
#define DRM_FORMAT_XVYU2101010 fourcc_code('X', 'V', '3', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XVYU12_16161616
|
||||
#define DRM_FORMAT_XVYU12_16161616 fourcc_code('X', 'V', '3', '6')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XVYU16161616
|
||||
#define DRM_FORMAT_XVYU16161616 fourcc_code('X', 'V', '4', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_Y0L0
|
||||
#define DRM_FORMAT_Y0L0 fourcc_code('Y', '0', 'L', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_X0L0
|
||||
#define DRM_FORMAT_X0L0 fourcc_code('X', '0', 'L', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_Y0L2
|
||||
#define DRM_FORMAT_Y0L2 fourcc_code('Y', '0', 'L', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_X0L2
|
||||
#define DRM_FORMAT_X0L2 fourcc_code('X', '0', 'L', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YUV420_8BIT
|
||||
#define DRM_FORMAT_YUV420_8BIT fourcc_code('Y', 'U', '0', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YUV420_10BIT
|
||||
#define DRM_FORMAT_YUV420_10BIT fourcc_code('Y', 'U', '1', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XRGB8888_A8
|
||||
#define DRM_FORMAT_XRGB8888_A8 fourcc_code('X', 'R', 'A', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XBGR8888_A8
|
||||
#define DRM_FORMAT_XBGR8888_A8 fourcc_code('X', 'B', 'A', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGBX8888_A8
|
||||
#define DRM_FORMAT_RGBX8888_A8 fourcc_code('R', 'X', 'A', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGRX8888_A8
|
||||
#define DRM_FORMAT_BGRX8888_A8 fourcc_code('B', 'X', 'A', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGB888_A8
|
||||
#define DRM_FORMAT_RGB888_A8 fourcc_code('R', '8', 'A', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGR888_A8
|
||||
#define DRM_FORMAT_BGR888_A8 fourcc_code('B', '8', 'A', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGB565_A8
|
||||
#define DRM_FORMAT_RGB565_A8 fourcc_code('R', '5', 'A', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_BGR565_A8
|
||||
#define DRM_FORMAT_BGR565_A8 fourcc_code('B', '5', 'A', '8')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_NV12
|
||||
#define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_NV21
|
||||
#define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_NV16
|
||||
#define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_NV61
|
||||
#define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_NV24
|
||||
#define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_NV42
|
||||
#define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_NV15
|
||||
#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_P210
|
||||
#define DRM_FORMAT_P210 fourcc_code('P', '2', '1', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_P010
|
||||
#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_P012
|
||||
#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_P016
|
||||
#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_P030
|
||||
#define DRM_FORMAT_P030 fourcc_code('P', '0', '3', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_Q410
|
||||
#define DRM_FORMAT_Q410 fourcc_code('Q', '4', '1', '0')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_Q401
|
||||
#define DRM_FORMAT_Q401 fourcc_code('Q', '4', '0', '1')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YUV410
|
||||
#define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YVU410
|
||||
#define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YUV411
|
||||
#define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YVU411
|
||||
#define DRM_FORMAT_YVU411 fourcc_code('Y', 'V', '1', '1')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YUV420
|
||||
#define DRM_FORMAT_YUV420 fourcc_code('Y', 'U', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YVU420
|
||||
#define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YUV422
|
||||
#define DRM_FORMAT_YUV422 fourcc_code('Y', 'U', '1', '6')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YVU422
|
||||
#define DRM_FORMAT_YVU422 fourcc_code('Y', 'V', '1', '6')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YUV444
|
||||
#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4')
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_YVU444
|
||||
#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4')
|
||||
#endif
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
#include "gdkdmabufformatsbuilderprivate.h"
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
#include <vulkan/vulkan.h>
|
||||
#endif
|
||||
|
||||
#define GDK_DMABUF_MAX_PLANES 4
|
||||
|
||||
typedef struct _GdkDmabuf GdkDmabuf;
|
||||
typedef struct _GdkDmabufDownloader GdkDmabufDownloader;
|
||||
|
||||
struct _GdkDmabuf
|
||||
{
|
||||
@@ -19,29 +22,23 @@ struct _GdkDmabuf
|
||||
} planes[GDK_DMABUF_MAX_PLANES];
|
||||
};
|
||||
|
||||
struct _GdkDmabufDownloader
|
||||
{
|
||||
const char *name;
|
||||
gboolean (* add_formats) (const GdkDmabufDownloader *downloader,
|
||||
GdkDisplay *display,
|
||||
GdkDmabufFormatsBuilder *builder);
|
||||
gboolean (* supports) (const GdkDmabufDownloader *downloader,
|
||||
GdkDisplay *display,
|
||||
const GdkDmabuf *dmabuf,
|
||||
gboolean premultiplied,
|
||||
GdkMemoryFormat *out_format,
|
||||
GError **error);
|
||||
void (* download) (const GdkDmabufDownloader *downloader,
|
||||
GdkTexture *texture,
|
||||
#ifdef HAVE_DMABUF
|
||||
|
||||
GdkDmabufFormats * gdk_dmabuf_get_mmap_formats (void) G_GNUC_CONST;
|
||||
void gdk_dmabuf_download_mmap (GdkTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
guchar *data,
|
||||
gsize stride);
|
||||
};
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
|
||||
const GdkDmabufDownloader * gdk_dmabuf_get_direct_downloader (void) G_GNUC_CONST;
|
||||
const GdkDmabufDownloader * gdk_dmabuf_get_egl_downloader (void) G_GNUC_CONST;
|
||||
int gdk_dmabuf_ioctl (int fd,
|
||||
unsigned long request,
|
||||
void *arg);
|
||||
gboolean gdk_dmabuf_import_sync_file (int dmabuf_fd,
|
||||
guint32 flags,
|
||||
int sync_file_fd);
|
||||
int gdk_dmabuf_export_sync_file (int dmabuf_fd,
|
||||
guint32 flags);
|
||||
|
||||
gboolean gdk_dmabuf_sanitize (GdkDmabuf *dest,
|
||||
gsize width,
|
||||
@@ -51,4 +48,14 @@ gboolean gdk_dmabuf_sanitize (GdkDmabuf
|
||||
|
||||
gboolean gdk_dmabuf_is_disjoint (const GdkDmabuf *dmabuf);
|
||||
|
||||
gboolean gdk_dmabuf_fourcc_is_yuv (guint32 fourcc,
|
||||
gboolean *is_yuv);
|
||||
gboolean gdk_dmabuf_get_memory_format (guint32 fourcc,
|
||||
gboolean premultiplied,
|
||||
GdkMemoryFormat *out_format);
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
VkFormat gdk_dmabuf_get_vk_format (guint32 fourcc,
|
||||
VkComponentMapping *out_components);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,21 +21,15 @@
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkdmabufdownloaderprivate.h"
|
||||
#include "gdkdmabufformatsbuilderprivate.h"
|
||||
#include "gdkdmabuffourccprivate.h"
|
||||
#include "gdkdmabufprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include <gdk/gdkglcontext.h>
|
||||
#include <gdk/gdkgltexturebuilder.h>
|
||||
#include <gdk/gdktexturedownloader.h>
|
||||
|
||||
#ifdef HAVE_DMABUF
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/dma-buf.h>
|
||||
#include <drm_fourcc.h>
|
||||
#include <epoxy/egl.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* GdkDmabufTexture:
|
||||
*
|
||||
@@ -52,7 +46,7 @@ struct _GdkDmabufTexture
|
||||
GdkTexture parent_instance;
|
||||
|
||||
GdkDisplay *display;
|
||||
const GdkDmabufDownloader *downloader;
|
||||
GdkDmabufDownloader *downloader;
|
||||
|
||||
GdkDmabuf dmabuf;
|
||||
|
||||
@@ -69,11 +63,6 @@ G_DEFINE_QUARK (gdk-dmabuf-error-quark, gdk_dmabuf_error)
|
||||
|
||||
G_DEFINE_TYPE (GdkDmabufTexture, gdk_dmabuf_texture, GDK_TYPE_TEXTURE)
|
||||
|
||||
static void
|
||||
gdk_dmabuf_texture_init (GdkDmabufTexture *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_dmabuf_texture_dispose (GObject *object)
|
||||
{
|
||||
@@ -82,9 +71,39 @@ gdk_dmabuf_texture_dispose (GObject *object)
|
||||
if (self->destroy)
|
||||
self->destroy (self->data);
|
||||
|
||||
g_clear_object (&self->downloader);
|
||||
g_clear_object (&self->display);
|
||||
|
||||
G_OBJECT_CLASS (gdk_dmabuf_texture_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
typedef struct _Download Download;
|
||||
|
||||
struct _Download
|
||||
{
|
||||
GdkDmabufTexture *texture;
|
||||
GdkMemoryFormat format;
|
||||
guchar *data;
|
||||
gsize stride;
|
||||
volatile int spinlock;
|
||||
};
|
||||
|
||||
static gboolean
|
||||
gdk_dmabuf_texture_invoke_callback (gpointer data)
|
||||
{
|
||||
Download *download = data;
|
||||
|
||||
gdk_dmabuf_downloader_download (download->texture->downloader,
|
||||
download->texture,
|
||||
download->format,
|
||||
download->data,
|
||||
download->stride);
|
||||
|
||||
g_atomic_int_set (&download->spinlock, 1);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_dmabuf_texture_download (GdkTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
@@ -92,12 +111,19 @@ gdk_dmabuf_texture_download (GdkTexture *texture,
|
||||
gsize stride)
|
||||
{
|
||||
GdkDmabufTexture *self = GDK_DMABUF_TEXTURE (texture);
|
||||
Download download = { self, format, data, stride, 0 };
|
||||
|
||||
self->downloader->download (self->downloader,
|
||||
texture,
|
||||
format,
|
||||
data,
|
||||
stride);
|
||||
if (self->downloader == NULL)
|
||||
{
|
||||
#ifdef HAVE_DMABUF
|
||||
gdk_dmabuf_download_mmap (texture, format, data, stride);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
g_main_context_invoke (NULL, gdk_dmabuf_texture_invoke_callback, &download);
|
||||
|
||||
while (g_atomic_int_get (&download.spinlock) == 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -111,6 +137,11 @@ gdk_dmabuf_texture_class_init (GdkDmabufTextureClass *klass)
|
||||
gobject_class->dispose = gdk_dmabuf_texture_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_dmabuf_texture_init (GdkDmabufTexture *self)
|
||||
{
|
||||
}
|
||||
|
||||
GdkDisplay *
|
||||
gdk_dmabuf_texture_get_display (GdkDmabufTexture *self)
|
||||
{
|
||||
@@ -134,14 +165,15 @@ gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
|
||||
GdkTexture *update_texture;
|
||||
GdkDisplay *display;
|
||||
GdkDmabuf dmabuf;
|
||||
GdkMemoryFormat format;
|
||||
GError *local_error = NULL;
|
||||
int width, height;
|
||||
gboolean premultiplied;
|
||||
gsize i;
|
||||
|
||||
display = gdk_dmabuf_texture_builder_get_display (builder);
|
||||
width = gdk_dmabuf_texture_builder_get_width (builder);
|
||||
height = gdk_dmabuf_texture_builder_get_height (builder);
|
||||
premultiplied = gdk_dmabuf_texture_builder_get_premultiplied (builder);
|
||||
|
||||
if (!gdk_dmabuf_sanitize (&dmabuf,
|
||||
width,
|
||||
@@ -152,43 +184,57 @@ gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
|
||||
|
||||
gdk_display_init_dmabuf (display);
|
||||
|
||||
for (i = 0; display->dmabuf_downloaders[i] != NULL; i++)
|
||||
{
|
||||
if (local_error && g_error_matches (local_error, GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_UNSUPPORTED_FORMAT))
|
||||
g_clear_error (&local_error);
|
||||
|
||||
if (display->dmabuf_downloaders[i]->supports (display->dmabuf_downloaders[i],
|
||||
display,
|
||||
&dmabuf,
|
||||
gdk_dmabuf_texture_builder_get_premultiplied (builder),
|
||||
&format,
|
||||
local_error ? NULL : &local_error))
|
||||
break;
|
||||
}
|
||||
|
||||
if (display->dmabuf_downloaders[i] == NULL)
|
||||
{
|
||||
g_propagate_error (error, local_error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GDK_DEBUG (DMABUF,
|
||||
"Dmabuf texture, format %.4s:%#lx, %s%u planes, memory format %u, downloader %s",
|
||||
(char *) &dmabuf.fourcc, dmabuf.modifier,
|
||||
gdk_dmabuf_texture_builder_get_premultiplied (builder) ? " premultiplied, " : "",
|
||||
dmabuf.n_planes,
|
||||
format,
|
||||
display->dmabuf_downloaders[i]->name);
|
||||
|
||||
self = g_object_new (GDK_TYPE_DMABUF_TEXTURE,
|
||||
"width", width,
|
||||
"height", height,
|
||||
NULL);
|
||||
|
||||
GDK_TEXTURE (self)->format = format;
|
||||
g_set_object (&self->display, display);
|
||||
self->downloader = display->dmabuf_downloaders[i];
|
||||
self->dmabuf = dmabuf;
|
||||
|
||||
if (!gdk_dmabuf_get_memory_format (dmabuf.fourcc, premultiplied, &(GDK_TEXTURE (self)->format)))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Falling back to generic RGBA for dmabuf format %.4s",
|
||||
(char *) &dmabuf.fourcc);
|
||||
GDK_TEXTURE (self)->format = premultiplied ? GDK_MEMORY_R8G8B8A8_PREMULTIPLIED
|
||||
: GDK_MEMORY_R8G8B8A8;
|
||||
}
|
||||
|
||||
if (!gdk_dmabuf_formats_contains (gdk_dmabuf_get_mmap_formats (), dmabuf.fourcc, dmabuf.modifier))
|
||||
{
|
||||
for (i = 0; display->dmabuf_downloaders[i] != NULL; i++)
|
||||
{
|
||||
if (local_error && g_error_matches (local_error, GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_UNSUPPORTED_FORMAT))
|
||||
g_clear_error (&local_error);
|
||||
|
||||
if (gdk_dmabuf_downloader_supports (display->dmabuf_downloaders[i],
|
||||
self,
|
||||
local_error ? NULL : &local_error))
|
||||
{
|
||||
self->downloader = g_object_ref (display->dmabuf_downloaders[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (self->downloader == NULL)
|
||||
{
|
||||
g_propagate_error (error, local_error);
|
||||
g_object_unref (self);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Creating dmabuf texture, format %.4s:%#" G_GINT64_MODIFIER "x, %s%u planes, memory format %u, downloader %s",
|
||||
(char *) &dmabuf.fourcc, dmabuf.modifier,
|
||||
gdk_dmabuf_texture_builder_get_premultiplied (builder) ? " premultiplied, " : "",
|
||||
dmabuf.n_planes,
|
||||
GDK_TEXTURE (self)->format,
|
||||
self->downloader ? G_OBJECT_TYPE_NAME (self->downloader) : "none");
|
||||
|
||||
/* Set this only once we know that the texture will be created.
|
||||
* Otherwise dispose() will run the callback */
|
||||
self->destroy = destroy;
|
||||
self->data = data;
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ G_BEGIN_DECLS
|
||||
|
||||
#define GDK_DMABUF_ERROR (gdk_dmabuf_error_quark ())
|
||||
|
||||
typedef struct _GdkDmabufTexture GdkDmabufTexture;
|
||||
typedef struct _GdkDmabufTextureClass GdkDmabufTextureClass;
|
||||
|
||||
GDK_AVAILABLE_IN_4_14
|
||||
|
||||
@@ -27,11 +27,6 @@
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
|
||||
#include <cairo-gobject.h>
|
||||
#ifdef HAVE_DMABUF
|
||||
#include <drm_fourcc.h>
|
||||
#else
|
||||
#define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)
|
||||
#endif
|
||||
|
||||
|
||||
struct _GdkDmabufTextureBuilder
|
||||
@@ -85,12 +80,15 @@ struct _GdkDmabufTextureBuilderClass
|
||||
* descriptor per plane.
|
||||
*
|
||||
* The format of the data (for graphics data, essentially its colorspace) is described
|
||||
* by a 32-bit integer. These format identifiers are defined in the header file
|
||||
* [drm_fourcc.h](https://github.com/torvalds/linux/blob/master/include/uapi/drm_fourcc.h)
|
||||
* by a 32-bit integer. These format identifiers are defined in the header file `drm_fourcc.h`
|
||||
* and commonly referred to as **_fourcc_** values, since they are identified by 4 ASCII
|
||||
* characters. Additionally, each DMA buffer has a **_modifier_**, which is a 64-bit integer
|
||||
* that describes driver-specific details of the memory layout, such as tiling or compression.
|
||||
*
|
||||
* For historical reasons, some producers of dma-bufs don't provide an explicit modifier, but
|
||||
* instead return `DMA_FORMAT_MOD_INVALID` to indicate that their modifier is **_implicit_**.
|
||||
* GTK tries to accomodate this situation by accepting `DMA_FORMAT_MOD_INVALID` as modifier.
|
||||
*
|
||||
* The operation of `GdkDmabufTextureBuilder` is quite simple: Create a texture builder,
|
||||
* set all the necessary properties, and then call [method@Gdk.DmabufTextureBuilder.build]
|
||||
* to create the new texture.
|
||||
@@ -106,6 +104,12 @@ struct _GdkDmabufTextureBuilderClass
|
||||
* `GdkDmabufTextureBuilder` can be used for quick one-shot construction of
|
||||
* textures as well as kept around and reused to construct multiple textures.
|
||||
*
|
||||
* For further information, see
|
||||
*
|
||||
* * The Linux kernel [documentation](https://docs.kernel.org/driver-api/dma-buf.html)
|
||||
*
|
||||
* * The header file [drm_fourcc.h](https://gitlab.freedesktop.org/mesa/drm/-/blob/main/include/drm/drm_fourcc.h)
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
|
||||
@@ -254,7 +258,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
gobject_class->set_property = gdk_dmabuf_texture_builder_set_property;
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:display: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_display org.gdk.Property.set=gdk_dmabuf_texture_builder_set_display)
|
||||
* GdkDmabufTextureBuilder:display: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_display org.gtk.Property.set=gdk_dmabuf_texture_builder_set_display)
|
||||
*
|
||||
* The display that this texture will be used on.
|
||||
*
|
||||
@@ -266,7 +270,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:width: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_width org.gdk.Property.set=gdk_dmabuf_texture_builder_set_width)
|
||||
* GdkDmabufTextureBuilder:width: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_width org.gtk.Property.set=gdk_dmabuf_texture_builder_set_width)
|
||||
*
|
||||
* The width of the texture.
|
||||
*
|
||||
@@ -278,7 +282,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:height: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_height org.gdk.Property.set=gdk_dmabuf_texture_builder_set_height)
|
||||
* GdkDmabufTextureBuilder:height: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_height org.gtk.Property.set=gdk_dmabuf_texture_builder_set_height)
|
||||
*
|
||||
* The height of the texture.
|
||||
*
|
||||
@@ -290,7 +294,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:fourcc: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_fourcc org.gdk.Property.set=gdk_dmabuf_texture_builder_set_fourcc)
|
||||
* GdkDmabufTextureBuilder:fourcc: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_fourcc org.gtk.Property.set=gdk_dmabuf_texture_builder_set_fourcc)
|
||||
*
|
||||
* The format of the texture, as a fourcc value.
|
||||
*
|
||||
@@ -328,7 +332,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:n-planes: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_n_planes org.gdk.Property.set=gdk_dmabuf_texture_builder_set_n_planes)
|
||||
* GdkDmabufTextureBuilder:n-planes: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_n_planes org.gtk.Property.set=gdk_dmabuf_texture_builder_set_n_planes)
|
||||
*
|
||||
* The number of planes of the texture.
|
||||
*
|
||||
@@ -343,7 +347,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:update-region: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_update_region org.gdk.Property.set=gdk_dmabuf_texture_builder_set_update_region)
|
||||
* GdkDmabufTextureBuilder:update-region: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_update_region org.gtk.Property.set=gdk_dmabuf_texture_builder_set_update_region)
|
||||
*
|
||||
* The update region for [property@Gdk.GLTextureBuilder:update-texture].
|
||||
*
|
||||
@@ -355,9 +359,9 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:update-texture: (attributes org.gdk.Property.get=gdk_dmabuf_texture_builder_get_update_texture org.gdk.Property.set=gdk_dmabuf_texture_builder_set_update_texture)
|
||||
* GdkDmabufTextureBuilder:update-texture: (attributes org.gtk.Property.get=gdk_dmabuf_texture_builder_get_update_texture org.gtk.Property.set=gdk_dmabuf_texture_builder_set_update_texture)
|
||||
*
|
||||
* The texture [property@Gdk.GLTextureBuilder:update-region] is an update for.
|
||||
* The texture [property@Gdk.DmabufTextureBuilder:update-region] is an update for.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
@@ -439,7 +443,7 @@ gdk_dmabuf_texture_builder_set_display (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_width: (attributes org.gdk.Method.get_property=width)
|
||||
* gdk_dmabuf_texture_builder_get_width: (attributes org.gtk.Method.get_property=width)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the width previously set via gdk_dmabuf_texture_builder_set_width() or
|
||||
@@ -458,7 +462,7 @@ gdk_dmabuf_texture_builder_get_width (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_width: (attributes org.gdk.Method.set_property=width)
|
||||
* gdk_dmabuf_texture_builder_set_width: (attributes org.gtk.Method.set_property=width)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @width: The texture's width or 0 to unset
|
||||
*
|
||||
@@ -483,7 +487,7 @@ gdk_dmabuf_texture_builder_set_width (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_height: (attributes org.gdk.Method.get_property=height)
|
||||
* gdk_dmabuf_texture_builder_get_height: (attributes org.gtk.Method.get_property=height)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the height previously set via gdk_dmabuf_texture_builder_set_height() or
|
||||
@@ -502,7 +506,7 @@ gdk_dmabuf_texture_builder_get_height (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_height: (attributes org.gdk.Method.set_property=height)
|
||||
* gdk_dmabuf_texture_builder_set_height: (attributes org.gtk.Method.set_property=height)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @height: the texture's height or 0 to unset
|
||||
*
|
||||
@@ -527,7 +531,7 @@ gdk_dmabuf_texture_builder_set_height (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_fourcc: (attributes org.gdk.Method.get_property=fourcc)
|
||||
* gdk_dmabuf_texture_builder_get_fourcc: (attributes org.gtk.Method.get_property=fourcc)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the format previously set via gdk_dmabuf_texture_builder_set_fourcc()
|
||||
@@ -548,7 +552,7 @@ gdk_dmabuf_texture_builder_get_fourcc (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_fourcc: (attributes org.gdk.Method.set_property=fourcc)
|
||||
* gdk_dmabuf_texture_builder_set_fourcc: (attributes org.gtk.Method.set_property=fourcc)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @fourcc: the texture's format or 0 to unset
|
||||
*
|
||||
@@ -606,13 +610,6 @@ gdk_dmabuf_texture_builder_set_modifier (GdkDmabufTextureBuilder *self,
|
||||
guint64 modifier)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DMABUF_TEXTURE_BUILDER (self));
|
||||
if (modifier == DRM_FORMAT_MOD_INVALID)
|
||||
{
|
||||
g_critical ("GTK does not support the INVALID modifier. "
|
||||
"If you use code that produces it, it should include "
|
||||
"instructions how to transform it into a regular modifier.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->dmabuf.modifier == modifier)
|
||||
return;
|
||||
@@ -623,7 +620,7 @@ gdk_dmabuf_texture_builder_set_modifier (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_n_planes: (attributes org.gdk.Method.get_property=n-planes)
|
||||
* gdk_dmabuf_texture_builder_get_n_planes: (attributes org.gtk.Method.get_property=n-planes)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the number of planes.
|
||||
@@ -685,7 +682,7 @@ gdk_dmabuf_texture_builder_set_premultiplied (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_n_planes: (attributes org.gdk.Method.set_property=n-planes)
|
||||
* gdk_dmabuf_texture_builder_set_n_planes: (attributes org.gtk.Method.set_property=n-planes)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @n_planes: the number of planes
|
||||
*
|
||||
@@ -846,7 +843,7 @@ gdk_dmabuf_texture_builder_set_offset (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_update_texture: (attributes org.gdk.Method.get_property=update_texture)
|
||||
* gdk_dmabuf_texture_builder_get_update_texture: (attributes org.gtk.Method.get_property=update-texture)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the texture previously set via gdk_dmabuf_texture_builder_set_update_texture() or
|
||||
@@ -865,7 +862,7 @@ gdk_dmabuf_texture_builder_get_update_texture (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_update_texture: (attributes org.gdk.Method.set_property=update_texture)
|
||||
* gdk_dmabuf_texture_builder_set_update_texture: (attributes org.gtk.Method.set_property=update-texture)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @texture: (nullable): the texture to update
|
||||
*
|
||||
@@ -888,7 +885,7 @@ gdk_dmabuf_texture_builder_set_update_texture (GdkDmabufTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_get_update_region: (attributes org.gdk.Method.get_property=update_region)
|
||||
* gdk_dmabuf_texture_builder_get_update_region: (attributes org.gtk.Method.get_property=update-region)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
*
|
||||
* Gets the region previously set via gdk_dmabuf_texture_builder_set_update_region() or
|
||||
@@ -907,7 +904,7 @@ gdk_dmabuf_texture_builder_get_update_region (GdkDmabufTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_texture_builder_set_update_region: (attributes org.gdk.Method.set_property=update_region)
|
||||
* gdk_dmabuf_texture_builder_set_update_region: (attributes org.gtk.Method.set_property=update-region)
|
||||
* @self: a `GdkDmabufTextureBuilder`
|
||||
* @region: (nullable): the region to update
|
||||
*
|
||||
@@ -991,9 +988,10 @@ gdk_dmabuf_texture_builder_build (GdkDmabufTextureBuilder *self,
|
||||
for (i = 0; i < self->dmabuf.n_planes; i++)
|
||||
g_return_val_if_fail (self->dmabuf.planes[i].fd != -1, NULL);
|
||||
|
||||
if (GDK_DEBUG_CHECK (DMABUF_DISABLE))
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (self->display, DMABUF_DISABLE))
|
||||
{
|
||||
g_set_error_literal (error, GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_NOT_AVAILABLE,
|
||||
g_set_error_literal (error,
|
||||
GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_NOT_AVAILABLE,
|
||||
"dmabuf support disabled via GDK_DEBUG environment variable");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,12 @@ gdk_draw_context_default_surface_resized (GdkDrawContext *context)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_draw_context_default_empty_frame (GdkDrawContext *context)
|
||||
{
|
||||
g_warning ("FIXME: Implement");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_draw_context_dispose (GObject *gobject)
|
||||
{
|
||||
@@ -161,6 +167,7 @@ gdk_draw_context_class_init (GdkDrawContextClass *klass)
|
||||
gobject_class->dispose = gdk_draw_context_dispose;
|
||||
|
||||
klass->surface_resized = gdk_draw_context_default_surface_resized;
|
||||
klass->empty_frame = gdk_draw_context_default_empty_frame;
|
||||
|
||||
/**
|
||||
* GdkDrawContext:display: (attributes org.gtk.Property.get=gdk_draw_context_get_display)
|
||||
@@ -470,3 +477,17 @@ gdk_draw_context_get_frame_region (GdkDrawContext *context)
|
||||
|
||||
return priv->frame_region;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_draw_context_empty_frame (GdkDrawContext *context)
|
||||
{
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAW_CONTEXT (context));
|
||||
g_return_if_fail (priv->surface != NULL);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (priv->surface))
|
||||
return;
|
||||
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->empty_frame (context);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ void gdk_draw_context_begin_frame (GdkDrawContext
|
||||
const cairo_region_t *region);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_draw_context_end_frame (GdkDrawContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_draw_context_is_in_frame (GdkDrawContext *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -46,6 +46,7 @@ struct _GdkDrawContextClass
|
||||
cairo_region_t *update_area);
|
||||
void (* end_frame) (GdkDrawContext *context,
|
||||
cairo_region_t *painted);
|
||||
void (* empty_frame) (GdkDrawContext *context);
|
||||
void (* surface_resized) (GdkDrawContext *context);
|
||||
};
|
||||
|
||||
@@ -54,5 +55,9 @@ void gdk_draw_context_surface_resized (GdkDrawContext
|
||||
void gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
GdkMemoryDepth depth,
|
||||
const cairo_region_t *region);
|
||||
|
||||
void gdk_draw_context_empty_frame (GdkDrawContext *context);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -114,6 +114,15 @@ typedef enum
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/**
|
||||
* GDK_NO_MODIFIER_MASK:
|
||||
*
|
||||
* No modifier.
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
GDK_NO_MODIFIER_MASK GDK_AVAILABLE_ENUMERATOR_IN_4_14 = 0,
|
||||
|
||||
GDK_SHIFT_MASK = 1 << 0,
|
||||
GDK_LOCK_MASK = 1 << 1,
|
||||
GDK_CONTROL_MASK = 1 << 2,
|
||||
|
||||
@@ -402,7 +402,6 @@ gdk_event_alloc (GdkEventType event_type,
|
||||
|
||||
GdkEvent *event = (GdkEvent *) g_type_create_instance (gdk_event_types[event_type]);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (EVENTS))
|
||||
{
|
||||
char *str = g_enum_to_string (GDK_TYPE_EVENT_TYPE, event_type);
|
||||
@@ -410,7 +409,6 @@ gdk_event_alloc (GdkEventType event_type,
|
||||
g_type_name (gdk_event_types[event_type]), str);
|
||||
g_free (str);
|
||||
}
|
||||
#endif
|
||||
|
||||
event->event_type = event_type;
|
||||
event->surface = surface != NULL ? g_object_ref (surface) : NULL;
|
||||
|
||||
@@ -346,19 +346,15 @@ gdk_frame_clock_end_updating (GdkFrameClock *frame_clock)
|
||||
GDK_FRAME_CLOCK_GET_CLASS (frame_clock)->end_updating (frame_clock);
|
||||
}
|
||||
|
||||
static void
|
||||
static inline void
|
||||
_gdk_frame_clock_freeze (GdkFrameClock *clock)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_FRAME_CLOCK (clock));
|
||||
|
||||
GDK_FRAME_CLOCK_GET_CLASS (clock)->freeze (clock);
|
||||
}
|
||||
|
||||
static void
|
||||
static inline void
|
||||
_gdk_frame_clock_thaw (GdkFrameClock *clock)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_FRAME_CLOCK (clock));
|
||||
|
||||
GDK_FRAME_CLOCK_GET_CLASS (clock)->thaw (clock);
|
||||
}
|
||||
|
||||
@@ -390,6 +386,12 @@ _gdk_frame_clock_uninhibit_freeze (GdkFrameClock *clock)
|
||||
_gdk_frame_clock_freeze (clock);
|
||||
}
|
||||
|
||||
static inline gint64
|
||||
_gdk_frame_clock_get_frame_counter (GdkFrameClock *frame_clock)
|
||||
{
|
||||
return frame_clock->priv->frame_counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_frame_clock_get_frame_counter:
|
||||
* @frame_clock: a `GdkFrameClock`
|
||||
@@ -404,13 +406,15 @@ _gdk_frame_clock_uninhibit_freeze (GdkFrameClock *clock)
|
||||
gint64
|
||||
gdk_frame_clock_get_frame_counter (GdkFrameClock *frame_clock)
|
||||
{
|
||||
GdkFrameClockPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_FRAME_CLOCK (frame_clock), 0);
|
||||
|
||||
priv = frame_clock->priv;
|
||||
return _gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
}
|
||||
|
||||
return priv->frame_counter;
|
||||
static inline gint64
|
||||
_gdk_frame_clock_get_history_start (GdkFrameClock *frame_clock)
|
||||
{
|
||||
return frame_clock->priv->frame_counter + 1 - frame_clock->priv->n_timings;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -433,13 +437,9 @@ gdk_frame_clock_get_frame_counter (GdkFrameClock *frame_clock)
|
||||
gint64
|
||||
gdk_frame_clock_get_history_start (GdkFrameClock *frame_clock)
|
||||
{
|
||||
GdkFrameClockPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_FRAME_CLOCK (frame_clock), 0);
|
||||
|
||||
priv = frame_clock->priv;
|
||||
|
||||
return priv->frame_counter + 1 - priv->n_timings;
|
||||
return _gdk_frame_clock_get_history_start (frame_clock);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -470,6 +470,24 @@ _gdk_frame_clock_begin_frame (GdkFrameClock *frame_clock)
|
||||
priv->timings[priv->current] = _gdk_frame_timings_new (priv->frame_counter);
|
||||
}
|
||||
|
||||
static inline GdkFrameTimings *
|
||||
_gdk_frame_clock_get_timings (GdkFrameClock *frame_clock,
|
||||
gint64 frame_counter)
|
||||
{
|
||||
GdkFrameClockPrivate *priv = frame_clock->priv;
|
||||
int pos;
|
||||
|
||||
if (frame_counter > priv->frame_counter)
|
||||
return NULL;
|
||||
|
||||
if (frame_counter <= priv->frame_counter - priv->n_timings)
|
||||
return NULL;
|
||||
|
||||
pos = (priv->current - (priv->frame_counter - frame_counter) + FRAME_HISTORY_MAX_LENGTH) % FRAME_HISTORY_MAX_LENGTH;
|
||||
|
||||
return priv->timings[pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_frame_clock_get_timings:
|
||||
* @frame_clock: a `GdkFrameClock`
|
||||
@@ -490,22 +508,9 @@ GdkFrameTimings *
|
||||
gdk_frame_clock_get_timings (GdkFrameClock *frame_clock,
|
||||
gint64 frame_counter)
|
||||
{
|
||||
GdkFrameClockPrivate *priv;
|
||||
int pos;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_FRAME_CLOCK (frame_clock), NULL);
|
||||
|
||||
priv = frame_clock->priv;
|
||||
|
||||
if (frame_counter > priv->frame_counter)
|
||||
return NULL;
|
||||
|
||||
if (frame_counter <= priv->frame_counter - priv->n_timings)
|
||||
return NULL;
|
||||
|
||||
pos = (priv->current - (priv->frame_counter - frame_counter) + FRAME_HISTORY_MAX_LENGTH) % FRAME_HISTORY_MAX_LENGTH;
|
||||
|
||||
return priv->timings[pos];
|
||||
return _gdk_frame_clock_get_timings (frame_clock, frame_counter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -528,11 +533,9 @@ gdk_frame_clock_get_current_timings (GdkFrameClock *frame_clock)
|
||||
|
||||
priv = frame_clock->priv;
|
||||
|
||||
return gdk_frame_clock_get_timings (frame_clock, priv->frame_counter);
|
||||
return _gdk_frame_clock_get_timings (frame_clock, priv->frame_counter);
|
||||
}
|
||||
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
void
|
||||
_gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
|
||||
GdkFrameTimings *timings)
|
||||
@@ -541,8 +544,8 @@ _gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
|
||||
|
||||
gint64 previous_frame_time = 0;
|
||||
gint64 previous_smoothed_frame_time = 0;
|
||||
GdkFrameTimings *previous_timings = gdk_frame_clock_get_timings (clock,
|
||||
timings->frame_counter - 1);
|
||||
GdkFrameTimings *previous_timings = _gdk_frame_clock_get_timings (clock,
|
||||
timings->frame_counter - 1);
|
||||
|
||||
if (previous_timings != NULL)
|
||||
{
|
||||
@@ -579,7 +582,6 @@ _gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
|
||||
g_message ("%s", str->str);
|
||||
g_string_free (str, TRUE);
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
#define DEFAULT_REFRESH_INTERVAL 16667 /* 16.7ms (1/60th second) */
|
||||
#define MAX_HISTORY_AGE 150000 /* 150ms */
|
||||
@@ -614,11 +616,11 @@ gdk_frame_clock_get_refresh_info (GdkFrameClock *frame_clock,
|
||||
|
||||
g_return_if_fail (GDK_IS_FRAME_CLOCK (frame_clock));
|
||||
|
||||
frame_counter = gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
frame_counter = _gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
GdkFrameTimings *timings = gdk_frame_clock_get_timings (frame_clock, frame_counter);
|
||||
GdkFrameTimings *timings = _gdk_frame_clock_get_timings (frame_clock, frame_counter);
|
||||
gint64 presentation_time;
|
||||
gint64 refresh_interval;
|
||||
|
||||
@@ -730,15 +732,15 @@ guess_refresh_interval (GdkFrameClock *frame_clock)
|
||||
|
||||
interval = G_MAXINT64;
|
||||
|
||||
for (i = gdk_frame_clock_get_history_start (frame_clock);
|
||||
i < gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
for (i = _gdk_frame_clock_get_history_start (frame_clock);
|
||||
i < _gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
i++)
|
||||
{
|
||||
GdkFrameTimings *t, *before;
|
||||
gint64 ts, before_ts;
|
||||
|
||||
t = gdk_frame_clock_get_timings (frame_clock, i);
|
||||
before = gdk_frame_clock_get_timings (frame_clock, i - 1);
|
||||
t = _gdk_frame_clock_get_timings (frame_clock, i);
|
||||
before = _gdk_frame_clock_get_timings (frame_clock, i - 1);
|
||||
if (t == NULL || before == NULL)
|
||||
continue;
|
||||
|
||||
@@ -773,12 +775,12 @@ gdk_frame_clock_get_fps (GdkFrameClock *frame_clock)
|
||||
gint64 start_timestamp, end_timestamp;
|
||||
gint64 interval;
|
||||
|
||||
start_counter = gdk_frame_clock_get_history_start (frame_clock);
|
||||
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
start = gdk_frame_clock_get_timings (frame_clock, start_counter);
|
||||
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
|
||||
start_counter = _gdk_frame_clock_get_history_start (frame_clock);
|
||||
end_counter = _gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
start = _gdk_frame_clock_get_timings (frame_clock, start_counter);
|
||||
for (end = _gdk_frame_clock_get_timings (frame_clock, end_counter);
|
||||
end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
|
||||
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
|
||||
end = _gdk_frame_clock_get_timings (frame_clock, end_counter))
|
||||
end_counter--;
|
||||
if (end_counter - start_counter < 4)
|
||||
return 0.0;
|
||||
|
||||
@@ -585,14 +585,15 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
|
||||
{
|
||||
int iter;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
{
|
||||
if (priv->phase != GDK_FRAME_CLOCK_PHASE_LAYOUT &&
|
||||
(priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT))
|
||||
timings->layout_start_time = g_get_monotonic_time ();
|
||||
{
|
||||
if (timings)
|
||||
timings->layout_start_time = g_get_monotonic_time ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_LAYOUT;
|
||||
/* We loop in the layout phase, because we don't want to progress
|
||||
@@ -616,14 +617,15 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
case GDK_FRAME_CLOCK_PHASE_PAINT:
|
||||
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
{
|
||||
if (priv->phase != GDK_FRAME_CLOCK_PHASE_PAINT &&
|
||||
(priv->requested & GDK_FRAME_CLOCK_PHASE_PAINT))
|
||||
timings->paint_start_time = g_get_monotonic_time ();
|
||||
{
|
||||
if (timings)
|
||||
timings->paint_start_time = g_get_monotonic_time ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_PAINT;
|
||||
if (priv->requested & GDK_FRAME_CLOCK_PHASE_PAINT)
|
||||
@@ -643,13 +645,11 @@ gdk_frame_clock_paint_idle (void *data)
|
||||
*/
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
|
||||
}
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GDK_DEBUG_CHECK (FRAMES))
|
||||
{
|
||||
if (timings)
|
||||
timings->frame_end_time = g_get_monotonic_time ();
|
||||
}
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
G_GNUC_FALLTHROUGH;
|
||||
|
||||
case GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS:
|
||||
|
||||
@@ -95,11 +95,9 @@ struct _GdkFrameTimings
|
||||
gint64 refresh_interval;
|
||||
gint64 predicted_presentation_time;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gint64 layout_start_time;
|
||||
gint64 paint_start_time;
|
||||
gint64 frame_end_time;
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
guint complete : 1;
|
||||
guint slept_before : 1;
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gdkdmabufeglprivate.h"
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
@@ -87,6 +87,8 @@
|
||||
|
||||
#include "gdkprivate.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
# include "gdk/win32/gdkwin32.h"
|
||||
#endif
|
||||
@@ -104,10 +106,15 @@
|
||||
|
||||
#define DEFAULT_ALLOWED_APIS GDK_GL_API_GL | GDK_GL_API_GLES
|
||||
|
||||
typedef struct {
|
||||
typedef struct _GdkGLContextPrivate GdkGLContextPrivate;
|
||||
|
||||
struct _GdkGLContextPrivate
|
||||
{
|
||||
GdkGLVersion required;
|
||||
GdkGLVersion gl_version;
|
||||
|
||||
GdkGLMemoryFlags memory_flags[GDK_MEMORY_N_FORMATS];
|
||||
|
||||
guint has_khr_debug : 1;
|
||||
guint use_khr_debug : 1;
|
||||
guint has_half_float : 1;
|
||||
@@ -115,7 +122,6 @@ typedef struct {
|
||||
guint has_unpack_subimage : 1;
|
||||
guint has_debug_output : 1;
|
||||
guint has_bgra : 1;
|
||||
guint has_image_storage : 1;
|
||||
guint extensions_checked : 1;
|
||||
guint debug_enabled : 1;
|
||||
guint forward_compatible : 1;
|
||||
@@ -130,7 +136,7 @@ typedef struct {
|
||||
EGLContext egl_context;
|
||||
EGLBoolean (*eglSwapBuffersWithDamage) (EGLDisplay, EGLSurface, const EGLint *, EGLint);
|
||||
#endif
|
||||
} GdkGLContextPrivate;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
@@ -352,6 +358,7 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
|
||||
api == GDK_GL_API_GLES ? "yes" : "no");
|
||||
|
||||
supported_versions = gdk_gl_versions_get_for_api (api);
|
||||
ctx = EGL_NO_CONTEXT;
|
||||
for (j = 0; gdk_gl_version_greater_equal (&supported_versions[j], &version); j++)
|
||||
{
|
||||
context_attribs [major_idx] = gdk_gl_version_get_major (&supported_versions[j]);
|
||||
@@ -361,11 +368,11 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
|
||||
egl_config,
|
||||
share ? share_priv->egl_context : EGL_NO_CONTEXT,
|
||||
context_attribs);
|
||||
if (ctx != NULL)
|
||||
if (ctx != EGL_NO_CONTEXT)
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctx == NULL)
|
||||
if (ctx == EGL_NO_CONTEXT)
|
||||
return 0;
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Created EGL context[%p]", ctx);
|
||||
@@ -390,17 +397,24 @@ gdk_gl_context_realize_egl (GdkGLContext *context,
|
||||
{
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
GdkDebugFlags flags;
|
||||
GdkGLAPI api, preferred_api;
|
||||
gboolean prefer_legacy;
|
||||
|
||||
flags = gdk_display_get_debug_flags(display);
|
||||
|
||||
if (share && gdk_gl_context_is_api_allowed (context,
|
||||
gdk_gl_context_get_api (share),
|
||||
NULL))
|
||||
preferred_api = gdk_gl_context_get_api (share);
|
||||
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
|
||||
else if ((flags & GDK_DEBUG_GL_PREFER_GL) != 0 &&
|
||||
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
|
||||
preferred_api = GDK_GL_API_GL;
|
||||
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL))
|
||||
preferred_api = GDK_GL_API_GLES;
|
||||
else if ((flags & GDK_DEBUG_GL_PREFER_GL) == 0 &&
|
||||
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
|
||||
preferred_api = GDK_GL_API_GL;
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
@@ -409,8 +423,7 @@ gdk_gl_context_realize_egl (GdkGLContext *context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
prefer_legacy = (gdk_display_get_debug_flags(display) & GDK_DEBUG_GL_LEGACY) ||
|
||||
(share != NULL && gdk_gl_context_is_legacy (share));
|
||||
prefer_legacy = share != NULL && gdk_gl_context_is_legacy (share);
|
||||
|
||||
if (preferred_api == GDK_GL_API_GL)
|
||||
{
|
||||
@@ -1278,18 +1291,38 @@ gdk_gl_context_is_api_allowed (GdkGLContext *self,
|
||||
GError **error)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
GdkDebugFlags flags;
|
||||
GdkGLAPI allowed_apis;
|
||||
|
||||
if (gdk_display_get_debug_flags (gdk_gl_context_get_display (self)) & GDK_DEBUG_GL_GLES)
|
||||
allowed_apis = priv->allowed_apis;
|
||||
|
||||
flags = gdk_display_get_debug_flags (gdk_gl_context_get_display (self));
|
||||
|
||||
if (flags & GDK_DEBUG_GL_DISABLE_GLES)
|
||||
{
|
||||
if (!(api & GDK_GL_API_GLES))
|
||||
if (api == GDK_GL_API_GLES)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Anything but OpenGL ES disabled via GDK_DEBUG"));
|
||||
_("OpenGL ES disabled via GDK_DEBUG"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
allowed_apis &= ~GDK_GL_API_GLES;
|
||||
}
|
||||
|
||||
if (priv->allowed_apis & api)
|
||||
if (flags & GDK_DEBUG_GL_DISABLE_GL)
|
||||
{
|
||||
if (api == GDK_GL_API_GL)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("OpenGL disabled via GDK_DEBUG"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
allowed_apis &= ~GDK_GL_API_GL;
|
||||
}
|
||||
|
||||
if (allowed_apis & api)
|
||||
return TRUE;
|
||||
|
||||
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
@@ -1498,6 +1531,132 @@ gdk_gl_context_realize (GdkGLContext *context,
|
||||
return priv->api;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_gl_context_init_memory_flags (GdkGLContext *self)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
gsize i;
|
||||
|
||||
if (!gdk_gl_context_get_use_es (self))
|
||||
{
|
||||
for (i = 0; i < G_N_ELEMENTS (priv->memory_flags); i++)
|
||||
{
|
||||
priv->memory_flags[i] = GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* GLES 2.0 spec, tables 3.2 and 3.3 */
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8] = GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] = GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8A8] = GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
#if 0
|
||||
/* GLES2 can do these, but GTK can't */
|
||||
priv->memory_flags[GDK_MEMORY_A8] = GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G8] = GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G8A8_PREMULTIPLIED] = GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G8A8] = GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
#endif
|
||||
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
{
|
||||
/* GLES 3.0.6 spec, table 3.13 */
|
||||
priv->memory_flags[GDK_MEMORY_G8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G8A8_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G8A8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8A8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8X8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16_FLOAT] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A16_FLOAT] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32_FLOAT] |= GDK_GL_FORMAT_USABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT] |= GDK_GL_FORMAT_USABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A32_FLOAT] |= GDK_GL_FORMAT_USABLE;
|
||||
|
||||
/* no changes in GLES 3.1 spec, table 8.13 */
|
||||
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 2)))
|
||||
{
|
||||
/* GLES 3.2 spec, table 8.10 */
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] |= GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT] |= GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A16_FLOAT] |= GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] |= GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT] |= GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A32_FLOAT] |= GDK_GL_FORMAT_FILTERABLE;
|
||||
}
|
||||
}
|
||||
|
||||
if (epoxy_has_gl_extension ("GL_OES_rgb8_rgba8"))
|
||||
{
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8A8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
priv->memory_flags[GDK_MEMORY_R8G8B8X8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
}
|
||||
if (epoxy_has_gl_extension ("GL_EXT_abgr"))
|
||||
{
|
||||
priv->memory_flags[GDK_MEMORY_A8B8G8R8_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A8B8G8R8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
priv->memory_flags[GDK_MEMORY_X8B8G8R8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
}
|
||||
if (epoxy_has_gl_extension ("GL_EXT_texture_format_BGRA8888"))
|
||||
{
|
||||
priv->memory_flags[GDK_MEMORY_B8G8R8A8_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_B8G8R8A8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
priv->memory_flags[GDK_MEMORY_B8G8R8X8] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
}
|
||||
|
||||
/* Technically, those extensions are supported on GLES2.
|
||||
* However, GTK uses the wrong format/type pairs with them, so we don't enable them.
|
||||
*/
|
||||
if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
{
|
||||
if (epoxy_has_gl_extension ("GL_EXT_texture_norm16"))
|
||||
{
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G16A16_PREMULTIPLIED] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G16A16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_G16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_A16] |= GDK_GL_FORMAT_USABLE | GDK_GL_FORMAT_RENDERABLE | GDK_GL_FORMAT_FILTERABLE;
|
||||
}
|
||||
if (epoxy_has_gl_extension ("GL_OES_texture_half_float"))
|
||||
{
|
||||
GdkGLMemoryFlags flags = GDK_GL_FORMAT_USABLE;
|
||||
if (epoxy_has_gl_extension ("GL_EXT_color_buffer_half_float"))
|
||||
flags |= GDK_GL_FORMAT_RENDERABLE;
|
||||
if (epoxy_has_gl_extension ("GL_OES_texture_half_float_linear"))
|
||||
flags |= GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] |= flags;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16A16_FLOAT] |= flags;
|
||||
priv->memory_flags[GDK_MEMORY_R16G16B16_FLOAT] |= flags;
|
||||
priv->memory_flags[GDK_MEMORY_A16_FLOAT] |= flags;
|
||||
}
|
||||
if (epoxy_has_gl_extension ("GL_OES_texture_float"))
|
||||
{
|
||||
GdkGLMemoryFlags flags = GDK_GL_FORMAT_USABLE;
|
||||
if (epoxy_has_gl_extension ("GL_EXT_color_buffer_float"))
|
||||
flags |= GDK_GL_FORMAT_RENDERABLE;
|
||||
if (epoxy_has_gl_extension ("GL_OES_texture_float_linear"))
|
||||
flags |= GDK_GL_FORMAT_FILTERABLE;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] |= flags;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32A32_FLOAT] |= flags;
|
||||
priv->memory_flags[GDK_MEMORY_R32G32B32_FLOAT] |= flags;
|
||||
priv->memory_flags[GDK_MEMORY_A32_FLOAT] |= flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdk_gl_version_init_epoxy (GdkGLVersion *version)
|
||||
{
|
||||
@@ -1564,9 +1723,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
epoxy_has_gl_extension ("GL_ARB_sync") ||
|
||||
epoxy_has_gl_extension ("GL_APPLE_sync");
|
||||
|
||||
priv->has_image_storage = epoxy_has_gl_extension ("GL_EXT_EGL_image_storage");
|
||||
gdk_gl_context_init_memory_flags (context);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
{
|
||||
int max_texture_size;
|
||||
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);
|
||||
@@ -1577,10 +1735,9 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
"* Extensions checked:\n"
|
||||
" - GL_KHR_debug: %s\n"
|
||||
" - GL_EXT_unpack_subimage: %s\n"
|
||||
" - GL_EXT_texture_format_BGRA8888: %s\n"
|
||||
" - GL_EXT_EGL_image_storage: %s\n"
|
||||
" - half float: %s\n"
|
||||
" - sync: %s",
|
||||
" - sync: %s\n"
|
||||
" - bgra: %s",
|
||||
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
|
||||
gdk_gl_version_get_major (&priv->gl_version), gdk_gl_version_get_minor (&priv->gl_version),
|
||||
priv->is_legacy ? "legacy" : "core",
|
||||
@@ -1588,12 +1745,10 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
max_texture_size,
|
||||
priv->has_khr_debug ? "yes" : "no",
|
||||
priv->has_unpack_subimage ? "yes" : "no",
|
||||
priv->has_bgra ? "yes" : "no",
|
||||
priv->has_image_storage ? "yes" : "no",
|
||||
priv->has_half_float ? "yes" : "no",
|
||||
priv->has_sync ? "yes" : "no");
|
||||
priv->has_sync ? "yes" : "no",
|
||||
priv->has_bgra ? "yes" : "no");
|
||||
}
|
||||
#endif
|
||||
|
||||
priv->extensions_checked = TRUE;
|
||||
}
|
||||
@@ -1853,6 +2008,15 @@ gdk_gl_context_get_current (void)
|
||||
return context;
|
||||
}
|
||||
|
||||
GdkGLMemoryFlags
|
||||
gdk_gl_context_get_format_flags (GdkGLContext *self,
|
||||
GdkMemoryFormat format)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
|
||||
return priv->memory_flags[format];
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_has_debug (GdkGLContext *self)
|
||||
{
|
||||
@@ -1907,14 +2071,6 @@ gdk_gl_context_has_vertex_arrays (GdkGLContext *self)
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_has_image_storage (GdkGLContext *self)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||
|
||||
return priv->has_image_storage;
|
||||
}
|
||||
|
||||
/* This is currently private! */
|
||||
/* When using GL/ES, don't flip the 'R' and 'B' bits on Windows/ANGLE for glReadPixels() */
|
||||
gboolean
|
||||
@@ -1996,80 +2152,25 @@ gdk_gl_backend_use (GdkGLBackend backend_type)
|
||||
g_assert (the_gl_backend_type == backend_type);
|
||||
}
|
||||
|
||||
guint
|
||||
gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
||||
int width,
|
||||
int height,
|
||||
const GdkDmabuf *dmabuf,
|
||||
int target)
|
||||
static guint
|
||||
gdk_gl_context_import_dmabuf_for_target (GdkGLContext *self,
|
||||
int width,
|
||||
int height,
|
||||
const GdkDmabuf *dmabuf,
|
||||
int target)
|
||||
{
|
||||
#if defined(HAVE_EGL) && defined(HAVE_DMABUF)
|
||||
GdkDisplay *display = gdk_gl_context_get_display (self);
|
||||
EGLDisplay egl_display = gdk_display_get_egl_display (display);
|
||||
EGLint attribs[64];
|
||||
int i;
|
||||
EGLImage image;
|
||||
guint texture_id;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_GL_CONTEXT (self), 0);
|
||||
g_return_val_if_fail (width > 0, 0);
|
||||
g_return_val_if_fail (height > 0, 0);
|
||||
g_return_val_if_fail (1 <= dmabuf->n_planes && dmabuf->n_planes <= 4, 0);
|
||||
g_return_val_if_fail (target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES, 0);
|
||||
|
||||
if (egl_display == EGL_NO_DISPLAY || !display->have_egl_dma_buf_import)
|
||||
return 0;
|
||||
|
||||
GDK_DEBUG (DMABUF,
|
||||
"Importing dmabuf (format: %.4s:%#" G_GINT64_MODIFIER "x, planes: %u) into GL",
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier, dmabuf->n_planes);
|
||||
|
||||
i = 0;
|
||||
attribs[i++] = EGL_IMAGE_PRESERVED_KHR;
|
||||
attribs[i++] = EGL_TRUE;
|
||||
attribs[i++] = EGL_WIDTH;
|
||||
attribs[i++] = width;
|
||||
attribs[i++] = EGL_HEIGHT;
|
||||
attribs[i++] = height;
|
||||
attribs[i++] = EGL_LINUX_DRM_FOURCC_EXT;
|
||||
attribs[i++] = dmabuf->fourcc;
|
||||
|
||||
#define ADD_PLANE(plane) \
|
||||
{ \
|
||||
if (dmabuf->modifier != DRM_FORMAT_MOD_INVALID) \
|
||||
{ \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ##_MODIFIER_LO_EXT; \
|
||||
attribs[i++] = dmabuf->modifier & 0xFFFFFFFF; \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ## _MODIFIER_HI_EXT; \
|
||||
attribs[i++] = dmabuf->modifier >> 32; \
|
||||
} \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ##_FD_EXT; \
|
||||
attribs[i++] = dmabuf->planes[plane].fd; \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ##_PITCH_EXT; \
|
||||
attribs[i++] = dmabuf->planes[plane].stride; \
|
||||
attribs[i++] = EGL_DMA_BUF_PLANE## plane ##_OFFSET_EXT; \
|
||||
attribs[i++] = dmabuf->planes[plane].offset; \
|
||||
}
|
||||
|
||||
ADD_PLANE (0);
|
||||
|
||||
if (dmabuf->n_planes > 1) ADD_PLANE (1);
|
||||
if (dmabuf->n_planes > 2) ADD_PLANE (2);
|
||||
if (dmabuf->n_planes > 3) ADD_PLANE (3);
|
||||
|
||||
attribs[i++] = EGL_NONE;
|
||||
|
||||
image = eglCreateImageKHR (egl_display,
|
||||
EGL_NO_CONTEXT,
|
||||
EGL_LINUX_DMA_BUF_EXT,
|
||||
(EGLClientBuffer)NULL,
|
||||
attribs);
|
||||
|
||||
image = gdk_dmabuf_egl_create_image (display,
|
||||
width,
|
||||
height,
|
||||
dmabuf,
|
||||
target);
|
||||
if (image == EGL_NO_IMAGE)
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "Creating EGLImage for dmabuf failed: %#x", eglGetError ());
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
||||
glGenTextures (1, &texture_id);
|
||||
glBindTexture (target, texture_id);
|
||||
@@ -2077,7 +2178,7 @@ gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
||||
glTexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
eglDestroyImageKHR (egl_display, image);
|
||||
eglDestroyImageKHR (gdk_display_get_egl_display (display), image);
|
||||
|
||||
return texture_id;
|
||||
#else
|
||||
@@ -2085,6 +2186,70 @@ gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
||||
#endif
|
||||
}
|
||||
|
||||
guint
|
||||
gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
||||
int width,
|
||||
int height,
|
||||
const GdkDmabuf *dmabuf,
|
||||
gboolean *external)
|
||||
{
|
||||
GdkDisplay *display = gdk_gl_context_get_display (self);
|
||||
guint texture_id;
|
||||
|
||||
gdk_display_init_dmabuf (display);
|
||||
|
||||
if (!gdk_dmabuf_formats_contains (display->egl_external_formats, dmabuf->fourcc, dmabuf->modifier))
|
||||
{
|
||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||
width, height,
|
||||
dmabuf,
|
||||
GL_TEXTURE_2D);
|
||||
if (texture_id == 0)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Import of %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_2D texture",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
*external = FALSE;
|
||||
return texture_id;
|
||||
}
|
||||
|
||||
if (!gdk_gl_context_get_use_es (self))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Can't import external_only %.4s:%#" G_GINT64_MODIFIER "x outside of GLES",
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||
width, height,
|
||||
dmabuf,
|
||||
GL_TEXTURE_EXTERNAL_OES);
|
||||
if (texture_id == 0)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Import of external_only %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_EXTERNAL_OES texture",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
*external = TRUE;
|
||||
return texture_id;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_gl_context_export_dmabuf (GdkGLContext *self,
|
||||
unsigned int texture_id,
|
||||
@@ -2111,9 +2276,13 @@ gdk_gl_context_export_dmabuf (GdkGLContext *self,
|
||||
g_return_val_if_fail (dmabuf != NULL, FALSE);
|
||||
|
||||
if (egl_display == EGL_NO_DISPLAY || !display->have_egl_dma_buf_export)
|
||||
return 0;
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Can't export dmabufs from GL, missing EGL or EGL_EXT_image_dma_buf_export");
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDK_DEBUG (DMABUF, "Exporting GL texture to dmabuf");
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF, "Exporting GL texture to dmabuf");
|
||||
|
||||
i = 0;
|
||||
attribs[i++] = EGL_IMAGE_PRESERVED_KHR;
|
||||
@@ -2129,7 +2298,8 @@ gdk_gl_context_export_dmabuf (GdkGLContext *self,
|
||||
|
||||
if (image == EGL_NO_IMAGE)
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "Creating EGLImage for dmabuf failed: %#x", eglGetError ());
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Creating EGLImage for dmabuf failed: %#x", eglGetError ());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -2139,13 +2309,15 @@ gdk_gl_context_export_dmabuf (GdkGLContext *self,
|
||||
&n_planes,
|
||||
&modifier))
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "eglExportDMABUFImageQueryMESA failed: %#x", eglGetError ());
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"eglExportDMABUFImageQueryMESA failed: %#x", eglGetError ());
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (n_planes < 1 || n_planes > GDK_DMABUF_MAX_PLANES)
|
||||
{
|
||||
GDK_DEBUG (DMABUF, "dmabufs with %d planes are not supported", n_planes);
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"dmabufs with %d planes are not supported", n_planes);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -2179,8 +2351,8 @@ gdk_gl_context_export_dmabuf (GdkGLContext *self,
|
||||
dmabuf->planes[i].offset = (int) offsets[i];
|
||||
}
|
||||
|
||||
GDK_DEBUG (DMABUF,
|
||||
"Exported GL texture to dmabuf (format: %.4s:%#" G_GINT64_MODIFIER "x, planes: %d)",
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Exported GL texture to dmabuf (format: %.4s:%#" G_GINT64_MODIFIER "x, planes: %d)",
|
||||
(char *)&fourcc, modifier, n_planes);
|
||||
|
||||
result = TRUE;
|
||||
|
||||
@@ -35,6 +35,17 @@ typedef enum {
|
||||
GDK_GL_CGL
|
||||
} GdkGLBackend;
|
||||
|
||||
typedef enum {
|
||||
/* The format is supported for glTexImage2D() */
|
||||
GDK_GL_FORMAT_USABLE = 1 << 0,
|
||||
/* The format can be rendered to.
|
||||
* GL/GLES spec term: "color-renderable" */
|
||||
GDK_GL_FORMAT_RENDERABLE = 1 << 1,
|
||||
/* GL_LINEAR/GL_MIPMAP_LINEAR can be used for textures in this format.
|
||||
* GLES spec term: "texture-filterable" */
|
||||
GDK_GL_FORMAT_FILTERABLE = 1 << 2
|
||||
} GdkGLMemoryFlags;
|
||||
|
||||
/* The maximum amount of buffers we track update regions for.
|
||||
* Note that this is equal to the max buffer age value we
|
||||
* can provide a damage region for */
|
||||
@@ -150,6 +161,8 @@ void gdk_gl_context_label_object_printf (GdkGLContext
|
||||
|
||||
const char * gdk_gl_context_get_glsl_version_string (GdkGLContext *self);
|
||||
|
||||
GdkGLMemoryFlags gdk_gl_context_get_format_flags (GdkGLContext *self,
|
||||
GdkMemoryFormat format) G_GNUC_PURE;
|
||||
gboolean gdk_gl_context_has_debug (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
gboolean gdk_gl_context_use_es_bgra (GdkGLContext *context);
|
||||
@@ -162,15 +175,13 @@ gboolean gdk_gl_context_has_bgra (GdkGLContext
|
||||
|
||||
gboolean gdk_gl_context_has_vertex_arrays (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
gboolean gdk_gl_context_has_image_storage (GdkGLContext *self) G_GNUC_PURE;
|
||||
|
||||
double gdk_gl_context_get_scale (GdkGLContext *self);
|
||||
|
||||
guint gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
||||
int width,
|
||||
int height,
|
||||
const GdkDmabuf *dmabuf,
|
||||
int target);
|
||||
gboolean *external);
|
||||
|
||||
gboolean gdk_gl_context_export_dmabuf (GdkGLContext *self,
|
||||
unsigned int texture_id,
|
||||
|
||||
@@ -151,15 +151,18 @@ gdk_gl_texture_find_format (GdkGLContext *context,
|
||||
|
||||
for (format = 0; format < GDK_MEMORY_N_FORMATS; format++)
|
||||
{
|
||||
GLenum q_internal_format, q_format, q_type;
|
||||
GLint q_internal_format;
|
||||
GLenum q_format, q_type;
|
||||
GLint q_swizzle[4];
|
||||
|
||||
if (gdk_memory_format_alpha (format) != alpha)
|
||||
continue;
|
||||
|
||||
if (!gdk_memory_format_gl_format (format, context, &q_internal_format, &q_format, &q_type, q_swizzle))
|
||||
if (!(gdk_gl_context_get_format_flags (context, format) & GDK_GL_FORMAT_RENDERABLE))
|
||||
continue;
|
||||
|
||||
gdk_memory_format_gl_format (format, &q_internal_format, &q_format, &q_type, q_swizzle);
|
||||
|
||||
if (q_format != gl_format || q_type != gl_type)
|
||||
continue;
|
||||
|
||||
@@ -179,18 +182,19 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
GdkMemoryFormat format;
|
||||
gsize expected_stride;
|
||||
Download *download = download_;
|
||||
GLenum gl_internal_format, gl_format, gl_type;
|
||||
GLint gl_internal_format;
|
||||
GLenum gl_format, gl_type;
|
||||
GLint gl_swizzle[4];
|
||||
|
||||
format = gdk_texture_get_format (texture),
|
||||
expected_stride = texture->width * gdk_memory_format_bytes_per_pixel (download->format);
|
||||
|
||||
if (!gdk_gl_context_get_use_es (context) &&
|
||||
gdk_memory_format_gl_format (format,
|
||||
context,
|
||||
&gl_internal_format,
|
||||
&gl_format, &gl_type, gl_swizzle))
|
||||
((gdk_gl_context_get_format_flags (context, format) & GDK_GL_FORMAT_USABLE) == GDK_GL_FORMAT_USABLE))
|
||||
{
|
||||
gdk_memory_format_gl_format (format,
|
||||
&gl_internal_format,
|
||||
&gl_format, &gl_type, gl_swizzle);
|
||||
if (download->stride == expected_stride &&
|
||||
download->format == format)
|
||||
{
|
||||
@@ -228,7 +232,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
else
|
||||
{
|
||||
GdkMemoryFormat actual_format;
|
||||
GLint gl_read_format, gl_read_type;
|
||||
GLenum gl_read_format, gl_read_type;
|
||||
GLuint fbo;
|
||||
|
||||
glGenFramebuffers (1, &fbo);
|
||||
@@ -236,26 +240,34 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self->id, 0);
|
||||
if (gdk_gl_context_check_version (context, "4.3", "3.1"))
|
||||
{
|
||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_FORMAT, &gl_read_format);
|
||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_TYPE, &gl_read_type);
|
||||
if (!gdk_gl_texture_find_format (context, gdk_memory_format_alpha (format), gl_read_format, gl_read_type, &actual_format))
|
||||
GLint read_format, read_type;
|
||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_FORMAT, &read_format);
|
||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_TYPE, &read_type);
|
||||
if (gdk_gl_texture_find_format (context, gdk_memory_format_alpha (format), read_format, read_type, &actual_format))
|
||||
{
|
||||
gl_read_format = GL_RGBA;
|
||||
gl_read_type = GL_UNSIGNED_BYTE;
|
||||
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_PREMULTIPLIED)
|
||||
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED; /* pray */
|
||||
else
|
||||
actual_format = GDK_MEMORY_R8G8B8A8;
|
||||
gl_read_format = read_format;
|
||||
gl_read_type = read_type;
|
||||
}
|
||||
else
|
||||
{
|
||||
actual_format = gdk_memory_depth_get_format (gdk_memory_format_get_depth (format));
|
||||
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_STRAIGHT)
|
||||
actual_format = gdk_memory_format_get_straight (actual_format);
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
&gl_internal_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_read_format = GL_RGBA;
|
||||
gl_read_type = GL_UNSIGNED_BYTE;
|
||||
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_PREMULTIPLIED)
|
||||
actual_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED; /* pray */
|
||||
else
|
||||
actual_format = GDK_MEMORY_R8G8B8A8;
|
||||
actual_format = gdk_memory_depth_get_format (gdk_memory_format_get_depth (format));
|
||||
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_STRAIGHT)
|
||||
actual_format = gdk_memory_format_get_straight (actual_format);
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
&gl_internal_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
|
||||
if (download->format == actual_format &&
|
||||
|
||||
@@ -213,7 +213,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
gobject_class->set_property = gdk_gl_texture_builder_set_property;
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:context: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_context org.gdk.Property.set=gdk_gl_texture_builder_set_context)
|
||||
* GdkGLTextureBuilder:context: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_context org.gtk.Property.set=gdk_gl_texture_builder_set_context)
|
||||
*
|
||||
* The context owning the texture.
|
||||
*
|
||||
@@ -225,7 +225,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:format: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_format org.gdk.Property.set=gdk_gl_texture_builder_set_format)
|
||||
* GdkGLTextureBuilder:format: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_format org.gtk.Property.set=gdk_gl_texture_builder_set_format)
|
||||
*
|
||||
* The format when downloading the texture.
|
||||
*
|
||||
@@ -238,7 +238,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:has-mipmap: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_has_mipmap org.gdk.Property.set=gdk_gl_texture_builder_set_has_mipmap)
|
||||
* GdkGLTextureBuilder:has-mipmap: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_has_mipmap org.gtk.Property.set=gdk_gl_texture_builder_set_has_mipmap)
|
||||
*
|
||||
* If the texture has a mipmap.
|
||||
*
|
||||
@@ -250,7 +250,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:height: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_height org.gdk.Property.set=gdk_gl_texture_builder_set_height)
|
||||
* GdkGLTextureBuilder:height: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_height org.gtk.Property.set=gdk_gl_texture_builder_set_height)
|
||||
*
|
||||
* The height of the texture.
|
||||
*
|
||||
@@ -262,7 +262,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:id: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_id org.gdk.Property.set=gdk_gl_texture_builder_set_id)
|
||||
* GdkGLTextureBuilder:id: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_id org.gtk.Property.set=gdk_gl_texture_builder_set_id)
|
||||
*
|
||||
* The texture ID to use.
|
||||
*
|
||||
@@ -274,7 +274,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:sync: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_sync org.gdk.Property.set=gdk_gl_texture_builder_set_sync)
|
||||
* GdkGLTextureBuilder:sync: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_sync org.gtk.Property.set=gdk_gl_texture_builder_set_sync)
|
||||
*
|
||||
* An optional `GLSync` object.
|
||||
*
|
||||
@@ -287,7 +287,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:update-region: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_update_region org.gdk.Property.set=gdk_gl_texture_builder_set_update_region)
|
||||
* GdkGLTextureBuilder:update-region: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_update_region org.gtk.Property.set=gdk_gl_texture_builder_set_update_region)
|
||||
*
|
||||
* The update region for [property@Gdk.GLTextureBuilder:update-texture].
|
||||
*
|
||||
@@ -299,7 +299,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:update-texture: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_update_texture org.gdk.Property.set=gdk_gl_texture_builder_set_update_texture)
|
||||
* GdkGLTextureBuilder:update-texture: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_update_texture org.gtk.Property.set=gdk_gl_texture_builder_set_update_texture)
|
||||
*
|
||||
* The texture [property@Gdk.GLTextureBuilder:update-region] is an update for.
|
||||
*
|
||||
@@ -311,7 +311,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLTextureBuilder:width: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_width org.gdk.Property.set=gdk_gl_texture_builder_set_width)
|
||||
* GdkGLTextureBuilder:width: (attributes org.gtk.Property.get=gdk_gl_texture_builder_get_width org.gtk.Property.set=gdk_gl_texture_builder_set_width)
|
||||
*
|
||||
* The width of the texture.
|
||||
*
|
||||
@@ -347,7 +347,7 @@ gdk_gl_texture_builder_new (void)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_context: (attributes org.gdk.Method.get_property=context)
|
||||
* gdk_gl_texture_builder_get_context: (attributes org.gtk.Method.get_property=context)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the context previously set via gdk_gl_texture_builder_set_context() or
|
||||
@@ -366,7 +366,7 @@ gdk_gl_texture_builder_get_context (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_context: (attributes org.gdk.Method.set_property=context)
|
||||
* gdk_gl_texture_builder_set_context: (attributes org.gtk.Method.set_property=context)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @context: (nullable): The context the texture beongs to or %NULL to unset
|
||||
*
|
||||
@@ -391,7 +391,7 @@ gdk_gl_texture_builder_set_context (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_height: (attributes org.gdk.Method.get_property=height)
|
||||
* gdk_gl_texture_builder_get_height: (attributes org.gtk.Method.get_property=height)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the height previously set via gdk_gl_texture_builder_set_height() or
|
||||
@@ -410,7 +410,7 @@ gdk_gl_texture_builder_get_height (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_height: (attributes org.gdk.Method.set_property=height)
|
||||
* gdk_gl_texture_builder_set_height: (attributes org.gtk.Method.set_property=height)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @height: The texture's height or 0 to unset
|
||||
*
|
||||
@@ -435,7 +435,7 @@ gdk_gl_texture_builder_set_height (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_id: (attributes org.gdk.Method.get_property=id)
|
||||
* gdk_gl_texture_builder_get_id: (attributes org.gtk.Method.get_property=id)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the texture id previously set via gdk_gl_texture_builder_set_id() or
|
||||
@@ -454,7 +454,7 @@ gdk_gl_texture_builder_get_id (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_id: (attributes org.gdk.Method.set_property=id)
|
||||
* gdk_gl_texture_builder_set_id: (attributes org.gtk.Method.set_property=id)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @id: The texture id to be used for creating the texture
|
||||
*
|
||||
@@ -481,7 +481,7 @@ gdk_gl_texture_builder_set_id (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_width: (attributes org.gdk.Method.get_property=width)
|
||||
* gdk_gl_texture_builder_get_width: (attributes org.gtk.Method.get_property=width)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the width previously set via gdk_gl_texture_builder_set_width() or
|
||||
@@ -500,7 +500,7 @@ gdk_gl_texture_builder_get_width (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_width: (attributes org.gdk.Method.set_property=width)
|
||||
* gdk_gl_texture_builder_set_width: (attributes org.gtk.Method.set_property=width)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @width: The texture's width or 0 to unset
|
||||
*
|
||||
@@ -525,7 +525,7 @@ gdk_gl_texture_builder_set_width (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_has_mipmap: (attributes org.gdk.Method.get_property=has-mipmap)
|
||||
* gdk_gl_texture_builder_get_has_mipmap: (attributes org.gtk.Method.get_property=has-mipmap)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets whether the texture has a mipmap.
|
||||
@@ -543,7 +543,7 @@ gdk_gl_texture_builder_get_has_mipmap (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_has_mipmap: (attributes org.gdk.Method.set_property=has-mipmap)
|
||||
* gdk_gl_texture_builder_set_has_mipmap: (attributes org.gtk.Method.set_property=has-mipmap)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @has_mipmap: Whether the texture has a mipmap
|
||||
*
|
||||
@@ -569,7 +569,7 @@ gdk_gl_texture_builder_set_has_mipmap (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_sync: (attributes org.gdk.Method.get_property=sync)
|
||||
* gdk_gl_texture_builder_get_sync: (attributes org.gtk.Method.get_property=sync)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the `GLsync` previously set via gdk_gl_texture_builder_set_sync().
|
||||
@@ -587,7 +587,7 @@ gdk_gl_texture_builder_get_sync (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_sync: (attributes org.gdk.Method.set_property=sync)
|
||||
* gdk_gl_texture_builder_set_sync: (attributes org.gtk.Method.set_property=sync)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @sync: (nullable): the GLSync object
|
||||
*
|
||||
@@ -617,7 +617,7 @@ gdk_gl_texture_builder_set_sync (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_format: (attributes org.gdk.Method.get_property=format)
|
||||
* gdk_gl_texture_builder_get_format: (attributes org.gtk.Method.get_property=format)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the format previously set via gdk_gl_texture_builder_set_format().
|
||||
@@ -635,7 +635,7 @@ gdk_gl_texture_builder_get_format (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_format: (attributes org.gdk.Method.set_property=format)
|
||||
* gdk_gl_texture_builder_set_format: (attributes org.gtk.Method.set_property=format)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @format: The texture's format
|
||||
*
|
||||
@@ -673,7 +673,7 @@ gdk_gl_texture_builder_set_format (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_update_texture: (attributes org.gdk.Method.get_property=update_texture)
|
||||
* gdk_gl_texture_builder_get_update_texture: (attributes org.gtk.Method.get_property=update-texture)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the texture previously set via gdk_gl_texture_builder_set_update_texture() or
|
||||
@@ -692,7 +692,7 @@ gdk_gl_texture_builder_get_update_texture (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_update_texture: (attributes org.gdk.Method.set_property=update_texture)
|
||||
* gdk_gl_texture_builder_set_update_texture: (attributes org.gtk.Method.set_property=update-texture)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @texture: (nullable): the texture to update
|
||||
*
|
||||
@@ -715,7 +715,7 @@ gdk_gl_texture_builder_set_update_texture (GdkGLTextureBuilder *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_get_update_region: (attributes org.gdk.Method.get_property=update_region)
|
||||
* gdk_gl_texture_builder_get_update_region: (attributes org.gtk.Method.get_property=update-region)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
*
|
||||
* Gets the region previously set via gdk_gl_texture_builder_set_update_region() or
|
||||
@@ -734,7 +734,7 @@ gdk_gl_texture_builder_get_update_region (GdkGLTextureBuilder *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_texture_builder_set_update_region: (attributes org.gdk.Method.set_property=update_region)
|
||||
* gdk_gl_texture_builder_set_update_region: (attributes org.gtk.Method.set_property=update-region)
|
||||
* @self: a `GdkGLTextureBuilder`
|
||||
* @region: (nullable): the region to update
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user