Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
2da1b321
Commit
2da1b321
authored
Dec 15, 2020
by
Xaver Hugl
Browse files
Fix login modeset
parent
c7fb0160
Changes
5
Hide whitespace changes
Inline
Side-by-side
abstract_wayland_output.cpp
View file @
2da1b321
...
...
@@ -251,6 +251,7 @@ QString AbstractWaylandOutput::description() const
void
AbstractWaylandOutput
::
setWaylandMode
(
const
QSize
&
size
,
int
refreshRate
)
{
m_waylandOutput
->
setCurrentMode
(
size
,
refreshRate
);
m_waylandOutputDevice
->
setCurrentMode
(
size
,
refreshRate
);
m_xdgOutputV1
->
setLogicalSize
(
pixelSize
()
/
scale
());
m_xdgOutputV1
->
done
();
}
...
...
plugins/platforms/drm/drm_backend.cpp
View file @
2da1b321
...
...
@@ -429,11 +429,23 @@ void DrmBackend::readOutputsConfiguration()
qCDebug
(
KWIN_DRM
)
<<
"Reading output configuration for ["
<<
uuid
<<
"] ["
<<
(
*
it
)
->
uuid
()
<<
"]"
;
const
auto
outputConfig
=
configGroup
.
group
((
*
it
)
->
uuid
());
(
*
it
)
->
setGlobalPos
(
outputConfig
.
readEntry
<
QPoint
>
(
"Position"
,
pos
));
// TODO: add mode
if
(
outputConfig
.
hasKey
(
"Scale"
))
(
*
it
)
->
setScale
(
outputConfig
.
readEntry
(
"Scale"
,
1.0
));
(
*
it
)
->
setTransform
(
stringToTransform
(
outputConfig
.
readEntry
(
"Transform"
,
"normal"
)));
pos
.
setX
(
pos
.
x
()
+
(
*
it
)
->
geometry
().
width
());
if
(
outputConfig
.
hasKey
(
"Mode"
))
{
QString
mode
=
outputConfig
.
readEntry
(
"Mode"
);
QStringList
list
=
mode
.
split
(
"_"
);
if
(
list
.
size
()
>
1
)
{
QStringList
size
=
list
[
0
].
split
(
"x"
);
if
(
size
.
size
()
>
1
)
{
int
width
=
size
[
0
].
toInt
();
int
height
=
size
[
1
].
toInt
();
int
refreshRate
=
list
[
1
].
toInt
();
(
*
it
)
->
updateMode
(
width
,
height
,
refreshRate
);
}
}
}
}
}
...
...
@@ -450,6 +462,13 @@ void DrmBackend::writeOutputsConfiguration()
auto
outputConfig
=
configGroup
.
group
((
*
it
)
->
uuid
());
outputConfig
.
writeEntry
(
"Scale"
,
(
*
it
)
->
scale
());
outputConfig
.
writeEntry
(
"Transform"
,
transformToString
((
*
it
)
->
transform
()));
QString
mode
;
mode
+=
QString
::
number
((
*
it
)
->
modeSize
().
width
());
mode
+=
"x"
;
mode
+=
QString
::
number
((
*
it
)
->
modeSize
().
height
());
mode
+=
"_"
;
mode
+=
QString
::
number
((
*
it
)
->
refreshRate
());
outputConfig
.
writeEntry
(
"Mode"
,
mode
);
}
}
...
...
plugins/platforms/drm/drm_gpu.cpp
View file @
2da1b321
...
...
@@ -244,13 +244,9 @@ bool DrmGpu::updateOutputs()
output
->
m_conn
=
con
;
crtc
->
setOutput
(
output
);
output
->
m_crtc
=
crtc
;
output
->
m_mode
=
connector
->
modes
[
0
];
if
(
modeCrtc
->
mode_valid
)
{
output
->
m_mode
=
modeCrtc
->
mode
;
}
else
{
output
->
m_mode
=
connector
->
modes
[
0
];
}
qCDebug
(
KWIN_DRM
)
<<
"For new output use mode "
<<
output
->
m_mode
.
name
;
qCDebug
(
KWIN_DRM
)
<<
"For new output use mode "
<<
output
->
m_mode
.
name
<<
output
->
m_mode
.
hdisplay
<<
output
->
m_mode
.
vdisplay
;
if
(
!
output
->
init
(
connector
.
data
()))
{
qCWarning
(
KWIN_DRM
)
<<
"Failed to create output for connector "
<<
con
->
id
();
delete
output
;
...
...
plugins/platforms/drm/drm_output.cpp
View file @
2da1b321
...
...
@@ -673,6 +673,24 @@ void DrmOutput::updateTransform(Transform transform)
}
}
void
DrmOutput
::
updateMode
(
uint32_t
width
,
uint32_t
height
,
uint32_t
refreshRate
)
{
if
(
m_mode
.
hdisplay
==
width
&&
m_mode
.
vdisplay
==
height
&&
m_mode
.
vrefresh
==
refreshRate
)
{
return
;
}
// try to find a fitting mode
DrmScopedPointer
<
drmModeConnector
>
connector
(
drmModeGetConnectorCurrent
(
m_gpu
->
fd
(),
m_conn
->
id
()));
for
(
int
i
=
0
;
i
<
connector
->
count_modes
;
i
++
)
{
auto
mode
=
connector
->
modes
[
i
];
if
(
mode
.
hdisplay
==
width
&&
mode
.
vdisplay
==
height
&&
mode
.
vrefresh
==
refreshRate
)
{
updateMode
(
i
);
return
;
}
}
qCWarning
(
KWIN_DRM
,
"Could not find a fitting mode with size=%dx%d and refresh rate %d for output %s"
,
width
,
height
,
refreshRate
,
uuid
().
constData
());
}
void
DrmOutput
::
updateMode
(
int
modeIndex
)
{
// get all modes on the connector
...
...
@@ -831,7 +849,6 @@ bool DrmOutput::presentAtomically(DrmBuffer *buffer)
updateCursor
();
showCursor
();
}
// TODO: forward to OutputInterface and OutputDeviceInterface
setWaylandMode
();
emit
screens
()
->
changed
();
}
...
...
plugins/platforms/drm/drm_output.h
View file @
2da1b321
...
...
@@ -136,6 +136,7 @@ private:
bool
atomicReqModesetPopulate
(
drmModeAtomicReq
*
req
,
bool
enable
);
void
updateDpms
(
KWaylandServer
::
OutputInterface
::
DpmsMode
mode
)
override
;
void
updateMode
(
int
modeIndex
)
override
;
void
updateMode
(
uint32_t
width
,
uint32_t
height
,
uint32_t
refreshRate
);
void
setWaylandMode
();
void
updateTransform
(
Transform
transform
)
override
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment