@ -315,69 +315,3 @@ drm_output_render_gl(struct drm_output_state *state, pixman_region32_t *damage)
return ret ;
}
static void
switch_to_gl_renderer ( struct drm_backend * b )
{
struct drm_device * device = b - > drm ;
struct drm_output * output ;
bool dmabuf_support_inited ;
bool linux_explicit_sync_inited ;
if ( ! b - > use_pixman )
return ;
dmabuf_support_inited = ! ! b - > compositor - > renderer - > import_dmabuf ;
linux_explicit_sync_inited =
b - > compositor - > capabilities & WESTON_CAP_EXPLICIT_SYNC ;
weston_log ( " Switching to GL renderer \n " ) ;
b - > gbm = create_gbm_device ( device - > drm . fd ) ;
if ( ! b - > gbm ) {
weston_log ( " Failed to create gbm device. "
" Aborting renderer switch \n " ) ;
return ;
}
wl_list_for_each ( output , & b - > compositor - > output_list , base . link )
pixman_renderer_output_destroy ( & output - > base ) ;
b - > compositor - > renderer - > destroy ( b - > compositor ) ;
if ( drm_backend_create_gl_renderer ( b ) < 0 ) {
gbm_device_destroy ( b - > gbm ) ;
weston_log ( " Failed to create GL renderer. Quitting. \n " ) ;
/* FIXME: we need a function to shutdown cleanly */
assert ( 0 ) ;
}
wl_list_for_each ( output , & b - > compositor - > output_list , base . link )
drm_output_init_egl ( output , b ) ;
b - > use_pixman = 0 ;
if ( ! dmabuf_support_inited & & b - > compositor - > renderer - > import_dmabuf ) {
if ( linux_dmabuf_setup ( b - > compositor ) < 0 )
weston_log ( " Error: initializing dmabuf "
" support failed. \n " ) ;
}
if ( ! linux_explicit_sync_inited & &
( b - > compositor - > capabilities & WESTON_CAP_EXPLICIT_SYNC ) ) {
if ( linux_explicit_synchronization_setup ( b - > compositor ) < 0 )
weston_log ( " Error: initializing explicit "
" synchronization support failed. \n " ) ;
}
}
void
renderer_switch_binding ( struct weston_keyboard * keyboard ,
const struct timespec * time , uint32_t key , void * data )
{
struct drm_backend * b =
to_drm_backend ( keyboard - > seat - > compositor ) ;
switch_to_gl_renderer ( b ) ;
}