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
|
@ -16,6 +16,7 @@
|
||||||
#include <wlr/backend/wayland.h>
|
#include <wlr/backend/wayland.h>
|
||||||
#include <wlr/config.h>
|
#include <wlr/config.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
#include "backend/backend.h"
|
||||||
#include "backend/multi.h"
|
#include "backend/multi.h"
|
||||||
|
|
||||||
#if WLR_HAS_X11_BACKEND
|
#if WLR_HAS_X11_BACKEND
|
||||||
|
@ -71,6 +72,13 @@ clockid_t wlr_backend_get_presentation_clock(struct wlr_backend *backend) {
|
||||||
return CLOCK_MONOTONIC;
|
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) {
|
static size_t parse_outputs_env(const char *name) {
|
||||||
const char *outputs_str = getenv(name);
|
const char *outputs_str = getenv(name);
|
||||||
if (outputs_str == NULL) {
|
if (outputs_str == NULL) {
|
||||||
|
|
|
@ -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_renderer *(*get_renderer)(struct wlr_backend *backend);
|
||||||
struct wlr_session *(*get_session)(struct wlr_backend *backend);
|
struct wlr_session *(*get_session)(struct wlr_backend *backend);
|
||||||
clockid_t (*get_presentation_clock)(struct wlr_backend *backend);
|
clockid_t (*get_presentation_clock)(struct wlr_backend *backend);
|
||||||
|
int (*get_drm_fd)(struct wlr_backend *backend);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue