@ -176,7 +176,8 @@ drm_output_plane_cursor_has_valid_format(struct weston_view *ev)
}
}
static struct drm_plane_state *
static struct drm_plane_state *
drm_output_prepare_overlay_view ( struct drm_output_state * output_state ,
drm_output_prepare_overlay_view ( struct drm_plane * plane ,
struct drm_output_state * output_state ,
struct weston_view * ev ,
struct weston_view * ev ,
enum drm_output_propose_state_mode mode ,
enum drm_output_propose_state_mode mode ,
uint64_t zpos )
uint64_t zpos )
@ -184,7 +185,6 @@ drm_output_prepare_overlay_view(struct drm_output_state *output_state,
struct drm_output * output = output_state - > output ;
struct drm_output * output = output_state - > output ;
struct weston_compositor * ec = output - > base . compositor ;
struct weston_compositor * ec = output - > base . compositor ;
struct drm_backend * b = to_drm_backend ( ec ) ;
struct drm_backend * b = to_drm_backend ( ec ) ;
struct drm_plane * p ;
struct drm_plane_state * state = NULL ;
struct drm_plane_state * state = NULL ;
struct drm_fb * fb ;
struct drm_fb * fb ;
int ret ;
int ret ;
@ -204,75 +204,67 @@ drm_output_prepare_overlay_view(struct drm_output_state *output_state,
return NULL ;
return NULL ;
}
}
wl_list_for_each ( p , & b - > plane_list , link ) {
state = drm_output_state_get_plane ( output_state , plane ) ;
if ( p - > type ! = WDRM_PLANE_TYPE_OVERLAY )
if ( state - > fb ) {
continue ;
state = NULL ;
goto out ;
}
if ( ! drm_plane_is_available ( p , output ) )
state - > ev = ev ;
continue ;
state - > output = output ;
if ( ! drm_plane_state_coords_for_view ( state , ev , zpos ) ) {
drm_debug ( b , " \t \t \t \t [overlay] not placing view %p on overlay: "
" unsuitable transform \n " , ev ) ;
drm_plane_state_put_back ( state ) ;
state = NULL ;
goto out ;
}
state = drm_output_state_get_plane ( output_state , p ) ;
/* If the surface buffer has an in-fence fd, but the plane
if ( state - > fb ) {
* doesn ' t support fences , we can ' t place the buffer on this
state = NULL ;
* plane . */
continue ;
if ( ev - > surface - > acquire_fence_fd > = 0 & &
}
plane - > props [ WDRM_PLANE_IN_FENCE_FD ] . prop_id = = 0 ) {
drm_debug ( b , " \t \t \t \t [overlay] not placing view %p on overlay: "
" no in-fence support \n " , ev ) ;
drm_plane_state_put_back ( state ) ;
state = NULL ;
goto out ;
}
state - > ev = ev ;
/* We hold one reference for the lifetime of this function;
state - > output = output ;
* from calling drm_fb_get_from_view , to the out label where
if ( ! drm_plane_state_coords_for_view ( state , ev , zpos ) ) {
* we unconditionally drop the reference . So , we take another
drm_debug ( b , " \t \t \t \t [overlay] not placing view %p on overlay: "
* reference here to live within the state . */
" unsuitable transform \n " , ev ) ;
state - > fb = drm_fb_ref ( fb ) ;
drm_plane_state_put_back ( state ) ;
state = NULL ;
continue ;
}
/* If the surface buffer has an in-fence fd, but the plane
state - > in_fence_fd = ev - > surface - > acquire_fence_fd ;
* doesn ' t support fences , we can ' t place the buffer on this
* plane . */
if ( ev - > surface - > acquire_fence_fd > = 0 & &
p - > props [ WDRM_PLANE_IN_FENCE_FD ] . prop_id = = 0 ) {
drm_debug ( b , " \t \t \t \t [overlay] not placing view %p on overlay: "
" no in-fence support \n " , ev ) ;
drm_plane_state_put_back ( state ) ;
state = NULL ;
continue ;
}
/* We hold one reference for the lifetime of this function;
/* In planes-only mode, we don't have an incremental state to
* from calling drm_fb_get_from_view , to the out label where
* test against , so we just hope it ' ll work . */
* we unconditionally drop the reference . So , we take another
if ( mode = = DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY ) {
* reference here to live within the state . */
drm_debug ( b , " \t \t \t [overlay] provisionally placing "
state - > fb = drm_fb_ref ( fb ) ;
" view %p on overlay %lu in planes-only mode \n " ,
ev , ( unsigned long ) plane - > plane_id ) ;
state - > in_fence_fd = ev - > surface - > acquire_fence_fd ;
availability = PLACED_ON_PLANE ;
goto out ;
/* In planes-only mode, we don't have an incremental state to
}
* test against , so we just hope it ' ll work . */
if ( mode = = DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY ) {
drm_debug ( b , " \t \t \t \t [overlay] provisionally placing "
" view %p on overlay %lu in planes-only mode \n " ,
ev , ( unsigned long ) p - > plane_id ) ;
availability = PLACED_ON_PLANE ;
goto out ;
}
ret = drm_pending_state_test ( output_state - > pending_state ) ;
ret = drm_pending_state_test ( output_state - > pending_state ) ;
if ( ret = = 0 ) {
if ( ret = = 0 ) {
drm_debug ( b , " \t \t \t \t [overlay] provisionally placing "
drm_debug ( b , " \t \t \t [overlay] provisionally placing "
" view %p on overlay %d in mixed mode \n " ,
" view %p on overlay %d in mixed mode \n " ,
ev , p - > plane_id ) ;
ev , plane - > plane_id ) ;
availability = PLACED_ON_PLANE ;
availability = PLACED_ON_PLANE ;
goto out ;
goto out ;
}
}
drm_debug ( b , " \t \t \t \t [overlay] not placing view %p on overlay %lu "
drm_debug ( b , " \t \t \t [overlay] not placing view %p on overlay %lu "
" in mixed mode: kernel test failed \n " ,
" in mixed mode: kernel test failed \n " ,
ev , ( unsigned long ) p - > plane_id ) ;
ev , ( unsigned long ) plane - > plane_id ) ;
drm_plane_state_put_back ( state ) ;
drm_plane_state_put_back ( state ) ;
state = NULL ;
state = NULL ;
}
switch ( availability ) {
switch ( availability ) {
case NO_PLANES :
case NO_PLANES :
@ -555,7 +547,7 @@ drm_output_try_view_on_plane(struct drm_plane *plane,
plane - > plane_id , ev ) ;
plane - > plane_id , ev ) ;
return NULL ;
return NULL ;
}
}
return drm_output_prepare_overlay_view ( state , ev , mode , zpos ) ;
return drm_output_prepare_overlay_view ( plane , state , ev , mode , zpos ) ;
case WDRM_PLANE_TYPE_PRIMARY :
case WDRM_PLANE_TYPE_PRIMARY :
if ( mode ! = DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY ) {
if ( mode ! = DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY ) {
drm_debug ( b , " \t \t \t \t [plane] plane %d refusing to "
drm_debug ( b , " \t \t \t \t [plane] plane %d refusing to "