Replace the old config printer with the new fancy one: less duplicate code,
more details logged.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Print details of all available EGLConfigs in case none match what we are
looking for. This helps debugging.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
If configless_context is not supported, we pick one EGLConfig as the "base
config" because we have just one GL context and different configs between the
context and EGLSurfaces might not work. Until now, we did not actually make
sure to pick the base config.
If the base config matches the requirements, prefer it. Only if it doesn't
match, go looking for another config.
This should give better chances of success on systems where configless_context
is not supported by relying less on eglChooseConfig().
Cc: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Fold more code into the common config choosing, the pbuffer path this time.
Simplifies code and allows gl_renderer_get_egl_config() to grow smarter in the
future to guarantee config compatility in the absence of configless_context
extension.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Now that all backends pass in a list of acceptable DRM formats, that is used to
determine if the EGLConfig has an alpha channel or not. Therefore the
opaque_attribs and alpha_attribs are now useless, and we can remove the whole
config_attribs argument from the API.
gl_renderer_get_egl_config() uses an internal attrib list that matches at least
the union of the opaque_attribs and alpha_attribs matches.
Overall, behaviour should remain unchanged.
The new attribute array becomes variable in the future, so it is left
non-const.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Implement fuzzy EGLConfig pixel format matching, where we ensure that R, G, B
and A channels have the expected number of bits exactly. This is used on EGL
platforms where the EGLConfig native visual ID is not a DRM format code. On EGL
GBM platform, the old exact matching of native visual ID is kept.
As only the DRM backend uses a DRM format list for picking a config, this patch
should not change any behaviour.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Using arrays of pixel_format_info instead of just DRM format codes is useful
for fuzzy matching of formats with EGLConfigs in the future. The immediate
benefit is that we can easily print format names in log messages.
We should never deal with formats we don't have in our database, so discarding
unknown formats should be ok. Using unknown formats would become hard later,
too.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
If configless context is supported, we can skip choosing the "base" config
completely as it will never be used.
This simplifies the code a little bit.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
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>
Start a new source file for EGL glue stuff, for the EGL platform Weston runs
on. gl-renderer.c is getting too long, and I want to add even more boring code
(config pretty-printing etc.).
This pure code move, no changes.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>