diff mbox series

[i-g-t,4/5] lib/kms: Skip no-op display updates

Message ID 20180914201310.19527-4-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [i-g-t,1/5] igt/kms_getfb: Check the iface exists before use | expand

Commit Message

Chris Wilson Sept. 14, 2018, 8:13 p.m. UTC
If the display is disabled (e.g. the driver has disabled the KMS
interface) there is nothing to do so avoid failing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_kms.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Daniel Vetter Oct. 1, 2018, 8:47 a.m. UTC | #1
On Fri, Sep 14, 2018 at 09:13:09PM +0100, Chris Wilson wrote:
> If the display is disabled (e.g. the driver has disabled the KMS
> interface) there is nothing to do so avoid failing.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Silently doing nothing feels funny, I think putting the igt_require into
igt_display_init makes more sense with this one in mind. Also avoids the
churn in patch 5.
-Daniel

> ---
>  lib/igt_kms.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 9710bcae1..dedc81344 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -3271,6 +3271,9 @@ static int do_display_commit(igt_display_t *display,
>  	enum pipe pipe;
>  	LOG_INDENT(display, "commit");
>  
> +	if (!display->n_pipes || !display->n_outputs)
> +		return 0; /* nothing to do */
> +
>  	igt_display_refresh(display);
>  
>  	if (s == COMMIT_ATOMIC) {
> @@ -3321,6 +3324,9 @@ int igt_display_try_commit_atomic(igt_display_t *display, uint32_t flags, void *
>  {
>  	int ret;
>  
> +	if (!display->n_pipes || !display->n_outputs)
> +		return 0; /* nothing to do */
> +
>  	LOG_INDENT(display, "commit");
>  
>  	igt_display_refresh(display);
> -- 
> 2.19.0
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
diff mbox series

Patch

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 9710bcae1..dedc81344 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3271,6 +3271,9 @@  static int do_display_commit(igt_display_t *display,
 	enum pipe pipe;
 	LOG_INDENT(display, "commit");
 
+	if (!display->n_pipes || !display->n_outputs)
+		return 0; /* nothing to do */
+
 	igt_display_refresh(display);
 
 	if (s == COMMIT_ATOMIC) {
@@ -3321,6 +3324,9 @@  int igt_display_try_commit_atomic(igt_display_t *display, uint32_t flags, void *
 {
 	int ret;
 
+	if (!display->n_pipes || !display->n_outputs)
+		return 0; /* nothing to do */
+
 	LOG_INDENT(display, "commit");
 
 	igt_display_refresh(display);