gl-renderer: Replace window-create args with struct
gl_rendererer's output_window_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
c890c384c8
commit
db6e6e1ec5
@@ -3172,10 +3172,7 @@ gl_renderer_output_create(struct weston_output *output,
|
||||
|
||||
static int
|
||||
gl_renderer_output_window_create(struct weston_output *output,
|
||||
EGLNativeWindowType window_for_legacy,
|
||||
void *window_for_platform,
|
||||
const uint32_t *drm_formats,
|
||||
unsigned drm_formats_count)
|
||||
const struct gl_renderer_output_options *options)
|
||||
{
|
||||
struct weston_compositor *ec = output->compositor;
|
||||
struct gl_renderer *gr = get_renderer(ec);
|
||||
@@ -3183,10 +3180,10 @@ gl_renderer_output_window_create(struct weston_output *output,
|
||||
int ret = 0;
|
||||
|
||||
egl_surface = gl_renderer_create_window_surface(gr,
|
||||
window_for_legacy,
|
||||
window_for_platform,
|
||||
drm_formats,
|
||||
drm_formats_count);
|
||||
options->window_for_legacy,
|
||||
options->window_for_platform,
|
||||
options->drm_formats,
|
||||
options->drm_formats_count);
|
||||
if (egl_surface == EGL_NO_SURFACE) {
|
||||
weston_log("failed to create egl surface\n");
|
||||
return -1;
|
||||
|
||||
@@ -76,6 +76,17 @@ struct gl_renderer_display_options {
|
||||
unsigned drm_formats_count;
|
||||
};
|
||||
|
||||
struct gl_renderer_output_options {
|
||||
/** Native window handle for \c eglCreateWindowSurface */
|
||||
EGLNativeWindowType window_for_legacy;
|
||||
/** Native window handle for \c eglCreatePlatformWindowSurface */
|
||||
void *window_for_platform;
|
||||
/** Array of DRM pixel formats acceptable for the window */
|
||||
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
|
||||
@@ -114,12 +125,7 @@ struct gl_renderer_interface {
|
||||
* Attach GL-renderer to the output with a native window
|
||||
*
|
||||
* \param output The output to create a rendering surface for.
|
||||
* \param window_for_legacy Native window handle for
|
||||
* eglCreateWindowSurface().
|
||||
* \param window_for_platform Native window handle for
|
||||
* eglCreatePlatformWindowSurface().
|
||||
* \param drm_formats Array of DRM pixel formats that are acceptable.
|
||||
* \param drm_formats_count The drm_formats array length.
|
||||
* \param options The options struct describing output configuration
|
||||
* \return 0 on success, -1 on failure.
|
||||
*
|
||||
* This function creates the renderer data structures needed to repaint
|
||||
@@ -138,10 +144,7 @@ struct gl_renderer_interface {
|
||||
* with \c EGL_WINDOW_BIT in \c egl_surface_type.
|
||||
*/
|
||||
int (*output_window_create)(struct weston_output *output,
|
||||
EGLNativeWindowType window_for_legacy,
|
||||
void *window_for_platform,
|
||||
const uint32_t *drm_formats,
|
||||
unsigned drm_formats_count);
|
||||
const struct gl_renderer_output_options *options);
|
||||
|
||||
/**
|
||||
* Attach GL-renderer to the output with internal pixel storage
|
||||
|
||||
Reference in New Issue
Block a user