mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-05 05:05:57 +01:00
backend: add get_drm_fd to interface
This function allows backends to return the DRM FD they are using. This will allow the allocator and the renderer to use the right device.
This commit is contained in:
parent
87293d1b15
commit
a53ab146fe
3 changed files with 17 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
|||
#include <wlr/backend/wayland.h>
|
||||
#include <wlr/config.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "backend/backend.h"
|
||||
#include "backend/multi.h"
|
||||
|
||||
#if WLR_HAS_X11_BACKEND
|
||||
|
@ -71,6 +72,13 @@ clockid_t wlr_backend_get_presentation_clock(struct wlr_backend *backend) {
|
|||
return CLOCK_MONOTONIC;
|
||||
}
|
||||
|
||||
int backend_get_drm_fd(struct wlr_backend *backend) {
|
||||
if (!backend->impl->get_drm_fd) {
|
||||
return -1;
|
||||
}
|
||||
return backend->impl->get_drm_fd(backend);
|
||||
}
|
||||
|
||||
static size_t parse_outputs_env(const char *name) {
|
||||
const char *outputs_str = getenv(name);
|
||||
if (outputs_str == NULL) {
|
||||
|
|
8
include/backend/backend.h
Normal file
8
include/backend/backend.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef BACKEND_H
|
||||
#define BACKEND_H
|
||||
|
||||
#include <wlr/backend.h>
|
||||
|
||||
int backend_get_drm_fd(struct wlr_backend *backend);
|
||||
|
||||
#endif
|
|
@ -19,6 +19,7 @@ struct wlr_backend_impl {
|
|||
struct wlr_renderer *(*get_renderer)(struct wlr_backend *backend);
|
||||
struct wlr_session *(*get_session)(struct wlr_backend *backend);
|
||||
clockid_t (*get_presentation_clock)(struct wlr_backend *backend);
|
||||
int (*get_drm_fd)(struct wlr_backend *backend);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue