diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c index ea11207e..ada56904 100644 --- a/libdrm/xf86drmMode.c +++ b/libdrm/xf86drmMode.c @@ -664,3 +664,16 @@ int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size, return 0; } + +int drmModePageFlip(int fd, uint32_t *crtc_ids, uint32_t crtc_count, + uint32_t fb_id) +{ + struct drm_gem_page_flip flip; + + flip.fb_id = fb_id; + flip.crtc_ids_ptr = (uint64_t)crtc_ids; + flip.crtc_count = (uint32_t)crtc_count; + flip.flags = 0; + + return drmIoctl(fd, DRM_IOCTL_GEM_PAGE_FLIP, &flip); +} diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h index 62304bb9..2406e2fc 100644 --- a/libdrm/xf86drmMode.h +++ b/libdrm/xf86drmMode.h @@ -259,8 +259,6 @@ typedef struct _drmModeConnector { uint32_t *encoders; /**< List of encoder ids */ } drmModeConnector, *drmModeConnectorPtr; - - extern void drmModeFreeModeInfo( drmModeModeInfoPtr ptr ); extern void drmModeFreeResources( drmModeResPtr ptr ); extern void drmModeFreeFB( drmModeFBPtr ptr ); @@ -362,3 +360,5 @@ extern int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue); extern int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue); +extern int drmModePageFlip(int fd, uint32_t *crtc_ids, uint32_t crtc_count, + uint32_t fb_id); diff --git a/shared-core/drm.h b/shared-core/drm.h index b97ba098..2353ac42 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -1107,7 +1107,7 @@ struct drm_gem_open { #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, uint32_t) -#define DRM_IOCTL_MODE_REPLACEFB DRM_IOWR(0xB0, struct drm_mode_fb_cmd) +#define DRM_IOCTL_GEM_PAGE_FLIP DRM_IOW( 0xB0, struct drm_gem_page_flip) /*@}*/ diff --git a/shared-core/drm_mode.h b/shared-core/drm_mode.h index 9b92733d..2354f775 100644 --- a/shared-core/drm_mode.h +++ b/shared-core/drm_mode.h @@ -270,4 +270,23 @@ struct drm_mode_crtc_lut { uint64_t blue; }; +#define DRM_PAGE_FLIP_WAIT (1<<0) /* block on previous page flip */ +#define DRM_PAGE_FLIP_FLAGS_MASK (DRM_PAGE_FLIP_WAIT) + +struct drm_gem_page_flip { + /** Handle of new front buffer */ + uint32_t fb_id; + + /** + * crtcs to flip + */ + uint32_t crtc_count; + uint64_t crtc_ids_ptr; + + /** + * page flip flags (wait on flip only for now) + */ + uint32_t flags; +}; + #endif