gl-renderer: use gl_renderer_get_egl_config() for display_create

Replace a direct call to egl_choose_config() with a higher level function
gl_renderer_get_egl_config(). This will make follow-up work easier when
attribute lists will be generated inside gl_renderer_get_egl_config() instead
of passed in as is.

We explicitly replace visual_id with drm_formats, because that is what they
really are. Only the DRM backend passes in other than NULL/0, and if other
backends start caring about the actual pixel format, drm_format is the lingua
franca.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 5 years ago
parent 8e42af02a6
commit d8e851899a
  1. 4
      libweston/backend-drm/drm.c
  2. 10
      libweston/renderer-gl/gl-renderer.c
  3. 4
      libweston/renderer-gl/gl-renderer.h

@ -735,12 +735,12 @@ fallback_format_for(uint32_t format)
static int static int
drm_backend_create_gl_renderer(struct drm_backend *b) drm_backend_create_gl_renderer(struct drm_backend *b)
{ {
EGLint format[3] = { uint32_t format[3] = {
b->gbm_format, b->gbm_format,
fallback_format_for(b->gbm_format), fallback_format_for(b->gbm_format),
0, 0,
}; };
int n_formats = 2; unsigned n_formats = 2;
if (format[1]) if (format[1])
n_formats = 3; n_formats = 3;

@ -3388,8 +3388,8 @@ gl_renderer_display_create(struct weston_compositor *ec,
EGLenum platform, EGLenum platform,
void *native_display, void *native_display,
const EGLint *config_attribs, const EGLint *config_attribs,
const EGLint *visual_id, const uint32_t *drm_formats,
int n_ids) unsigned drm_formats_count)
{ {
struct gl_renderer *gr; struct gl_renderer *gr;
EGLint major, minor; EGLint major, minor;
@ -3454,8 +3454,10 @@ gl_renderer_display_create(struct weston_compositor *ec,
log_egl_info(gr->egl_display); log_egl_info(gr->egl_display);
if (egl_choose_config(gr, config_attribs, visual_id, gr->egl_config = gl_renderer_get_egl_config(gr, config_attribs,
n_ids, &gr->egl_config) < 0) { drm_formats,
drm_formats_count);
if (gr->egl_config == EGL_NO_CONFIG_KHR) {
weston_log("failed to choose EGL config\n"); weston_log("failed to choose EGL config\n");
goto fail_terminate; goto fail_terminate;
} }

@ -64,8 +64,8 @@ struct gl_renderer_interface {
EGLenum platform, EGLenum platform,
void *native_display, void *native_display,
const EGLint *config_attribs, const EGLint *config_attribs,
const EGLint *visual_id, const uint32_t *drm_formats,
const int n_ids); unsigned drm_formats_count);
int (*output_window_create)(struct weston_output *output, int (*output_window_create)(struct weston_output *output,
EGLNativeWindowType window_for_legacy, EGLNativeWindowType window_for_legacy,

Loading…
Cancel
Save