Commit 304528e8 authored by Nerdopolis Turfwalker's avatar Nerdopolis Turfwalker Committed by Vlad Zahorodnii

[platforms/fbdev] Attempt to set the framebuffer color layout on the framebuffer device

Summary:
Weston does something similar
https://cgit.freedesktop.org/wayland/weston/tree/libweston/compositor-fbdev.c#n315
 ...and it seems that the non-primary framebuffer devices start completely off. (the screen is off on my Displayport device, and the window for the second vga card in qemu is much smaller than the primary one, and all black for my qemu vm) .

In my testing, sending the ioctl FBIOPUT_VSCREENINFO with a *changed* &varinfo allows it to wake up, and turns on the screen.
doing FBIOGET_VSCREENINFO and then FBIOPUT_VSCREENINFO in my testing does not work.

I think really the values that end up getting changed are varinfo.transp.offset and varinfo.transp.length. at least on the qemu system, but in this patch I am aligning all of them for completeness, because the drivers might do it differently for qemu

Test Plan: This causes the window for /dev/fb1 (remote-viewer, and a qemu vm with two "VGA" (bochsdrm) cards) to resize from the smaller size when specifying it as the --fb-device on seat0, and kwin draws on the device.

Reviewers: #kwin, davidedmundson, graesslin

Reviewed By: #kwin, graesslin

Subscribers: zzag, davidedmundson, rkflx, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D9572
parent 77966a09
......@@ -98,8 +98,8 @@ void FramebufferBackend::openFrameBuffer()
return;
}
m_fd = fd;
if (!queryScreenInfo()) {
qCWarning(KWIN_FB) << "failed to query framebuffer information";
if (!handleScreenInfo()) {
qCWarning(KWIN_FB) << "failed to handle framebuffer information";
emit initFailed();
return;
}
......@@ -112,7 +112,7 @@ void FramebufferBackend::openFrameBuffer()
emit screensQueried();
}
bool FramebufferBackend::queryScreenInfo()
bool FramebufferBackend::handleScreenInfo()
{
if (m_fd < 0) {
return false;
......@@ -125,6 +125,28 @@ bool FramebufferBackend::queryScreenInfo()
if (ioctl(m_fd, FBIOGET_FSCREENINFO, &fixinfo) < 0 || ioctl(m_fd, FBIOGET_VSCREENINFO, &varinfo) < 0) {
return false;
}
// correct the color info, and try to turn on screens, assuming this is a non-primary framebuffer device
varinfo.grayscale = 0;
varinfo.transp.offset = 24;
varinfo.transp.length = 8;
varinfo.transp.msb_right = 0;
varinfo.red.offset = 16;
varinfo.red.length = 8;
varinfo.red.msb_right = 0;
varinfo.green.offset = 8;
varinfo.green.length = 8;
varinfo.green.msb_right = 0;
varinfo.blue.offset = 0;
varinfo.blue.length = 8;
varinfo.blue.msb_right = 0;
ioctl(m_fd, FBIOPUT_VSCREENINFO, &varinfo);
// Probe the device for new screen information.
if (ioctl(m_fd, FBIOGET_VSCREENINFO, &varinfo) < 0) {
return false;
}
m_resolution = QSize(varinfo.xres, varinfo.yres);
m_physicalSize = QSize(varinfo.width, varinfo.height);
m_id = QByteArray(fixinfo.id);
......
......@@ -84,7 +84,7 @@ public:
private:
void openFrameBuffer();
bool queryScreenInfo();
bool handleScreenInfo();
void initImageFormat();
QSize m_resolution;
QSize m_physicalSize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment