[Mesa-dev] [PATCH v2 3/4] platform/android: Enable kms_swrast fallback

Robert Foss robert.foss at collabora.com
Tue Jul 17 12:11:40 UTC 2018


Hey Eric,

Thanks for the review, adding you r-b.

On 2018-07-17 12:48, Eric Engestrom wrote:
> On Tuesday, 2018-07-17 12:32:59 +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>
>> Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>
>> ---
>>
>> Changes since v1:
>>    - Added r-b
>>    - Removed local variable
>>
>> 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 | 18 ++++++++++--------
>>   1 file changed, 10 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
>> index 92b2d2b343e..d17b2fb6073 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)
> 
> My suggestion was actually to use `disp->Options.ForceSoftware` directly here,
> instead of passing both `disp` and `disp->Options.ForceSoftware` as parameters :)
> 
>> +      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;
>>   
>> @@ -1362,10 +1366,6 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp)
>>      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 +1384,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, disp->Options.ForceSoftware)) {
>>         err = "DRI2: failed to load driver";
>>         goto cleanup;
>>      }
>> -- 
>> 2.17.1
>>


More information about the mesa-dev mailing list