From eaed6b6d294e82124cd4f7a70387f590e3910552 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Thu, 19 Oct 2017 12:57:45 -0400 Subject: wl-output: send layout position --- include/wlr/types/wlr_output.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index dc637e26..312b51f8 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -56,6 +56,9 @@ struct wlr_output { struct wl_listener surface_destroy; } cursor; + // the output position in layout space reported to clients + int32_t lx, ly; + void *data; }; @@ -66,6 +69,7 @@ bool wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode); void wlr_output_transform(struct wlr_output *output, enum wl_output_transform transform); +void wlr_output_set_position(struct wlr_output *output, int32_t lx, int32_t ly); bool wlr_output_set_cursor(struct wlr_output *output, const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height, int32_t hotspot_x, int32_t hotspot_y); -- cgit v1.2.3 From 9b984253e2b878128d2042836a8c86228700b1ee Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Sat, 21 Oct 2017 14:48:58 +1300 Subject: Move egl.h to render/egl.h --- backend/drm/backend.c | 2 +- backend/drm/renderer.c | 2 +- backend/wayland/backend.c | 2 +- backend/x11/backend.c | 2 +- include/backend/drm/drm.h | 2 +- include/backend/wayland.h | 2 +- include/backend/x11.h | 2 +- include/render/gles2.h | 2 +- include/wlr/backend.h | 2 +- include/wlr/backend/interface.h | 2 +- include/wlr/egl.h | 66 ----------------------------------------- include/wlr/render/egl.h | 66 +++++++++++++++++++++++++++++++++++++++++ render/egl.c | 2 +- render/gles2/renderer.c | 2 +- render/gles2/texture.c | 2 +- types/wlr_surface.c | 2 +- 16 files changed, 80 insertions(+), 80 deletions(-) delete mode 100644 include/wlr/egl.h create mode 100644 include/wlr/render/egl.h (limited to 'include/wlr') diff --git a/backend/drm/backend.c b/backend/drm/backend.c index d7e2e616..ab66adf5 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include "backend/drm/drm.h" static bool wlr_drm_backend_start(struct wlr_backend *backend) { diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index 0d338490..d53acaa8 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -8,8 +8,8 @@ #include #include -#include #include +#include #include #include #include diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index e57f3583..5018eeb0 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 11dd8568..4ecca325 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -15,7 +15,7 @@ #endif #include #include -#include +#include #include #include #include diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index 6106a85a..7a0e43ea 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include "iface.h" diff --git a/include/backend/wayland.h b/include/backend/wayland.h index 508a7f52..88aeabca 100644 --- a/include/backend/wayland.h +++ b/include/backend/wayland.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/backend/x11.h b/include/backend/x11.h index b4284b63..f5ec56bc 100644 --- a/include/backend/x11.h +++ b/include/backend/x11.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/render/gles2.h b/include/render/gles2.h index 688a51dd..0b7032cc 100644 --- a/include/render/gles2.h +++ b/include/render/gles2.h @@ -8,9 +8,9 @@ #include #include #include -#include #include #include +#include #include #include diff --git a/include/wlr/backend.h b/include/wlr/backend.h index 6c11152f..78d01edf 100644 --- a/include/wlr/backend.h +++ b/include/wlr/backend.h @@ -3,7 +3,7 @@ #include #include -#include +#include struct wlr_backend_impl; diff --git a/include/wlr/backend/interface.h b/include/wlr/backend/interface.h index ea41400a..3f0aaadb 100644 --- a/include/wlr/backend/interface.h +++ b/include/wlr/backend/interface.h @@ -3,7 +3,7 @@ #include #include -#include +#include struct wlr_backend_impl { bool (*start)(struct wlr_backend *backend); diff --git a/include/wlr/egl.h b/include/wlr/egl.h deleted file mode 100644 index 9ab4d9ce..00000000 --- a/include/wlr/egl.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef WLR_EGL_H -#define WLR_EGL_H - -#include -#include -#include - -struct wlr_egl { - EGLDisplay display; - EGLConfig config; - EGLContext context; - - const char *egl_exts; - const char *gl_exts; - - struct wl_display *wl_display; -}; - -// TODO: Allocate and return a wlr_egl -/** - * Initializes an egl context for the given platform and remote display. - * Will attempt to load all possibly required api functions. - */ -bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, EGLint visual_id, void *display); - -/** - * Frees all related egl resources, makes the context not-current and - * unbinds a bound wayland display. - */ -void wlr_egl_free(struct wlr_egl *egl); - -/** - * Binds the given display to the egl instance. - * This will allow clients to create egl surfaces from wayland ones and render to it. - */ -bool wlr_egl_bind_display(struct wlr_egl *egl, struct wl_display *local_display); - -/** - * Refer to the eglQueryWaylandBufferWL extension function. - */ -bool wlr_egl_query_buffer(struct wlr_egl *egl, struct wl_resource *buf, - EGLint attrib, EGLint *value); - -/** - * Returns a surface for the given native window - * The window must match the remote display the wlr_egl was created with. - */ -EGLSurface wlr_egl_create_surface(struct wlr_egl *egl, void *window); - -/** - * Creates an egl image from the given client buffer and attributes. - */ -EGLImageKHR wlr_egl_create_image(struct wlr_egl *egl, - EGLenum target, EGLClientBuffer buffer, const EGLint *attribs); - -/** - * Destroys an egl image created with the given wlr_egl. - */ -bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImageKHR image); - -/** - * Returns a string for the last error ocurred with egl. - */ -const char *egl_error(void); - -#endif diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h new file mode 100644 index 00000000..9ab4d9ce --- /dev/null +++ b/include/wlr/render/egl.h @@ -0,0 +1,66 @@ +#ifndef WLR_EGL_H +#define WLR_EGL_H + +#include +#include +#include + +struct wlr_egl { + EGLDisplay display; + EGLConfig config; + EGLContext context; + + const char *egl_exts; + const char *gl_exts; + + struct wl_display *wl_display; +}; + +// TODO: Allocate and return a wlr_egl +/** + * Initializes an egl context for the given platform and remote display. + * Will attempt to load all possibly required api functions. + */ +bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, EGLint visual_id, void *display); + +/** + * Frees all related egl resources, makes the context not-current and + * unbinds a bound wayland display. + */ +void wlr_egl_free(struct wlr_egl *egl); + +/** + * Binds the given display to the egl instance. + * This will allow clients to create egl surfaces from wayland ones and render to it. + */ +bool wlr_egl_bind_display(struct wlr_egl *egl, struct wl_display *local_display); + +/** + * Refer to the eglQueryWaylandBufferWL extension function. + */ +bool wlr_egl_query_buffer(struct wlr_egl *egl, struct wl_resource *buf, + EGLint attrib, EGLint *value); + +/** + * Returns a surface for the given native window + * The window must match the remote display the wlr_egl was created with. + */ +EGLSurface wlr_egl_create_surface(struct wlr_egl *egl, void *window); + +/** + * Creates an egl image from the given client buffer and attributes. + */ +EGLImageKHR wlr_egl_create_image(struct wlr_egl *egl, + EGLenum target, EGLClientBuffer buffer, const EGLint *attribs); + +/** + * Destroys an egl image created with the given wlr_egl. + */ +bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImageKHR image); + +/** + * Returns a string for the last error ocurred with egl. + */ +const char *egl_error(void); + +#endif diff --git a/render/egl.c b/render/egl.c index 9815b923..08612125 100644 --- a/render/egl.c +++ b/render/egl.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include "render/glapi.h" // Extension documentation diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index 94c50b9a..cf4a0aab 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -5,9 +5,9 @@ #include #include #include -#include #include #include +#include #include #include #include diff --git a/render/gles2/texture.c b/render/gles2/texture.c index 5e934aa4..ff71cb08 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -5,8 +5,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 9e38d701..68c21468 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -2,9 +2,9 @@ #include #include #include -#include #include #include +#include #include static void wlr_surface_state_reset_buffer(struct wlr_surface_state *state) { -- cgit v1.2.3 From 822a9f65a4f965a7561de287013c2a5c159453ab Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Sat, 21 Oct 2017 17:37:25 +1300 Subject: Add pointer to backend inside wlr_output --- backend/drm/drm.c | 2 +- backend/wayland/output.c | 2 +- backend/x11/backend.c | 2 +- include/wlr/interfaces/wlr_output.h | 6 ++++-- include/wlr/types/wlr_output.h | 4 +++- types/wlr_output.c | 3 ++- 6 files changed, 12 insertions(+), 7 deletions(-) (limited to 'include/wlr') diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 0e898d3f..b3057166 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -707,7 +707,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) { drmModeFreeConnector(drm_conn); continue; } - wlr_output_init(&wlr_conn->output, &output_impl); + wlr_output_init(&wlr_conn->output, &drm->backend, &output_impl); struct wl_event_loop *ev = wl_display_get_event_loop(drm->display); wlr_conn->retry_pageflip = wl_event_loop_add_timer(ev, retry_pageflip, diff --git a/backend/wayland/output.c b/backend/wayland/output.c index e1138ee1..0216823e 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -241,7 +241,7 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) { wlr_log(L_ERROR, "Failed to allocate wlr_wl_backend_output"); return NULL; } - wlr_output_init(&output->wlr_output, &output_impl); + wlr_output_init(&output->wlr_output, &backend->backend, &output_impl); struct wlr_output *wlr_output = &output->wlr_output; wlr_output->width = 640; diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 4ecca325..d30ec376 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -264,7 +264,7 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) { output->x11 = x11; - wlr_output_init(&output->wlr_output, &output_impl); + wlr_output_init(&output->wlr_output, &x11->backend, &output_impl); snprintf(output->wlr_output.name, sizeof(output->wlr_output.name), "X11-1"); output->win = xcb_generate_id(x11->xcb_conn); diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index b7927569..17dd5538 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -1,8 +1,9 @@ #ifndef WLR_INTERFACES_WLR_OUTPUT_H #define WLR_INTERFACES_WLR_OUTPUT_H -#include #include +#include +#include struct wlr_output_impl { void (*enable)(struct wlr_output *output, bool enable); @@ -21,7 +22,8 @@ struct wlr_output_impl { uint16_t (*get_gamma_size)(struct wlr_output *output); }; -void wlr_output_init(struct wlr_output *output, const struct wlr_output_impl *impl); +void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, + const struct wlr_output_impl *impl); void wlr_output_free(struct wlr_output *output); void wlr_output_update_matrix(struct wlr_output *output); struct wl_global *wlr_output_create_global( diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 312b51f8..a2d595ea 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -1,9 +1,10 @@ #ifndef WLR_TYPES_WLR_OUTPUT_H #define WLR_TYPES_WLR_OUTPUT_H +#include #include +#include #include -#include struct wlr_output_mode { uint32_t flags; // enum wl_output_mode @@ -15,6 +16,7 @@ struct wlr_output_impl; struct wlr_output { const struct wlr_output_impl *impl; + struct wlr_backend *backend; struct wl_global *wl_global; struct wl_list wl_resources; diff --git a/types/wlr_output.c b/types/wlr_output.c index 5e10509e..c89c5c45 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -307,8 +307,9 @@ bool wlr_output_move_cursor(struct wlr_output *output, int x, int y) { return output->impl->move_cursor(output, x, y); } -void wlr_output_init(struct wlr_output *output, +void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, const struct wlr_output_impl *impl) { + output->backend = backend; output->impl = impl; output->modes = list_create(); output->transform = WL_OUTPUT_TRANSFORM_NORMAL; -- cgit v1.2.3