[Mesa-dev] [RFC 2/5] egl/android: Add Android property for forcing kms_swrast

Tomasz Figa tfiga at chromium.org
Thu Jul 5 14:16:31 UTC 2018


On Thu, Jul 5, 2018 at 7:07 PM Robert Foss <robert.foss at collabora.com> wrote:
>
> In order to simplify Android bringup on new devices,
> provide the property "drm.gpu.force_software" which
> forces kms_swrast to be used.
>
> Signed-off-by: Robert Foss <robert.foss at collabora.com>
> ---
>  src/egl/main/egldriver.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
> index 218b3daef25..bb9e90c157d 100644
> --- a/src/egl/main/egldriver.c
> +++ b/src/egl/main/egldriver.c
> @@ -39,6 +39,10 @@
>  #include <stdlib.h>
>  #include "c11/threads.h"
>
> +#ifdef HAVE_ANDROID_PLATFORM
> +#include <cutils/properties.h>
> +#endif
> +
>  #include "egldefines.h"
>  #include "egldisplay.h"
>  #include "egldriver.h"
> @@ -87,6 +91,12 @@ _eglMatchDriver(_EGLDisplay *dpy)
>     dpy->Options.ForceSoftware =
>        env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false);
>
> +#ifdef HAVE_ANDROID_PLATFORM
> +   char prop_val[PROPERTY_VALUE_MAX];
> +   property_get("drm.gpu.force_software", prop_val, "0");
> +   dpy->Options.ForceSoftware |= strncmp(prop_val, "0", PROPERTY_VALUE_MAX);

ForceSoftware is an EGLBoolean, which is just an unsigned int, not
stdbool, so no implicit conversion into {0, 1} for us here. I think
what we want here is

dpy->Options.ForceSoftware |= strncmp(prop_val, "0", PROPERTY_VALUE_MAX) != 0;

Best regards,
Tomasz


More information about the mesa-dev mailing list