libdrm: add libdrm support for page flip ioctl
parent
2577764a50
commit
b80bcffba6
|
@ -682,6 +682,12 @@ typedef struct _drmEventContext {
|
|||
unsigned int tv_usec,
|
||||
void *user_data);
|
||||
|
||||
void (*page_flip_handler)(int fd,
|
||||
unsigned int sequence,
|
||||
unsigned int tv_sec,
|
||||
unsigned int tv_usec,
|
||||
void *user_data);
|
||||
|
||||
} drmEventContext, *drmEventContextPtr;
|
||||
|
||||
extern int drmHandleEvent(int fd, drmEventContextPtr evctx);
|
||||
|
|
|
@ -700,7 +700,17 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
|
|||
vblank->tv_usec,
|
||||
U642VOID (vblank->user_data));
|
||||
break;
|
||||
|
||||
case DRM_EVENT_FLIP_COMPLETE:
|
||||
if (evctx->version < 1 ||
|
||||
evctx->page_flip_handler == NULL)
|
||||
break;
|
||||
vblank = (struct drm_event_vblank *) e;
|
||||
evctx->page_flip_handler(fd,
|
||||
vblank->sequence,
|
||||
vblank->tv_sec,
|
||||
vblank->tv_usec,
|
||||
U642VOID (vblank->user_data));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -710,3 +720,16 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id,
|
||||
uint32_t flags, void *user_data)
|
||||
{
|
||||
struct drm_mode_crtc_page_flip flip;
|
||||
|
||||
flip.fb_id = fb_id;
|
||||
flip.crtc_id = crtc_id;
|
||||
flip.user_data = VOID2U64(user_data);
|
||||
flip.flags = flags;
|
||||
flip.reserved = 0;
|
||||
|
||||
return drmIoctl(fd, DRM_IOCTL_MODE_PAGE_FLIP, &flip);
|
||||
}
|
||||
|
|
|
@ -362,3 +362,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_id, uint32_t fb_id,
|
||||
uint32_t flags, void *user_data);
|
||||
|
|
|
@ -795,6 +795,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_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
@ -827,6 +828,7 @@ struct drm_event {
|
|||
};
|
||||
|
||||
#define DRM_EVENT_VBLANK 0x01
|
||||
#define DRM_EVENT_FLIP_COMPLETE 0x02
|
||||
|
||||
struct drm_event_vblank {
|
||||
struct drm_event base;
|
||||
|
|
|
@ -270,4 +270,15 @@ struct drm_mode_crtc_lut {
|
|||
uint64_t blue;
|
||||
};
|
||||
|
||||
#define DRM_MODE_PAGE_FLIP_EVENT 0x01
|
||||
#define DRM_MODE_PAGE_FLIP_FLAGS DRM_MODE_PAGE_FLIP_EVENT
|
||||
|
||||
struct drm_mode_crtc_page_flip {
|
||||
uint32_t crtc_id;
|
||||
uint32_t fb_id;
|
||||
uint32_t flags;
|
||||
uint32_t reserved;
|
||||
uint64_t user_data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue