Skip to content
Snippets Groups Projects
Commit ef18f359 authored by Apertis package maintainers's avatar Apertis package maintainers
Browse files

Import Upstream version 0.2.0

parents
No related branches found
No related tags found
No related merge requests found
root = true
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = tab
indent_size = 8
max_line_length = 100
[*.py]
indent_style = space
indent_size = 4
[*.yml]
indent_style = space
indent_size = 2
include:
- project: 'freedesktop/ci-templates'
ref: 3f37cc0e461f5b0c815409bf6f55759f26a74e9c
file:
- '/templates/ci-fairy.yml'
- '/templates/alpine.yml'
# When updating the prepare-container step, make sure to bump
# FDO_DISTRIBUTION_TAG, otherwise the container won't get rebuilt.
# To force a rebuild of the container, use:
# $ git push -f -o ci.variable="FDO_FORCE_REBUILD=1"
variables:
FDO_UPSTREAM_REPO: 'emersion/libdisplay-info'
FDO_DISTRIBUTION_TAG: '2024-06-07.0'
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_PIPELINE_SOURCE == 'push'
stages:
- "Contribution checks"
- "Prepare container"
- "Build and test"
- "Publish"
check-mr:
extends: .fdo.ci-fairy
stage: "Contribution checks"
script:
- ci-fairy check-commits --signed-off-by
- ci-fairy check-merge-request --require-allow-collaboration
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
when: always
- when: never
prepare-container:
extends: .fdo.container-build@alpine@x86_64
stage: "Prepare container"
variables:
EDID_DECODE_COMMIT: c6b859d7f0251e2433fb81bd3f67bd2011c2036c
FDO_BASE_IMAGE: alpine:latest
FDO_DISTRIBUTION_PACKAGES: |
build-base clang compiler-rt meson make git gcovr py3-pygments go hwdata
FDO_DISTRIBUTION_EXEC: |
grep $EDID_DECODE_COMMIT ./subprojects/edid-decode.wrap >/dev/null || \
(echo "Keep edid-decode.wrap and CI in sync!" && exit 1)
git clone git://linuxtv.org/edid-decode.git
cd edid-decode
git checkout $EDID_DECODE_COMMIT
meson setup build/
ninja -C build/
ninja -C build/ install
cd ..
rm -rf edid-decode
go install git.sr.ht/~emersion/gyosu@latest
mv ~/go/bin/gyosu /usr/bin/
rm -rf ~/go
rules:
- when: on_success
testing-check:
extends: .fdo.distribution-image@alpine
stage: "Build and test"
script:
- |
# Check if the origin of all test EDIDs is documented
for f in ./test/data/*.edid; do
grep -q "^$(basename ${f%.edid})\s" ./test/data/README.md ||
(echo "$f not in README.md" && exit 1)
done
# Check if the test references checked in the repo match what we have in CI
meson setup build/
ninja -C build/ gen-test-data
git diff --quiet ||
(echo "Checked in reference output does not match generated reference output" && exit 1)
rules:
- when: on_success
build-gcc:
extends: .fdo.distribution-image@alpine
stage: "Build and test"
script:
- CC=gcc meson setup build/ --fatal-meson-warnings -Dwerror=true -Db_coverage=true
- ninja -C build/
- ninja -C build/ test
- ninja -C build/ -j1 coverage-xml coverage-html
artifacts:
when: always
paths:
- build/meson-logs/
reports:
junit: build/meson-logs/testlog.junit.xml
coverage_report:
coverage_format: cobertura
path: build/meson-logs/coverage.xml
rules:
- when: on_success
build-clang:
extends: .fdo.distribution-image@alpine
stage: "Build and test"
script:
- CC=clang meson setup build/ --fatal-meson-warnings -Dwerror=true -Db_sanitize=address,undefined -Db_lundef=false
- ninja -C build/
- UBSAN_OPTIONS=halt_on_error=1 ninja -C build/ test
artifacts:
when: always
paths:
- build/meson-logs/
reports:
junit: build/meson-logs/testlog.junit.xml
rules:
- when: on_success
build-docs:
extends: .fdo.distribution-image@alpine
stage: "Build and test"
script:
- gyosu -I$PWD/include/ -fexported-symbols='di_*'
-ffile-prefix-map=$PWD/include/= -fsite-name=libdisplay-info
-o public $PWD/include/libdisplay-info/
artifacts:
paths:
- public/
rules:
- when: on_success
pages:
extends: .fdo.distribution-image@alpine
stage: "Publish"
script:
- "true"
artifacts:
paths:
- public/
rules:
- if: '$CI_PROJECT_PATH == "emersion/libdisplay-info" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: on_success
- when: never
LICENSE 0 → 100644
MIT License
Copyright (c) 2022 The libdisplay-info Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# libdisplay-info
EDID and DisplayID library.
Goals:
- Provide a set of high-level, easy-to-use, opinionated functions as well as
low-level functions to access detailed information.
- Simplicity and correctness over performance and resource usage.
- Well-tested and fuzzed.
Documentation is available on the [website].
## Using
The public API headers are categorised as either high-level or low-level API
as per the comments in the header files. Users of libdisplay-info should prefer
high-level API over low-level API when possible.
If high-level API lacks needed features, please propose additions to the
high-level API upstream before using low-level API to get what you need.
If the additions are rejected, you are welcome to use the low-level API.
This policy is aimed to propagate best practises when interpreting EDID
and DisplayID information which can often be cryptic or even inconsistent.
libdisplay-info uses [semantic versioning]. The public API is not yet stable.
## Contributing
Open issues and merge requests on the [GitLab project]. Discuss and ask
questions in the [#wayland] IRC channel on OFTC.
In general, the [Wayland contribution guidelines] should be followed. In
particular, each commit must carry a Signed-off-by tag to denote that the
submitter adheres to the [Developer Certificate of Origin 1.1]. This project
follows the [freedesktop.org Contributor Covenant].
## Building
libdisplay-info has the following dependencies:
- [hwdata] for the PNP ID database used at build-time only.
libdisplay-info is built using [Meson]:
meson setup build/
ninja -C build/
## Testing
The low-level EDID library is tested against [edid-decode]. `test/data/`
contains a small collection of EDID blobs and diffs between upstream
`edid-decode` and our `di-edid-decode` clone. Our CI ensures the diffs are
up-to-date. A patch should never make the diffs grow larger. To re-generate the
test data, build `edid-decode` at the Git revision mentioned in
`.gitlab-ci.yml`, put the executable in `PATH`, and run
`ninja -C build/ gen-test-data`.
The latest code coverage report is available on [GitLab CI][coverage].
## Fuzzing
To fuzz libdisplay-info with [AFL], the library needs to be instrumented:
CC=afl-gcc meson build/
ninja -C build/
afl-fuzz -i test/data/ -o afl/ build/di-edid-decode/di-edid-decode
[website]: https://emersion.pages.freedesktop.org/libdisplay-info/
[semantic versioning]: https://semver.org/
[GitLab project]: https://gitlab.freedesktop.org/emersion/libdisplay-info
[#wayland]: ircs://irc.oftc.net/#wayland
[Wayland contribution guidelines]: https://gitlab.freedesktop.org/wayland/wayland/-/blob/main/CONTRIBUTING.md
[Developer Certificate of Origin 1.1]: https://developercertificate.org/
[freedesktop.org Contributor Covenant]: https://www.freedesktop.org/wiki/CodeOfConduct/
[hwdata]: https://github.com/vcrhonek/hwdata
[Meson]: https://mesonbuild.com/
[coverage]: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/jobs/artifacts/main/file/build/meson-logs/coveragereport/index.html?job=build-gcc
[edid-decode]: https://git.linuxtv.org/edid-decode.git/
[AFL]: https://lcamtuf.coredump.cx/afl/
This diff is collapsed.
cta.c 0 → 100644
This diff is collapsed.
cvt.c 0 → 100644
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
di_edid_decode = executable(
'di-edid-decode',
[
'cta.c',
'displayid.c',
'edid.c',
'main.c',
],
dependencies: [di_dep, math],
install: true,
)
This diff is collapsed.
This diff is collapsed.
edid.c 0 → 100644
This diff is collapsed.
exclude = subprojects/
exclude = build/
gtf.c 0 → 100644
This diff is collapsed.
#ifndef BITS_H
#define BITS_H
/**
* Utility functions to operate on bits.
*/
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
/**
* Check whether a byte has a bit set.
*/
static inline bool
has_bit(uint8_t val, size_t index)
{
return val & (1 << index);
}
/**
* Extract a bit range from a byte.
*
* Both offsets are inclusive, start from zero, and high must be greater than low.
*/
static inline uint8_t
get_bit_range(uint8_t val, size_t high, size_t low)
{
size_t n;
uint8_t bitmask;
assert(high <= 7 && high >= low);
n = high - low + 1;
bitmask = (uint8_t) ((1 << n) - 1);
return (uint8_t) (val >> low) & bitmask;
}
#endif
This diff is collapsed.
#ifndef DI_EDID_DECODE_H
#define DI_EDID_DECODE_H
#include <stdbool.h>
#include <libdisplay-info/edid.h>
#include <libdisplay-info/cta.h>
#include <libdisplay-info/displayid.h>
struct uncommon_features {
bool color_point_descriptor;
bool color_management_data;
bool cta_transfer_characteristics;
};
extern struct uncommon_features uncommon_features;
struct di_edid;
struct di_edid_detailed_timing_def;
struct di_edid_cta;
struct di_displayid;
void
print_edid(const struct di_edid *edid);
void
print_detailed_timing_def(const struct di_edid_detailed_timing_def *def);
void
print_cta(const struct di_edid_cta *cta);
void
print_displayid(const struct di_displayid *displayid);
void
print_displayid_type_i_ii_vii_timing(const struct di_displayid_type_i_ii_vii_timing *t,
int indent, const char *prefix);
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment