Add function to query the DRM device given an EGLDisplay. It is the
device being used by the compositor to perform composition.
This will be useful in the next commits of this series, where we add
support for dma-buf feedback.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This is to put more of the EGL client extension handling in the same
place. This also adds a boolean to check if EGL_EXT_platform_base is
supported, similar to other extensions we check.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
EGL client extensions are not tied to the EGLDisplay we create, and have
an effect on how we create the EGLDisplay. Since we're using this to
look for EGL_EXT_platform_base, it makes more sense for this to be near
the start of the GL renderer initialization.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
When all shared/ headers are included in the same way, we can drop unnecessary
include seach paths from the compiler.
This include style was chosen because it is prevalent in the code base. Doing
anything different would have been a bigger patch.
This also means that we need to keep the project root directory in the include
search path, which means that one could accidentally include private headers
with
#include "libweston/dbus.h"
or even
#include <libweston/dbus.h>
IMO such problem is smaller than the churn caused by any of the alternatives,
and we should be able to catch those in review. We might even be able to catch
those with grep in CI if necessary.
The "bad" include style was found with:
$ for h in shared/*.h; do git grep -F $(basename $h); done | grep -vF '"shared/'
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
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>