e4a44377fb
redbear-ci / check (push) Has been cancelled
The recipe was not building libdisplay-info. It synthesized its own
meson.build declaring `version: '0.2.3'` and compiled a hand-written
stub: one di.c and four headers, 518 lines, 20 exported functions.
0.2.3 does not exist upstream -- the tags are 0.1.0, 0.1.1, 0.2.0, 0.3.0
and 0.4.0. That fabricated version satisfied kwin's
pkg_check_modules(libdisplayinfo REQUIRED IMPORTED_TARGET libdisplay-info>=0.2.0)
so kwin configured cleanly and then failed to compile utils/edid.cpp on
di_info_get_default_color_primaries, di_info_get_hdr_static_metadata,
di_info_get_supported_signal_colorimetry and di_edid_display_descriptor.
A version gate satisfied by a declaration rather than an implementation.
Now vendors upstream 0.4.0 (gitlab.freedesktop.org/emersion/libdisplay-info):
14 C files, 10898 lines, 10 headers, 94 exported symbols. 0.4.0 rather than
0.2.0 because the colorimetry and HDR static metadata accessors kwin needs
post-date the 0.2.x series -- and they feed the real colour-primaries and
HDR path of the display stack, so a stub returning NULL would have been
wrong at runtime even if it had compiled.
Red Bear delta is one hunk in source/meson.build: the unconditional
subdir('di-edid-decode') and subdir('test') are commented out. Both build
auxiliary executables and a shell test harness that are not part of the
runtime and do not cross-compile for Redox. Library, headers and
pkg-config are untouched.
Verified: builds clean, stages libdisplay-info.so.0.4.0 with all four
symbols kwin needs, pkg-config reports 0.4.0, and kwin's utils/edid.cpp
now compiles.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
41 lines
679 B
C
41 lines
679 B
C
#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
|