All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: airlied@linux.ie, linux-fbdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org, b.zolnierkie@samsung.com
Subject: Re: [PATCH 07/11] drm/fbdevdrm: Add DRM <-> fbdev pixel-format conversion
Date: Tue, 26 Mar 2019 16:29:10 +0000	[thread overview]
Message-ID: <20190326162910.GY3888@intel.com> (raw)
In-Reply-To: <20190326091744.11542-8-tzimmermann@suse.de>

On Tue, Mar 26, 2019 at 10:17:40AM +0100, Thomas Zimmermann wrote:
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/fbdevdrm/Makefile          |   1 +
>  drivers/gpu/drm/fbdevdrm/fbdevdrm_format.c | 441 +++++++++++++++++++++
>  drivers/gpu/drm/fbdevdrm/fbdevdrm_format.h |  26 ++
>  3 files changed, 468 insertions(+)
>  create mode 100644 drivers/gpu/drm/fbdevdrm/fbdevdrm_format.c
>  create mode 100644 drivers/gpu/drm/fbdevdrm/fbdevdrm_format.h
> 
> diff --git a/drivers/gpu/drm/fbdevdrm/Makefile b/drivers/gpu/drm/fbdevdrm/Makefile
> index b8fab9d52faa..aef60d0f4888 100644
> --- a/drivers/gpu/drm/fbdevdrm/Makefile
> +++ b/drivers/gpu/drm/fbdevdrm/Makefile
> @@ -2,6 +2,7 @@ ccflags-y = -Iinclude/drm
>  fbdevdrm-y := fbdevdrm_bo.o \
>  	      fbdevdrm_device.o \
>  	      fbdevdrm_drv.o \
> +	      fbdevdrm_format.o \
>  	      fbdevdrm_modeset.o \
>  	      fbdevdrm_ttm.o
>  
> diff --git a/drivers/gpu/drm/fbdevdrm/fbdevdrm_format.c b/drivers/gpu/drm/fbdevdrm/fbdevdrm_format.c
> new file mode 100644
> index 000000000000..208f7c60e525
> --- /dev/null
> +++ b/drivers/gpu/drm/fbdevdrm/fbdevdrm_format.c
> @@ -0,0 +1,441 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later
> + *
> + * One purpose of this driver is to allow for easy conversion of framebuffer
> + * drivers to DRM. As a special exception to the GNU GPL, you are allowed to
> + * relicense this file under the terms of a license of your choice if you're
> + * porting a framebuffer driver. In order to do so, update the SPDX license
> + * identifier to the new license and remove this exception.
> + *
> + * If you add code to this file, please ensure that it's compatible with the
> + * stated exception.
> + */
> +
> +#include "fbdevdrm_format.h"
> +#include <asm/byteorder.h>
> +#include <linux/fb.h>
> +
> +#if defined __BIG_ENDIAN
> +#define HOST_FUNC(_func) \
> +	_func ## _be
> +#elif defined __LITTLE_ENDIAN
> +#define HOST_FUNC(_func) \
> +	_func ## _le
> +#else
> +#error "Unsupported endianess"
> +#endif
> +
> +static bool is_c8(const struct fb_info* fb_info)
> +{
> +	return fb_info->var.bits_per_pixel = 8;
> +}
> +
> +static bool is_rgb565_be(const struct fb_info* fb_info)
> +{
> +	return (fb_info->var.bits_per_pixel = 16) &&
> +	       (fb_info->var.red.offset = 0) &&
> +	       (fb_info->var.red.length = 5) &&
> +	       (fb_info->var.green.offset = 5) &&
> +	       (fb_info->var.green.length = 6) &&
> +	       (fb_info->var.blue.offset = 11) &&
> +	       (fb_info->var.blue.length = 5);
> +}

You can't distinguish LE vs. BE like this.

Maybe FBINFO_FOREIGN_ENDIAN is trustworthy?

-- 
Ville Syrjälä
Intel

WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: airlied@linux.ie, linux-fbdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org, b.zolnierkie@samsung.com
Subject: Re: [PATCH 07/11] drm/fbdevdrm: Add DRM <-> fbdev pixel-format conversion
Date: Tue, 26 Mar 2019 18:29:10 +0200	[thread overview]
Message-ID: <20190326162910.GY3888@intel.com> (raw)
In-Reply-To: <20190326091744.11542-8-tzimmermann@suse.de>

