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