All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jordan Justen <jljusten@gmail.com>
To: Keith Packard <keithp@keithp.com>
Cc: "mesa-dev@lists.freedesktop.org" <mesa-dev@lists.freedesktop.org>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 5/8] dri/common: Add functions mapping MESA_FORMAT_* <-> __DRI_IMAGE_FORMAT_*
Date: Mon, 4 Nov 2013 19:01:45 -0800	[thread overview]
Message-ID: <CAFe8ug_8oRkKUdPANY1J585VYbNej0DHDu3+scgYkRGYMe1HDg@mail.gmail.com> (raw)
In-Reply-To: <1383618208-21310-6-git-send-email-keithp@keithp.com>

On Mon, Nov 4, 2013 at 6:23 PM, Keith Packard <keithp@keithp.com> wrote:
> The __DRI_IMAGE_FORMAT codes are used by the image extension, drivers need to
> be able to translate between them. Instead of duplicating this translation in
> each driver, create a shared version.
>
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
>  src/mesa/drivers/dri/common/dri_util.c | 62 ++++++++++++++++++++++++++++++++++
>  src/mesa/drivers/dri/common/dri_util.h |  6 ++++
>  2 files changed, 68 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
> index 95c8b41..76c8ae5 100644
> --- a/src/mesa/drivers/dri/common/dri_util.c
> +++ b/src/mesa/drivers/dri/common/dri_util.c
> @@ -792,3 +792,65 @@ driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv)
>        assert(fb->Height == dPriv->h);
>     }
>  }
> +
> +uint32_t
> +driGLFormatToImageFormat(gl_format format)
> +{
> +   switch (format) {
> +   case MESA_FORMAT_RGB565:
> +      return __DRI_IMAGE_FORMAT_RGB565;
> +   case MESA_FORMAT_XRGB8888:
> +      return __DRI_IMAGE_FORMAT_XRGB8888;
> +   case MESA_FORMAT_ARGB2101010:
> +      return __DRI_IMAGE_FORMAT_ARGB2101010;
> +   case MESA_FORMAT_XRGB2101010_UNORM:
> +      return __DRI_IMAGE_FORMAT_XRGB2101010;
> +   case MESA_FORMAT_ARGB8888:
> +      return __DRI_IMAGE_FORMAT_ARGB8888;
> +   case MESA_FORMAT_RGBA8888_REV:
> +      return __DRI_IMAGE_FORMAT_ABGR8888;
> +   case MESA_FORMAT_RGBX8888_REV:
> +      return __DRI_IMAGE_FORMAT_XBGR8888;
> +   case MESA_FORMAT_R8:
> +      return __DRI_IMAGE_FORMAT_R8;
> +   case MESA_FORMAT_GR88:
> +      return __DRI_IMAGE_FORMAT_GR88;
> +   case MESA_FORMAT_NONE:
> +      return __DRI_IMAGE_FORMAT_NONE;
> +   case MESA_FORMAT_SARGB8:
> +      return __DRI_IMAGE_FORMAT_SARGB8;

After patch 6, this will add SARGB8, right? So, maybe add this to the
commit message, or separate out adding SARGB8 into a separate commit?

Patches 1-6: Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

-Jordan

> +   default:
> +      return 0;
> +   }
> +}
> +
> +gl_format
> +driImageFormatToGLFormat(uint32_t image_format)
> +{
> +   switch (image_format) {
> +   case __DRI_IMAGE_FORMAT_RGB565:
> +      return MESA_FORMAT_RGB565;
> +   case __DRI_IMAGE_FORMAT_XRGB8888:
> +      return MESA_FORMAT_XRGB8888;
> +   case __DRI_IMAGE_FORMAT_ARGB2101010:
> +      return MESA_FORMAT_ARGB2101010;
> +   case __DRI_IMAGE_FORMAT_XRGB2101010:
> +      return MESA_FORMAT_XRGB2101010_UNORM;
> +   case __DRI_IMAGE_FORMAT_ARGB8888:
> +      return MESA_FORMAT_ARGB8888;
> +   case __DRI_IMAGE_FORMAT_ABGR8888:
> +      return MESA_FORMAT_RGBA8888_REV;
> +   case __DRI_IMAGE_FORMAT_XBGR8888:
> +      return MESA_FORMAT_RGBX8888_REV;
> +   case __DRI_IMAGE_FORMAT_R8:
> +      return MESA_FORMAT_R8;
> +   case __DRI_IMAGE_FORMAT_GR88:
> +      return MESA_FORMAT_GR88;
> +   case __DRI_IMAGE_FORMAT_SARGB8:
> +      return MESA_FORMAT_SARGB8;
> +   case __DRI_IMAGE_FORMAT_NONE:
> +      return MESA_FORMAT_NONE;
> +   default:
> +      return MESA_FORMAT_NONE;
> +   }
> +}
> diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
> index 5b56061..fd40769 100644
> --- a/src/mesa/drivers/dri/common/dri_util.h
> +++ b/src/mesa/drivers/dri/common/dri_util.h
> @@ -271,6 +271,12 @@ struct __DRIdrawableRec {
>      } dri2;
>  };
>
> +extern uint32_t
> +driGLFormatToImageFormat(gl_format format);
> +
> +extern gl_format
> +driImageFormatToGLFormat(uint32_t image_format);
> +
>  extern void
>  dri2InvalidateDrawable(__DRIdrawable *drawable);
>
> --
> 1.8.4.2
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2013-11-05  3:01 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05  2:23 [PATCH 0/8] Add DRIimage-based DRI3/Present loader Keith Packard
2013-11-05  2:23 ` [PATCH 1/8] drivers/dri/common: A few dri2 functions are not actually DRI2 specific Keith Packard
2013-11-05  2:23 ` [PATCH 2/8] dri/intel: Split out DRI2 buffer update code to separate function Keith Packard
2013-11-05  2:23 ` [PATCH 3/8] dri/intel: Add explicit size parameter to intel_region_alloc_for_fd Keith Packard
2013-11-05 22:23   ` Kristian Høgsberg
2013-11-06  0:52     ` Keith Packard
2013-11-07  5:17     ` Christopher James Halse Rogers
2013-11-07  5:42       ` Keith Packard
2013-11-05  2:23 ` [PATCH 4/8] Define __DRI_IMAGE_FORMAT_SARGB8 Keith Packard
2013-11-05  2:23 ` [PATCH 5/8] dri/common: Add functions mapping MESA_FORMAT_* <-> __DRI_IMAGE_FORMAT_* Keith Packard
2013-11-05  3:01   ` Jordan Justen [this message]
2013-11-05  4:11     ` Keith Packard
2013-11-05 22:53       ` Jordan Justen
2013-11-05 22:35   ` Kristian Høgsberg
2013-11-06  0:54     ` Keith Packard
2013-11-05  2:23 ` [PATCH 6/8] dri/i915, dri/i965: Use driGLFormatToImageFormat and driImageFormatToGLFormat Keith Packard
2013-11-05 22:37   ` [PATCH 6/8] dri/i915,dri/i965: " Kristian Høgsberg
2013-11-05  2:23 ` [PATCH 7/8] dri: add __DRIimageLoaderExtension and __DRIimageDriverExtension Keith Packard
2013-11-05 20:05   ` Eric Anholt
2013-11-05 23:47     ` Keith Packard
2013-11-05 22:59   ` Kristian Høgsberg
2013-11-06  0:59     ` Keith Packard
2013-11-06  2:48       ` Kristian Høgsberg
2013-11-06  6:25   ` Kristian Høgsberg
2013-11-06 14:55     ` Keith Packard
2013-11-06 16:17       ` Kristian Høgsberg
2013-11-06 18:09         ` Keith Packard
2013-11-06 19:06           ` Kristian Høgsberg
2013-11-06 19:29             ` Keith Packard
2013-11-05  2:23 ` [PATCH 8/8] Add DRI3+Present loader Keith Packard
2013-11-05 23:10   ` Eric Anholt
2013-11-06  2:32     ` Keith Packard
2013-11-05 16:40 ` [PATCH 0/8] Add DRIimage-based DRI3/Present loader Keith Packard
2013-11-05 20:04   ` Eric Anholt
2013-11-05 22:09     ` Kristian Høgsberg
2013-11-05 23:54     ` 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=CAFe8ug_8oRkKUdPANY1J585VYbNej0DHDu3+scgYkRGYMe1HDg@mail.gmail.com \
    --to=jljusten@gmail.com \
    --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 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.