diff mbox

[i-g-t] demos/intel_sprite_on: Fix connector iteration bug

Message ID 1465829466-13735-1-git-send-email-jim.bride@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

jim.bride@linux.intel.com June 13, 2016, 2:51 p.m. UTC
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(-)

Comments

Marius Vlad June 15, 2016, 12:17 p.m. UTC | #1
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
jim.bride@linux.intel.com June 15, 2016, 5:24 p.m. UTC | #2
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
diff mbox

Patch

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.