Skip to content
Commits on Source (8)
......@@ -43,7 +43,7 @@
variables:
FDO_UPSTREAM_REPO: wayland/weston
FDO_REPO_SUFFIX: "$BUILD_OS/$BUILD_ARCH"
FDO_DISTRIBUTION_TAG: '2023-03-03-bump-wayland-protocols-to-1.31'
FDO_DISTRIBUTION_TAG: '2023-04-28-add-libdisplay-info.4'
include:
......@@ -182,7 +182,7 @@ aarch64-debian-container_prep:
- .ci-rules
script:
- cd "$BUILDDIR"
- meson --prefix="$PREFIX" -Db_sanitize=address ${MESON_OPTIONS} ${MESON_TOOLCHAIN_OPTIONS} ..
- meson --prefix="$PREFIX" --wrap-mode=nofallback -Db_sanitize=address ${MESON_OPTIONS} ${MESON_TOOLCHAIN_OPTIONS} ..
- ninja -k0 -j${FDO_CI_CONCURRENT:-4}
- ninja install
- test -n "${QEMU_SMP}" || QEMU_SMP=${FDO_CI_CONCURRENT:-4}
......@@ -210,7 +210,7 @@ aarch64-debian-container_prep:
- .ci-rules
script:
- cd "$BUILDDIR"
- meson --prefix="$PREFIX" ${MESON_OPTIONS} ..
- meson --prefix="$PREFIX" --wrap-mode=nofallback ${MESON_OPTIONS} ..
- ninja -k0 -j${FDO_CI_CONCURRENT:-4}
- ninja install
- ninja clean
......
......@@ -97,7 +97,7 @@ git clone --branch 1.20.0 --depth=1 https://gitlab.freedesktop.org/wayland/wayla
cd wayland
git show -s HEAD
mkdir build
meson build -Ddocumentation=false
meson build --wrap-mode=nofallback -Ddocumentation=false
ninja ${NINJAFLAGS} -C build install
cd ..
rm -rf wayland
......@@ -108,7 +108,7 @@ rm -rf wayland
git clone --branch 1.31 --depth=1 https://gitlab.freedesktop.org/wayland/wayland-protocols
cd wayland-protocols
git show -s HEAD
meson build
meson build --wrap-mode=nofallback
ninja ${NINJAFLAGS} -C build install
cd ..
rm -rf wayland-protocols
......@@ -122,7 +122,7 @@ rm -rf wayland-protocols
# be manually inspected for correctness.
git clone --branch 21.3 --depth=1 https://gitlab.freedesktop.org/mesa/mesa.git
cd mesa
meson build -Dauto_features=disabled \
meson build --wrap-mode=nofallback -Dauto_features=disabled \
-Dgallium-drivers=swrast -Dvulkan-drivers= -Ddri-drivers=
ninja ${NINJAFLAGS} -C build install
cd ..
......@@ -133,7 +133,7 @@ rm -rf mesa
# building and installing libdrm as soon as we move to Debian 12.
git clone --branch libdrm-2.4.108 --depth=1 https://gitlab.freedesktop.org/mesa/drm.git
cd drm
meson build -Dauto_features=disabled \
meson build --wrap-mode=nofallback -Dauto_features=disabled \
-Dvc4=false -Dfreedreno=false -Detnaviv=false
ninja ${NINJAFLAGS} -C build install
cd ..
......@@ -147,7 +147,7 @@ rm -rf drm
git clone --single-branch --branch master https://gitlab.freedesktop.org/pipewire/pipewire.git pipewire-src
cd pipewire-src
git checkout -b snapshot bf112940d0bf8f526dd6229a619c1283835b49c2
meson build
meson build --wrap-mode=nofallback
ninja ${NINJAFLAGS} -C build install
cd ..
rm -rf pipewire-src
......@@ -156,7 +156,7 @@ rm -rf pipewire-src
# We use this for our tests using the DRM backend.
git clone --depth=1 --branch 0.6.1 https://git.sr.ht/~kennylevinsen/seatd
cd seatd
meson build -Dauto_features=disabled \
meson build --wrap-mode=nofallback -Dauto_features=disabled \
-Dlibseat-seatd=enabled -Dlibseat-logind=systemd -Dserver=enabled
ninja ${NINJAFLAGS} -C build install
cd ..
......@@ -165,13 +165,21 @@ rm -rf seatd
# Build and install aml and neatvnc, which are required for the VNC backend
git clone --branch v0.3.0 --depth=1 https://github.com/any1/aml.git
cd aml
meson build
meson build --wrap-mode=nofallback
ninja ${NINJAFLAGS} -C build install
cd ..
rm -rf aml
git clone --branch v0.6.0 --depth=1 https://github.com/any1/neatvnc.git
cd neatvnc
meson build -Dauto_features=disabled
meson build --wrap-mode=nofallback -Dauto_features=disabled
ninja ${NINJAFLAGS} -C build install
cd ..
rm -rf neatvnc
# Build and install libdisplay-info, used by drm-backend
git clone --branch 0.1.1 --depth=1 https://gitlab.freedesktop.org/emersion/libdisplay-info.git
cd libdisplay-info
meson build --wrap-mode=nofallback
ninja ${NINJAFLAGS} -C build install
cd ..
rm -rf libdisplay-info
#!/bin/bash
#
#
# Constructs the base container image used to build Weston within CI. Per the
# comment at the top of .gitlab-ci.yml, any changes in this file must bump the
# $FDO_DISTRIBUTION_TAG variable so we know the container has to be rebuilt.
......@@ -43,6 +43,7 @@ apt-get -y --no-install-recommends install \
freerdp2-dev \
gcovr \
git \
hwdata \
lcov \
libasound2-dev \
libbluetooth-dev \
......
......@@ -1401,6 +1401,10 @@ wet_output_set_eotf_mode(struct weston_output *output,
if ((weston_output_get_supported_eotf_modes(output) & eotf_mode) == 0) {
weston_log("Error: output '%s' does not support EOTF mode %s.\n",
output->name, str);
#if !HAVE_LIBDISPLAY_INFO
weston_log_continue(STAMP_SPACE "Weston was built without libdisplay-info, "
"so HDR capabilities cannot be detected.\n");
#endif
free(str);
return -1;
}
......
......@@ -433,13 +433,6 @@ struct drm_fb_private {
struct wl_listener buffer_destroy_listener;
};
struct drm_edid {
char eisa_id[13];
char monitor_name[13];
char pnp_id[5];
char serial_number[13];
};
/**
* Pending state holds one or more drm_output_state structures, collected from
* performing repaint. This pending state is transient, and only lives between
......@@ -616,8 +609,6 @@ struct drm_head {
struct weston_head base;
struct drm_connector connector;
struct drm_edid edid;
struct backlight *backlight;
drmModeModeInfo inherited_mode; /**< Original mode on the connector */
......
......@@ -2,6 +2,17 @@ if not get_option('backend-drm')
subdir_done()
endif
dep_libdisplay_info = dependency(
'libdisplay-info',
version: ['>= 0.1.1', '< 0.2.0'],
fallback: ['display-info', 'di_dep'],
default_options: [
'werror=false',
],
required: false,
)
config_h.set10('HAVE_LIBDISPLAY_INFO', dep_libdisplay_info.found())
lib_backlight = static_library(
'backlight',
'libbacklight.c',
......@@ -42,6 +53,7 @@ deps_drm = [
dep_libdrm,
dep_libinput_backend,
dependency('libudev', version: '>= 136'),
dep_libdisplay_info,
dep_backlight
]
......
......@@ -32,8 +32,33 @@
#include <xf86drm.h>
#include <xf86drmMode.h>
#if HAVE_LIBDISPLAY_INFO
#include <libdisplay-info/info.h>
#endif
#include "drm-internal.h"
#include "shared/weston-drm-fourcc.h"
#include "shared/xalloc.h"
struct drm_head_info {
char *make; /* The monitor make (PNP ID or company name). */
char *model; /* The monitor model (product name). */
char *serial_number;
/* The monitor supported EOTF modes, combination of
* enum weston_eotf_mode bits.
*/
uint32_t eotf_mask;
};
static void
drm_head_info_fini(struct drm_head_info *dhi)
{
free(dhi->make);
free(dhi->model);
free(dhi->serial_number);
*dhi = (struct drm_head_info){};
}
static const char *const aspect_ratio_as_string[] = {
[WESTON_MODE_PIC_AR_NONE] = "",
......@@ -200,6 +225,43 @@ parse_modeline(const char *s, drmModeModeInfo *mode)
return 0;
}
#if HAVE_LIBDISPLAY_INFO
static void
drm_head_info_from_edid(struct drm_head_info *dhi,
const uint8_t *data,
size_t length)
{
struct di_info *di_ctx;
const char *msg;
di_ctx = di_info_parse_edid(data, length);
if (!di_ctx)
return;
msg = di_info_get_failure_msg(di_ctx);
if (msg)
weston_log("DRM: EDID for the following head fails conformity:\n%s\n", msg);
dhi->make = di_info_get_make(di_ctx);
dhi->model = di_info_get_model(di_ctx);
dhi->serial_number = di_info_get_serial(di_ctx);
di_info_destroy(di_ctx);
/* TODO: parse this from EDID */
dhi->eotf_mask = WESTON_EOTF_MODE_ALL_MASK;
}
#else /* HAVE_LIBDISPLAY_INFO */
struct drm_edid {
char eisa_id[13];
char monitor_name[13];
char pnp_id[5];
char serial_number[13];
};
static void
edid_parse_string(const uint8_t *data, char text[])
{
......@@ -298,33 +360,46 @@ edid_parse(struct drm_edid *edid, const uint8_t *data, size_t length)
return 0;
}
static void
drm_head_info_from_edid(struct drm_head_info *dhi,
const uint8_t *data,
size_t length)
{
struct drm_edid edid = {};
int rc;
rc = edid_parse(&edid, data, length);
if (rc == 0) {
if (edid.pnp_id[0] != '\0')
dhi->make = xstrdup(edid.pnp_id);
if (edid.monitor_name[0] != '\0')
dhi->model = xstrdup(edid.monitor_name);
if (edid.serial_number[0] != '\0')
dhi->serial_number = xstrdup(edid.serial_number);
}
/* This ad hoc code will never parse HDR data. */
dhi->eotf_mask = WESTON_EOTF_MODE_SDR;
}
#endif /* HAVE_LIBDISPLAY_INFO else */
/** Parse monitor make, model and serial from EDID
*
* \param head The head whose \c drm_edid to fill in.
* \param props The DRM connector properties to get the EDID from.
* \param[out] make The monitor make (PNP ID).
* \param[out] model The monitor model (name).
* \param[out] serial_number The monitor serial number.
* \param[out] eotf_mask The monitor supported EOTF modes, combination of
* enum weston_eotf_mode bits.
* \param[out] dhi Receives information from EDID.
*
* Each of \c *make, \c *model and \c *serial_number are set only if the
* information is found in the EDID. The pointers they are set to must not
* be free()'d explicitly, instead they get implicitly freed when the
* \c drm_head is destroyed.
* \c *dhi must be drm_head_info_fini()'d by the caller.
*/
static void
find_and_parse_output_edid(struct drm_head *head,
drmModeObjectPropertiesPtr props,
const char **make,
const char **model,
const char **serial_number,
uint32_t *eotf_mask)
struct drm_head_info *dhi)
{
struct drm_device *device = head->connector.device;
drmModePropertyBlobPtr edid_blob = NULL;
uint32_t blob_id;
int rc;
blob_id =
drm_property_get_value(
......@@ -337,21 +412,9 @@ find_and_parse_output_edid(struct drm_head *head,
if (!edid_blob)
return;
rc = edid_parse(&head->edid,
edid_blob->data,
edid_blob->length);
if (!rc) {
if (head->edid.pnp_id[0] != '\0')
*make = head->edid.pnp_id;
if (head->edid.monitor_name[0] != '\0')
*model = head->edid.monitor_name;
if (head->edid.serial_number[0] != '\0')
*serial_number = head->edid.serial_number;
}
drmModeFreePropertyBlob(edid_blob);
drm_head_info_from_edid(dhi, edid_blob->data, edid_blob->length);
/* TODO: parse this from EDID */
*eotf_mask = WESTON_EOTF_MODE_ALL_MASK;
drmModeFreePropertyBlob(edid_blob);
}
static void
......@@ -532,15 +595,16 @@ update_head_from_connector(struct drm_head *head)
struct drm_connector *connector = &head->connector;
drmModeObjectProperties *props = connector->props_drm;
drmModeConnector *conn = connector->conn;
const char *make = "unknown";
const char *model = "unknown";
const char *serial_number = "unknown";
uint32_t eotf_mask = WESTON_EOTF_MODE_SDR;
find_and_parse_output_edid(head, props, &make, &model, &serial_number, &eotf_mask);
weston_head_set_monitor_strings(&head->base, make, model, serial_number);
prune_eotf_modes_by_kms_support(head, &eotf_mask);
weston_head_set_supported_eotf_mask(&head->base, eotf_mask);
struct drm_head_info dhi = { .eotf_mask = WESTON_EOTF_MODE_SDR };
find_and_parse_output_edid(head, props, &dhi);
weston_head_set_monitor_strings(&head->base, dhi.make ?: "unknown",
dhi.model ?: "unknown",
dhi.serial_number ?: "unknown");
prune_eotf_modes_by_kms_support(head, &dhi.eotf_mask);
weston_head_set_supported_eotf_mask(&head->base, dhi.eotf_mask);
weston_head_set_non_desktop(&head->base,
check_non_desktop(connector, props));
weston_head_set_subpixel(&head->base,
......@@ -554,6 +618,8 @@ update_head_from_connector(struct drm_head *head)
/* Unknown connection status is assumed disconnected. */
weston_head_set_connection_status(&head->base,
conn->connection == DRM_MODE_CONNECTED);
drm_head_info_fini(&dhi);
}
/**
......
......@@ -70,7 +70,7 @@ global_args = cc.get_supported_arguments(
'-Wundef',
'-fvisibility=hidden',
)
add_global_arguments(global_args, language: 'c')
add_project_arguments(global_args, language: 'c')
if cc.has_header_symbol('sys/sysmacros.h', 'major')
config_h.set('MAJOR_IN_SYSMACROS', 1)
......
[wrap-git]
directory = display-info
url = https://gitlab.freedesktop.org/emersion/libdisplay-info.git
revision = 0.1.1