backends/drm: minor refactor of DrmPipeline
This commit is contained in:
parent
991f6b458d
commit
ca79f11ede
2 changed files with 33 additions and 31 deletions
|
@ -182,7 +182,7 @@ bool DrmPipeline::commitPipelinesAtomic(const QVector<DrmPipeline*> &pipelines,
|
|||
bool DrmPipeline::populateAtomicValues(drmModeAtomicReq *req, uint32_t &flags)
|
||||
{
|
||||
if (needsModeset()) {
|
||||
prepareModeset();
|
||||
prepareAtomicModeset();
|
||||
flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
|
||||
}
|
||||
if (activePending()) {
|
||||
|
@ -218,6 +218,29 @@ bool DrmPipeline::populateAtomicValues(drmModeAtomicReq *req, uint32_t &flags)
|
|||
return true;
|
||||
}
|
||||
|
||||
void DrmPipeline::prepareAtomicModeset()
|
||||
{
|
||||
if (!pending.crtc) {
|
||||
m_connector->setPending(DrmConnector::PropertyIndex::CrtcId, 0);
|
||||
return;
|
||||
}
|
||||
auto mode = m_connector->modes()[pending.modeIndex];
|
||||
|
||||
m_connector->setPending(DrmConnector::PropertyIndex::CrtcId, activePending() ? pending.crtc->id() : 0);
|
||||
if (const auto &prop = m_connector->getProp(DrmConnector::PropertyIndex::Broadcast_RGB)) {
|
||||
prop->setEnum(pending.rgbRange);
|
||||
}
|
||||
|
||||
pending.crtc->setPending(DrmCrtc::PropertyIndex::Active, activePending());
|
||||
pending.crtc->setPending(DrmCrtc::PropertyIndex::ModeId, activePending() ? mode->blobId() : 0);
|
||||
|
||||
pending.crtc->primaryPlane()->setPending(DrmPlane::PropertyIndex::CrtcId, activePending() ? pending.crtc->id() : 0);
|
||||
pending.crtc->primaryPlane()->setTransformation(DrmPlane::Transformation::Rotate0);
|
||||
if (pending.crtc->cursorPlane()) {
|
||||
pending.crtc->cursorPlane()->setTransformation(DrmPlane::Transformation::Rotate0);
|
||||
}
|
||||
}
|
||||
|
||||
void DrmPipeline::atomicCommitFailed()
|
||||
{
|
||||
if (m_oldTestBuffer) {
|
||||
|
@ -364,28 +387,6 @@ bool DrmPipeline::moveCursor(QPoint pos)
|
|||
return result;
|
||||
}
|
||||
|
||||
void DrmPipeline::prepareModeset()
|
||||
{
|
||||
if (!pending.crtc) {
|
||||
m_connector->setPending(DrmConnector::PropertyIndex::CrtcId, 0);
|
||||
return;
|
||||
}
|
||||
auto mode = m_connector->modes()[pending.modeIndex];
|
||||
|
||||
m_connector->setPending(DrmConnector::PropertyIndex::CrtcId, activePending() ? pending.crtc->id() : 0);
|
||||
if (const auto &prop = m_connector->getProp(DrmConnector::PropertyIndex::Broadcast_RGB)) {
|
||||
prop->setEnum(pending.rgbRange);
|
||||
}
|
||||
|
||||
pending.crtc->setPending(DrmCrtc::PropertyIndex::Active, activePending());
|
||||
pending.crtc->setPending(DrmCrtc::PropertyIndex::ModeId, activePending() ? mode->blobId() : 0);
|
||||
|
||||
pending.crtc->primaryPlane()->setPending(DrmPlane::PropertyIndex::CrtcId, activePending() ? pending.crtc->id() : 0);
|
||||
pending.crtc->primaryPlane()->setTransformation(DrmPlane::Transformation::Rotate0);
|
||||
if (pending.crtc->cursorPlane())
|
||||
pending.crtc->cursorPlane()->setTransformation(DrmPlane::Transformation::Rotate0);
|
||||
}
|
||||
|
||||
void DrmPipeline::applyPendingChanges()
|
||||
{
|
||||
if (!pending.crtc) {
|
||||
|
|
|
@ -62,8 +62,6 @@ public:
|
|||
bool present(const QSharedPointer<DrmBuffer> &buffer);
|
||||
|
||||
bool needsModeset() const;
|
||||
bool needsCommit() const;
|
||||
void prepareModeset();
|
||||
void applyPendingChanges();
|
||||
void revertPendingChanges();
|
||||
|
||||
|
@ -117,22 +115,25 @@ private:
|
|||
bool activePending() const;
|
||||
bool isCursorVisible() const;
|
||||
|
||||
// legacy only
|
||||
bool presentLegacy();
|
||||
bool legacyModeset();
|
||||
bool applyPendingChangesLegacy();
|
||||
bool setCursorLegacy();
|
||||
bool moveCursorLegacy();
|
||||
static bool commitPipelinesLegacy(const QVector<DrmPipeline*> &pipelines, CommitMode mode);
|
||||
|
||||
// atomic modesetting only
|
||||
bool populateAtomicValues(drmModeAtomicReq *req, uint32_t &flags);
|
||||
void atomicCommitFailed();
|
||||
void atomicCommitSuccessful(CommitMode mode);
|
||||
|
||||
static void printFlags(uint32_t flags);
|
||||
enum class PrintMode { OnlyChanged, All };
|
||||
static void printProps(DrmObject *object, PrintMode mode);
|
||||
|
||||
void prepareAtomicModeset();
|
||||
static bool commitPipelinesAtomic(const QVector<DrmPipeline*> &pipelines, CommitMode mode, const QVector<DrmObject*> &unusedObjects);
|
||||
static bool commitPipelinesLegacy(const QVector<DrmPipeline*> &pipelines, CommitMode mode);
|
||||
|
||||
// logging helpers
|
||||
enum class PrintMode { OnlyChanged, All };
|
||||
static void printFlags(uint32_t flags);
|
||||
static void printProps(DrmObject *object, PrintMode mode);
|
||||
|
||||
DrmOutput *m_output = nullptr;
|
||||
DrmConnector *m_connector = nullptr;
|
||||
|
|
Loading…
Reference in a new issue