public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] demos/intel_sprite_on: Fix connector iteration bug
@ 2016-06-13 14:51 Jim Bride
  2016-06-15 12:17 ` Marius Vlad
  2016-06-15 17:48 ` [PATCH v2 " Jim Bride
  0 siblings, 2 replies; 5+ messages in thread
From: Jim Bride @ 2016-06-13 14:51 UTC (permalink / raw)
  To: intel-gfx

Instead of looping until the first disconnected port is found,
now go through all possible connectors, drawing the sprite on
any connected display.

Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
---
 demos/intel_sprite_on.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/demos/intel_sprite_on.c b/demos/intel_sprite_on.c
index 6dddded..ff40e3c 100644
--- a/demos/intel_sprite_on.c
+++ b/demos/intel_sprite_on.c
@@ -563,10 +563,8 @@ static void ricochet(int tiled, int sprite_w, int sprite_h,
 
 		// Find the native (preferred) display mode
 		connector_find_preferred_mode(gfx_fd, gfx_resources, &curr_connector);
-		if (curr_connector.mode_valid == 0) {
-			printf("No valid preferred mode detected\n");
-			goto out;
-		}
+		if (curr_connector.mode_valid == 0)
+			continue;
 
 		// Determine if sprite hardware is available on pipe
 		// associated with this connector.
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH i-g-t] demos/intel_sprite_on: Fix connector iteration bug
  2016-06-13 14:51 [PATCH i-g-t] demos/intel_sprite_on: Fix connector iteration bug Jim Bride
@ 2016-06-15 12:17 ` Marius Vlad
  2016-06-15 17:24   ` Jim Bride
  2016-06-15 17:48 ` [PATCH v2 " Jim Bride
  1 sibling, 1 reply; 5+ messages in thread
From: Marius Vlad @ 2016-06-15 12:17 UTC (permalink / raw)
  To: Jim Bride; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 1393 bytes --]

On Mon, Jun 13, 2016 at 07:51:06AM -0700, Jim Bride wrote:
> Instead of looping until the first disconnected port is found,
> now go through all possible connectors, drawing the sprite on
> any connected display.
> 
> Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
> ---
>  demos/intel_sprite_on.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/demos/intel_sprite_on.c b/demos/intel_sprite_on.c
> index 6dddded..ff40e3c 100644
> --- a/demos/intel_sprite_on.c
> +++ b/demos/intel_sprite_on.c
> @@ -563,10 +563,8 @@ static void ricochet(int tiled, int sprite_w, int sprite_h,
>  
>  		// Find the native (preferred) display mode
>  		connector_find_preferred_mode(gfx_fd, gfx_resources, &curr_connector);
> -		if (curr_connector.mode_valid == 0) {
> -			printf("No valid preferred mode detected\n");
> -			goto out;
> -		}
> +		if (curr_connector.mode_valid == 0)
> +			continue;

Could you also add that info message when all connectors are disconnected?

Like checking the index is equal w/ the number of connectors available?

>  
>  		// Determine if sprite hardware is available on pipe
>  		// associated with this connector.
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH i-g-t] demos/intel_sprite_on: Fix connector iteration bug
  2016-06-15 12:17 ` Marius Vlad
@ 2016-06-15 17:24   ` Jim Bride
  0 siblings, 0 replies; 5+ messages in thread
From: Jim Bride @ 2016-06-15 17:24 UTC (permalink / raw)
  To: intel-gfx

On Wed, Jun 15, 2016 at 03:17:28PM +0300, Marius Vlad wrote:
> On Mon, Jun 13, 2016 at 07:51:06AM -0700, Jim Bride wrote:
> > Instead of looping until the first disconnected port is found,
> > now go through all possible connectors, drawing the sprite on
> > any connected display.
> > 
> > Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
> > ---
> >  demos/intel_sprite_on.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/demos/intel_sprite_on.c b/demos/intel_sprite_on.c
> > index 6dddded..ff40e3c 100644
> > --- a/demos/intel_sprite_on.c
> > +++ b/demos/intel_sprite_on.c
> > @@ -563,10 +563,8 @@ static void ricochet(int tiled, int sprite_w, int sprite_h,
> >  
> >  		// Find the native (preferred) display mode
> >  		connector_find_preferred_mode(gfx_fd, gfx_resources, &curr_connector);
> > -		if (curr_connector.mode_valid == 0) {
> > -			printf("No valid preferred mode detected\n");
> > -			goto out;
> > -		}
> > +		if (curr_connector.mode_valid == 0)
> > +			continue;
> 
> Could you also add that info message when all connectors are disconnected?
> 
> Like checking the index is equal w/ the number of connectors available?

Sure.  New version coming in a little bit.

Jim

> >  
> >  		// Determine if sprite hardware is available on pipe
> >  		// associated with this connector.
> > -- 
> > 2.7.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 i-g-t] demos/intel_sprite_on: Fix connector iteration bug
  2016-06-13 14:51 [PATCH i-g-t] demos/intel_sprite_on: Fix connector iteration bug Jim Bride
  2016-06-15 12:17 ` Marius Vlad
@ 2016-06-15 17:48 ` Jim Bride
  2016-07-04 14:34   ` Marius Vlad
  1 sibling, 1 reply; 5+ messages in thread
From: Jim Bride @ 2016-06-15 17:48 UTC (permalink / raw)
  To: intel-gfx

Instead of looping until the first disconnected port is found,
now go through all possible connectors, drawing the sprite on
any connected display.

v2: Print a message if we don't find any valid connectors.

Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
---
 demos/intel_sprite_on.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/demos/intel_sprite_on.c b/demos/intel_sprite_on.c
index 6dddded..d3bd420 100644
--- a/demos/intel_sprite_on.c
+++ b/demos/intel_sprite_on.c
@@ -518,6 +518,8 @@ static void ricochet(int tiled, int sprite_w, int sprite_h,
 	char                                key;
 	int				    sprite_plane_count = 0;
 	int 				    i;
+	int 				    found_count = 0;
+
 	// Open up I915 graphics device
 	gfx_fd = drmOpen("i915", NULL);
 	if (gfx_fd < 0) {
@@ -564,10 +566,15 @@ static void ricochet(int tiled, int sprite_w, int sprite_h,
 		// Find the native (preferred) display mode
 		connector_find_preferred_mode(gfx_fd, gfx_resources, &curr_connector);
 		if (curr_connector.mode_valid == 0) {
-			printf("No valid preferred mode detected\n");
-			goto out;
+
+			if (((c_index + 1) == gfx_resources->count_connectors) &&
+			    (found_count == 0))
+				printf("Failed to find any valid connections.");
+			continue;
 		}
 
+		found_count++;
+
 		// Determine if sprite hardware is available on pipe
 		// associated with this connector.
 		sprite_plane_count = connector_find_plane(gfx_fd, &curr_connector,
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 i-g-t] demos/intel_sprite_on: Fix connector iteration bug
  2016-06-15 17:48 ` [PATCH v2 " Jim Bride
@ 2016-07-04 14:34   ` Marius Vlad
  0 siblings, 0 replies; 5+ messages in thread
From: Marius Vlad @ 2016-07-04 14:34 UTC (permalink / raw)
  To: Jim Bride; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 1684 bytes --]

Applied.
On Wed, Jun 15, 2016 at 10:48:32AM -0700, Jim Bride wrote:
> Instead of looping until the first disconnected port is found,
> now go through all possible connectors, drawing the sprite on
> any connected display.
> 
> v2: Print a message if we don't find any valid connectors.
> 
> Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
> ---
>  demos/intel_sprite_on.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/demos/intel_sprite_on.c b/demos/intel_sprite_on.c
> index 6dddded..d3bd420 100644
> --- a/demos/intel_sprite_on.c
> +++ b/demos/intel_sprite_on.c
> @@ -518,6 +518,8 @@ static void ricochet(int tiled, int sprite_w, int sprite_h,
>  	char                                key;
>  	int				    sprite_plane_count = 0;
>  	int 				    i;
> +	int 				    found_count = 0;
> +
>  	// Open up I915 graphics device
>  	gfx_fd = drmOpen("i915", NULL);
>  	if (gfx_fd < 0) {
> @@ -564,10 +566,15 @@ static void ricochet(int tiled, int sprite_w, int sprite_h,
>  		// Find the native (preferred) display mode
>  		connector_find_preferred_mode(gfx_fd, gfx_resources, &curr_connector);
>  		if (curr_connector.mode_valid == 0) {
> -			printf("No valid preferred mode detected\n");
> -			goto out;
> +
> +			if (((c_index + 1) == gfx_resources->count_connectors) &&
> +			    (found_count == 0))
> +				printf("Failed to find any valid connections.");
> +			continue;
>  		}
>  
> +		found_count++;
> +
>  		// Determine if sprite hardware is available on pipe
>  		// associated with this connector.
>  		sprite_plane_count = connector_find_plane(gfx_fd, &curr_connector,
> -- 
> 2.7.4
> 

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-04 14:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-13 14:51 [PATCH i-g-t] demos/intel_sprite_on: Fix connector iteration bug Jim Bride
2016-06-15 12:17 ` Marius Vlad
2016-06-15 17:24   ` Jim Bride
2016-06-15 17:48 ` [PATCH v2 " Jim Bride
2016-07-04 14:34   ` Marius Vlad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox