libdrm: add KMS page flip interface

Sits on top of KMS page flipping ioctl.
This commit is contained in:
Jesse Barnes 2009-05-01 14:33:22 -07:00
parent 11b60973bc
commit e98581da95
4 changed files with 35 additions and 3 deletions

View file

@ -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);
}

View file

@ -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);

View file

@ -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)
/*@}*/

View file

@ -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