I don't know if this has worked in the past, but when debugging some Qt
applications I saw the following debug messages:
$ gwenview
qt.qpa.xcb: Has MIT-SHM : true
qt.qpa.xcb: Has MIT-SHM FD : true
qt.qpa.xcb: xcb_shm_attach() failed
qt.qpa.xcb: failed to create System V shared memory segment (remote X11
connection?), disabling SHM
qt.qpa.xcb: Using XInput version 2.2
qt.qpa.screen: Output DP-1 is not connected
qt.qpa.screen: Output HDMI-1 is not connected
The code that fails is here. xcb_shm_attach_checked and/or
xcb_request_check failed with all my Qt applications.
pobj/qtbase-5.15.6/qtbase-everywhere-src-5.15.6/src/plugins/platforms/xcb/qxcbbackingstore.cpp
bool QXcbBackingStoreImage::createSystemVShmSegment(xcb_connection_t *c, size_t
segmentSize,
xcb_shm_segment_info_t
*shmInfo)
{
const int id = shmget(IPC_PRIVATE, segmentSize, IPC_CREAT | 0x1C0);
if (id == -1) {
qCWarning(lcQpaXcb, "shmget() failed (%d: %s) for size %zu", errno,
strerror(errno), segmentSize);
return false;
}
void *addr = shmat(id, nullptr, 0);
if (addr == (void *)-1) {
qCWarning(lcQpaXcb, "shmat() failed (%d: %s) for id %d", errno,
strerror(errno), id);
return false;
}
if (shmctl(id, IPC_RMID, nullptr) == -1)
qCWarning(lcQpaXcb, "Error while marking the shared memory segment to
be destroyed");
const auto seg = xcb_generate_id(c);
auto cookie = xcb_shm_attach_checked(c, seg, id, false);
auto *error = xcb_request_check(c, cookie);
if (error) {
qCWarning(lcQpaXcb(), "xcb_shm_attach() failed");
free(error);
if (shmdt(addr) == -1)
qCWarning(lcQpaXcb, "shmdt() failed (%d: %s) for %p", errno,
strerror(errno), addr);
return false;
If you want to test it run any Qt application with
QT_LOGGING_RULES="qt.qpa.xcb.debug=true" exported.
Should SHM with XCB generally work on OpenBSD?
Rafael