[libcamera-devel,1/3] cam: drm: Add support for test-only commits
diff mbox series

Message ID 20220807180100.396-2-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • cam: Support KMS scaling
Related show

Commit Message

Laurent Pinchart Aug. 7, 2022, 6 p.m. UTC
Test-only commits are used to test a commit without applying any
modification to the device. This will be used by the KMS sink to test
feature support.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/cam/drm.cpp | 2 ++
 src/cam/drm.h   | 1 +
 2 files changed, 3 insertions(+)

Comments

Kieran Bingham Aug. 7, 2022, 7:49 p.m. UTC | #1
Quoting Laurent Pinchart via libcamera-devel (2022-08-07 19:00:58)
> Test-only commits are used to test a commit without applying any
> modification to the device. This will be used by the KMS sink to test
> feature support.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/cam/drm.cpp | 2 ++
>  src/cam/drm.h   | 1 +
>  2 files changed, 3 insertions(+)
> 
> diff --git a/src/cam/drm.cpp b/src/cam/drm.cpp
> index fbfc0a595d36..b0602c942853 100644
> --- a/src/cam/drm.cpp
> +++ b/src/cam/drm.cpp
> @@ -377,6 +377,8 @@ int AtomicRequest::commit(unsigned int flags)
>                 drmFlags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
>         if (flags & FlagAsync)
>                 drmFlags |= DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK;
> +       if (flags & FlagTestOnly)
> +               drmFlags |= DRM_MODE_ATOMIC_TEST_ONLY;
>  
>         return drmModeAtomicCommit(dev_->fd(), request_, drmFlags, this);
>  }
> diff --git a/src/cam/drm.h b/src/cam/drm.h
> index 655a7509c001..ebaea04d3974 100644
> --- a/src/cam/drm.h
> +++ b/src/cam/drm.h
> @@ -251,6 +251,7 @@ public:
>         enum Flags {
>                 FlagAllowModeset = (1 << 0),
>                 FlagAsync = (1 << 1),
> +               FlagTestOnly = (1 << 2),

I still want BIT() :-D but perhaps here it should be FLAG() ...

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

>         };
>  
>         AtomicRequest(Device *dev);
> -- 
> Regards,
> 
> Laurent Pinchart
>
Eric Curtin Aug. 8, 2022, 10:38 a.m. UTC | #2
Hi Laurent,

On Sun, 7 Aug 2022 at 19:01, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Test-only commits are used to test a commit without applying any
> modification to the device. This will be used by the KMS sink to test
> feature support.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

LGTM, and also tested successfully.

Reviewed-by: Eric Curtin <ecurtin@redhat.com>

> ---
>  src/cam/drm.cpp | 2 ++
>  src/cam/drm.h   | 1 +
>  2 files changed, 3 insertions(+)
>
> diff --git a/src/cam/drm.cpp b/src/cam/drm.cpp
> index fbfc0a595d36..b0602c942853 100644
> --- a/src/cam/drm.cpp
> +++ b/src/cam/drm.cpp
> @@ -377,6 +377,8 @@ int AtomicRequest::commit(unsigned int flags)
>                 drmFlags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
>         if (flags & FlagAsync)
>                 drmFlags |= DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK;
> +       if (flags & FlagTestOnly)
> +               drmFlags |= DRM_MODE_ATOMIC_TEST_ONLY;
>
>         return drmModeAtomicCommit(dev_->fd(), request_, drmFlags, this);
>  }
> diff --git a/src/cam/drm.h b/src/cam/drm.h
> index 655a7509c001..ebaea04d3974 100644
> --- a/src/cam/drm.h
> +++ b/src/cam/drm.h
> @@ -251,6 +251,7 @@ public:
>         enum Flags {
>                 FlagAllowModeset = (1 << 0),
>                 FlagAsync = (1 << 1),
> +               FlagTestOnly = (1 << 2),
>         };
>
>         AtomicRequest(Device *dev);
> --
> Regards,
>
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/cam/drm.cpp b/src/cam/drm.cpp
index fbfc0a595d36..b0602c942853 100644
--- a/src/cam/drm.cpp
+++ b/src/cam/drm.cpp
@@ -377,6 +377,8 @@  int AtomicRequest::commit(unsigned int flags)
 		drmFlags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
 	if (flags & FlagAsync)
 		drmFlags |= DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_NONBLOCK;
+	if (flags & FlagTestOnly)
+		drmFlags |= DRM_MODE_ATOMIC_TEST_ONLY;
 
 	return drmModeAtomicCommit(dev_->fd(), request_, drmFlags, this);
 }
diff --git a/src/cam/drm.h b/src/cam/drm.h
index 655a7509c001..ebaea04d3974 100644
--- a/src/cam/drm.h
+++ b/src/cam/drm.h
@@ -251,6 +251,7 @@  public:
 	enum Flags {
 		FlagAllowModeset = (1 << 0),
 		FlagAsync = (1 << 1),
+		FlagTestOnly = (1 << 2),
 	};
 
 	AtomicRequest(Device *dev);