Skip to content

Commit 8d86820

Browse files
committed
editorial changes
1 parent 6376010 commit 8d86820

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

include/grabber/drm/DRMFrameGrabber.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,6 @@ class DRMFrameGrabber : public Grabber
7575
*/
7676
~DRMFrameGrabber() override;
7777

78-
/**
79-
* @brief Releases all allocated DRM resources.
80-
* This includes closing the device file descriptor and freeing memory associated with
81-
* connectors, encoders, CRTCs, planes, and framebuffers.
82-
*/
83-
void freeResources();
84-
8578
/**
8679
* @brief Captures a single frame from the configured DRM device.
8780
* The captured frame is processed (cropped and scaled) and stored in the provided image object.
@@ -152,6 +145,13 @@ class DRMFrameGrabber : public Grabber
152145

153146
private:
154147

148+
/**
149+
* @brief Releases all allocated DRM resources.
150+
* This includes closing the device file descriptor and freeing memory associated with
151+
* connectors, encoders, CRTCs, planes, and framebuffers.
152+
*/
153+
void freeResources();
154+
155155
/**
156156
* @brief Opens the DRM device file descriptor.
157157
* @return True on success, false on failure.

libsrc/grabber/drm/DRMFrameGrabber.cpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -810,43 +810,43 @@ void DRMFrameGrabber::enumerateConnectorsAndEncoders(const drmModeRes* resources
810810

811811
void DRMFrameGrabber::findActiveCrtc(const drmModeRes* resources)
812812
{
813-
for (int i = 0; i < resources->count_crtcs; i++)
814-
{
815-
_crtc = drmModeGetCrtc(_deviceFd, resources->crtcs[i]);
816-
if (_crtc && _crtc->mode_valid)
817-
{
818-
return;
819-
}
820-
drmModeFreeCrtc(_crtc);
821-
_crtc = nullptr;
813+
for (int i = 0; i < resources->count_crtcs; i++)
814+
{
815+
_crtc = drmModeGetCrtc(_deviceFd, resources->crtcs[i]);
816+
if (_crtc && _crtc->mode_valid)
817+
{
818+
return; // Found active CRTC, so we can exit
819+
}
820+
drmModeFreeCrtc(_crtc);
821+
_crtc = nullptr;
822822
}
823823
}
824824

825825
bool DRMFrameGrabber::isPrimaryPlaneForCrtc(uint32_t planeId, const drmModeObjectProperties* properties)
826826
{
827827
for (unsigned int j = 0; j < properties->count_props; ++j)
828828
{
829-
auto prop = drmModeGetProperty(_deviceFd, properties->props[j]);
830-
if (!prop) continue;
829+
auto prop = drmModeGetProperty(_deviceFd, properties->props[j]);
830+
if (!prop) continue;
831831

832-
bool isPrimary = (strcmp(prop->name, "type") == 0 && properties->prop_values[j] == DRM_PLANE_TYPE_PRIMARY);
833-
drmModeFreeProperty(prop);
832+
bool isPrimary = (strcmp(prop->name, "type") == 0 && properties->prop_values[j] == DRM_PLANE_TYPE_PRIMARY);
833+
drmModeFreeProperty(prop);
834834

835-
if (isPrimary)
836-
{
837-
auto plane = drmModeGetPlane(_deviceFd, planeId);
838-
if (plane && _crtc && plane->crtc_id == _crtc->crtc_id)
839-
{
840-
qCDebug(grabber_drm) << plane;
841-
_planes.insert({planeId, plane});
842-
return true;
843-
}
844-
if (plane)
845-
{
846-
drmModeFreePlane(plane);
847-
}
848-
}
849-
}
835+
if (isPrimary)
836+
{
837+
auto plane = drmModeGetPlane(_deviceFd, planeId);
838+
if (plane && _crtc && plane->crtc_id == _crtc->crtc_id)
839+
{
840+
qCDebug(grabber_drm) << plane;
841+
_planes.insert({planeId, plane});
842+
return true;
843+
}
844+
if (plane)
845+
{
846+
drmModeFreePlane(plane);
847+
}
848+
}
849+
}
850850
return false;
851851
}
852852

0 commit comments

Comments
 (0)