Commit 9212a7eb authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz
Browse files

Merge tag '0.2' into librem5-master

The interesting commits are the one covered in Librem5/wlroots!39 (commits) and the ones relating to input method and text input protocols.

wlroots 0.2

Cedric Sodhi (1):
      Tell Mesa not to attempt X11 headers

Cosimo Cecchi (1):
      xcursor: Support XDG user data dir location

Drew DeVault (26):
      Merge pull request #1307 from emersion/static-analysis
      Merge pull request #1289 from ixru/fix-cursor-visibility
      Merge pull request #1327 from RyanDwyer/xwm-unset-minmax-hints
      Add FreeBSD build
      Merge pull request #1338 from emersion/wayland-swap-interval
      Merge pull request #1340 from emersion/fix-input-method-destroy
      Merge pull request #1332 from emersion/shm-open
      Merge pull request #1346 from emersion/fix-schedule-frame-mgpu
      Merge pull request #1341 from emersion/view-at-unmapped
      Merge pull request #1350 from emersion/check-gles2-bgra-ext
      Merge pull request #1261 from arandomhuman/damage-control
      Merge pull request #1357 from emersion/xopen-source
      Merge pull request #1358 from emersion/xcursor-heap
      Merge pull request #1364 from ManDay/master
      Merge pull request #1356 from emersion/egl-renderable-type
      Merge pull request #1369 from ascent12/wayland_backend
      Merge pull request #1372 from emersion/config10
      Merge pull request #1373 from emersion/fix-teardown-segfaults
      Merge pull request #1366 from emersion/render-software-cursors
      Merge pull request #1375 from emersion/tablet-segfault
      Merge pull request #1392 from emersion/disable-static-analysis
      Merge pull request #1396 from emersion/fix-destroyed-subsurface
      Merge pull request #1384 from emersion/data-multiple-devices
      Merge pull request #1387 from emersion/rename-gtk-primary-selection
      Merge pull request #1399 from emersion/fix-wl-backend-zero-vla
      Merge pull request #1400 from emersion/xcursor-fixes

Ilia Bozhinov (1):
      output: add wlr_output_preferred_read_format()

Julio Galvan (1):
      Fix compilation error on musl

Philipp Ludwig (1):
      xcursor: fix crash when encountering cursor themes with circular dependencies

Rostislav Pehlivanov (2):
      Skip interlaced modes during drm mode detection
      Fix interlaced mode rejection

Ryan Dwyer (3):
      xwm: Unset min/max size hints if they're not used
      Merge pull request #1335 from emersion/fucking-transparency
      Merge pull request #1395 from emersion/text-input-log-newline

Scott Anderson (11):
      backend/wayland: Move registry into backend
      backend/wayland: Use specific wl_global versions
      backend/wayland: Move initilisation code earlier
      backend/wayland: Make header order consistent
      backend/x11: Rename xcb_conn to xcb
      backend/x11: Make header order consistent
      backend/x11: Move atom initilisation earlier
      backend/x11: Check for xinput extension
      backend/x11: Add new Xinput events
      backend/x11: Remove old input functions
      backend/x11: Hide cursor with Xfixes

Sorcus (1):
      Fix "variable ‘cursor_default’ set but not used"

Tobias Stoeckmann (1):
      xcursor: Fix heap overflows when parsing malicious files

buffet (1):
      Fixed loc count in readme

emersion (48):
      backend: fix use-after-free in wlr_backend_autocreate
      tablet-v2: fix memory leak on OOM, fix resource version
      Update version to 0.1
      xwayland: fix typo to enable transparency
      Merge pull request #1336 from swaywm/freebsd
      idle: allow zero timeout
      render: on Wayland, make eglSwapBuffers non-blocking
      Merge pull request #1337 from emersion/idle-zero-timeout
      Merge pull request #1339 from MrSorcus/master
      input-method-v2: initialize destroy signal
      util: use shm_open for in-memory files
      xwayland: don't fail if XDG_RUNTIME_DIR is not set
      rootston: fix segfault in view_at
      rootston: fix segfault when destroying unmapped fullscreen views
      backend/drm: add WLR_DRM_NO_ATOMIC_GAMMA env variable
      backend/drm: fix frame scheduling on secondary GPUs
      Merge pull request #1344 from emersion/no-atomic-gamma
      render/gles2: remove assumptions about supported formats
      backend/drm: specify minimum config attributes
      render/gles2: check for GL_OES_EGL_image_external
      surface: fix wlr_surface_get_effective_damage to give surface coords
      Use _POSIX_C_SOURCE, use shm_open
      examples: only link clients to wlroots if necessary
      Merge pull request #1362 from julio641742/patch-1
      Merge pull request #1361 from sghctoma/fix-shm
      render: correctly set EGL_RENDERABLE_TYPE
      backend/wayland: handle WL_EVENT_WRITABLE for Wayland socket
      Use #if instead of #ifdef for wlroots config data
      xdg-shell: don't destroy xdg role state on role destroy
      tablet-v2: fix segfault on display destroy
      Merge pull request #1368 from ascent12/x11_backend
      output: remove wlr_output_set_fullscreen_surface
      output: add wlr_output_render_software_cursors
      output: make wlr_egl flip the damage
      gtk-primary-selection: support multiple devices
      gtk-primary-selection: track resources
      Merge pull request #1382 from atomnuker/master
      Merge pull request #1380 from emersion/gtk-primary-selection-multiple-devices
      Merge pull request #1385 from atomnuker/master
      Rename wlr_primary_selection to wlr_gtk_primary_selection
      Merge pull request #1390 from ammen99/fix-preferred-read-format
      Merge pull request #1391 from buffet/fix-loc-count
      Disable Clang static analysis
      text-input-v3: remove newline in log message
      data-device: allow multiple devices for the same seat
      data-device: never cancel the source when offer is destroyed
      surface: fix destroyed subsurfaces handling
      backend/wayland: fix zero-length VLA

ixru (2):
      Fix cursor visibility on surface commit
      Better placement of visibility check

random human (5):
      wlr_surface: fix surface damage transformation
      wlr_surface: fix surface damage on resize
      wlr_surface: remove duplicated damage calculation
      wlr_surface: more consistent argument naming in surface_update_damage
      wlr_surface: add wlr_surface_get_effective_damage

sghctoma (3):
      Force ftruncate for shared mem. objects on FreeBSD
      Use ftruncate to set shared memory object's size
      Remove WLR_HAS_POSIX_FALLOCATE from build system