On Tue, Mar 26, 2019 at 10:17:40AM +0100, Thomas Zimmermann wrote:
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/fbdevdrm/Makefile          |   1 +
>  drivers/gpu/drm/fbdevdrm/fbdevdrm_format.c | 441 +++++++++++++++++++++
>  drivers/gpu/drm/fbdevdrm/fbdevdrm_format.h |  26 ++
>  3 files changed, 468 insertions(+)
>  create mode 100644 drivers/gpu/drm/fbdevdrm/fbdevdrm_format.c
>  create mode 100644 drivers/gpu/drm/fbdevdrm/fbdevdrm_format.h
> 
> diff --git a/drivers/gpu/drm/fbdevdrm/Makefile b/drivers/gpu/drm/fbdevdrm/Makefile
> index b8fab9d52faa..aef60d0f4888 100644
> --- a/drivers/gpu/drm/fbdevdrm/Makefile
> +++ b/drivers/gpu/drm/fbdevdrm/Makefile
> @@ -2,6 +2,7 @@ ccflags-y = -Iinclude/drm
>  fbdevdrm-y := fbdevdrm_bo.o \
>  	      fbdevdrm_device.o \
>  	      fbdevdrm_drv.o \
> +	      fbdevdrm_format.o \
>  	      fbdevdrm_modeset.o \
>  	      fbdevdrm_ttm.o
>  
> diff --git a/drivers/gpu/drm/fbdevdrm/fbdevdrm_format.c b/drivers/gpu/drm/fbdevdrm/fbdevdrm_format.c
> new file mode 100644
> index 000000000000..208f7c60e525
> --- /dev/null
> +++ b/drivers/gpu/drm/fbdevdrm/fbdevdrm_format.c
> @@ -0,0 +1,441 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later
> + *
> + * One purpose of this driver is to allow for easy conversion of framebuffer
> + * drivers to DRM. As a special exception to the GNU GPL, you are allowed to
> + * relicense this file under the terms of a license of your choice if you're
> + * porting a framebuffer driver. In order to do so, update the SPDX license
> + * identifier to the new license and remove this exception.
> + *
> + * If you add code to this file, please ensure that it's compatible with the
> + * stated exception.
> + */
> +
> +#include "fbdevdrm_format.h"
> +#include <asm/byteorder.h>
> +#include <linux/fb.h>
> +
> +#if defined __BIG_ENDIAN
> +#define HOST_FUNC(_func) \
> +	_func ## _be
> +#elif defined __LITTLE_ENDIAN
> +#define HOST_FUNC(_func) \
> +	_func ## _le
> +#else
> +#error "Unsupported endianess"
> +#endif
> +
> +static bool is_c8(const struct fb_info* fb_info)
> +{
> +	return fb_info->var.bits_per_pixel == 8;
> +}
> +
> +static bool is_rgb565_be(const struct fb_info* fb_info)
> +{
> +	return (fb_info->var.bits_per_pixel == 16) &&
> +	       (fb_info->var.red.offset == 0) &&
> +	       (fb_info->var.red.length == 5) &&
> +	       (fb_info->var.green.offset == 5) &&
> +	       (fb_info->var.green.length == 6) &&
> +	       (fb_info->var.blue.offset == 11) &&
> +	       (fb_info->var.blue.length == 5);
> +}

You can't distinguish LE vs. BE like this.

