forked from AuroraMiddleware/gtk
Merge branch 'ci-jobs' into 'master'
Update CI jobs See merge request GNOME/gtk!1412
This commit is contained in:
commit
bb71cdd722
11
.clang-format
Normal file
11
.clang-format
Normal file
@ -0,0 +1,11 @@
|
||||
# See https://wiki.apertis.org/Guidelines/Coding_conventions#Code_formatting
|
||||
BasedOnStyle: GNU
|
||||
AlwaysBreakAfterDefinitionReturnType: All
|
||||
BreakBeforeBinaryOperators: None
|
||||
BinPackParameters: false
|
||||
SpaceAfterCStyleCast: true
|
||||
# Our column limit is actually 80, but setting that results in clang-format
|
||||
# making a lot of dubious hanging-indent choices; disable it and assume the
|
||||
# developer will line wrap appropriately. clang-format will still check
|
||||
# existing hanging indents.
|
||||
ColumnLimit: 0
|
@ -1,4 +1,5 @@
|
||||
stages:
|
||||
- style-check
|
||||
- build
|
||||
- flatpak
|
||||
- deploy
|
||||
@ -12,16 +13,47 @@ stages:
|
||||
- subprojects/libepoxy/
|
||||
- subprojects/pango/
|
||||
|
||||
fedora-x86_64: &fedora-x86_64-defaults
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v10
|
||||
stage: build
|
||||
# Common variables
|
||||
variables:
|
||||
COMMON_MESON_FLAGS: "--fatal-meson-warnings --werror"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 2
|
||||
G_MESSAGES_DEBUG: "all"
|
||||
CCACHE_DISABLE: "true"
|
||||
|
||||
.only-default:
|
||||
only:
|
||||
- branches
|
||||
except:
|
||||
- tags
|
||||
|
||||
style-check-diff:
|
||||
extends: .only-default
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v13
|
||||
stage: style-check
|
||||
allow_failure: true
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/test-docker.sh
|
||||
- .gitlab-ci/run-style-check-diff.sh
|
||||
|
||||
fedora-x86_64:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v13
|
||||
stage: build
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
|
||||
script:
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS}
|
||||
-Dx11-backend=true
|
||||
-Dwayland-backend=true
|
||||
-Dbroadway-backend=true
|
||||
-Dvulkan=yes
|
||||
-Dprofiler=true
|
||||
_build
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- "${CI_PROJECT_DIR}/_build/report.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report.xml"
|
||||
name: "gtk-${CI_COMMIT_REF_NAME}"
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
@ -34,10 +66,37 @@ fedora-x86_64: &fedora-x86_64-defaults
|
||||
key: "$CI_JOB_NAME"
|
||||
<<: *cache-paths
|
||||
|
||||
fedora-x86_64-staticlibs:
|
||||
release-build:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v13
|
||||
stage: build
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "-Ddefault_library=both"
|
||||
<<: *fedora-x86_64-defaults
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
script:
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS}
|
||||
-Dx11-backend=true
|
||||
-Dwayland-backend=true
|
||||
-Dbroadway-backend=true
|
||||
-Dvulkan=yes
|
||||
_build
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build
|
||||
allow_failure: true
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- "${CI_PROJECT_DIR}/_build/report.xml"
|
||||
name: "gtk-${CI_COMMIT_REF_NAME}"
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
- "${CI_PROJECT_DIR}/_build/report.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report.html"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*.syscap"
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
<<: *cache-paths
|
||||
|
||||
.mingw-defaults: &mingw-defaults
|
||||
stage: build
|
||||
@ -108,11 +167,12 @@ flatpak-master:icon-browser:
|
||||
<<: *flatpak-master
|
||||
|
||||
pages:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v10
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v13
|
||||
stage: deploy
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
script:
|
||||
- meson -Dgtk_doc=true _build .
|
||||
- ninja -C _build
|
||||
- meson ${COMMON_MESON_FLAGS} -Dgtk_doc=true _build
|
||||
- ninja -C _build gdk4-doc gsk4-doc gtk4-doc
|
||||
- mkdir -p public/
|
||||
- mv _build/docs/reference/gtk/html/ public/gtk/
|
||||
|
38
.gitlab-ci/README.md
Normal file
38
.gitlab-ci/README.md
Normal file
@ -0,0 +1,38 @@
|
||||
## GTK CI infrastructure
|
||||
|
||||
GTK uses different CI images depending on platform and jobs.
|
||||
|
||||
The CI images are Docker containers, generated either using `docker` or
|
||||
`podman`, and pushed to the GitLab [container registry][registry].
|
||||
|
||||
Each Docker image has a tag composed of two parts:
|
||||
|
||||
- `${image}`: the base image for a given platform, like "fedora" or
|
||||
"debian-stable"
|
||||
- `${number}`: an incremental version number, or `latest`
|
||||
|
||||
See the [container registry][registry] for the available images for each
|
||||
branch, as well as their available versions.
|
||||
|
||||
### Checklist for Updating a CI image
|
||||
|
||||
- [ ] Update the `${image}.Dockerfile` file with the dependencies
|
||||
- [ ] Run `./run-docker.sh build --base ${image} --base-version ${number}`
|
||||
- [ ] Run `./run-docker.sh push --base ${image} --base-version ${number}`
|
||||
once the Docker image is built; you may need to log in by using
|
||||
`docker login` or `podman login`
|
||||
- [ ] Update the `image` keys in the `.gitlab-ci.yml` file with the new
|
||||
image tag
|
||||
- [ ] Open a merge request with your changes and let it run
|
||||
|
||||
### Checklist for Adding a new CI image
|
||||
|
||||
- [ ] Write a new `${image}.Dockerfile` with the instructions to set up
|
||||
a build environment
|
||||
- [ ] Add the `pip3 install meson` incantation
|
||||
- [ ] Run `./run-docker.sh build --base ${image} --base-version ${number}`
|
||||
- [ ] Run `./run-docker.sh push --base ${image} --base-version ${number}`
|
||||
- [ ] Add the new job to `.gitlab-ci.yml` referencing the image
|
||||
- [ ] Open a merge request with your changes and let it run
|
||||
|
||||
[registry]: https://gitlab.gnome.org/GNOME/gtk/container_registry
|
133
.gitlab-ci/clang-format-diff.py
Executable file
133
.gitlab-ci/clang-format-diff.py
Executable file
@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# === clang-format-diff.py - ClangFormat Diff Reformatter ---*- python -*-=== #
|
||||
#
|
||||
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
# ===---------------------------------------------------------------------=== #
|
||||
|
||||
"""
|
||||
This script reads input from a unified diff and reformats all the changed
|
||||
lines. This is useful to reformat all the lines touched by a specific patch.
|
||||
Example usage for git/svn users:
|
||||
|
||||
git diff -U0 --no-color HEAD^ | clang-format-diff.py -p1 -i
|
||||
svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import argparse
|
||||
import difflib
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
if sys.version_info.major >= 3:
|
||||
from io import StringIO
|
||||
else:
|
||||
from io import BytesIO as StringIO
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description=__doc__,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
parser.add_argument('-i', action='store_true', default=False,
|
||||
help='apply edits to files instead of displaying a '
|
||||
'diff')
|
||||
parser.add_argument('-p', metavar='NUM', default=0,
|
||||
help='strip the smallest prefix containing P slashes')
|
||||
parser.add_argument('-regex', metavar='PATTERN', default=None,
|
||||
help='custom pattern selecting file paths to reformat '
|
||||
'(case sensitive, overrides -iregex)')
|
||||
parser.add_argument('-iregex', metavar='PATTERN',
|
||||
default=r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hh|hpp|m|mm|inc'
|
||||
r'|js|ts|proto|protodevel|java|cs)',
|
||||
help='custom pattern selecting file paths to reformat '
|
||||
'(case insensitive, overridden by -regex)')
|
||||
parser.add_argument('-sort-includes', action='store_true', default=False,
|
||||
help='let clang-format sort include blocks')
|
||||
parser.add_argument('-v', '--verbose', action='store_true',
|
||||
help='be more verbose, ineffective without -i')
|
||||
parser.add_argument('-style',
|
||||
help='formatting style to apply (LLVM, Google, '
|
||||
'Chromium, Mozilla, WebKit)')
|
||||
parser.add_argument('-binary', default='clang-format',
|
||||
help='location of binary to use for clang-format')
|
||||
args = parser.parse_args()
|
||||
|
||||
# Extract changed lines for each file.
|
||||
filename = None
|
||||
lines_by_file = {}
|
||||
for line in sys.stdin:
|
||||
match = re.search(r'^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
|
||||
if match:
|
||||
filename = match.group(2)
|
||||
if filename is None:
|
||||
continue
|
||||
|
||||
if args.regex is not None:
|
||||
if not re.match('^%s$' % args.regex, filename):
|
||||
continue
|
||||
else:
|
||||
if not re.match('^%s$' % args.iregex, filename, re.IGNORECASE):
|
||||
continue
|
||||
|
||||
match = re.search(r'^@@.*\+(\d+)(,(\d+))?', line)
|
||||
if match:
|
||||
start_line = int(match.group(1))
|
||||
line_count = 1
|
||||
if match.group(3):
|
||||
line_count = int(match.group(3))
|
||||
if line_count == 0:
|
||||
continue
|
||||
end_line = start_line + line_count - 1
|
||||
lines_by_file.setdefault(filename, []).extend(
|
||||
['-lines', str(start_line) + ':' + str(end_line)])
|
||||
|
||||
# Reformat files containing changes in place.
|
||||
# We need to count amount of bytes generated in the output of
|
||||
# clang-format-diff. If clang-format-diff doesn't generate any bytes it
|
||||
# means there is nothing to format.
|
||||
format_line_counter = 0
|
||||
for filename, lines in lines_by_file.items():
|
||||
if args.i and args.verbose:
|
||||
print('Formatting {}'.format(filename))
|
||||
command = [args.binary, filename]
|
||||
if args.i:
|
||||
command.append('-i')
|
||||
if args.sort_includes:
|
||||
command.append('-sort-includes')
|
||||
command.extend(lines)
|
||||
if args.style:
|
||||
command.extend(['-style', args.style])
|
||||
p = subprocess.Popen(command,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=None,
|
||||
stdin=subprocess.PIPE,
|
||||
universal_newlines=True)
|
||||
stdout, _ = p.communicate()
|
||||
if p.returncode != 0:
|
||||
sys.exit(p.returncode)
|
||||
|
||||
if not args.i:
|
||||
with open(filename) as f:
|
||||
code = f.readlines()
|
||||
formatted_code = StringIO(stdout).readlines()
|
||||
diff = difflib.unified_diff(code, formatted_code,
|
||||
filename, filename,
|
||||
'(before formatting)',
|
||||
'(after formatting)')
|
||||
diff_string = ''.join(diff)
|
||||
if diff_string:
|
||||
format_line_counter += sys.stdout.write(diff_string)
|
||||
|
||||
if format_line_counter > 0:
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -8,6 +8,7 @@ RUN dnf -y install \
|
||||
cairo-devel \
|
||||
cairo-gobject-devel \
|
||||
ccache \
|
||||
clang \
|
||||
colord-devel \
|
||||
cups-devel \
|
||||
dbus-daemon \
|
||||
@ -23,6 +24,7 @@ RUN dnf -y install \
|
||||
gettext \
|
||||
git \
|
||||
glib2-devel \
|
||||
glib2-static \
|
||||
glibc-devel \
|
||||
glibc-headers \
|
||||
gobject-introspection-devel \
|
||||
@ -61,9 +63,11 @@ RUN dnf -y install \
|
||||
ninja-build \
|
||||
pango-devel \
|
||||
pcre-devel \
|
||||
pcre-static \
|
||||
python3 \
|
||||
python3-jinja2 \
|
||||
python3-pip \
|
||||
python3-pygments \
|
||||
python3-wheel \
|
||||
redhat-rpm-config \
|
||||
sassc \
|
@ -17,7 +17,7 @@ flatpak-builder \
|
||||
meson \
|
||||
--prefix /app \
|
||||
--libdir /app/lib \
|
||||
--buildtype debug \
|
||||
--buildtype release \
|
||||
-Dx11-backend=true \
|
||||
-Dwayland-backend=true \
|
||||
-Dprint-backends=file \
|
||||
|
@ -1,11 +1,130 @@
|
||||
#!/bin/bash
|
||||
|
||||
read_arg() {
|
||||
# $1 = arg name
|
||||
# $2 = arg value
|
||||
# $3 = arg parameter
|
||||
local rematch='^[^=]*=(.*)$'
|
||||
if [[ $2 =~ $rematch ]]; then
|
||||
read "$1" <<< "${BASH_REMATCH[1]}"
|
||||
else
|
||||
read "$1" <<< "$3"
|
||||
# There is no way to shift our callers args, so
|
||||
# return 1 to indicate they should do it instead.
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
set -e
|
||||
|
||||
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v10"
|
||||
build=0
|
||||
run=0
|
||||
push=0
|
||||
list=0
|
||||
print_help=0
|
||||
no_login=0
|
||||
|
||||
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
|
||||
--file "Dockerfile" .
|
||||
sudo docker run --rm --security-opt label=disable \
|
||||
--volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
|
||||
--tty --interactive "${TAG}" bash
|
||||
while (($# > 0)); do
|
||||
case "${1%%=*}" in
|
||||
build) build=1;;
|
||||
run) run=1;;
|
||||
push) push=1;;
|
||||
list) list=1;;
|
||||
help) print_help=1;;
|
||||
--base|-b) read_arg base "$@" || shift;;
|
||||
--base-version) read_arg base_version "$@" || shift;;
|
||||
--no-login) no_login=1;;
|
||||
*) echo -e "\e[1;31mERROR\e[0m: Unknown option '$1'"; exit 1;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ $print_help == 1 ]; then
|
||||
echo "$0 - Build and run Docker images"
|
||||
echo ""
|
||||
echo "Usage: $0 <command> [options] [basename]"
|
||||
echo ""
|
||||
echo "Available commands"
|
||||
echo ""
|
||||
echo " build --base=<BASENAME> - Build Docker image <BASENAME>.Dockerfile"
|
||||
echo " run --base=<BASENAME> - Run Docker image <BASENAME>"
|
||||
echo " push --base=<BASENAME> - Push Docker image <BASENAME> to the registry"
|
||||
echo " list - List available images"
|
||||
echo " help - This help message"
|
||||
echo ""
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
if [ $list == 1 ]; then
|
||||
echo "Available Docker images:"
|
||||
for f in *.Dockerfile; do
|
||||
filename=$( basename -- "$f" )
|
||||
basename="${filename%.*}"
|
||||
|
||||
echo -e " \e[1;39m$basename\e[0m"
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# All commands after this require --base to be set
|
||||
if [ -z $base ]; then
|
||||
echo "Usage: $0 <command>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$base.Dockerfile" ]; then
|
||||
echo -e "\e[1;31mERROR\e[0m: Dockerfile for '$base' not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z $base_version ]; then
|
||||
base_version="latest"
|
||||
else
|
||||
base_version="v$base_version"
|
||||
fi
|
||||
|
||||
TAG="registry.gitlab.gnome.org/gnome/gtk/${base}:${base_version}"
|
||||
|
||||
if [ $build == 1 ]; then
|
||||
if docker --help |& grep -q podman; then
|
||||
# Docker is actually implemented by podman, and its OCI output
|
||||
# is incompatible with some of the dockerd instances on GitLab
|
||||
# CI runners.
|
||||
format="--format docker"
|
||||
else
|
||||
format=""
|
||||
fi
|
||||
|
||||
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
|
||||
sudo docker build \
|
||||
${format} \
|
||||
--build-arg HOST_USER_ID="$UID" \
|
||||
--tag "${TAG}" \
|
||||
--file "${base}.Dockerfile" .
|
||||
exit $?
|
||||
fi
|
||||
|
||||
if [ $push == 1 ]; then
|
||||
echo -e "\e[1;32mPUSHING\e[0m: ${base} as ${TAG}"
|
||||
|
||||
if [ $no_login == 0 ]; then
|
||||
sudo docker login registry.gitlab.gnome.org
|
||||
fi
|
||||
|
||||
sudo docker push $TAG
|
||||
exit $?
|
||||
fi
|
||||
|
||||
if [ $run == 1 ]; then
|
||||
echo -e "\e[1;32mRUNNING\e[0m: ${base} as ${TAG}"
|
||||
sudo docker run \
|
||||
--rm \
|
||||
--volume "$(pwd)/..:/home/user/app" \
|
||||
--workdir "/home/user/app" \
|
||||
--tty \
|
||||
--interactive "${TAG}" \
|
||||
bash
|
||||
exit $?
|
||||
fi
|
||||
|
34
.gitlab-ci/run-style-check-diff.sh
Executable file
34
.gitlab-ci/run-style-check-diff.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
set +e
|
||||
|
||||
# We need to add a new remote for the upstream master, since this script could
|
||||
# be running in a personal fork of the repository which has out of date branches.
|
||||
git remote add upstream https://gitlab.gnome.org/GNOME/gtk.git
|
||||
git fetch upstream
|
||||
|
||||
# Work out the newest common ancestor between the detached HEAD that this CI job
|
||||
# has checked out, and the upstream target branch (which will typically be
|
||||
# `upstream/master` or `upstream/gtk-3-24`).
|
||||
#
|
||||
# `${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}` is only defined if we’re running in
|
||||
# a merge request pipeline; fall back to `${CI_DEFAULT_BRANCH}` otherwise.
|
||||
newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent upstream/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}) <(git rev-list --first-parent HEAD) | head -1)
|
||||
git diff -U0 --no-color "${newest_common_ancestor_sha}" | .gitlab-ci/clang-format-diff.py -binary "clang-format" -p1
|
||||
|
||||
# The style check is not infallible. The clang-format configuration cannot
|
||||
# perfectly describe GTK’s coding style: in particular, it cannot align
|
||||
# function arguments. The documented coding style for GTK takes priority over
|
||||
# clang-format suggestions. Hopefully we can eventually improve clang-format to
|
||||
# be configurable enough for our coding style. That’s why this CI check is OK
|
||||
# to fail: the idea is that people can look through the output and ignore it if
|
||||
# it’s wrong. (That situation can also happen if someone touches pre-existing
|
||||
# badly formatted code and it doesn’t make sense to tidy up the wider coding
|
||||
# style with the changes they’re making.)
|
||||
echo ""
|
||||
echo "Note that clang-format output is advisory and cannot always match the"
|
||||
echo "GTK coding style, documented at:"
|
||||
echo " https://gitlab.gnome.org/GNOME/gtk/blob/master/docs/CODING-STYLE"
|
||||
echo "Warnings from this tool can be ignored in favour of the documented "
|
||||
echo "coding style, or in favour of matching the style of existing"
|
||||
echo "surrounding code."
|
32
.gitlab-ci/run-tests.sh
Executable file
32
.gitlab-ci/run-tests.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
set +x
|
||||
set +e
|
||||
|
||||
srcdir=$( pwd )
|
||||
builddir=$1
|
||||
|
||||
export GDK_BACKEND=x11
|
||||
xvfb-run -a -s "-screen 0 1024x768x24" \
|
||||
meson test -C ${builddir} \
|
||||
--print-errorlogs \
|
||||
--suite=gtk \
|
||||
--no-suite=gtk:a11y
|
||||
|
||||
# Store the exit code for the CI run, but always
|
||||
# generate the reports
|
||||
exit_code=$?
|
||||
|
||||
$srcdir/.gitlab-ci/meson-junit-report.py \
|
||||
--project-name=gtk \
|
||||
--job-id="${CI_JOB_NAME}" \
|
||||
--output=${builddir}/report.xml \
|
||||
${builddir}/meson-logs/testlog.json
|
||||
$srcdir/.gitlab-ci/meson-html-report.py \
|
||||
--project-name=gtk \
|
||||
--job-id="${CI_JOB_NAME}" \
|
||||
--reftest-output-dir="${builddir}/testsuite/reftests/output" \
|
||||
--output=${builddir}/report.html \
|
||||
${builddir}/meson-logs/testlog.json
|
||||
|
||||
exit $exit_code
|
@ -303,7 +303,7 @@ gdk_broadway_device_surface_at_position (GdkDevice *device,
|
||||
GdkModifierType *mask,
|
||||
gboolean get_toplevel)
|
||||
{
|
||||
GdkSurface *surface;
|
||||
GdkSurface *surface = NULL;
|
||||
|
||||
gdk_broadway_device_query_state (device, NULL, &surface, NULL, NULL, win_x, win_y, mask);
|
||||
|
||||
|
@ -175,13 +175,17 @@ gdk_draw_context_class_init (GdkDrawContextClass *klass)
|
||||
g_object_class_install_properties (gobject_class, LAST_PROP, pspecs);
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static guint pixels_counter;
|
||||
#endif
|
||||
|
||||
static void
|
||||
gdk_draw_context_init (GdkDrawContext *self)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (pixels_counter == 0)
|
||||
pixels_counter = gdk_profiler_define_int_counter ("frame pixels", "Pixels drawn per frame");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -320,6 +324,7 @@ gdk_draw_context_begin_frame (GdkDrawContext *context,
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, priv->frame_region);
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static gint64
|
||||
region_get_pixels (cairo_region_t *region)
|
||||
{
|
||||
@ -336,6 +341,7 @@ region_get_pixels (cairo_region_t *region)
|
||||
|
||||
return pixels;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* gdk_draw_context_end_frame:
|
||||
@ -376,10 +382,12 @@ gdk_draw_context_end_frame (GdkDrawContext *context)
|
||||
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->end_frame (context, priv->frame_region);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (gdk_profiler_is_running ())
|
||||
gdk_profiler_set_int_counter (pixels_counter,
|
||||
g_get_monotonic_time () * 1000,
|
||||
region_get_pixels (priv->frame_region));
|
||||
#endif
|
||||
|
||||
g_clear_pointer (&priv->frame_region, cairo_region_destroy);
|
||||
g_clear_object (&priv->surface->paint_context);
|
||||
|
18
gdk/gdkgl.c
18
gdk/gdkgl.c
@ -443,7 +443,6 @@ gdk_gl_texture_from_surface (cairo_surface_t *cairo_surface,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkGLContext *paint_context;
|
||||
GdkDisplay *display;
|
||||
cairo_surface_t *image;
|
||||
double device_x_offset, device_y_offset;
|
||||
cairo_rectangle_int_t rect, e;
|
||||
@ -458,13 +457,18 @@ gdk_gl_texture_from_surface (cairo_surface_t *cairo_surface,
|
||||
guint target;
|
||||
|
||||
paint_context = gdk_gl_context_get_current ();
|
||||
if (paint_context)
|
||||
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (paint_context));
|
||||
else
|
||||
display = NULL;
|
||||
|
||||
if (paint_context &&
|
||||
GDK_DISPLAY_DEBUG_CHECK (display, GL_SOFTWARE) == 0 &&
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (paint_context != NULL)
|
||||
{
|
||||
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (paint_context));
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_SOFTWARE) == 0)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (paint_context != NULL &&
|
||||
GDK_GL_CONTEXT_GET_CLASS (paint_context)->texture_from_surface &&
|
||||
GDK_GL_CONTEXT_GET_CLASS (paint_context)->texture_from_surface (paint_context, cairo_surface, region))
|
||||
return;
|
||||
|
@ -638,7 +638,11 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
|
||||
int minor)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
gboolean force_gles = FALSE;
|
||||
int version, min_ver;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GdkDisplay *display;
|
||||
#endif
|
||||
|
||||
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
|
||||
g_return_if_fail (!priv->realized);
|
||||
@ -651,10 +655,16 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Enforce a minimum context version number of 3.2 */
|
||||
version = (major * 100) + minor;
|
||||
|
||||
if (priv->use_es > 0 || GDK_DISPLAY_DEBUG_CHECK (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), GL_GLES))
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
force_gles = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES);
|
||||
#endif
|
||||
/* Enforce a minimum context version number of 3.2 for desktop GL,
|
||||
* and 2.0 for GLES
|
||||
*/
|
||||
if (priv->use_es > 0 || force_gles)
|
||||
min_ver = 200;
|
||||
else
|
||||
min_ver = 302;
|
||||
@ -683,12 +693,25 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
|
||||
int *minor)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
gboolean force_gles = FALSE;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GdkDisplay *display;
|
||||
#endif
|
||||
int default_major, default_minor;
|
||||
int maj, min;
|
||||
|
||||
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
|
||||
|
||||
if (priv->use_es > 0 || GDK_DISPLAY_DEBUG_CHECK (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), GL_GLES))
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
force_gles = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES);
|
||||
#endif
|
||||
|
||||
/* Default fallback values for uninitialised contexts; we
|
||||
* enforce a context version number of 3.2 for desktop GL,
|
||||
* and 2.0 for GLES
|
||||
*/
|
||||
if (priv->use_es > 0 || force_gles)
|
||||
{
|
||||
default_major = 2;
|
||||
default_minor = 0;
|
||||
@ -936,6 +959,10 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
gboolean has_npot, has_texture_rectangle;
|
||||
gboolean gl_debug = FALSE;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GdkDisplay *display;
|
||||
#endif
|
||||
|
||||
if (!priv->realized)
|
||||
return;
|
||||
@ -993,7 +1020,12 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
priv->is_legacy = TRUE;
|
||||
}
|
||||
|
||||
if (priv->has_khr_debug && GDK_DISPLAY_DEBUG_CHECK (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), GL_DEBUG))
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
gl_debug = GDK_DISPLAY_DEBUG_CHECK (display, GL_DEBUG);
|
||||
#endif
|
||||
|
||||
if (priv->has_khr_debug && gl_debug)
|
||||
{
|
||||
priv->use_khr_debug = TRUE;
|
||||
glGetIntegerv (GL_MAX_LABEL_LENGTH, &priv->max_debug_label_length);
|
||||
|
@ -205,7 +205,10 @@ gdk_vulkan_strerror (VkResult result)
|
||||
case VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT:
|
||||
return "An operation on a swapchain created with VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT failed as it did not have exlusive full-screen access.";
|
||||
#endif
|
||||
|
||||
#if VK_HEADER_VERSION >= 131
|
||||
case VK_ERROR_UNKNOWN:
|
||||
return "An unknown error has occurred; either the application has provided invalid input, or an implementation failure has occurred.";
|
||||
#endif
|
||||
case VK_RESULT_RANGE_SIZE:
|
||||
case VK_RESULT_MAX_ENUM:
|
||||
default:
|
||||
|
@ -2845,17 +2845,18 @@ gsk_gl_renderer_unrealize (GskRenderer *renderer)
|
||||
static void
|
||||
gsk_gl_renderer_clear_tree (GskGLRenderer *self)
|
||||
{
|
||||
int removed_textures;
|
||||
|
||||
if (self->gl_context == NULL)
|
||||
return;
|
||||
|
||||
gdk_gl_context_make_current (self->gl_context);
|
||||
|
||||
ops_reset (&self->op_builder);
|
||||
removed_textures = gsk_gl_driver_collect_textures (self->gl_driver);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
int removed_textures = gsk_gl_driver_collect_textures (self->gl_driver);
|
||||
|
||||
GSK_RENDERER_NOTE (GSK_RENDERER (self), OPENGL, g_message ("Collected: %d textures", removed_textures));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3050,7 +3051,7 @@ add_offscreen_ops (GskGLRenderer *self,
|
||||
graphene_matrix_t prev_projection;
|
||||
graphene_rect_t prev_viewport;
|
||||
graphene_matrix_t item_proj;
|
||||
float prev_opacity;
|
||||
float prev_opacity = 1.0;
|
||||
int texture_id = 0;
|
||||
|
||||
if (node_is_invisible (child_node))
|
||||
|
@ -37,10 +37,10 @@ typedef struct {
|
||||
GQuark cpu_time;
|
||||
GQuark gpu_time;
|
||||
} ProfileTimers;
|
||||
#endif
|
||||
|
||||
static guint texture_pixels_counter;
|
||||
static guint fallback_pixels_counter;
|
||||
#endif
|
||||
|
||||
struct _GskVulkanRenderer
|
||||
{
|
||||
|
@ -70,6 +70,17 @@ tests = [
|
||||
['widgetorder'],
|
||||
]
|
||||
|
||||
# Tests that are expected to fail
|
||||
xfail = [
|
||||
]
|
||||
|
||||
# Tests that are expected to fail on non-debug builds
|
||||
xfail_nodebug = [
|
||||
'icontheme', # Overrides debugging messages
|
||||
]
|
||||
|
||||
is_debug = get_option('buildtype').startswith('debug')
|
||||
|
||||
test_cargs = []
|
||||
|
||||
if os_unix
|
||||
@ -90,6 +101,11 @@ foreach t : tests
|
||||
install: get_option('install-tests'),
|
||||
install_dir: testexecdir)
|
||||
|
||||
expect_fail = xfail.contains(test_name)
|
||||
if not is_debug
|
||||
expect_fail = xfail_nodebug.contains(test_name)
|
||||
endif
|
||||
|
||||
test(test_name, test_exe,
|
||||
args: [ '--tap', '-k' ],
|
||||
env: [ 'GIO_USE_VOLUME_MONITOR=unix',
|
||||
@ -102,7 +118,9 @@ foreach t : tests
|
||||
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
|
||||
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir),
|
||||
],
|
||||
suite: 'gtk')
|
||||
suite: 'gtk',
|
||||
should_fail: expect_fail,
|
||||
)
|
||||
endforeach
|
||||
|
||||
# FIXME: if objc autotestkeywords_CPPFLAGS += -DHAVE_OBJC=1 -x objective-c++
|
||||
|
Loading…
Reference in New Issue
Block a user