renderer/native: Try the gbm renderer before the EGLDevice renderer
This switches the order of what renderer mode is tried first, so that the gbm renderer mode is preferred on an NVIDIA driver where it is supported. We fall back to still try the EGLDevice renderer mode if the created gbm renderer is not hardware accelerated. The last fallback is still to use the gbm renderer, even if it is not hardware accelerated, as this is needed when hardware acceleration isn't available at all. The original reason for the old order was due to the fact that a gbm renderer without hardware acceleration would succeed even on NVIDIA driver that didn't support gbm. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2051>
This commit is contained in:
parent
e8249a572d
commit
8fc1325e8e
@ -1652,11 +1652,12 @@ meta_renderer_native_create_renderer_gpu_data (MetaRendererNative *renderer_nat
|
|||||||
MetaBackend *backend = meta_renderer_get_backend (renderer);
|
MetaBackend *backend = meta_renderer_get_backend (renderer);
|
||||||
MetaDevicePool *device_pool =
|
MetaDevicePool *device_pool =
|
||||||
meta_backend_native_get_device_pool (META_BACKEND_NATIVE (backend));
|
meta_backend_native_get_device_pool (META_BACKEND_NATIVE (backend));
|
||||||
MetaRendererNativeGpuData *renderer_gpu_data;
|
MetaRendererNativeGpuData *gbm_renderer_gpu_data;
|
||||||
MetaDeviceFileFlags device_file_flags = META_DEVICE_FILE_FLAG_NONE;
|
MetaDeviceFileFlags device_file_flags = META_DEVICE_FILE_FLAG_NONE;
|
||||||
g_autoptr (MetaDeviceFile) device_file = NULL;
|
g_autoptr (MetaDeviceFile) device_file = NULL;
|
||||||
GError *gbm_error = NULL;
|
GError *gbm_error = NULL;
|
||||||
#ifdef HAVE_EGL_DEVICE
|
#ifdef HAVE_EGL_DEVICE
|
||||||
|
MetaRendererNativeGpuData *egl_stream_renderer_gpu_data;
|
||||||
GError *egl_device_error = NULL;
|
GError *egl_device_error = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1674,31 +1675,34 @@ meta_renderer_native_create_renderer_gpu_data (MetaRendererNative *renderer_nat
|
|||||||
if (!device_file)
|
if (!device_file)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
gbm_renderer_gpu_data = create_renderer_gpu_data_gbm (renderer_native,
|
||||||
|
device_file,
|
||||||
|
gpu_kms,
|
||||||
|
&gbm_error);
|
||||||
|
if (gbm_renderer_gpu_data)
|
||||||
|
{
|
||||||
|
MetaRenderDevice *render_device = gbm_renderer_gpu_data->render_device;
|
||||||
|
|
||||||
|
if (meta_render_device_is_hardware_accelerated (render_device))
|
||||||
|
return gbm_renderer_gpu_data;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_EGL_DEVICE
|
#ifdef HAVE_EGL_DEVICE
|
||||||
/* Try to initialize the EGLDevice backend first. Whenever we use a
|
egl_stream_renderer_gpu_data =
|
||||||
* non-NVIDIA GPU, the EGLDevice enumeration function won't find a match, and
|
create_renderer_gpu_data_egl_device (renderer_native,
|
||||||
* we'll fall back to GBM (which will always succeed as it has a software
|
device_file,
|
||||||
* rendering fallback)
|
gpu_kms,
|
||||||
*/
|
&egl_device_error);
|
||||||
renderer_gpu_data = create_renderer_gpu_data_egl_device (renderer_native,
|
if (egl_stream_renderer_gpu_data)
|
||||||
device_file,
|
{
|
||||||
gpu_kms,
|
g_clear_pointer (&gbm_renderer_gpu_data,
|
||||||
&egl_device_error);
|
meta_renderer_native_gpu_data_free);
|
||||||
if (renderer_gpu_data)
|
return egl_stream_renderer_gpu_data;
|
||||||
return renderer_gpu_data;
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
renderer_gpu_data = create_renderer_gpu_data_gbm (renderer_native,
|
if (gbm_renderer_gpu_data)
|
||||||
device_file,
|
return gbm_renderer_gpu_data;
|
||||||
gpu_kms,
|
|
||||||
&gbm_error);
|
|
||||||
if (renderer_gpu_data)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_EGL_DEVICE
|
|
||||||
g_error_free (egl_device_error);
|
|
||||||
#endif
|
|
||||||
return renderer_gpu_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_set_error (error, G_IO_ERROR,
|
g_set_error (error, G_IO_ERROR,
|
||||||
G_IO_ERROR_FAILED,
|
G_IO_ERROR_FAILED,
|
||||||
|
Loading…
Reference in New Issue
Block a user