aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gilg <subdiff@gmail.com>2021-04-12 10:39:51 +0200
committerSimon Ser <contact@emersion.fr>2021-04-12 11:43:56 +0200
commitb36af22c94ea8e02616f5ab0ca06001f41f69a49 (patch)
tree9db3987acf485f5e35572a6125462fb458343283
parentb29ac8fbaceeac7f902fc75bb94a13b9cd9a0465 (diff)
backend: move get_drm_fd to public interface
The get_drm_fd was made available in an internal header with a53ab146f. Move it now to the public header so consumers opting in to the unstable interfaces can make use of it.
-rw-r--r--backend/backend.c3
-rw-r--r--backend/multi/backend.c3
-rw-r--r--include/backend/backend.h8
-rw-r--r--include/wlr/backend.h7
-rw-r--r--render/wlr_renderer.c3
5 files changed, 10 insertions, 14 deletions
diff --git a/backend/backend.c b/backend/backend.c
index 245bd429..b93b1e22 100644
--- a/backend/backend.c
+++ b/backend/backend.c
@@ -16,7 +16,6 @@
#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
@@ -72,7 +71,7 @@ clockid_t wlr_backend_get_presentation_clock(struct wlr_backend *backend) {
return CLOCK_MONOTONIC;
}
-int backend_get_drm_fd(struct wlr_backend *backend) {
+int wlr_backend_get_drm_fd(struct wlr_backend *backend) {
if (!backend->impl->get_drm_fd) {
return -1;
}
diff --git a/backend/multi/backend.c b/backend/multi/backend.c
index a8f96669..e9ed74ec 100644
--- a/backend/multi/backend.c
+++ b/backend/multi/backend.c
@@ -6,7 +6,6 @@
#include <wlr/backend/interface.h>
#include <wlr/backend/session.h>
#include <wlr/util/log.h>
-#include "backend/backend.h"
#include "backend/multi.h"
#include "util/signal.h"
@@ -103,7 +102,7 @@ static int multi_backend_get_drm_fd(struct wlr_backend *backend) {
struct subbackend_state *sub;
wl_list_for_each(sub, &multi->backends, link) {
if (sub->backend->impl->get_drm_fd) {
- return backend_get_drm_fd(sub->backend);
+ return wlr_backend_get_drm_fd(sub->backend);
}
}
diff --git a/include/backend/backend.h b/include/backend/backend.h
deleted file mode 100644
index f920cc9f..00000000
--- a/include/backend/backend.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef BACKEND_H
-#define BACKEND_H
-
-#include <wlr/backend.h>
-
-int backend_get_drm_fd(struct wlr_backend *backend);
-
-#endif
diff --git a/include/wlr/backend.h b/include/wlr/backend.h
index 2b869f28..b56e789c 100644
--- a/include/wlr/backend.h
+++ b/include/wlr/backend.h
@@ -57,5 +57,12 @@ struct wlr_session *wlr_backend_get_session(struct wlr_backend *backend);
* Returns the clock used by the backend for presentation feedback.
*/
clockid_t wlr_backend_get_presentation_clock(struct wlr_backend *backend);
+/**
+ * Returns the DRM node file descriptor used by the backend's underlying
+ * platform. Can be used by consumers for additional rendering operations.
+ * The consumer must not close the file descriptor since the backend continues
+ * to have ownership of it.
+ */
+int wlr_backend_get_drm_fd(struct wlr_backend *backend);
#endif
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index 4a10f2b0..7b1bc89a 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -11,7 +11,6 @@
#include "util/signal.h"
#include "render/pixel_format.h"
#include "render/wlr_renderer.h"
-#include "backend/backend.h"
void wlr_renderer_init(struct wlr_renderer *renderer,
const struct wlr_renderer_impl *impl) {
@@ -247,7 +246,7 @@ struct wlr_renderer *wlr_renderer_autocreate_with_drm_fd(int drm_fd) {
}
struct wlr_renderer *wlr_renderer_autocreate(struct wlr_backend *backend) {
- int drm_fd = backend_get_drm_fd(backend);
+ int drm_fd = wlr_backend_get_drm_fd(backend);
if (drm_fd < 0) {
wlr_log(WLR_ERROR, "Failed to get DRM FD from backend");
return NULL;