From: Daniel Vetter <daniel@ffwll.ch>
To: Keith Packard <keithp@keithp.com>
Cc: mesa-dev@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] dri3, i915, i965: Add __DRI_IMAGE_FOURCC_SARGB8888
Date: Fri, 22 Nov 2013 11:26:32 +0100 [thread overview]
Message-ID: <20131122102632.GQ27344@phenom.ffwll.local> (raw)
In-Reply-To: <1385093524-22276-1-git-send-email-keithp@keithp.com>
On Thu, Nov 21, 2013 at 08:12:04PM -0800, Keith Packard wrote:
> The __DRIimage createImageFromFds function takes a fourcc code, but there was
> no fourcc code that match __DRI_IMAGE_FORMAT_SARGB8. This adds a define for
> that format, adds a translation in DRI3 from __DRI_IMAGE_FORMAT_SARGB8 to
> __DRI_IMAGE_FOURCC_SARGB8888 and then adds translations *back* to
> __IMAGE_FORMAT_SARGB8 in both the i915 and i965 drivers.
>
> I'll refrain from comments on whether I think having two separate sets of
> format defines in dri_interface.h is a good idea or not...
>
> Signed-off-by: Keith Packard <keithp@keithp.com>
Hm, where do we have the canonical source for all these fourcc codes? I'm
asking since we have our own copy in the kernel as drm_fourcc.h, and that
one is part of the userspace ABI since we use it to pass around
framebuffer formats and format lists.
Just afraid to create long-term maintainance madness here with the
kernel's iron thou-shalt-not-break-userspace-ever rule ... Not likely
we'll ever accept srgb for framebuffers though.
-Daniel
> ---
>
> This gets iceweasel running with the GL compositor enabled.
>
> include/GL/internal/dri_interface.h | 1 +
> src/glx/dri3_glx.c | 1 +
> src/mesa/drivers/dri/i915/intel_screen.c | 3 +++
> src/mesa/drivers/dri/i965/intel_screen.c | 3 +++
> 4 files changed, 8 insertions(+)
>
> diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
> index b012570..a4387c4 100644
> --- a/include/GL/internal/dri_interface.h
> +++ b/include/GL/internal/dri_interface.h
> @@ -1034,6 +1034,7 @@ struct __DRIdri2ExtensionRec {
> #define __DRI_IMAGE_FOURCC_XRGB8888 0x34325258
> #define __DRI_IMAGE_FOURCC_ABGR8888 0x34324241
> #define __DRI_IMAGE_FOURCC_XBGR8888 0x34324258
> +#define __DRI_IMAGE_FOURCC_SARGB8888 0x83324258
> #define __DRI_IMAGE_FOURCC_YUV410 0x39565559
> #define __DRI_IMAGE_FOURCC_YUV411 0x31315559
> #define __DRI_IMAGE_FOURCC_YUV420 0x32315559
> diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
> index b047cc8..5861317 100644
> --- a/src/glx/dri3_glx.c
> +++ b/src/glx/dri3_glx.c
> @@ -890,6 +890,7 @@ image_format_to_fourcc(int format)
>
> /* Convert from __DRI_IMAGE_FORMAT to __DRI_IMAGE_FOURCC (sigh) */
> switch (format) {
> + case __DRI_IMAGE_FORMAT_SARGB8: return __DRI_IMAGE_FOURCC_SARGB8888;
> case __DRI_IMAGE_FORMAT_RGB565: return __DRI_IMAGE_FOURCC_RGB565;
> case __DRI_IMAGE_FORMAT_XRGB8888: return __DRI_IMAGE_FOURCC_XRGB8888;
> case __DRI_IMAGE_FORMAT_ARGB8888: return __DRI_IMAGE_FOURCC_ARGB8888;
> diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
> index 7f1fc6b..2dd2bc7 100644
> --- a/src/mesa/drivers/dri/i915/intel_screen.c
> +++ b/src/mesa/drivers/dri/i915/intel_screen.c
> @@ -184,6 +184,9 @@ static struct intel_image_format intel_image_formats[] = {
> { __DRI_IMAGE_FOURCC_ARGB8888, __DRI_IMAGE_COMPONENTS_RGBA, 1,
> { { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 } } },
>
> + { __DRI_IMAGE_FOURCC_SARGB8888, __DRI_IMAGE_COMPONENTS_RGBA, 1,
> + { { 0, 0, 0, __DRI_IMAGE_FORMAT_SARGB8, 4 } } },
> +
> { __DRI_IMAGE_FOURCC_XRGB8888, __DRI_IMAGE_COMPONENTS_RGB, 1,
> { { 0, 0, 0, __DRI_IMAGE_FORMAT_XRGB8888, 4 }, } },
>
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
> index e44d0f6..cf8c3e2 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -220,6 +220,9 @@ static struct intel_image_format intel_image_formats[] = {
> { __DRI_IMAGE_FOURCC_ARGB8888, __DRI_IMAGE_COMPONENTS_RGBA, 1,
> { { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 } } },
>
> + { __DRI_IMAGE_FOURCC_SARGB8888, __DRI_IMAGE_COMPONENTS_RGBA, 1,
> + { { 0, 0, 0, __DRI_IMAGE_FORMAT_SARGB8, 4 } } },
> +
> { __DRI_IMAGE_FOURCC_XRGB8888, __DRI_IMAGE_COMPONENTS_RGB, 1,
> { { 0, 0, 0, __DRI_IMAGE_FORMAT_XRGB8888, 4 }, } },
>
> --
> 1.8.4.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2013-11-22 10:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-22 4:12 [PATCH] dri3, i915, i965: Add __DRI_IMAGE_FOURCC_SARGB8888 Keith Packard
2013-11-22 10:26 ` Daniel Vetter [this message]
2013-11-22 11:01 ` [Mesa-dev] " Keith Packard
2013-11-22 16:17 ` Daniel Vetter
2013-11-22 17:46 ` Ville Syrjälä
2013-11-22 22:12 ` [Intel-gfx] " Kristian Høgsberg
2013-11-22 23:05 ` Ville Syrjälä
2013-11-22 23:43 ` Keith Packard
2013-11-23 1:10 ` Ville Syrjälä
2013-11-25 14:57 ` Geert Uytterhoeven
2013-11-22 23:36 ` [Intel-gfx] " Keith Packard
2013-11-25 8:57 ` [Mesa-dev] " Daniel Vetter
2013-11-25 14:15 ` Ville Syrjälä
2013-11-25 22:08 ` Eric Anholt
2013-12-13 22:58 ` Kenneth Graunke
2013-12-14 0:37 ` [Mesa-dev] " Keith Packard
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=20131122102632.GQ27344@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=keithp@keithp.com \
--cc=mesa-dev@lists.freedesktop.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox