aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorScott Anderson <ascent12@hotmail.com>2017-05-01 17:49:18 +1200
committerScott Anderson <ascent12@hotmail.com>2017-05-01 17:49:18 +1200
commit41a82fd2fcd4759fbb522ffe7e8f6667d6ab945a (patch)
treeb11530bf9596da41231d0698c1633fbcb5cd2101 /include
parent9ac46ec5ed6ba67a8c684069f8255384f6acd18b (diff)
Renaming.
Diffstat (limited to 'include')
-rw-r--r--include/backend/drm/backend.h37
-rw-r--r--include/backend/drm/drm.h52
-rw-r--r--include/backend/drm/event.h24
-rw-r--r--include/backend/drm/otd.h44
-rw-r--r--include/backend/drm/session.h19
-rw-r--r--include/backend/drm/udev.h21
6 files changed, 111 insertions, 86 deletions
diff --git a/include/backend/drm/backend.h b/include/backend/drm/backend.h
new file mode 100644
index 00000000..caa18bcc
--- /dev/null
+++ b/include/backend/drm/backend.h
@@ -0,0 +1,37 @@
+#ifndef DRM_BACKEND_H
+#define DRM_BACKEND_H
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <EGL/egl.h>
+#include <gbm.h>
+#include <libudev.h>
+
+#include "session.h"
+#include "udev.h"
+#include "event.h"
+#include "drm.h"
+
+struct wlr_drm_backend {
+ int fd;
+ bool paused;
+
+ // Priority Queue (Max-heap)
+ size_t event_cap;
+ size_t event_len;
+ struct wlr_drm_event *events;
+
+ size_t display_len;
+ struct wlr_drm_display *displays;
+
+ uint32_t taken_crtcs;
+
+ struct wlr_drm_renderer renderer;
+ struct wlr_session session;
+ struct wlr_udev udev;
+};
+
+struct wlr_drm_backend *wlr_drm_backend_init(void);
+void wlr_drm_backend_free(struct wlr_drm_backend *backend);
+
+#endif
diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h
index 8744b440..bd3d4105 100644
--- a/include/backend/drm/drm.h
+++ b/include/backend/drm/drm.h
@@ -7,17 +7,35 @@
#include <EGL/egl.h>
#include <gbm.h>
-enum otd_display_state {
- OTD_DISP_INVALID,
- OTD_DISP_DISCONNECTED,
- OTD_DISP_NEEDS_MODESET,
- OTD_DISP_CONNECTED,
+struct wlr_drm_renderer {
+ int fd;
+
+ // Currently here so that rendering has access to the event queue.
+ // Ideally this is will be removed later once the way events are
+ // handled is changed.
+ struct wlr_drm_backend *backend;
+
+ struct gbm_device *gbm;
+ struct {
+ EGLDisplay disp;
+ EGLConfig conf;
+ EGLContext context;
+ } egl;
};
-struct otd_display {
- struct otd *otd;
+bool wlr_drm_renderer_init(struct wlr_drm_renderer *renderer,
+ struct wlr_drm_backend *backend, int fd);
+void wlr_drm_renderer_free(struct wlr_drm_renderer *renderer);
- enum otd_display_state state;
+enum wlr_drm_display_state {
+ DRM_DISP_INVALID,
+ DRM_DISP_DISCONNECTED,
+ DRM_DISP_NEEDS_MODESET,
+ DRM_DISP_CONNECTED,
+};
+
+struct wlr_drm_display {
+ enum wlr_drm_display_state state;
uint32_t connector;
char name[16];
@@ -31,24 +49,22 @@ struct otd_display {
uint32_t crtc;
drmModeCrtc *old_crtc;
+ struct wlr_drm_renderer *renderer;
struct gbm_surface *gbm;
EGLSurface *egl;
- uint32_t fb_id;
bool pageflip_pending;
bool cleanup;
};
-bool init_renderer(struct otd *otd);
-void destroy_renderer(struct otd *otd);
-
-void scan_connectors(struct otd *otd);
-bool modeset_str(struct otd *otd, struct otd_display *disp, const char *str);
-void destroy_display_renderer(struct otd *otd, struct otd_display *disp);
+bool wlr_drm_display_modeset(struct wlr_drm_backend *backend,
+ struct wlr_drm_display *disp, const char *str);
+void wlr_drm_display_free(struct wlr_drm_display *disp);
-void get_drm_event(struct otd *otd);
+void wlr_drm_display_begin(struct wlr_drm_display *disp);
+void wlr_drm_display_end(struct wlr_drm_display *disp);
-void rendering_begin(struct otd_display *disp);
-void rendering_end(struct otd_display *disp);
+void wlr_drm_scan_connectors(struct wlr_drm_backend *backend);
+void wlr_drm_event(int fd);
#endif
diff --git a/include/backend/drm/event.h b/include/backend/drm/event.h
index fc4f6f9a..2155bd32 100644
--- a/include/backend/drm/event.h
+++ b/include/backend/drm/event.h
@@ -2,20 +2,24 @@
#define EVENT_H
#include <stdbool.h>
+#include "drm.h"
-enum otd_event_type {
- OTD_EV_NONE,
- OTD_EV_RENDER,
- OTD_EV_DISPLAY_REM,
- OTD_EV_DISPLAY_ADD,
+enum wlr_drm_event_type {
+ DRM_EV_NONE,
+ DRM_EV_RENDER,
+ DRM_EV_DISPLAY_REM,
+ DRM_EV_DISPLAY_ADD,
};
-struct otd_event {
- enum otd_event_type type;
- struct otd_display *display;
+struct wlr_drm_event {
+ enum wlr_drm_event_type type;
+ struct wlr_drm_display *display;
};
-bool otd_get_event(struct otd *otd, struct otd_event *restrict ret);
-bool event_add(struct otd *otd, struct otd_display *disp, enum otd_event_type type);
+struct wlr_drm_backend;
+bool wlr_drm_get_event(struct wlr_drm_backend *backend,
+ struct wlr_drm_event *restrict ret);
+bool wlr_drm_add_event(struct wlr_drm_backend *backend,
+ struct wlr_drm_display *disp, enum wlr_drm_event_type type);
#endif
diff --git a/include/backend/drm/otd.h b/include/backend/drm/otd.h
deleted file mode 100644
index eef0e991..00000000
--- a/include/backend/drm/otd.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef LIBOTD_H
-#define LIBOTD_H
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <EGL/egl.h>
-#include <gbm.h>
-#include <libudev.h>
-
-#include "session.h"
-
-struct otd {
- int fd;
- bool paused;
-
- // Priority Queue (Max-heap)
- size_t event_cap;
- size_t event_len;
- struct otd_event *events;
-
- size_t display_len;
- struct otd_display *displays;
-
- uint32_t taken_crtcs;
-
- struct gbm_device *gbm;
- struct {
- EGLDisplay disp;
- EGLConfig conf;
- EGLContext context;
- } egl;
-
- struct otd_session session;
-
- struct udev *udev;
- struct udev_monitor *mon;
- int udev_fd;
- char *drm_path;
-};
-
-struct otd *otd_start(void);
-void otd_finish(struct otd *otd);
-
-#endif
diff --git a/include/backend/drm/session.h b/include/backend/drm/session.h
index c21900e9..6936b19a 100644
--- a/include/backend/drm/session.h
+++ b/include/backend/drm/session.h
@@ -4,22 +4,21 @@
#include <systemd/sd-bus.h>
#include <stdbool.h>
-struct otd_session {
+struct wlr_session {
+ sd_bus *bus;
+
char *id;
char *path;
char *seat;
-
- sd_bus *bus;
};
-struct otd;
-bool otd_new_session(struct otd *otd);
-void otd_close_session(struct otd *otd);
+bool wlr_session_start(struct wlr_session *session);
+void wlr_session_end(struct wlr_session *session);
-int take_device(struct otd *restrict otd,
- const char *restrict path,
- bool *restrict paused_out);
+int wlr_session_take_device(struct wlr_session *restrict session,
+ const char *restrict path,
+ bool *restrict paused_out);
-void release_device(struct otd *otd, int fd);
+void wlr_session_release_device(struct wlr_session *session, int fd);
#endif
diff --git a/include/backend/drm/udev.h b/include/backend/drm/udev.h
index 9bd4c0d0..6b10c9ec 100644
--- a/include/backend/drm/udev.h
+++ b/include/backend/drm/udev.h
@@ -1,9 +1,22 @@
#ifndef UDEV_H
#define UDEV_H
-bool otd_udev_start(struct otd *otd);
-void otd_udev_finish(struct otd *otd);
-void otd_udev_find_gpu(struct otd *otd);
-void otd_udev_event(struct otd *otd);
+#include <libudev.h>
+
+#include "backend/drm/session.h"
+
+struct wlr_udev {
+ struct udev *udev;
+ struct udev_monitor *mon;
+ int mon_fd;
+ char *drm_path;
+};
+
+bool wlr_udev_init(struct wlr_udev *udev);
+void wlr_udev_free(struct wlr_udev *udev);
+int wlr_udev_find_gpu(struct wlr_udev *udev, struct wlr_session *session);
+
+struct wlr_drm_backend;
+void wlr_udev_event(struct wlr_drm_backend *backend);
#endif