From 096249a2a1dc604b062a6fef6c4ca56065724d79 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Sat, 30 Sep 2017 20:52:58 +1300 Subject: Split DRM rendering to its own file --- include/backend/drm/drm.h | 20 ++---------------- include/backend/drm/renderer.h | 47 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 18 deletions(-) create mode 100644 include/backend/drm/renderer.h (limited to 'include/backend/drm') diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index c57493f3..b13cb5e7 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -17,6 +17,7 @@ #include "iface.h" #include "properties.h" +#include "renderer.h" struct wlr_drm_plane { uint32_t type; @@ -24,13 +25,7 @@ struct wlr_drm_plane { uint32_t possible_crtcs; - uint32_t width, height; - - struct gbm_surface *gbm; - EGLSurface egl; - - struct gbm_bo *front; - struct gbm_bo *back; + struct wlr_drm_surface surf; // Only used by cursor float matrix[16]; @@ -70,17 +65,6 @@ struct wlr_drm_connector { struct wl_list link; }; -struct wlr_drm_renderer { - int fd; - struct gbm_device *gbm; - struct wlr_egl egl; -}; - -bool wlr_drm_renderer_init(struct wlr_drm_renderer *renderer, int fd); -void wlr_drm_renderer_free(struct wlr_drm_renderer *renderer); - -struct wlr_drm_interface; - struct wlr_drm_backend { struct wlr_backend backend; diff --git a/include/backend/drm/renderer.h b/include/backend/drm/renderer.h new file mode 100644 index 00000000..bbcf4f0c --- /dev/null +++ b/include/backend/drm/renderer.h @@ -0,0 +1,47 @@ +#ifndef BACKEND_DRM_RENDERER_H +#define BACKEND_DRM_RENDERER_H + +#include +#include + +#include +#include + +struct wlr_drm_renderer { + int fd; + struct gbm_device *gbm; + struct wlr_egl egl; +}; + +struct wlr_drm_surface { + uint32_t width; + uint32_t height; + + struct gbm_surface *gbm; + EGLSurface egl; + + struct gbm_bo *front; + struct gbm_bo *back; +}; + +bool wlr_drm_renderer_init(struct wlr_drm_renderer *renderer, int fd); + +void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer); + +bool wlr_drm_surface_init(struct wlr_drm_renderer *renderer, + struct wlr_drm_surface *surf, uint32_t width, uint32_t height, + uint32_t format, uint32_t flags); + +void wlr_drm_surface_finish(struct wlr_drm_renderer *renderer, + struct wlr_drm_surface *surf); + +void wlr_drm_surface_make_current(struct wlr_drm_renderer *renderer, + struct wlr_drm_surface *surf); + +struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_renderer *renderer, + struct wlr_drm_surface *surf); + +struct gbm_bo *wlr_drm_surface_get_front(struct wlr_drm_renderer *renderer, + struct wlr_drm_surface *surf); + +#endif -- cgit v1.2.3