[Mesa-dev] [PATCH v1 2/3] platform/android: Enable kms_swrast fallback

Robert Foss robert.foss at collabora.com
Mon Jul 9 14:00:03 UTC 2018


Hey Eric,

Thanks for the quick reviews!

On 09/07/18 15:45, Eric Engestrom wrote:
> On Monday, 2018-07-09 13:01:49 +0200, Robert Foss wrote:
>> Add support for the ForceSoftware option, which is togglable
>> on the Android platform through setting the "drm.gpu.force_software"
>> property to a non-zero value.
>>
>> kms_swrast is also enabled as a fallback for when a driver is not
>> able to be loaded for for a drm node that was opened.
>>
>> Signed-off-by: Robert Foss <robert.foss at collabora.com>
>> ---
>>
>> Changes since RFC:
>>    - Removed whitespace change
>>    - Switched variable type from int to EGLBoolean
>>    - Removed software renderer fallback from platform_android, since
>>      it is already implemented in _eglMatchDriver()
>>
>>   src/egl/drivers/dri2/platform_android.c | 19 +++++++++++--------
>>   1 file changed, 11 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
>> index 92b2d2b343e..14a69abbc04 100644
>> --- a/src/egl/drivers/dri2/platform_android.c
>> +++ b/src/egl/drivers/dri2/platform_android.c
>> @@ -1193,12 +1193,16 @@ static const __DRIextension *droid_image_loader_extensions[] = {
>>   };
>>   
>>   EGLBoolean
>> -droid_load_driver(_EGLDisplay *disp)
>> +droid_load_driver(_EGLDisplay *disp, EGLBoolean force_software)
>>   {
>>      struct dri2_egl_display *dri2_dpy = disp->DriverData;
>>      const char *err;
>>   
>> -   dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd);
>> +   if (force_software)
> 
> You could use `disp->Options.ForceSoftware` directly here, and drop the
> added parameter as well as the local var below and the call change.
> 
> With that:
> Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>

Ack.

> 
>> +      dri2_dpy->driver_name = strdup("kms_swrast");
>> +   else
>> +      dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd);
>> +
>>      if (dri2_dpy->driver_name == NULL)
>>         return false;
>>   
>> @@ -1359,13 +1363,10 @@ EGLBoolean
>>   dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp)
>>   {
>>      struct dri2_egl_display *dri2_dpy;
>> +   EGLBoolean force_software = disp->Options.ForceSoftware;
>>      const char *err;
>>      int ret;
>>   
>> -   /* Not supported yet */
>> -   if (disp->Options.ForceSoftware)
>> -      return EGL_FALSE;
>> -
>>      loader_set_logger(_eglLog);
>>   
>>      dri2_dpy = calloc(1, sizeof(*dri2_dpy));
>> @@ -1384,11 +1385,13 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp)
>>   
>>      dri2_dpy->fd = droid_open_device(disp);
>>      if (dri2_dpy->fd < 0) {
>> -      err = "DRI2: failed to open device";
>> +      err = "DRI2: failed to open device, trying software device";
>>         goto cleanup;
>>      }
>>   
>> -   if (!droid_load_driver(disp)) {
>> +   /* Fallback to forcing software rendering is implemented using
>> +    * disp->Options.ForceSoftware in egldriver.c */
>> +   if (!droid_load_driver(disp, force_software)) {
>>         err = "DRI2: failed to load driver";
>>         goto cleanup;
>>      }
>> -- 
>> 2.17.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list