gl-renderer: Replace display-create args with struct
gl_rendererer's output_create has a lot of arguments now. Add a structure for the options to make it more clear what is what. This is in preparation for adding bare-integer arguments which are ripe for confusion when passing positional arguments. Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
committed by
Pekka Paalanen
parent
f9a6162595
commit
c890c384c8
@@ -3374,11 +3374,7 @@ gl_renderer_create_pbuffer_surface(struct gl_renderer *gr) {
|
||||
|
||||
static int
|
||||
gl_renderer_display_create(struct weston_compositor *ec,
|
||||
EGLenum platform,
|
||||
void *native_display,
|
||||
EGLint egl_surface_type,
|
||||
const uint32_t *drm_formats,
|
||||
unsigned drm_formats_count)
|
||||
const struct gl_renderer_display_options *options)
|
||||
{
|
||||
struct gl_renderer *gr;
|
||||
|
||||
@@ -3386,7 +3382,7 @@ gl_renderer_display_create(struct weston_compositor *ec,
|
||||
if (gr == NULL)
|
||||
return -1;
|
||||
|
||||
gr->platform = platform;
|
||||
gr->platform = options->egl_platform;
|
||||
|
||||
if (gl_renderer_setup_egl_client_extensions(gr) < 0)
|
||||
goto fail;
|
||||
@@ -3401,7 +3397,7 @@ gl_renderer_display_create(struct weston_compositor *ec,
|
||||
gl_renderer_surface_get_content_size;
|
||||
gr->base.surface_copy_content = gl_renderer_surface_copy_content;
|
||||
|
||||
if (gl_renderer_setup_egl_display(gr, native_display) < 0)
|
||||
if (gl_renderer_setup_egl_display(gr, options->egl_native_display) < 0)
|
||||
goto fail;
|
||||
|
||||
log_egl_info(gr->egl_display);
|
||||
@@ -3412,13 +3408,16 @@ gl_renderer_display_create(struct weston_compositor *ec,
|
||||
goto fail_with_error;
|
||||
|
||||
if (!gr->has_configless_context) {
|
||||
EGLint egl_surface_type = options->egl_surface_type;
|
||||
|
||||
if (!gr->has_surfaceless_context)
|
||||
egl_surface_type |= EGL_PBUFFER_BIT;
|
||||
|
||||
gr->egl_config = gl_renderer_get_egl_config(gr,
|
||||
egl_surface_type,
|
||||
drm_formats,
|
||||
drm_formats_count);
|
||||
gr->egl_config =
|
||||
gl_renderer_get_egl_config(gr,
|
||||
egl_surface_type,
|
||||
options->drm_formats,
|
||||
options->drm_formats_count);
|
||||
if (gr->egl_config == EGL_NO_CONFIG_KHR) {
|
||||
weston_log("failed to choose EGL config\n");
|
||||
goto fail_terminate;
|
||||
|
||||
@@ -58,18 +58,30 @@ enum gl_renderer_border_side {
|
||||
GL_RENDERER_BORDER_BOTTOM = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* Options passed to the \c display_create method of the GL renderer interface.
|
||||
*
|
||||
* \see struct gl_renderer_interface
|
||||
*/
|
||||
struct gl_renderer_display_options {
|
||||
/** The EGL platform identifier */
|
||||
EGLenum egl_platform;
|
||||
/** The native display corresponding to the given EGL platform */
|
||||
void *egl_native_display;
|
||||
/** EGL_SURFACE_TYPE bits for the base EGLConfig */
|
||||
EGLint egl_surface_type;
|
||||
/** Array of DRM pixel formats acceptable for the base EGLConfig */
|
||||
const uint32_t *drm_formats;
|
||||
/** The \c drm_formats array length */
|
||||
unsigned drm_formats_count;
|
||||
};
|
||||
|
||||
struct gl_renderer_interface {
|
||||
/**
|
||||
* Initialize GL-renderer with the given EGL platform and native display
|
||||
*
|
||||
* \param ec The weston_compositor where to initialize.
|
||||
* \param platform The EGL platform identifier.
|
||||
* \param native_display The native display corresponding to the given
|
||||
* EGL platform.
|
||||
* \param egl_surface_type EGL_SURFACE_TYPE bits for the base EGLConfig.
|
||||
* \param drm_formats Array of DRM pixel formats that are acceptable
|
||||
* for the base EGLConfig.
|
||||
* \param drm_formats_count The drm_formats array length.
|
||||
* \param options The options struct describing display configuration
|
||||
* \return 0 on success, -1 on failure.
|
||||
*
|
||||
* This function creates an EGLDisplay and initializes it. It also
|
||||
@@ -96,11 +108,7 @@ struct gl_renderer_interface {
|
||||
* DRM format.
|
||||
*/
|
||||
int (*display_create)(struct weston_compositor *ec,
|
||||
EGLenum platform,
|
||||
void *native_display,
|
||||
EGLint egl_surface_type,
|
||||
const uint32_t *drm_formats,
|
||||
unsigned drm_formats_count);
|
||||
const struct gl_renderer_display_options *options);
|
||||
|
||||
/**
|
||||
* Attach GL-renderer to the output with a native window
|
||||
|
||||
Reference in New Issue
Block a user