2012-11-13 22:10:28 +04:00
|
|
|
/*
|
|
|
|
* Copyright © 2012 John Kåre Alsaker
|
|
|
|
*
|
2015-06-12 01:35:43 +03:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
2012-11-13 22:10:28 +04:00
|
|
|
*
|
2015-06-12 01:35:43 +03:00
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial
|
|
|
|
* portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
2012-11-13 22:10:28 +04:00
|
|
|
*/
|
|
|
|
|
2013-05-22 19:03:19 +04:00
|
|
|
#include "config.h"
|
|
|
|
|
2016-07-19 14:16:27 +03:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2019-03-28 17:28:47 +03:00
|
|
|
#include <libweston/libweston.h>
|
2019-07-16 23:11:25 +03:00
|
|
|
#include "backend.h"
|
2019-07-10 13:46:39 +03:00
|
|
|
#include "libweston-internal.h"
|
2012-11-13 22:10:28 +04:00
|
|
|
|
2013-01-08 20:09:02 +04:00
|
|
|
#ifdef ENABLE_EGL
|
|
|
|
|
2012-11-13 22:10:28 +04:00
|
|
|
#include <EGL/egl.h>
|
2015-03-24 15:12:00 +03:00
|
|
|
#include <EGL/eglext.h>
|
2012-11-13 22:10:28 +04:00
|
|
|
|
2013-01-08 20:09:02 +04:00
|
|
|
#else
|
|
|
|
|
|
|
|
typedef int EGLint;
|
2015-03-24 15:12:01 +03:00
|
|
|
typedef int EGLenum;
|
2013-01-11 14:50:45 +04:00
|
|
|
typedef void *EGLDisplay;
|
|
|
|
typedef void *EGLSurface;
|
2015-03-24 15:12:05 +03:00
|
|
|
typedef void *EGLConfig;
|
2013-01-11 14:50:45 +04:00
|
|
|
typedef intptr_t EGLNativeDisplayType;
|
|
|
|
typedef intptr_t EGLNativeWindowType;
|
2013-12-04 17:34:45 +04:00
|
|
|
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
|
2013-01-08 20:09:02 +04:00
|
|
|
|
2015-03-24 15:12:02 +03:00
|
|
|
#endif /* ENABLE_EGL */
|
|
|
|
|
2013-10-28 07:24:54 +04:00
|
|
|
enum gl_renderer_border_side {
|
|
|
|
GL_RENDERER_BORDER_TOP = 0,
|
|
|
|
GL_RENDERER_BORDER_LEFT = 1,
|
|
|
|
GL_RENDERER_BORDER_RIGHT = 2,
|
|
|
|
GL_RENDERER_BORDER_BOTTOM = 3,
|
|
|
|
};
|
|
|
|
|
2013-10-14 16:57:11 +04:00
|
|
|
struct gl_renderer_interface {
|
2016-05-18 18:41:07 +03:00
|
|
|
int (*display_create)(struct weston_compositor *ec,
|
|
|
|
EGLenum platform,
|
2019-09-19 12:17:28 +03:00
|
|
|
void *native_display,
|
2019-09-13 16:14:19 +03:00
|
|
|
const uint32_t *drm_formats,
|
|
|
|
unsigned drm_formats_count);
|
2013-10-14 16:57:11 +04:00
|
|
|
|
2016-05-18 18:43:00 +03:00
|
|
|
int (*output_window_create)(struct weston_output *output,
|
|
|
|
EGLNativeWindowType window_for_legacy,
|
|
|
|
void *window_for_platform,
|
2019-09-13 15:35:10 +03:00
|
|
|
const uint32_t *drm_formats,
|
|
|
|
unsigned drm_formats_count);
|
2013-10-14 16:57:11 +04:00
|
|
|
|
|
|
|
void (*output_destroy)(struct weston_output *output);
|
|
|
|
|
2013-10-28 07:24:54 +04:00
|
|
|
/* Sets the output border.
|
|
|
|
*
|
|
|
|
* The side specifies the side for which we are setting the border.
|
|
|
|
* The width and height are the width and height of the border.
|
|
|
|
* The tex_width patemeter specifies the width of the actual
|
|
|
|
* texture; this may be larger than width if the data is not
|
|
|
|
* tightly packed.
|
|
|
|
*
|
|
|
|
* The top and bottom textures will extend over the sides to the
|
2014-04-11 12:42:59 +04:00
|
|
|
* full width of the bordered window. The right and left edges,
|
|
|
|
* however, will extend only to the top and bottom of the
|
2013-10-28 07:24:54 +04:00
|
|
|
* compositor surface. This is demonstrated by the picture below:
|
|
|
|
*
|
|
|
|
* +-----------------------+
|
|
|
|
* | TOP |
|
|
|
|
* +-+-------------------+-+
|
|
|
|
* | | | |
|
|
|
|
* |L| |R|
|
|
|
|
* |E| |I|
|
|
|
|
* |F| |G|
|
|
|
|
* |T| |H|
|
|
|
|
* | | |T|
|
|
|
|
* | | | |
|
|
|
|
* +-+-------------------+-+
|
|
|
|
* | BOTTOM |
|
|
|
|
* +-----------------------+
|
|
|
|
*/
|
|
|
|
void (*output_set_border)(struct weston_output *output,
|
|
|
|
enum gl_renderer_border_side side,
|
|
|
|
int32_t width, int32_t height,
|
|
|
|
int32_t tex_width, unsigned char *data);
|
|
|
|
|
2018-05-22 06:05:14 +03:00
|
|
|
/* Create fence sync FD to wait for GPU rendering.
|
|
|
|
*
|
|
|
|
* Return FD on success, -1 on failure or unsupported
|
|
|
|
* EGL_ANDROID_native_fence_sync extension.
|
|
|
|
*/
|
|
|
|
int (*create_fence_fd)(struct weston_output *output);
|
2013-10-14 16:57:11 +04:00
|
|
|
};
|