gl_renderer: introduce gl_renderer_get_egl_config()

In an attempt to pull more of EGLConfig choosing into one place, refactor code
into the new gl_renderer_get_egl_config(). The purpose of this function is to
find an EGL config that not only satisfies the requested attributes and the
pixel formats if given but also makes sure the config is generally compatible
with the single GL context we have.

All this was already checked in gl_renderer_create_window_surface(), but
gl_renderer_create_pbuffer_surface() is still missing it. This patch is
preparation for fixing the pbuffer path.

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>
This commit is contained in:
Pekka Paalanen
2019-09-13 15:35:10 +03:00
parent 5aaf8dc405
commit 8e42af02a6
5 changed files with 64 additions and 24 deletions
+3 -3
View File
@@ -720,7 +720,7 @@ create_gbm_device(int fd)
* This works around https://bugs.freedesktop.org/show_bug.cgi?id=89689
* but it's entirely possible we'll see this again on other implementations.
*/
static int
static uint32_t
fallback_format_for(uint32_t format)
{
const struct pixel_format_info *pf;
@@ -1338,11 +1338,11 @@ err:
static int
drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
{
EGLint format[2] = {
uint32_t format[2] = {
output->gbm_format,
fallback_format_for(output->gbm_format),
};
int n_formats = 1;
unsigned n_formats = 1;
struct weston_mode *mode = output->base.current_mode;
struct drm_plane *plane = output->scanout_plane;
unsigned int i;