libc: Implement DRM_IOCTL_PAGE_FLIP
@@ -1390,6 +1390,47 @@ int ioctl(int fd, unsigned long request, void *arg) {
return resp.result();
}
+ case DRM_IOCTL_MODE_PAGE_FLIP: {
+ auto param = reinterpret_cast<drm_mode_crtc_page_flip *>(arg);
+ HelAction actions[3];
+ globalQueue.trim();
+
+ managarm::fs::CntRequest<MemoryAllocator> req(getAllocator());
+ req.set_req_type(managarm::fs::CntReqType::PT_IOCTL);
+ req.set_command(request);
+
+ assert(!(param->flags & ~DRM_MODE_PAGE_FLIP_EVENT));
+ req.set_drm_crtc_id(param->crtc_id);
+ req.set_drm_fb_id(param->fb_id);
+
+ frigg::String<MemoryAllocator> ser(getAllocator());
+ req.SerializeToString(&ser);
+ actions[0].type = kHelActionOffer;
+ actions[0].flags = kHelItemAncillary;
+ actions[1].type = kHelActionSendFromBuffer;
+ actions[1].flags = kHelItemChain;
+ actions[1].buffer = ser.data();
+ actions[1].length = ser.size();
+ actions[2].type = kHelActionRecvInline;
+ actions[2].flags = 0;
+ HEL_CHECK(helSubmitAsync(handle, actions, 3,
+ globalQueue.getQueue(), 0, 0));
+
+ auto element = globalQueue.dequeueSingle();
+ auto offer = parseSimple(element);
+ auto send_req = parseSimple(element);
+ auto recv_resp = parseInline(element);
+
+ HEL_CHECK(offer->error);
+ HEL_CHECK(send_req->error);
+ HEL_CHECK(recv_resp->error);
+
+ managarm::fs::SvrResponse<MemoryAllocator> resp(getAllocator());
+ resp.ParseFromArray(recv_resp->data, recv_resp->length);
+ __ensure(resp.error() == managarm::fs::Errors::SUCCESS);
+
+ return resp.result();
+ }
case DRM_IOCTL_MODE_DIRTYFB: {
auto param = reinterpret_cast<drm_mode_fb_dirty_cmd*>(arg);
HelAction actions[4];
