Re: [PATCH libdrm] modetest: fix printing of fourcc on BE machines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18/04/17 09:56 PM, Ilia Mirkin wrote:
> fourcc is not a string, it's a packed integer. This happens to work out
> on LE, but gets reversed on BE.
> 
> Signed-off-by: Ilia Mirkin <imirkin@xxxxxxxxxxxx>
> ---
>  tests/modetest/modetest.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
> index c390d87..b8891ff 100644
> --- a/tests/modetest/modetest.c
> +++ b/tests/modetest/modetest.c
> @@ -174,6 +174,15 @@ static const char *mode_flag_names[] = {
>  
>  static bit_name_fn(mode_flag)
>  
> +static void dump_fourcc(uint32_t fourcc)
> +{
> +	printf(" %c%c%c%c",
> +		fourcc,
> +		fourcc >> 8,
> +		fourcc >> 16,
> +		fourcc >> 24);
> +}
> +
>  static void dump_encoders(struct device *dev)
>  {
>  	drmModeEncoder *encoder;
> @@ -443,7 +452,7 @@ static void dump_planes(struct device *dev)
>  
>  		printf("  formats:");
>  		for (j = 0; j < ovr->count_formats; j++)
> -			printf(" %4.4s", (char *)&ovr->formats[j]);
> +			dump_fourcc(ovr->formats[j]);
>  		printf("\n");
>  
>  		if (plane->props) {
> 

Reviewed-by: Michel Dänzer <michel.daenzer@xxxxxxx>


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux