Skip to content

Commit

Permalink
Merge pull request #998 from no92/sysdep-managarm-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
no92 authored Feb 17, 2024
2 parents c0522eb + 7cd37d8 commit 4a9f0e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 2 additions & 8 deletions sysdeps/managarm/generic/drm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,23 +626,17 @@ int ioctl_drm(int fd, unsigned long request, void *arg, int *result, HelHandle h
case DRM_IOCTL_MODE_ADDFB2: {
auto param = reinterpret_cast<drm_mode_fb_cmd2 *>(arg);

if(param->pixel_format != DRM_FORMAT_XRGB8888)
mlibc::infoLogger() << "mlibc: Unexpected pixel format "
<< frg::hex_fmt(param->pixel_format) << frg::endlog;
__ensure(param->pixel_format == DRM_FORMAT_XRGB8888
|| param->pixel_format == DRM_FORMAT_ARGB8888);
__ensure(!param->flags || param->flags == DRM_MODE_FB_MODIFIERS);
__ensure(!param->modifier[0] || param->modifier[0] == DRM_FORMAT_MOD_INVALID);
__ensure(!param->offsets[0]);

managarm::fs::GenericIoctlRequest<MemoryAllocator> req(getSysdepsAllocator());
req.set_command(DRM_IOCTL_MODE_ADDFB);
req.set_command(DRM_IOCTL_MODE_ADDFB2);

req.set_drm_width(param->width);
req.set_drm_height(param->height);
req.set_drm_pitch(param->pitches[0]);
req.set_drm_bpp(32);
req.set_drm_depth(24);
req.set_drm_fourcc(param->pixel_format);
req.set_drm_handle(param->handles[0]);

auto [offer, send_ioctl_req, send_req, recv_resp] = exchangeMsgsSync(
Expand Down
6 changes: 5 additions & 1 deletion sysdeps/managarm/generic/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,11 @@ int sys_socketpair(int domain, int type_and_flags, int proto, int *fds) {

managarm::posix::SvrResponse<MemoryAllocator> resp(getSysdepsAllocator());
resp.ParseFromArray(recvResp.data(), recvResp.length());
__ensure(resp.error() == managarm::posix::Errors::SUCCESS);
if(resp.error() == managarm::posix::Errors::PROTOCOL_NOT_SUPPORTED) {
return EPROTONOSUPPORT;
} else {
__ensure(resp.error() == managarm::posix::Errors::SUCCESS);
}
__ensure(resp.fds_size() == 2);
fds[0] = resp.fds(0);
fds[1] = resp.fds(1);
Expand Down

0 comments on commit 4a9f0e2

Please sign in to comment.