@@ -810,43 +810,43 @@ void DRMFrameGrabber::enumerateConnectorsAndEncoders(const drmModeRes* resources
810810
811811void 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
825825bool 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