@ -403,7 +403,6 @@ drm_property_info_free(struct drm_property_info *info, int num_props)
memset ( info , 0 , sizeof ( * info ) * num_props ) ;
}
# ifdef HAVE_DRM_FORMATS_BLOB
static inline uint32_t *
formats_ptr ( struct drm_format_modifier_blob * blob )
{
@ -416,7 +415,6 @@ modifiers_ptr(struct drm_format_modifier_blob *blob)
return ( struct drm_format_modifier * )
( ( ( char * ) blob ) + blob - > modifiers_offset ) ;
}
# endif
/**
* Populates the plane ' s formats array , using either the IN_FORMATS blob
@ -427,7 +425,6 @@ drm_plane_populate_formats(struct drm_plane *plane, const drmModePlane *kplane,
const drmModeObjectProperties * props )
{
unsigned i ;
# ifdef HAVE_DRM_FORMATS_BLOB
drmModePropertyBlobRes * blob ;
struct drm_format_modifier_blob * fmt_mod_blob ;
struct drm_format_modifier * blob_modifiers ;
@ -494,7 +491,6 @@ drm_plane_populate_formats(struct drm_plane *plane, const drmModePlane *kplane,
return 0 ;
fallback :
# endif
/* No IN_FORMATS blob available, so just use the old. */
assert ( plane - > count_formats = = kplane - > count_formats ) ;
for ( i = 0 ; i < kplane - > count_formats ; i + + ) {
@ -782,7 +778,6 @@ err:
return - 1 ;
}
# ifdef HAVE_DRM_ATOMIC
static int
crtc_add_prop ( drmModeAtomicReq * req , struct drm_output * output ,
enum wdrm_crtc_property prop , uint64_t val )
@ -1241,7 +1236,6 @@ out:
drm_pending_state_free ( pending_state ) ;
return ret ;
}
# endif
/**
* Tests a pending state , to see if the kernel will accept the update as
@ -1264,13 +1258,11 @@ out:
int
drm_pending_state_test ( struct drm_pending_state * pending_state )
{
# ifdef HAVE_DRM_ATOMIC
struct drm_backend * b = pending_state - > backend ;
if ( b - > atomic_modeset )
return drm_pending_state_apply_atomic ( pending_state ,
DRM_STATE_TEST_ONLY ) ;
# endif
/* We have no way to test state before application on the legacy
* modesetting API , so just claim it succeeded . */
@ -1291,11 +1283,9 @@ drm_pending_state_apply(struct drm_pending_state *pending_state)
struct drm_output_state * output_state , * tmp ;
uint32_t * unused ;
# ifdef HAVE_DRM_ATOMIC
if ( b - > atomic_modeset )
return drm_pending_state_apply_atomic ( pending_state ,
DRM_STATE_APPLY_ASYNC ) ;
# endif
if ( b - > state_invalid ) {
/* If we need to reset all our state (e.g. because we've
@ -1349,11 +1339,9 @@ drm_pending_state_apply_sync(struct drm_pending_state *pending_state)
struct drm_output_state * output_state , * tmp ;
uint32_t * unused ;
# ifdef HAVE_DRM_ATOMIC
if ( b - > atomic_modeset )
return drm_pending_state_apply_atomic ( pending_state ,
DRM_STATE_APPLY_SYNC ) ;
# endif
if ( b - > state_invalid ) {
/* If we need to reset all our state (e.g. because we've
@ -1417,7 +1405,6 @@ page_flip_handler(int fd, unsigned int frame,
drm_output_update_complete ( output , flags , sec , usec ) ;
}
# ifdef HAVE_DRM_ATOMIC
static void
atomic_flip_handler ( int fd , unsigned int frame , unsigned int sec ,
unsigned int usec , unsigned int crtc_id , void * data )
@ -1444,25 +1431,18 @@ atomic_flip_handler(int fd, unsigned int frame, unsigned int sec,
drm_output_update_complete ( output , flags , sec , usec ) ;
drm_debug ( b , " [atomic][CRTC:%u] flip processing completed \n " , crtc_id ) ;
}
# endif
int
on_drm_input ( int fd , uint32_t mask , void * data )
{
# ifdef HAVE_DRM_ATOMIC
struct drm_backend * b = data ;
# endif
drmEventContext evctx ;
memset ( & evctx , 0 , sizeof evctx ) ;
# ifndef HAVE_DRM_ATOMIC
evctx . version = 2 ;
# else
evctx . version = 3 ;
if ( b - > atomic_modeset )
evctx . page_flip_handler2 = atomic_flip_handler ;
else
# endif
evctx . page_flip_handler = page_flip_handler ;
drmHandleEvent ( fd , & evctx ) ;
@ -1509,7 +1489,6 @@ init_kms_caps(struct drm_backend *b)
weston_log ( " DRM: %s universal planes \n " ,
b - > universal_planes ? " supports " : " does not support " ) ;
# ifdef HAVE_DRM_ATOMIC
if ( b - > universal_planes & & ! getenv ( " WESTON_DISABLE_ATOMIC " ) ) {
ret = drmGetCap ( b - > drm . fd , DRM_CAP_CRTC_IN_VBLANK_EVENT , & cap ) ;
if ( ret ! = 0 )
@ -1517,16 +1496,13 @@ init_kms_caps(struct drm_backend *b)
ret = drmSetClientCap ( b - > drm . fd , DRM_CLIENT_CAP_ATOMIC , 1 ) ;
b - > atomic_modeset = ( ( ret = = 0 ) & & ( cap = = 1 ) ) ;
}
# endif
weston_log ( " DRM: %s atomic modesetting \n " ,
b - > atomic_modeset ? " supports " : " does not support " ) ;
# ifdef HAVE_DRM_ADDFB2_MODIFIERS
ret = drmGetCap ( b - > drm . fd , DRM_CAP_ADDFB2_MODIFIERS , & cap ) ;
if ( ret = = 0 )
b - > fb_modifiers = cap ;
else
# endif
b - > fb_modifiers = 0 ;
/*