Maybe FBINFO_FOREIGN_ENDIAN is trustworthy?

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-03-26 16:29 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-26  9:17 [RFC][PATCH 00/11] DRM driver for fbdev devices Thomas Zimmermann
2019-03-26  9:17 ` Thomas Zimmermann
2019-03-26  9:17 ` [PATCH 01/11] drm/fbdevdrm: Add driver skeleton Thomas Zimmermann
2019-03-26  9:17   ` Thomas Zimmermann
2019-03-26  9:17 ` [PATCH 02/11] drm/fbdevdrm: Add fbdevdrm device Thomas Zimmermann
2019-03-26  9:17   ` Thomas Zimmermann
2019-03-26 16:03   ` Adam Jackson
2019-03-26 16:03     ` Adam Jackson
2019-03-27  7:55     ` Thomas Zimmermann
2019-03-27  7:55       ` Thomas Zimmermann
2019-03-27  8:03       ` Daniel Vetter
2019-03-27  8:03         ` Daniel Vetter
2019-03-26  9:17 ` [PATCH 03/11] drm/fbdevdrm: Add memory management Thomas Zimmermann
2019-03-26  9:17   ` Thomas Zimmermann
2019-03-26  9:17 ` [PATCH 04/11] drm/fbdevdrm: Add file operations Thomas Zimmermann
2019-03-26  9:17   ` Thomas Zimmermann
2019-03-26  9:17 ` [PATCH 05/11] drm/fbdevdrm: Add GEM and dumb interfaces Thomas Zimmermann
2019-03-26  9:17   ` Thomas Zimmermann
2019-03-26  9:17 ` [PATCH 06/11] drm/fbdevdrm: Add modesetting infrastructure Thomas Zimmermann
2019-03-26  9:17   ` Thomas Zimmermann
2019-03-26  9:17 ` [PATCH 07/11] drm/fbdevdrm: Add DRM <-> fbdev pixel-format conversion Thomas Zimmermann
2019-03-26  9:17   ` Thomas Zimmermann
2019-03-26 16:29   ` Ville Syrjälä [this message]
2019-03-26 16:29     ` Ville Syrjälä
2019-03-27  8:28     ` Thomas Zimmermann
2019-03-27  8:28       ` Thomas Zimmermann
2019-03-27 10:00       ` Ville Syrjälä
2019-03-27 10:00         ` Ville Syrjälä
2019-03-26  9:17 ` [PATCH 08/11] drm/fbdevdrm: Add mode conversion DRM <-> fbdev Thomas Zimmermann
2019-03-26  9:17   ` Thomas Zimmermann
2019-03-26  9:17 ` [PATCH 09/11] drm/fbdevdrm: Add primary plane Thomas Zimmermann
2019-03-26  9:17   ` Thomas Zimmermann
2019-03-26 13:33   ` Mathieu Malaterre
2019-03-26 13:33     ` Mathieu Malaterre
2019-03-26 13:57     ` Thomas Zimmermann
2019-03-26 13:57       ` Thomas Zimmermann
2019-03-27  9:37     ` Thomas Zimmermann
2019-03-27  9:37       ` Thomas Zimmermann
2019-04-02  7:08       ` Mathieu Malaterre
2019-04-02  7:08         ` Mathieu Malaterre
2019-03-26  9:17 ` [PATCH 10/11] drm/fbdevdrm: Add CRTC Thomas Zimmermann
2019-03-26  9:17   ` Thomas Zimmermann
2019-03-26  9:17 ` [PATCH 11/11] drm/fbdevdrm: Detect and validate display modes Thomas Zimmermann
2019-03-26  9:17   ` Thomas Zimmermann
2019-03-26 16:47   ` Ville Syrjälä
2019-03-26 16:47     ` Ville Syrjälä
2019-03-26 18:20     ` Daniel Vetter
2019-03-26 18:20       ` Daniel Vetter
2019-03-27  8:31     ` Thomas Zimmermann
2019-03-27  8:31       ` Thomas Zimmermann
2019-03-26 14:53 ` [RFC][PATCH 00/11] DRM driver for fbdev devices Daniel Vetter
2019-03-26 14:53   ` Daniel Vetter
2019-03-27  9:10   ` Thomas Zimmermann
2019-03-27  9:10     ` Thomas Zimmermann
2019-03-27  9:41     ` Daniel Vetter
2019-03-27  9:41       ` Daniel Vetter
2019-03-27  9:55       ` Michel Dänzer
2019-03-27  9:55         ` Michel Dänzer
2019-03-27 10:58         ` Daniel Vetter
2019-03-27 10:58           ` Daniel Vetter
2019-03-27 14:46       ` Thomas Zimmermann
2019-03-27 14:46         ` Thomas Zimmermann
2019-03-27 17:05         ` Daniel Vetter
2019-03-27 17:05           ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190326162910.GY3888@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=b.zolnierkie@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.