summaryrefslogtreecommitdiff
path: root/src/cam/kms_sink.h
AgeCommit message (Collapse)Author
2022-08-09cam: kms_sink: Scale the frame buffer to full screen if supportedLaurent Pinchart
The KMS sink currently displays the frame buffer on the top-left corner of the screen, resulting in either a black area on the bottom and right sides (if the frame buffer is smaller than the display resolution) of in a restricted field of view (if the frame buffer is larger than the display resolution). Improve this by scaling the frame buffer to full screen if supported, and aligning the crop rectangle to the frame buffer center if the field of view needs to be restricted. The implementation test for possible composition options, from best to worst. The tests are performed when the camera is started, as testing atomic commits requires access to frame buffer objects, which are not available at configure time. Changing this would require either a large refactoring of the cam application to provide frame buffers earlier, or extending the KMS API to support testing commits with dummy buffer objects. Both are candidates for later development. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-09cam: kms_sink: Make lifetime management of DRM request saferLaurent Pinchart
The drmRequest is KMSSink::processRequest() is created as a naked pointer, passed to the constructor of the KMSSink::Request object that stores it in a std::unique_ptr<>, and used later in the function. The current implementation is safe, but could be prone to both memory leaks and use-after-free bugs if modified. Improve it by replacing the naked pointer with a std::unique_ptr<>. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-02-08cam: kms_sink: Use the first suitable pipeline foundEric Curtin
When searching for a suitable pipeline, we mistakenly only break from the inner loop. This results in the last suitable output being selected. Pick the first one instead. Fixes: 1de0f90dd432 ("cam: kms_sink: Print display pipelineconfiguration") Signed-off-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-11-24cam: Convert to pragma onceKieran Bingham
Remove the verbose #ifndef/#define/#endif pattern for maintaining header idempotency, and replace it with a simple #pragma once. This simplifies the headers, and prevents redundant changes when header files get moved. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-08-05cam: kms_sink: Enable display on first frameLaurent Pinchart
Not all display controllers support enabling the display without any active plane. Delay display enabling to the first frame. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-05cam: Add KMS sink classLaurent Pinchart
Add a KMSSink class to display framebuffers through the DRM/KMS API. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>