@ -166,7 +166,7 @@ struct drm_backend {
int min_height , max_height ;
int no_addfb2 ;
struct wl_list sprit e_list;
struct wl_list plan e_list;
int sprites_are_broken ;
int sprites_hidden ;
@ -1129,7 +1129,7 @@ drm_output_repaint(struct weston_output *output_base,
struct drm_output * output = to_drm_output ( output_base ) ;
struct drm_backend * backend =
to_drm_backend ( output - > base . compositor ) ;
struct drm_plane * s ;
struct drm_plane * p ;
struct drm_mode * mode ;
int ret = 0 ;
@ -1191,28 +1191,29 @@ drm_output_repaint(struct weston_output *output_base,
/*
* Now , update all the sprite surfaces
*/
wl_list_for_each ( s , & backend - > sprit e_list, link ) {
wl_list_for_each ( p , & backend - > plan e_list, link ) {
uint32_t flags = 0 , fb_id = 0 ;
drmVBlank vbl = {
. request . type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT ,
. request . sequence = 1 ,
} ;
/* XXX: Set output much earlier, so we don't attempt to place
* planes on entirely the wrong output . */
if ( ( ! s - > fb_current & & ! s - > fb_pending ) | |
! drm_plane_crtc_supported ( output , s ) )
if ( p - > type ! = WDRM_PLANE_TYPE_OVERLAY )
continue ;
if ( ( ! p - > fb_current & & ! p - > fb_pending ) | |
! drm_plane_crtc_supported ( output , p ) )
continue ;
if ( s - > fb_pending & & ! backend - > sprites_hidden )
fb_id = s - > fb_pending - > fb_id ;
if ( p - > fb_pending & & ! backend - > sprites_hidden )
fb_id = p - > fb_pending - > fb_id ;
ret = drmModeSetPlane ( backend - > drm . fd , s - > plane_id ,
ret = drmModeSetPlane ( backend - > drm . fd , p - > plane_id ,
output - > crtc_id , fb_id , flags ,
s - > dest_x , s - > dest_y ,
s - > dest_w , s - > dest_h ,
s - > src_x , s - > src_y ,
s - > src_w , s - > src_h ) ;
p - > dest_x , p - > dest_y ,
p - > dest_w , p - > dest_h ,
p - > src_x , p - > src_y ,
p - > src_w , p - > src_h ) ;
if ( ret )
weston_log ( " setplane failed: %d: %s \n " ,
ret , strerror ( errno ) ) ;
@ -1223,17 +1224,17 @@ drm_output_repaint(struct weston_output *output_base,
* Queue a vblank signal so we know when the surface
* becomes active on the display or has been replaced .
*/
vbl . request . signal = ( unsigned long ) s ;
vbl . request . signal = ( unsigned long ) p ;
ret = drmWaitVBlank ( backend - > drm . fd , & vbl ) ;
if ( ret ) {
weston_log ( " vblank event request failed: %d: %s \n " ,
ret , strerror ( errno ) ) ;
}
s - > output = output ;
s - > fb_last = s - > fb_current ;
s - > fb_current = s - > fb_pending ;
s - > fb_pending = NULL ;
p - > output = output ;
p - > fb_last = p - > fb_current ;
p - > fb_current = p - > fb_pending ;
p - > fb_pending = NULL ;
output - > vblank_pending + + ;
}
@ -1489,7 +1490,10 @@ drm_output_prepare_overlay_view(struct drm_output *output,
if ( ev - > alpha ! = 1.0f )
return NULL ;
wl_list_for_each ( p , & b - > sprite_list , link ) {
wl_list_for_each ( p , & b - > plane_list , link ) {
if ( p - > type ! = WDRM_PLANE_TYPE_OVERLAY )
continue ;
if ( ! drm_plane_crtc_supported ( output , p ) )
continue ;
@ -2171,7 +2175,7 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane)
drmModeFreeObjectProperties ( props ) ;
weston_plane_init ( & plane - > base , b - > compositor , 0 , 0 ) ;
wl_list_insert ( & b - > sprit e_list, & plane - > link ) ;
wl_list_insert ( & b - > plan e_list, & plane - > link ) ;
return plane ;
}
@ -2232,14 +2236,10 @@ create_sprites(struct drm_backend *b)
if ( ! drm_plane )
continue ;
/* Ignore non-overlay planes for now. */
if ( drm_plane - > type ! = WDRM_PLANE_TYPE_OVERLAY ) {
drm_plane_destroy ( drm_plane ) ;
continue ;
}
weston_compositor_stack_plane ( b - > compositor , & drm_plane - > base ,
& b - > compositor - > primary_plane ) ;
if ( drm_plane - > type = = WDRM_PLANE_TYPE_OVERLAY )
weston_compositor_stack_plane ( b - > compositor ,
& drm_plane - > base ,
& b - > compositor - > primary_plane ) ;
}
drmModeFreePlaneResources ( kplane_res ) ;
@ -2257,7 +2257,7 @@ destroy_sprites(struct drm_backend *b)
{
struct drm_plane * plane , * next ;
wl_list_for_each_safe ( plane , next , & b - > sprit e_list, link )
wl_list_for_each_safe ( plane , next , & b - > plan e_list, link )
drm_plane_destroy ( plane ) ;
}
@ -3490,7 +3490,7 @@ session_notify(struct wl_listener *listener, void *data)
{
struct weston_compositor * compositor = data ;
struct drm_backend * b = to_drm_backend ( compositor ) ;
struct drm_plane * sprit e;
struct drm_plane * plan e;
struct drm_output * output ;
if ( compositor - > session_active ) {
@ -3524,12 +3524,16 @@ session_notify(struct wl_listener *listener, void *data)
output = container_of ( compositor - > output_list . next ,
struct drm_output , base . link ) ;
wl_list_for_each ( sprite , & b - > sprite_list , link )
wl_list_for_each ( plane , & b - > plane_list , link ) {
if ( plane - > type ! = WDRM_PLANE_TYPE_OVERLAY )
continue ;
drmModeSetPlane ( b - > drm . fd ,
sprite - > plane_id ,
plan e- > plane_id ,
output - > crtc_id , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) ;
} ;
}
}
}
/**
@ -3950,7 +3954,7 @@ drm_backend_create(struct weston_compositor *compositor,
weston_setup_vt_switch_bindings ( compositor ) ;
wl_list_init ( & b - > sprit e_list) ;
wl_list_init ( & b - > plan e_list) ;
create_sprites ( b ) ;
if ( udev_input_init ( & b - > input ,