aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-05-07 12:26:48 -0400
committerDrew DeVault <sir@cmpwn.com>2017-05-07 12:26:48 -0400
commit00931f2f8fa4098c5e70b5ececd6d2dcb8786f90 (patch)
tree45d3e79648d601161f483d3f66ac960851ba233f /include
parent15b1ce9e6ced22a90ab0df7a6b86c6d35c40ca93 (diff)
Generalize output handling
Diffstat (limited to 'include')
-rw-r--r--include/backend/drm/drm.h15
-rw-r--r--include/wayland.h18
-rw-r--r--include/wlr/backend.h1
-rw-r--r--include/wlr/backend/drm.h20
-rw-r--r--include/wlr/wayland.h41
5 files changed, 47 insertions, 48 deletions
diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h
index 3e83058a..4b42aa68 100644
--- a/include/backend/drm/drm.h
+++ b/include/backend/drm/drm.h
@@ -12,7 +12,6 @@
struct wlr_drm_renderer {
int fd;
-
struct gbm_device *gbm;
struct wlr_egl egl;
};
@@ -26,15 +25,17 @@ enum wlr_drm_output_state {
DRM_OUTPUT_CONNECTED,
};
-struct wlr_drm_output {
+struct wlr_output_mode_state {
+ struct wlr_wl_output_mode *wlr_mode;
+ drmModeModeInfo mode;
+};
+
+struct wlr_output_state {
+ struct wlr_output *wlr_output;
enum wlr_drm_output_state state;
uint32_t connector;
char name[16];
- size_t num_modes;
- struct wlr_drm_mode *modes;
- struct wlr_drm_mode *active_mode;
-
uint32_t width;
uint32_t height;
@@ -49,7 +50,7 @@ struct wlr_drm_output {
bool cleanup;
};
-void wlr_drm_output_cleanup(struct wlr_drm_output *out, bool restore);
+void wlr_drm_output_cleanup(struct wlr_output_state *output, bool restore);
void wlr_drm_scan_connectors(struct wlr_backend_state *state);
int wlr_drm_event(int fd, uint32_t mask, void *data);
diff --git a/include/wayland.h b/include/wayland.h
new file mode 100644
index 00000000..68817936
--- /dev/null
+++ b/include/wayland.h
@@ -0,0 +1,18 @@
+#ifndef _WLR_WAYLAND_INTERNAL_H
+#define _WLR_WAYLAND_INTERNAL_H
+
+#include <wayland-server.h>
+#include <wlr/wayland.h>
+#include <stdbool.h>
+
+struct wlr_output_impl {
+ bool (*set_mode)(struct wlr_output_state *state, struct wlr_output_mode *mode);
+ void (*destroy)(struct wlr_output_state *state);
+};
+
+struct wlr_output *wlr_output_create(struct wlr_output_impl *impl,
+ struct wlr_output_state *state);
+
+void wlr_output_free(struct wlr_output *output);
+
+#endif
diff --git a/include/wlr/backend.h b/include/wlr/backend.h
index 88a5c8e9..b424c29f 100644
--- a/include/wlr/backend.h
+++ b/include/wlr/backend.h
@@ -13,7 +13,6 @@ struct wlr_backend {
struct {
struct wl_signal output_add;
struct wl_signal output_remove;
- struct wl_signal output_frame;
struct wl_signal keyboard_add;
struct wl_signal keyboard_remove;
struct wl_signal pointer_add;
diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h
index 5db9b35c..2d9bf879 100644
--- a/include/wlr/backend/drm.h
+++ b/include/wlr/backend/drm.h
@@ -5,26 +5,12 @@
#include <wlr/session.h>
#include <wlr/backend.h>
#include <xf86drmMode.h> // drmModeModeInfo
-
-struct wlr_drm_backend;
-struct wlr_drm_output;
-
-struct wlr_drm_mode {
- uint16_t width;
- uint16_t height;
- uint32_t rate;
- drmModeModeInfo mode;
-};
+#include <wlr/wayland.h>
struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
struct wlr_session *session);
-const char *wlr_drm_output_get_name(struct wlr_drm_output *out);
-
-struct wlr_drm_mode *wlr_drm_output_get_modes(struct wlr_drm_output *out, size_t *count);
-bool wlr_drm_output_modeset(struct wlr_drm_output *out, struct wlr_drm_mode *mode);
-
-void wlr_drm_output_begin(struct wlr_drm_output *out);
-void wlr_drm_output_end(struct wlr_drm_output *out);
+void wlr_drm_output_begin(struct wlr_output *out);
+void wlr_drm_output_end(struct wlr_output *out);
#endif
diff --git a/include/wlr/wayland.h b/include/wlr/wayland.h
index bbbd2457..158acc33 100644
--- a/include/wlr/wayland.h
+++ b/include/wlr/wayland.h
@@ -3,26 +3,26 @@
#include <wayland-server.h>
#include <wlr/common/list.h>
+#include <stdbool.h>
-struct wlr_wl_seat {
- struct wl_seat *wl_seat;
- uint32_t capabilities;
- char *name;
- list_t *keyboards;
- list_t *pointers;
-};
-
-void wlr_wl_seat_free(struct wlr_wl_seat *seat);
+struct wlr_output_mode_state;
-struct wlr_wl_output_mode {
+struct wlr_output_mode {
+ struct wlr_output_mode_state *state;
uint32_t flags; // enum wl_output_mode
int32_t width, height;
int32_t refresh; // mHz
};
-struct wlr_wl_output {
- struct wl_output *wl_output;
+struct wlr_output_impl;
+struct wlr_output_state;
+
+struct wlr_output {
+ const struct wlr_output_impl *impl;
+ struct wlr_output_state *state;
+
uint32_t flags;
+ char *name;
char *make;
char *model;
uint32_t scale;
@@ -30,20 +30,15 @@ struct wlr_wl_output {
int32_t phys_width, phys_height; // mm
int32_t subpixel; // enum wl_output_subpixel
int32_t transform; // enum wl_output_transform
- list_t *modes;
- struct wlr_wl_output_mode *current_mode;
-};
-void wlr_wl_output_free(struct wlr_wl_output *output);
+ list_t *modes;
+ struct wlr_output_mode *current_mode;
-struct wlr_wl_keyboard {
- struct wl_keyboard *wl_keyboard;
+ struct {
+ struct wl_signal frame;
+ } events;
};
-struct wlr_wl_pointer {
- struct wl_pointer *wl_pointer;
- struct wl_surface *current_surface;
- wl_fixed_t x, y;
-};
+bool wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode);
#endif