parents 54d15553 a22311ec
Pipeline #2239 passed with stage
in 1 minute and 7 seconds
......@@ -15,11 +15,9 @@ sources:
- https://github.com/swaywm/wlroots
tasks:
- setup: |
mkdir wlroots/build-{gcc,clang}
cd wlroots/build-gcc
CC=gcc meson ..
cd ../build-clang
CC=clang meson ..
cd wlroots
CC=gcc meson build-gcc
CC=clang meson build-clang
- gcc: |
cd wlroots/build-gcc
ninja
......
image: freebsd
packages:
- devel/automake
- multimedia/ffmpeg
- devel/gmake
- devel/json-c
- devel/libtool
- x11/libxkbcommon
- textproc/libxslt
- x11-toolkits/pango
- devel/pkgconf
- print/texinfo
- x11/xcb-util-image
- x11/xcb-util-wm
- python36
- py36-setuptools
sources:
- https://github.com/swaywm/wlroots
tasks:
- setup: |
# Don't build unnecessary stuff
echo "OPTIONS_UNSET+= NLS DOCS EXAMPLES LIBWACOM" | sudo tee -a /etc/make.conf
# Note: this could probably be set in the FreeBSD base image
echo "BATCH=yes" | sudo tee -a /etc/make.conf
- ports_tree: |
# This is ugly, but fetching and extracting the whole ports tree takes a
# really-really long time...
# First we need a clean tree, and renaming is faster than deleting.
sudo mv /usr/ports /usr/ports.orig
sudo mkdir /usr/ports
# Fetch only needed ports
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/GIDs /usr/ports/GIDs
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/Keywords /usr/ports/Keywords
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/Makefile /usr/ports/Makefile
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/Mk /usr/ports/Mk
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/Templates /usr/ports/Templates
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/Tools /usr/ports/Tools
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/UIDs /usr/ports/UIDs
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/devel/libevdev /usr/ports/devel/libevdev
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/devel/libmtdev /usr/ports/devel/libmtdev
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/devel/libudev-devd /usr/ports/devel/libudev-devd
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/devel/meson /usr/ports/devel/meson
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/devel/ninja /usr/ports/devel/ninja
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/devel/py-evdev /usr/ports/devel/py-evdev
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/devel/py-six /usr/ports/devel/py-six
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/graphics/wayland-protocols /usr/ports/graphics/wayland-protocols
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/graphics/wayland /usr/ports/graphics/wayland
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/lang/python27 /usr/ports/lang/python27
sudo svnlite export --force https://svn.FreeBSD.org/ports/head/lang/python36 /usr/ports/lang/python36
- fixup_libinput: |
sudo svnlite export https://github.com/FreeBSDDesktop/freebsd-ports/branches/feature/input/devel/libepoll-shim /usr/ports/devel/libepoll-shim
sudo svnlite export https://github.com/FreeBSDDesktop/freebsd-ports/branches/feature/input/x11/libinput /usr/ports/x11/libinput
sudo svnlite export https://github.com/FreeBSDDesktop/freebsd-ports/branches/feature/input/devel/evdev-proto /usr/ports/devel/evdev-proto
sudo svnlite export https://github.com/FreeBSDDesktop/freebsd-ports/branches/feature/input/devel/py-pyudev /usr/ports/devel/py-pyudev
- ports_build: |
cd /usr/ports/graphics/wayland-protocols/ && sudo make install
cd /usr/ports/x11/libinput/ && sudo make install clean
# v4l_compat is a dependency of libinput, but the version in the ports tree
# conflicts with the new evdev-proto. It can be safely removed though.
sudo pkg remove -fy v4l_compat
cd /usr/ports/devel/evdev-proto && sudo make install clean
- fixup_epoll: |
cat << 'EOF' | sudo tee /usr/local/libdata/pkgconfig/epoll-shim.pc
prefix=/usr/local
exec_prefix=\$\{\$prefix\}
libdir=${prefix}/lib
sharedlibdir=${prefix}/lib
includedir=${prefix}/include/libepoll-shim
Name: epoll-shim
Description: epoll shim implemented using kevent
Version: 0
Requires:
Libs: -L${libdir} -L${sharedlibdir} -lepoll-shim -lthr
Cflags: -I${includedir}
EOF
- wlroots: |
cd wlroots
meson build
ninja -C build
......@@ -5,10 +5,8 @@ end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
[*.xml]
indent_style = space
indent_size = 2
tab_width = 8
# wlroots
Pluggable, composable, unopinionated modules for building a
[Wayland](http://wayland.freedesktop.org/) compositor; or about 40,000 lines of
[Wayland](http://wayland.freedesktop.org/) compositor; or about 50,000 lines of
code you were going to write anyway.
- wlroots provides backends that abstract the underlying display and input
......@@ -30,8 +30,8 @@ development tools - or any subset of these features you like, because all of
them work independently of one another and freely compose with anything you want
to implement yourself.
**Status**: prior to 1.0 the API is not stable, but we've done most of the work
and various projects are using wlroots to build Wayland compositors with.
Check out our [wiki](https://github.com/swaywm/wlroots/wiki/Getting-started) to
get started with wlroots.
wlroots is developed under the direction of the
[sway](https://github.com/swaywm/sway) project. A variety of wrapper libraries
......@@ -62,21 +62,18 @@ If you choose to enable X11 support:
* xcb
* xcb-composite
* xcb-xfixes
* xcb-xinput
* xcb-image
* xcb-render
* x11-xcb
* xcb-errors (optional, for improved error reporting)
* x11-icccm (optional, for improved Xwayland introspection)
* xcb-xkb (optional, for improved keyboard handling on the X11 backend)
Run these commands:
meson build
ninja -C build
On FreeBSD, you need to pass an extra flag to prevent a linking error:
`meson build -D b_lundef=false`.
Install like so:
sudo ninja -C build install
......@@ -86,7 +83,8 @@ Install like so:
wlroots comes with a test compositor called rootston, which demonstrates the
features of the library and is used as a testbed for the development of the
library. It may also be useful as a reference for understanding how to use
various wlroots features.
various wlroots features, but it's not considered a production-quality codebase
and is not designed for daily use.
If you followed the build instructions above the rootston executable can be
found at `./build/rootston/rootston`. To use it, refer to the example config at
......
......@@ -15,9 +15,9 @@
#include <wlr/backend/wayland.h>
#include <wlr/config.h>
#include <wlr/util/log.h>
#include "backend/multi.h"
/* WLR_HAS_X11_BACKEND needs to be after wlr/config.h */
#ifdef WLR_HAS_X11_BACKEND
#if WLR_HAS_X11_BACKEND
#include <wlr/backend/x11.h>
#endif
......@@ -56,6 +56,20 @@ struct wlr_renderer *wlr_backend_get_renderer(struct wlr_backend *backend) {
return NULL;
}
struct wlr_session *wlr_backend_get_session(struct wlr_backend *backend) {
if (backend->impl->get_session) {
return backend->impl->get_session(backend);
}
return NULL;
}
clockid_t wlr_backend_get_presentation_clock(struct wlr_backend *backend) {
if (backend->impl->get_presentation_clock) {
return backend->impl->get_presentation_clock(backend);
}
return CLOCK_MONOTONIC;
}
static size_t parse_outputs_env(const char *name) {
const char *outputs_str = getenv(name);
if (outputs_str == NULL) {
......@@ -87,7 +101,7 @@ static struct wlr_backend *attempt_wl_backend(struct wl_display *display,
return backend;
}
#ifdef WLR_HAS_X11_BACKEND
#if WLR_HAS_X11_BACKEND
static struct wlr_backend *attempt_x11_backend(struct wl_display *display,
const char *x11_display, wlr_renderer_create_func_t create_renderer_func) {
struct wlr_backend *backend = wlr_x11_backend_create(display, x11_display, create_renderer_func);
......@@ -150,7 +164,7 @@ static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
const char *name, wlr_renderer_create_func_t create_renderer_func) {
if (strcmp(name, "wayland") == 0) {
return attempt_wl_backend(display, create_renderer_func);
#ifdef WLR_HAS_X11_BACKEND
#if WLR_HAS_X11_BACKEND
} else if (strcmp(name, "x11") == 0) {
return attempt_x11_backend(display, NULL, create_renderer_func);
#endif
......@@ -158,10 +172,12 @@ static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
return attempt_headless_backend(display, create_renderer_func);
} else if (strcmp(name, "drm") == 0 || strcmp(name, "libinput") == 0) {
// DRM and libinput need a session
*session = wlr_session_create(display);
if (!*session) {
wlr_log(WLR_ERROR, "failed to start a session");
return NULL;
*session = wlr_session_create(display);
if (!*session) {
wlr_log(WLR_ERROR, "failed to start a session");
return NULL;
}
}
if (strcmp(name, "libinput") == 0) {
......@@ -178,13 +194,12 @@ static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
wlr_renderer_create_func_t create_renderer_func) {
struct wlr_backend *backend = wlr_multi_backend_create(display);
struct wlr_multi_backend *multi = (struct wlr_multi_backend *)backend;
if (!backend) {
wlr_log(WLR_ERROR, "could not allocate multibackend");
return NULL;
}
struct wlr_session *session = NULL;
char *names = getenv("WLR_BACKENDS");
if (names) {
names = strdup(names);
......@@ -197,20 +212,20 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
char *saveptr;
char *name = strtok_r(names, ",", &saveptr);
while (name != NULL) {
struct wlr_backend *subbackend =
attempt_backend_by_name(display, backend, &session, name, create_renderer_func);
struct wlr_backend *subbackend = attempt_backend_by_name(display,
backend, &multi->session, name, create_renderer_func);
if (subbackend == NULL) {
wlr_log(WLR_ERROR, "failed to start backend '%s'", name);
wlr_session_destroy(multi->session);
wlr_backend_destroy(backend);
wlr_session_destroy(session);
free(names);
return NULL;
}
if (!wlr_multi_backend_add(backend, subbackend)) {
wlr_log(WLR_ERROR, "failed to add backend '%s'", name);
wlr_session_destroy(multi->session);
wlr_backend_destroy(backend);
wlr_session_destroy(session);
free(names);
return NULL;
}
......@@ -232,7 +247,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
}
}
#ifdef WLR_HAS_X11_BACKEND
#if WLR_HAS_X11_BACKEND
const char *x11_display = getenv("DISPLAY");
if (x11_display) {
struct wlr_backend *x11_backend =
......@@ -245,29 +260,30 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
#endif
// Attempt DRM+libinput
session = wlr_session_create(display);
if (!session) {
multi->session = wlr_session_create(display);
if (!multi->session) {
wlr_log(WLR_ERROR, "Failed to start a DRM session");
wlr_backend_destroy(backend);
return NULL;
}
struct wlr_backend *libinput = wlr_libinput_backend_create(display, session);
struct wlr_backend *libinput = wlr_libinput_backend_create(display,
multi->session);
if (!libinput) {
wlr_log(WLR_ERROR, "Failed to start libinput backend");
wlr_session_destroy(multi->session);
wlr_backend_destroy(backend);
wlr_session_destroy(session);
return NULL;
}
wlr_multi_backend_add(backend, libinput);
struct wlr_backend *primary_drm =
attempt_drm_backend(display, backend, session, create_renderer_func);
struct wlr_backend *primary_drm = attempt_drm_backend(display, backend,
multi->session, create_renderer_func);
if (!primary_drm) {
wlr_log(WLR_ERROR, "Failed to open any DRM device");
wlr_backend_destroy(libinput);
wlr_session_destroy(multi->session);
wlr_backend_destroy(backend);
wlr_session_destroy(session);
return NULL;
}
......
......@@ -104,7 +104,8 @@ static bool atomic_crtc_pageflip(struct wlr_drm_backend *drm,
drmModeDestroyPropertyBlob(drm->fd, crtc->mode_id);
}
if (drmModeCreatePropertyBlob(drm->fd, mode, sizeof(*mode), &crtc->mode_id)) {
if (drmModeCreatePropertyBlob(drm->fd, mode, sizeof(*mode),
&crtc->mode_id)) {
wlr_log_errno(WLR_ERROR, "Unable to create property blob");
return false;
}
......@@ -120,6 +121,10 @@ static bool atomic_crtc_pageflip(struct wlr_drm_backend *drm,
struct atomic atom;
atomic_begin(crtc, &atom);
atomic_add(&atom, conn->id, conn->props.crtc_id, crtc->id);
if (mode != NULL && conn->props.link_status != 0) {
atomic_add(&atom, conn->id, conn->props.link_status,
DRM_MODE_LINK_STATUS_GOOD);
}
atomic_add(&atom, crtc->id, crtc->props.mode_id, crtc->mode_id);
atomic_add(&atom, crtc->id, crtc->props.active, 1);
set_plane_props(&atom, crtc->primary, crtc->id, fb_id, true);
......@@ -129,6 +134,9 @@ static bool atomic_crtc_pageflip(struct wlr_drm_backend *drm,
static bool atomic_conn_enable(struct wlr_drm_backend *drm,
struct wlr_drm_connector *conn, bool enable) {
struct wlr_drm_crtc *crtc = conn->crtc;
if (crtc == NULL) {
return !enable;
}
struct atomic atom;
atomic_begin(crtc, &atom);
......@@ -197,14 +205,16 @@ static bool atomic_crtc_move_cursor(struct wlr_drm_backend *drm,
}
static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, uint16_t *r, uint16_t *g, uint16_t *b,
uint32_t size) {
struct wlr_drm_crtc *crtc, size_t size,
uint16_t *r, uint16_t *g, uint16_t *b) {
// Fallback to legacy gamma interface when gamma properties are not available
// (can happen on older intel gpu's that support gamma but not degamma)
// TEMP: This is broken on AMDGPU. Always fallback to legacy until they get
// it fixed. Ref https://bugs.freedesktop.org/show_bug.cgi?id=107459
if (crtc->props.gamma_lut == 0 || true) {
return legacy_iface.crtc_set_gamma(drm, crtc, r, g, b, size);
// (can happen on older Intel GPUs that support gamma but not degamma).
// TEMP: This is broken on AMDGPU. Provide a fallback to legacy until they
// get it fixed. Ref https://bugs.freedesktop.org/show_bug.cgi?id=107459
const char *no_atomic_str = getenv("WLR_DRM_NO_ATOMIC_GAMMA");
bool no_atomic = no_atomic_str != NULL && strcmp(no_atomic_str, "1") == 0;
if (crtc->props.gamma_lut == 0 || no_atomic) {
return legacy_iface.crtc_set_gamma(drm, crtc, size, r, g, b);
}
struct drm_color_lut *gamma = malloc(size * sizeof(struct drm_color_lut));
......@@ -213,7 +223,7 @@ static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
return false;
}
for (uint32_t i = 0; i < size; i++) {
for (size_t i = 0; i < size; i++) {
gamma[i].red = r[i];
gamma[i].green = g[i];
gamma[i].blue = b[i];
......@@ -237,21 +247,20 @@ static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
return atomic_end(drm->fd, &atom);
}
static uint32_t atomic_crtc_get_gamma_size(struct wlr_drm_backend *drm,
static size_t atomic_crtc_get_gamma_size(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc) {
uint64_t gamma_lut_size;
if (crtc->props.gamma_lut_size == 0) {
return legacy_iface.crtc_get_gamma_size(drm, crtc);
}
uint64_t gamma_lut_size;
if (!get_drm_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size,
&gamma_lut_size)) {
&gamma_lut_size)) {
wlr_log(WLR_ERROR, "Unable to get gamma lut size");
return 0;
}
return (uint32_t)gamma_lut_size;
return (size_t)gamma_lut_size;
}
const struct wlr_drm_interface atomic_iface = {
......
......@@ -15,8 +15,14 @@
#include "backend/drm/drm.h"
#include "util/signal.h"
struct wlr_drm_backend *get_drm_backend_from_backend(
struct wlr_backend *wlr_backend) {
assert(wlr_backend_is_drm(wlr_backend));
return (struct wlr_drm_backend *)wlr_backend;
}
static bool backend_start(struct wlr_backend *backend) {
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
struct wlr_drm_backend *drm = get_drm_backend_from_backend(backend);
scan_drm_connectors(drm);
return true;
}
......@@ -26,7 +32,7 @@ static void backend_destroy(struct wlr_backend *backend) {
return;
}
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
struct wlr_drm_backend *drm = get_drm_backend_from_backend(backend);
restore_drm_outputs(drm);
......@@ -50,7 +56,7 @@ static void backend_destroy(struct wlr_backend *backend) {
static struct wlr_renderer *backend_get_renderer(
struct wlr_backend *backend) {
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
struct wlr_drm_backend *drm = get_drm_backend_from_backend(backend);
if (drm->parent) {
return drm->parent->renderer.wlr_rend;
......@@ -59,10 +65,16 @@ static struct wlr_renderer *backend_get_renderer(
}
}
static clockid_t backend_get_presentation_clock(struct wlr_backend *backend) {
struct wlr_drm_backend *drm = get_drm_backend_from_backend(backend);
return drm->clock;
}
static struct wlr_backend_impl backend_impl = {
.start = backend_start,
.destroy = backend_destroy,
.get_renderer = backend_get_renderer,
.get_presentation_clock = backend_get_presentation_clock,
};
bool wlr_backend_is_drm(struct wlr_backend *b) {
......@@ -95,6 +107,16 @@ static void session_signal(struct wl_listener *listener, void *data) {
(plane && plane->cursor_enabled) ? plane->cursor_bo : NULL);
drm->iface->crtc_move_cursor(drm, conn->crtc, conn->cursor_x,
conn->cursor_y);
if (conn->crtc->gamma_table != NULL) {
size_t size = conn->crtc->gamma_table_size;
uint16_t *r = conn->crtc->gamma_table;
uint16_t *g = conn->crtc->gamma_table + size;
uint16_t *b = conn->crtc->gamma_table + 2 * size;
drm->iface->crtc_set_gamma(drm, conn->crtc, size, r, g, b);
} else {
set_drm_connector_gamma(&conn->output, 0, NULL, NULL, NULL);
}
}
} else {
wlr_log(WLR_INFO, "DRM fd paused");
......@@ -141,7 +163,9 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
wl_list_init(&drm->outputs);
drm->fd = gpu_fd;
drm->parent = (struct wlr_drm_backend *)parent;
if (parent != NULL) {
drm->parent = get_drm_backend_from_backend(parent);
}
drm->drm_invalidated.notify = drm_invalidated;
wlr_session_signal_add(session, gpu_fd, &drm->drm_invalidated);
......@@ -185,8 +209,3 @@ error_fd:
free(drm);
return NULL;
}
struct wlr_session *wlr_drm_backend_get_session(struct wlr_backend *backend) {
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
return drm->session;
}
This diff is collapsed.
......@@ -39,7 +39,10 @@ bool legacy_crtc_set_cursor(struct wlr_drm_backend *drm,
}
if (!bo) {
drmModeSetCursor(drm->fd, crtc->id, 0, 0, 0);
if (drmModeSetCursor(drm->fd, crtc->id, 0, 0, 0)) {
wlr_log_errno(WLR_DEBUG, "Failed to clear hardware cursor");
return false;
}
return true;
}
......@@ -60,14 +63,14 @@ bool legacy_crtc_move_cursor(struct wlr_drm_backend *drm,
}
bool legacy_crtc_set_gamma(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc, uint16_t *r, uint16_t *g, uint16_t *b,
uint32_t size) {
return !drmModeCrtcSetGamma(drm->fd, crtc->id, size, r, g, b);
struct wlr_drm_crtc *crtc, size_t size,
uint16_t *r, uint16_t *g, uint16_t *b) {
return !drmModeCrtcSetGamma(drm->fd, crtc->id, (uint32_t)size, r, g, b);
}
uint32_t legacy_crtc_get_gamma_size(struct wlr_drm_backend *drm,
size_t legacy_crtc_get_gamma_size(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc) {
return crtc->legacy_crtc->gamma_size;
return (size_t)crtc->legacy_crtc->gamma_size;
}
const struct wlr_drm_interface legacy_iface = {
......
......@@ -19,9 +19,10 @@ struct prop_info {
static const struct prop_info connector_info[] = {
#define INDEX(name) (offsetof(union wlr_drm_connector_props, name) / sizeof(uint32_t))
{ "CRTC_ID", INDEX(crtc_id) },
{ "DPMS", INDEX(dpms) },
{ "EDID", INDEX(edid) },
{ "CRTC_ID", INDEX(crtc_id) },
{ "DPMS", INDEX(dpms) },
{ "EDID", INDEX(edid) },
{ "link-status", INDEX(link_status) },
#undef INDEX
};
......@@ -87,7 +88,8 @@ static bool scan_properties(int fd, uint32_t id, uint32_t type, uint32_t *result
return true;
}
bool get_drm_connector_props(int fd, uint32_t id, union wlr_drm_connector_props *out) {
bool get_drm_connector_props(int fd, uint32_t id,
union wlr_drm_connector_props *out) {
return scan_properties(fd, id, DRM_MODE_OBJECT_CONNECTOR, out->props,
connector_info, sizeof(connector_info) / sizeof(connector_info[0]));
}
......@@ -103,7 +105,8 @@ bool get_drm_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out) {
}
bool get_drm_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) {
drmModeObjectProperties *props = drmModeObjectGetProperties(fd, obj, DRM_MODE_OBJECT_ANY);
drmModeObjectProperties *props =
drmModeObjectGetProperties(fd, obj, DRM_MODE_OBJECT_ANY);
if (!props) {
return false;
}
......
......@@ -30,8 +30,17 @@ bool init_drm_renderer(struct wlr_drm_backend *drm,
create_renderer_func = wlr_renderer_autocreate;
}
static EGLint config_attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_ALPHA_SIZE, 1,
EGL_NONE,
};
renderer->wlr_rend = create_renderer_func(&renderer->egl,
EGL_PLATFORM_GBM_MESA, renderer->gbm, NULL, GBM_FORMAT_ARGB8888);
EGL_PLATFORM_GBM_MESA, renderer->gbm,
config_attribs, GBM_FORMAT_ARGB8888);
if (!renderer->wlr_rend) {
wlr_log(WLR_ERROR, "Failed to create EGL/WLR renderer");
......
......@@ -32,21 +32,30 @@ static const char *get_manufacturer(uint16_t id) {
case ID('A', 'A', 'A'): return "Avolites Ltd";
case ID('A', 'C', 'I'): return "Ancor Communications Inc";
case ID('A', 'C', 'R'): return "Acer Technologies";
case ID('A', 'D', 'A'): return "Addi-Data GmbH";
case ID('A', 'P', 'P'): return "Apple Computer Inc";
case ID('A', 'S', 'K'): return "Ask A/S";
case ID('A', 'V', 'T'): return "Avtek (Electronics) Pty Ltd";
case ID('B', 'N', 'O'): return "Bang & Olufsen";
case ID('C', 'M', 'N'): return "Chimei Innolux Corporation";
case ID('C', 'M', 'O'): return "Chi Mei Optoelectronics corp.";
case ID('C', 'R', 'O'): return "Extraordinary Technologies PTY Limited";
case ID('D', 'E', 'L'): return "Dell Inc.";
case ID('D', 'G', 'C'): return "Data General Corporation";
case ID('D', 'O', 'N'): return "DENON, Ltd.";
case ID('E', 'N', 'C'): return "Eizo Nanao Corporation";
case ID('E', 'P', 'H'): return "Epiphan Systems Inc.";
case ID('E', 'X', 'P'): return "Data Export Corporation";
case ID('F', 'N', 'I'): return "Funai Electric Co., Ltd.";
case ID('F', 'U', 'S'): return "Fujitsu Siemens Computers GmbH";
case ID('G', 'S', 'M'): return "Goldstar Company Ltd";
case ID('H', 'I', 'Q'): return "Kaohsiung Opto Electronics Americas, Inc.";
case ID('H', 'S', 'D'): return "HannStar Display Corp";
case ID('H', 'T', 'C'): return "Hitachi Ltd";
case ID('H', 'W', 'P'): return "Hewlett Packard";
case ID('I', 'N', 'T'): return "Interphase Corporation";
case ID('I', 'N', 'X'): return "Communications Supply Corporation (A division of WESCO)";
case ID('I', 'T', 'E'): return "Integrated Tech Express Inc";
case ID('I', 'V', 'M'): return "Iiyama North America";
case ID('L', 'E', 'N'): return "Lenovo Group Limited";
case ID('M', 'A', 'X'): return "Rogen Tech Distribution Inc";
......@@ -55,6 +64,7 @@ static const char *get_manufacturer(uint16_t id) {
case ID('M', 'T', 'C'): return "Mars-Tech Corporation";
case ID('M', 'T', 'X'): return "Matrox";
case ID('N', 'E', 'C'): return "NEC Corporation";
case ID('N', 'E', 'X'): return "Nexgen Mediatech Inc.";
case ID('O', 'N', 'K'): return "ONKYO Corporation";
case ID('O', 'R', 'N'): return "ORION ELECTRIC CO., LTD.";
case ID('O', 'T', 'M'): return "Optoma Corporation";
......@@ -63,15 +73,24 @@ static const char *get_manufacturer(uint16_t id) {
case ID('P', 'I', 'O'): return "Pioneer Electronic Corporation";