helpers: refactor class member vars (#10218)
This commit is contained in:
parent
b8a204c21d
commit
50e1bec85f
63 changed files with 1770 additions and 1769 deletions
|
|
@ -8,11 +8,11 @@
|
|||
CHyprColor::CHyprColor() = default;
|
||||
|
||||
CHyprColor::CHyprColor(float r_, float g_, float b_, float a_) : r(r_), g(g_), b(b_), a(a_) {
|
||||
okLab = Hyprgraphics::CColor(Hyprgraphics::CColor::SSRGB{r, g, b}).asOkLab();
|
||||
m_okLab = Hyprgraphics::CColor(Hyprgraphics::CColor::SSRGB{r, g, b}).asOkLab();
|
||||
}
|
||||
|
||||
CHyprColor::CHyprColor(uint64_t hex) : r(RED(hex)), g(GREEN(hex)), b(BLUE(hex)), a(ALPHA(hex)) {
|
||||
okLab = Hyprgraphics::CColor(Hyprgraphics::CColor::SSRGB{r, g, b}).asOkLab();
|
||||
m_okLab = Hyprgraphics::CColor(Hyprgraphics::CColor::SSRGB{r, g, b}).asOkLab();
|
||||
}
|
||||
|
||||
CHyprColor::CHyprColor(const Hyprgraphics::CColor& color, float a_) : a(a_) {
|
||||
|
|
@ -21,7 +21,7 @@ CHyprColor::CHyprColor(const Hyprgraphics::CColor& color, float a_) : a(a_) {
|
|||
g = SRGB.g;
|
||||
b = SRGB.b;
|
||||
|
||||
okLab = color.asOkLab();
|
||||
m_okLab = color.asOkLab();
|
||||
}
|
||||
|
||||
uint32_t CHyprColor::getAsHex() const {
|
||||
|
|
@ -33,11 +33,11 @@ Hyprgraphics::CColor::SSRGB CHyprColor::asRGB() const {
|
|||
}
|
||||
|
||||
Hyprgraphics::CColor::SOkLab CHyprColor::asOkLab() const {
|
||||
return okLab;
|
||||
return m_okLab;
|
||||
}
|
||||
|
||||
Hyprgraphics::CColor::SHSL CHyprColor::asHSL() const {
|
||||
return Hyprgraphics::CColor(okLab).asHSL();
|
||||
return Hyprgraphics::CColor(m_okLab).asHSL();
|
||||
}
|
||||
|
||||
CHyprColor CHyprColor::stripA() const {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class CHyprColor {
|
|||
double r = 0, g = 0, b = 0, a = 0;
|
||||
|
||||
private:
|
||||
Hyprgraphics::CColor::SOkLab okLab; // cache for the OkLab representation
|
||||
Hyprgraphics::CColor::SOkLab m_okLab; // cache for the OkLab representation
|
||||
};
|
||||
|
||||
//NOLINTNEXTLINE
|
||||
|
|
|
|||
|
|
@ -1,43 +1,43 @@
|
|||
#include "DamageRing.hpp"
|
||||
|
||||
void CDamageRing::setSize(const Vector2D& size_) {
|
||||
if (size_ == size)
|
||||
if (size_ == m_size)
|
||||
return;
|
||||
|
||||
size = size_;
|
||||
m_size = size_;
|
||||
|
||||
damageEntire();
|
||||
}
|
||||
|
||||
bool CDamageRing::damage(const CRegion& rg) {
|
||||
CRegion clipped = rg.copy().intersect(CBox{{}, size});
|
||||
CRegion clipped = rg.copy().intersect(CBox{{}, m_size});
|
||||
if (clipped.empty())
|
||||
return false;
|
||||
|
||||
current.add(clipped);
|
||||
m_current.add(clipped);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CDamageRing::damageEntire() {
|
||||
damage(CBox{{}, size});
|
||||
damage(CBox{{}, m_size});
|
||||
}
|
||||
|
||||
void CDamageRing::rotate() {
|
||||
previousIdx = (previousIdx + DAMAGE_RING_PREVIOUS_LEN - 1) % DAMAGE_RING_PREVIOUS_LEN;
|
||||
m_previousIdx = (m_previousIdx + DAMAGE_RING_PREVIOUS_LEN - 1) % DAMAGE_RING_PREVIOUS_LEN;
|
||||
|
||||
previous[previousIdx] = current;
|
||||
current.clear();
|
||||
m_previous[m_previousIdx] = m_current;
|
||||
m_current.clear();
|
||||
}
|
||||
|
||||
CRegion CDamageRing::getBufferDamage(int age) {
|
||||
if (age <= 0 || age > DAMAGE_RING_PREVIOUS_LEN + 1)
|
||||
return CBox{{}, size};
|
||||
return CBox{{}, m_size};
|
||||
|
||||
CRegion damage = current;
|
||||
CRegion damage = m_current;
|
||||
|
||||
for (int i = 0; i < age - 1; ++i) {
|
||||
int j = (previousIdx + i) % DAMAGE_RING_PREVIOUS_LEN;
|
||||
damage.add(previous.at(j));
|
||||
int j = (m_previousIdx + i) % DAMAGE_RING_PREVIOUS_LEN;
|
||||
damage.add(m_previous.at(j));
|
||||
}
|
||||
|
||||
// don't return a ludicrous amount of rects
|
||||
|
|
@ -48,5 +48,5 @@ CRegion CDamageRing::getBufferDamage(int age) {
|
|||
}
|
||||
|
||||
bool CDamageRing::hasChanged() {
|
||||
return !current.empty();
|
||||
return !m_current.empty();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ class CDamageRing {
|
|||
bool hasChanged();
|
||||
|
||||
private:
|
||||
Vector2D size;
|
||||
CRegion current;
|
||||
std::array<CRegion, DAMAGE_RING_PREVIOUS_LEN> previous;
|
||||
size_t previousIdx = 0;
|
||||
Vector2D m_size;
|
||||
CRegion m_current;
|
||||
std::array<CRegion, DAMAGE_RING_PREVIOUS_LEN> m_previous;
|
||||
size_t m_previousIdx = 0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||
if (same_mon) {
|
||||
for (auto const& rule : g_pConfigManager->getAllWorkspaceRules()) {
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromName(rule.monitor);
|
||||
if (PMONITOR && (PMONITOR->ID != g_pCompositor->m_lastMonitor->ID))
|
||||
if (PMONITOR && (PMONITOR->m_id != g_pCompositor->m_lastMonitor->m_id))
|
||||
invalidWSes.insert(rule.workspaceId);
|
||||
}
|
||||
}
|
||||
|
|
@ -165,7 +165,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||
if (!g_pCompositor->m_lastMonitor)
|
||||
return {WORKSPACE_INVALID};
|
||||
|
||||
const auto PWORKSPACE = g_pCompositor->m_lastMonitor->activeWorkspace;
|
||||
const auto PWORKSPACE = g_pCompositor->m_lastMonitor->m_activeWorkspace;
|
||||
|
||||
if (!valid(PWORKSPACE))
|
||||
return {WORKSPACE_INVALID};
|
||||
|
|
@ -184,12 +184,12 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||
|
||||
return {PLASTWORKSPACE->m_id, PLASTWORKSPACE->m_name};
|
||||
} else if (in == "next") {
|
||||
if (!g_pCompositor->m_lastMonitor || !g_pCompositor->m_lastMonitor->activeWorkspace) {
|
||||
if (!g_pCompositor->m_lastMonitor || !g_pCompositor->m_lastMonitor->m_activeWorkspace) {
|
||||
Debug::log(ERR, "no active monitor or workspace for 'next'");
|
||||
return {WORKSPACE_INVALID};
|
||||
}
|
||||
|
||||
auto PCURRENTWORKSPACE = g_pCompositor->m_lastMonitor->activeWorkspace;
|
||||
auto PCURRENTWORKSPACE = g_pCompositor->m_lastMonitor->m_activeWorkspace;
|
||||
|
||||
WORKSPACEID nextId = PCURRENTWORKSPACE->m_id + 1;
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||
}
|
||||
for (auto const& rule : g_pConfigManager->getAllWorkspaceRules()) {
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromName(rule.monitor);
|
||||
if (!PMONITOR || PMONITOR->ID == g_pCompositor->m_lastMonitor->ID) {
|
||||
if (!PMONITOR || PMONITOR->m_id == g_pCompositor->m_lastMonitor->m_id) {
|
||||
// Can't be invalid
|
||||
continue;
|
||||
}
|
||||
|
|
@ -265,7 +265,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||
} else {
|
||||
|
||||
// Just take a blind guess at where we'll probably end up
|
||||
WORKSPACEID activeWSID = g_pCompositor->m_lastMonitor->activeWorkspace ? g_pCompositor->m_lastMonitor->activeWorkspace->m_id : 1;
|
||||
WORKSPACEID activeWSID = g_pCompositor->m_lastMonitor->m_activeWorkspace ? g_pCompositor->m_lastMonitor->m_activeWorkspace->m_id : 1;
|
||||
WORKSPACEID predictedWSID = activeWSID + remains;
|
||||
int remainingWSes = 0;
|
||||
char walkDir = in[1];
|
||||
|
|
@ -407,7 +407,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||
remains = remains < 0 ? -((-remains) % validWSes.size()) : remains % validWSes.size();
|
||||
|
||||
// get the current item
|
||||
WORKSPACEID activeWSID = g_pCompositor->m_lastMonitor->activeWorkspace ? g_pCompositor->m_lastMonitor->activeWorkspace->m_id : 1;
|
||||
WORKSPACEID activeWSID = g_pCompositor->m_lastMonitor->m_activeWorkspace ? g_pCompositor->m_lastMonitor->m_activeWorkspace->m_id : 1;
|
||||
for (ssize_t i = 0; i < (ssize_t)validWSes.size(); i++) {
|
||||
if (validWSes[i] == activeWSID) {
|
||||
currentItem = i;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -71,7 +71,7 @@ class CMonitorState {
|
|||
private:
|
||||
void ensureBufferPresent();
|
||||
|
||||
CMonitor* m_pOwner = nullptr;
|
||||
CMonitor* m_owner = nullptr;
|
||||
};
|
||||
|
||||
class CMonitor {
|
||||
|
|
@ -79,84 +79,82 @@ class CMonitor {
|
|||
CMonitor(SP<Aquamarine::IOutput> output);
|
||||
~CMonitor();
|
||||
|
||||
Vector2D vecPosition = Vector2D(-1, -1); // means unset
|
||||
Vector2D vecXWaylandPosition = Vector2D(-1, -1); // means unset
|
||||
Vector2D vecSize = Vector2D(0, 0);
|
||||
Vector2D vecPixelSize = Vector2D(0, 0);
|
||||
Vector2D vecTransformedSize = Vector2D(0, 0);
|
||||
Vector2D m_position = Vector2D(-1, -1); // means unset
|
||||
Vector2D m_xwaylandPosition = Vector2D(-1, -1); // means unset
|
||||
Vector2D m_size = Vector2D(0, 0);
|
||||
Vector2D m_pixelSize = Vector2D(0, 0);
|
||||
Vector2D m_transformedSize = Vector2D(0, 0);
|
||||
|
||||
bool primary = false;
|
||||
MONITORID m_id = MONITOR_INVALID;
|
||||
PHLWORKSPACE m_activeWorkspace = nullptr;
|
||||
PHLWORKSPACE m_activeSpecialWorkspace = nullptr;
|
||||
float m_setScale = 1; // scale set by cfg
|
||||
float m_scale = 1; // real scale
|
||||
|
||||
MONITORID ID = MONITOR_INVALID;
|
||||
PHLWORKSPACE activeWorkspace = nullptr;
|
||||
PHLWORKSPACE activeSpecialWorkspace = nullptr;
|
||||
float setScale = 1; // scale set by cfg
|
||||
float scale = 1; // real scale
|
||||
std::string m_name = "";
|
||||
std::string m_description = "";
|
||||
std::string m_shortDescription = "";
|
||||
|
||||
std::string szName = "";
|
||||
std::string szDescription = "";
|
||||
std::string szShortDescription = "";
|
||||
Vector2D m_reservedTopLeft = Vector2D(0, 0);
|
||||
Vector2D m_reservedBottomRight = Vector2D(0, 0);
|
||||
|
||||
Vector2D vecReservedTopLeft = Vector2D(0, 0);
|
||||
Vector2D vecReservedBottomRight = Vector2D(0, 0);
|
||||
drmModeModeInfo m_customDrmMode = {};
|
||||
|
||||
drmModeModeInfo customDrmMode = {};
|
||||
CMonitorState m_state;
|
||||
CDamageRing m_damage;
|
||||
|
||||
CMonitorState state;
|
||||
CDamageRing damage;
|
||||
SP<Aquamarine::IOutput> m_output;
|
||||
float m_refreshRate = 60; // Hz
|
||||
int m_forceFullFrames = 0;
|
||||
bool m_scheduledRecalc = false;
|
||||
wl_output_transform m_transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||
float m_xwaylandScale = 1.f;
|
||||
Mat3x3 m_projMatrix;
|
||||
std::optional<Vector2D> m_forceSize;
|
||||
SP<Aquamarine::SOutputMode> m_currentMode;
|
||||
SP<Aquamarine::CSwapchain> m_cursorSwapchain;
|
||||
uint32_t m_drmFormat = DRM_FORMAT_INVALID;
|
||||
uint32_t m_prevDrmFormat = DRM_FORMAT_INVALID;
|
||||
|
||||
SP<Aquamarine::IOutput> output;
|
||||
float refreshRate = 60; // Hz
|
||||
int forceFullFrames = 0;
|
||||
bool scheduledRecalc = false;
|
||||
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||
float xwaylandScale = 1.f;
|
||||
Mat3x3 projMatrix;
|
||||
std::optional<Vector2D> forceSize;
|
||||
SP<Aquamarine::SOutputMode> currentMode;
|
||||
SP<Aquamarine::CSwapchain> cursorSwapchain;
|
||||
uint32_t drmFormat = DRM_FORMAT_INVALID;
|
||||
uint32_t prevDrmFormat = DRM_FORMAT_INVALID;
|
||||
bool m_dpmsStatus = true;
|
||||
bool m_vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it.
|
||||
bool m_enabled10bit = false; // as above, this can be TRUE even if 10 bit failed.
|
||||
eCMType m_cmType = CM_SRGB;
|
||||
float m_sdrSaturation = 1.0f;
|
||||
float m_sdrBrightness = 1.0f;
|
||||
bool m_createdByUser = false;
|
||||
bool m_isUnsafeFallback = false;
|
||||
|
||||
bool dpmsStatus = true;
|
||||
bool vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it.
|
||||
bool enabled10bit = false; // as above, this can be TRUE even if 10 bit failed.
|
||||
eCMType cmType = CM_SRGB;
|
||||
float sdrSaturation = 1.0f;
|
||||
float sdrBrightness = 1.0f;
|
||||
bool createdByUser = false;
|
||||
bool isUnsafeFallback = false;
|
||||
bool m_pendingFrame = false; // if we schedule a frame during rendering, reschedule it after
|
||||
bool m_renderingActive = false;
|
||||
|
||||
bool pendingFrame = false; // if we schedule a frame during rendering, reschedule it after
|
||||
bool renderingActive = false;
|
||||
wl_event_source* m_renderTimer = nullptr; // for RAT
|
||||
bool m_ratsScheduled = false;
|
||||
CTimer m_lastPresentationTimer;
|
||||
|
||||
wl_event_source* renderTimer = nullptr; // for RAT
|
||||
bool RATScheduled = false;
|
||||
CTimer lastPresentationTimer;
|
||||
bool m_isBeingLeased = false;
|
||||
|
||||
bool isBeingLeased = false;
|
||||
|
||||
SMonitorRule activeMonitorRule;
|
||||
SMonitorRule m_activeMonitorRule;
|
||||
|
||||
// explicit sync
|
||||
Hyprutils::OS::CFileDescriptor inFence; // TODO: remove when aq uses CFileDescriptor
|
||||
Hyprutils::OS::CFileDescriptor m_inFence; // TODO: remove when aq uses CFileDescriptor
|
||||
|
||||
PHLMONITORREF self;
|
||||
PHLMONITORREF m_self;
|
||||
|
||||
// mirroring
|
||||
PHLMONITORREF pMirrorOf;
|
||||
std::vector<PHLMONITORREF> mirrors;
|
||||
PHLMONITORREF m_mirrorOf;
|
||||
std::vector<PHLMONITORREF> m_mirrors;
|
||||
|
||||
// ctm
|
||||
Mat3x3 ctm = Mat3x3::identity();
|
||||
bool ctmUpdated = false;
|
||||
Mat3x3 m_ctm = Mat3x3::identity();
|
||||
bool m_ctmUpdated = false;
|
||||
|
||||
// for tearing
|
||||
PHLWINDOWREF solitaryClient;
|
||||
PHLWINDOWREF m_solitaryClient;
|
||||
|
||||
// for direct scanout
|
||||
PHLWINDOWREF lastScanout;
|
||||
bool scanoutNeedsCursorUpdate = false;
|
||||
PHLWINDOWREF m_lastScanout;
|
||||
bool m_scanoutNeedsCursorUpdate = false;
|
||||
|
||||
struct {
|
||||
bool canTear = false;
|
||||
|
|
@ -165,7 +163,7 @@ class CMonitor {
|
|||
|
||||
bool busy = false;
|
||||
bool frameScheduledWhileBusy = false;
|
||||
} tearingState;
|
||||
} m_tearingState;
|
||||
|
||||
struct {
|
||||
CSignal destroy;
|
||||
|
|
@ -173,9 +171,9 @@ class CMonitor {
|
|||
CSignal disconnect;
|
||||
CSignal dpmsChanged;
|
||||
CSignal modeChanged;
|
||||
} events;
|
||||
} m_events;
|
||||
|
||||
std::array<std::vector<PHLLSREF>, 4> m_aLayerSurfaceLayers;
|
||||
std::array<std::vector<PHLLSREF>, 4> m_layerSurfaceLayers;
|
||||
|
||||
// methods
|
||||
void onConnect(bool noRule);
|
||||
|
|
@ -207,15 +205,15 @@ class CMonitor {
|
|||
void debugLastPresentation(const std::string& message);
|
||||
void onMonitorFrame();
|
||||
|
||||
bool m_bEnabled = false;
|
||||
bool m_bRenderingInitPassed = false;
|
||||
bool m_enabled = false;
|
||||
bool m_renderingInitPassed = false;
|
||||
WP<CWindow> m_previousFSWindow;
|
||||
NColorManagement::SImageDescription imageDescription;
|
||||
NColorManagement::SImageDescription m_imageDescription;
|
||||
|
||||
// For the list lookup
|
||||
|
||||
bool operator==(const CMonitor& rhs) {
|
||||
return vecPosition == rhs.vecPosition && vecSize == rhs.vecSize && szName == rhs.szName;
|
||||
return m_position == rhs.m_position && m_size == rhs.m_size && m_name == rhs.m_name;
|
||||
}
|
||||
|
||||
// workspace previous per monitor functionality
|
||||
|
|
@ -226,8 +224,8 @@ class CMonitor {
|
|||
void setupDefaultWS(const SMonitorRule&);
|
||||
WORKSPACEID findAvailableDefaultWS();
|
||||
|
||||
bool doneScheduled = false;
|
||||
std::stack<WORKSPACEID> prevWorkSpaces;
|
||||
bool m_doneScheduled = false;
|
||||
std::stack<WORKSPACEID> m_prevWorkSpaces;
|
||||
|
||||
struct {
|
||||
CHyprSignalListener frame;
|
||||
|
|
@ -236,5 +234,5 @@ class CMonitor {
|
|||
CHyprSignalListener needsFrame;
|
||||
CHyprSignalListener presented;
|
||||
CHyprSignalListener commit;
|
||||
} listeners;
|
||||
} m_listeners;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
using namespace Hyprutils::OS;
|
||||
|
||||
SP<CSyncTimeline> CSyncTimeline::create(int drmFD_) {
|
||||
auto timeline = SP<CSyncTimeline>(new CSyncTimeline);
|
||||
timeline->drmFD = drmFD_;
|
||||
timeline->self = timeline;
|
||||
auto timeline = SP<CSyncTimeline>(new CSyncTimeline);
|
||||
timeline->m_drmFD = drmFD_;
|
||||
timeline->m_self = timeline;
|
||||
|
||||
if (drmSyncobjCreate(drmFD_, 0, &timeline->handle)) {
|
||||
if (drmSyncobjCreate(drmFD_, 0, &timeline->m_handle)) {
|
||||
Debug::log(ERR, "CSyncTimeline: failed to create a drm syncobj??");
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -20,12 +20,12 @@ SP<CSyncTimeline> CSyncTimeline::create(int drmFD_) {
|
|||
}
|
||||
|
||||
SP<CSyncTimeline> CSyncTimeline::create(int drmFD_, CFileDescriptor&& drmSyncobjFD) {
|
||||
auto timeline = SP<CSyncTimeline>(new CSyncTimeline);
|
||||
timeline->drmFD = drmFD_;
|
||||
timeline->syncobjFd = std::move(drmSyncobjFD);
|
||||
timeline->self = timeline;
|
||||
auto timeline = SP<CSyncTimeline>(new CSyncTimeline);
|
||||
timeline->m_drmFD = drmFD_;
|
||||
timeline->m_syncobjFD = std::move(drmSyncobjFD);
|
||||
timeline->m_self = timeline;
|
||||
|
||||
if (drmSyncobjFDToHandle(drmFD_, timeline->syncobjFd.get(), &timeline->handle)) {
|
||||
if (drmSyncobjFDToHandle(drmFD_, timeline->m_syncobjFD.get(), &timeline->m_handle)) {
|
||||
Debug::log(ERR, "CSyncTimeline: failed to create a drm syncobj from fd??");
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -34,10 +34,10 @@ SP<CSyncTimeline> CSyncTimeline::create(int drmFD_, CFileDescriptor&& drmSyncobj
|
|||
}
|
||||
|
||||
CSyncTimeline::~CSyncTimeline() {
|
||||
if (handle == 0)
|
||||
if (m_handle == 0)
|
||||
return;
|
||||
|
||||
drmSyncobjDestroy(drmFD, handle);
|
||||
drmSyncobjDestroy(m_drmFD, m_handle);
|
||||
}
|
||||
|
||||
std::optional<bool> CSyncTimeline::check(uint64_t point, uint32_t flags) {
|
||||
|
|
@ -48,7 +48,7 @@ std::optional<bool> CSyncTimeline::check(uint64_t point, uint32_t flags) {
|
|||
#endif
|
||||
|
||||
uint32_t signaled = 0;
|
||||
int ret = drmSyncobjTimelineWait(drmFD, &handle, &point, 1, 0, flags, &signaled);
|
||||
int ret = drmSyncobjTimelineWait(m_drmFD, &m_handle, &point, 1, 0, flags, &signaled);
|
||||
if (ret != 0 && ret != -ETIME_ERR) {
|
||||
Debug::log(ERR, "CSyncTimeline::check: drmSyncobjTimelineWait failed");
|
||||
return std::nullopt;
|
||||
|
|
@ -65,7 +65,7 @@ bool CSyncTimeline::addWaiter(const std::function<void()>& waiter, uint64_t poin
|
|||
return false;
|
||||
}
|
||||
|
||||
if (drmSyncobjEventfd(drmFD, handle, point, eventFd.get(), flags)) {
|
||||
if (drmSyncobjEventfd(m_drmFD, m_handle, point, eventFd.get(), flags)) {
|
||||
Debug::log(ERR, "CSyncTimeline::addWaiter: drmSyncobjEventfd failed");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -79,58 +79,58 @@ CFileDescriptor CSyncTimeline::exportAsSyncFileFD(uint64_t src) {
|
|||
int sync = -1;
|
||||
|
||||
uint32_t syncHandle = 0;
|
||||
if (drmSyncobjCreate(drmFD, 0, &syncHandle)) {
|
||||
if (drmSyncobjCreate(m_drmFD, 0, &syncHandle)) {
|
||||
Debug::log(ERR, "exportAsSyncFileFD: drmSyncobjCreate failed");
|
||||
return {};
|
||||
}
|
||||
|
||||
if (drmSyncobjTransfer(drmFD, syncHandle, 0, handle, src, 0)) {
|
||||
if (drmSyncobjTransfer(m_drmFD, syncHandle, 0, m_handle, src, 0)) {
|
||||
Debug::log(ERR, "exportAsSyncFileFD: drmSyncobjTransfer failed");
|
||||
drmSyncobjDestroy(drmFD, syncHandle);
|
||||
drmSyncobjDestroy(m_drmFD, syncHandle);
|
||||
return {};
|
||||
}
|
||||
|
||||
if (drmSyncobjExportSyncFile(drmFD, syncHandle, &sync)) {
|
||||
if (drmSyncobjExportSyncFile(m_drmFD, syncHandle, &sync)) {
|
||||
Debug::log(ERR, "exportAsSyncFileFD: drmSyncobjExportSyncFile failed");
|
||||
drmSyncobjDestroy(drmFD, syncHandle);
|
||||
drmSyncobjDestroy(m_drmFD, syncHandle);
|
||||
return {};
|
||||
}
|
||||
|
||||
drmSyncobjDestroy(drmFD, syncHandle);
|
||||
drmSyncobjDestroy(m_drmFD, syncHandle);
|
||||
return CFileDescriptor{sync};
|
||||
}
|
||||
|
||||
bool CSyncTimeline::importFromSyncFileFD(uint64_t dst, CFileDescriptor& fd) {
|
||||
uint32_t syncHandle = 0;
|
||||
|
||||
if (drmSyncobjCreate(drmFD, 0, &syncHandle)) {
|
||||
if (drmSyncobjCreate(m_drmFD, 0, &syncHandle)) {
|
||||
Debug::log(ERR, "importFromSyncFileFD: drmSyncobjCreate failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (drmSyncobjImportSyncFile(drmFD, syncHandle, fd.get())) {
|
||||
if (drmSyncobjImportSyncFile(m_drmFD, syncHandle, fd.get())) {
|
||||
Debug::log(ERR, "importFromSyncFileFD: drmSyncobjImportSyncFile failed");
|
||||
drmSyncobjDestroy(drmFD, syncHandle);
|
||||
drmSyncobjDestroy(m_drmFD, syncHandle);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (drmSyncobjTransfer(drmFD, handle, dst, syncHandle, 0, 0)) {
|
||||
if (drmSyncobjTransfer(m_drmFD, m_handle, dst, syncHandle, 0, 0)) {
|
||||
Debug::log(ERR, "importFromSyncFileFD: drmSyncobjTransfer failed");
|
||||
drmSyncobjDestroy(drmFD, syncHandle);
|
||||
drmSyncobjDestroy(m_drmFD, syncHandle);
|
||||
return false;
|
||||
}
|
||||
|
||||
drmSyncobjDestroy(drmFD, syncHandle);
|
||||
drmSyncobjDestroy(m_drmFD, syncHandle);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSyncTimeline::transfer(SP<CSyncTimeline> from, uint64_t fromPoint, uint64_t toPoint) {
|
||||
if (drmFD != from->drmFD) {
|
||||
Debug::log(ERR, "CSyncTimeline::transfer: cannot transfer timelines between gpus, {} -> {}", from->drmFD, drmFD);
|
||||
if (m_drmFD != from->m_drmFD) {
|
||||
Debug::log(ERR, "CSyncTimeline::transfer: cannot transfer timelines between gpus, {} -> {}", from->m_drmFD, m_drmFD);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (drmSyncobjTransfer(drmFD, handle, toPoint, from->handle, fromPoint, 0)) {
|
||||
if (drmSyncobjTransfer(m_drmFD, m_handle, toPoint, from->m_handle, fromPoint, 0)) {
|
||||
Debug::log(ERR, "CSyncTimeline::transfer: drmSyncobjTransfer failed");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -139,6 +139,6 @@ bool CSyncTimeline::transfer(SP<CSyncTimeline> from, uint64_t fromPoint, uint64_
|
|||
}
|
||||
|
||||
void CSyncTimeline::signal(uint64_t point) {
|
||||
if (drmSyncobjTimelineSignal(drmFD, &handle, &point, 1))
|
||||
if (drmSyncobjTimelineSignal(m_drmFD, &m_handle, &point, 1))
|
||||
Debug::log(ERR, "CSyncTimeline::signal: drmSyncobjTimelineSignal failed");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ class CSyncTimeline {
|
|||
bool transfer(SP<CSyncTimeline> from, uint64_t fromPoint, uint64_t toPoint);
|
||||
void signal(uint64_t point);
|
||||
|
||||
int drmFD = -1;
|
||||
Hyprutils::OS::CFileDescriptor syncobjFd;
|
||||
uint32_t handle = 0;
|
||||
WP<CSyncTimeline> self;
|
||||
int m_drmFD = -1;
|
||||
Hyprutils::OS::CFileDescriptor m_syncobjFD;
|
||||
uint32_t m_handle = 0;
|
||||
WP<CSyncTimeline> m_self;
|
||||
|
||||
private:
|
||||
CSyncTimeline() = default;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue