dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Kristian Høgsberg" <hoegsberg@gmail.com>
To: Keith Packard <keithp@keithp.com>
Cc: mesa3d-dev@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 6/8] dri/i915,dri/i965: Use driGLFormatToImageFormat and driImageFormatToGLFormat
Date: Tue, 5 Nov 2013 14:37:16 -0800	[thread overview]
Message-ID: <20131105223716.GC5220@tokamak.local> (raw)
In-Reply-To: <1383618208-21310-7-git-send-email-keithp@keithp.com>

On Mon, Nov 04, 2013 at 06:23:26PM -0800, Keith Packard wrote:
> Remove private versions of these functions

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>

> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
>  src/mesa/drivers/dri/i915/intel_screen.c | 53 ++-------------------------
>  src/mesa/drivers/dri/i965/intel_screen.c | 63 ++------------------------------
>  2 files changed, 8 insertions(+), 108 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
> index 085e894..12113c7 100644
> --- a/src/mesa/drivers/dri/i915/intel_screen.c
> +++ b/src/mesa/drivers/dri/i915/intel_screen.c
> @@ -244,32 +244,8 @@ intel_allocate_image(int dri_format, void *loaderPrivate)
>      image->dri_format = dri_format;
>      image->offset = 0;
>  
> -    switch (dri_format) {
> -    case __DRI_IMAGE_FORMAT_RGB565:
> -       image->format = MESA_FORMAT_RGB565;
> -       break;
> -    case __DRI_IMAGE_FORMAT_XRGB8888:
> -       image->format = MESA_FORMAT_XRGB8888;
> -       break;
> -    case __DRI_IMAGE_FORMAT_ARGB8888:
> -       image->format = MESA_FORMAT_ARGB8888;
> -       break;
> -    case __DRI_IMAGE_FORMAT_ABGR8888:
> -       image->format = MESA_FORMAT_RGBA8888_REV;
> -       break;
> -    case __DRI_IMAGE_FORMAT_XBGR8888:
> -       image->format = MESA_FORMAT_RGBX8888_REV;
> -       break;
> -    case __DRI_IMAGE_FORMAT_R8:
> -       image->format = MESA_FORMAT_R8;
> -       break;
> -    case __DRI_IMAGE_FORMAT_GR88:
> -       image->format = MESA_FORMAT_GR88;
> -       break;
> -    case __DRI_IMAGE_FORMAT_NONE:
> -       image->format = MESA_FORMAT_NONE;
> -       break;
> -    default:
> +    image->format = driImageFormatToGLFormat(dri_format);
> +    if (image->format == 0) {
>         free(image);
>         return NULL;
>      }
> @@ -318,27 +294,6 @@ intel_setup_image_from_dimensions(__DRIimage *image)
>     image->tile_y = 0;
>  }
>  
> -static inline uint32_t
> -intel_dri_format(GLuint format)
> -{
> -   switch (format) {
> -   case MESA_FORMAT_RGB565:
> -      return __DRI_IMAGE_FORMAT_RGB565;
> -   case MESA_FORMAT_XRGB8888:
> -      return __DRI_IMAGE_FORMAT_XRGB8888;
> -   case MESA_FORMAT_ARGB8888:
> -      return __DRI_IMAGE_FORMAT_ARGB8888;
> -   case MESA_FORMAT_RGBA8888_REV:
> -      return __DRI_IMAGE_FORMAT_ABGR8888;
> -   case MESA_FORMAT_R8:
> -      return __DRI_IMAGE_FORMAT_R8;
> -   case MESA_FORMAT_RG88:
> -      return __DRI_IMAGE_FORMAT_GR88;
> -   }
> -
> -   return MESA_FORMAT_NONE;
> -}
> -
>  static __DRIimage *
>  intel_create_image_from_name(__DRIscreen *screen,
>  			     int width, int height, int format,
> @@ -396,7 +351,7 @@ intel_create_image_from_renderbuffer(__DRIcontext *context,
>     image->data = loaderPrivate;
>     intel_region_reference(&image->region, irb->mt->region);
>     intel_setup_image_from_dimensions(image);
> -   image->dri_format = intel_dri_format(image->format);
> +   image->dri_format = driGLFormatToImageFormat(image->format);
>  
>     rb->NeedsFinishRenderTexture = true;
>     return image;
> @@ -450,7 +405,7 @@ intel_create_image_from_texture(__DRIcontext *context, int target,
>     image->format = obj->Image[face][level]->TexFormat;
>     image->data = loaderPrivate;
>     intel_setup_image_from_mipmap_tree(intel, image, iobj->mt, level, zoffset);
> -   image->dri_format = intel_dri_format(image->format);
> +   image->dri_format = driGLFormatToImageFormat(image->format);
>     if (image->dri_format == MESA_FORMAT_NONE) {
>        *error = __DRI_IMAGE_ERROR_BAD_PARAMETER;
>        free(image);
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
> index b89b1a5..f9339c1 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -298,38 +298,8 @@ intel_allocate_image(int dri_format, void *loaderPrivate)
>      image->dri_format = dri_format;
>      image->offset = 0;
>  
> -    switch (dri_format) {
> -    case __DRI_IMAGE_FORMAT_RGB565:
> -       image->format = MESA_FORMAT_RGB565;
> -       break;
> -    case __DRI_IMAGE_FORMAT_XRGB8888:
> -       image->format = MESA_FORMAT_XRGB8888;
> -       break;
> -    case __DRI_IMAGE_FORMAT_ARGB2101010:
> -       image->format = MESA_FORMAT_ARGB2101010;
> -       break;
> -    case __DRI_IMAGE_FORMAT_XRGB2101010:
> -       image->format = MESA_FORMAT_XRGB2101010_UNORM;
> -       break;
> -    case __DRI_IMAGE_FORMAT_ARGB8888:
> -       image->format = MESA_FORMAT_ARGB8888;
> -       break;
> -    case __DRI_IMAGE_FORMAT_ABGR8888:
> -       image->format = MESA_FORMAT_RGBA8888_REV;
> -       break;
> -    case __DRI_IMAGE_FORMAT_XBGR8888:
> -       image->format = MESA_FORMAT_RGBX8888_REV;
> -       break;
> -    case __DRI_IMAGE_FORMAT_R8:
> -       image->format = MESA_FORMAT_R8;
> -       break;
> -    case __DRI_IMAGE_FORMAT_GR88:
> -       image->format = MESA_FORMAT_GR88;
> -       break;
> -    case __DRI_IMAGE_FORMAT_NONE:
> -       image->format = MESA_FORMAT_NONE;
> -       break;
> -    default:
> +    image->format = driImageFormatToGLFormat(dri_format);
> +    if (image->format == 0) {
>         free(image);
>         return NULL;
>      }
> @@ -381,31 +351,6 @@ intel_setup_image_from_dimensions(__DRIimage *image)
>     image->has_depthstencil = false;
>  }
>  
> -static inline uint32_t
> -intel_dri_format(GLuint format)
> -{
> -   switch (format) {
> -   case MESA_FORMAT_RGB565:
> -      return __DRI_IMAGE_FORMAT_RGB565;
> -   case MESA_FORMAT_XRGB8888:
> -      return __DRI_IMAGE_FORMAT_XRGB8888;
> -   case MESA_FORMAT_ARGB8888:
> -      return __DRI_IMAGE_FORMAT_ARGB8888;
> -   case MESA_FORMAT_RGBA8888_REV:
> -      return __DRI_IMAGE_FORMAT_ABGR8888;
> -   case MESA_FORMAT_R8:
> -      return __DRI_IMAGE_FORMAT_R8;
> -   case MESA_FORMAT_RG88:
> -      return __DRI_IMAGE_FORMAT_GR88;
> -   case MESA_FORMAT_XRGB2101010_UNORM:
> -      return __DRI_IMAGE_FORMAT_XRGB2101010;
> -   case MESA_FORMAT_ARGB2101010:
> -      return __DRI_IMAGE_FORMAT_ARGB2101010;
> -   }
> -
> -   return MESA_FORMAT_NONE;
> -}
> -
>  static __DRIimage *
>  intel_create_image_from_name(__DRIscreen *screen,
>  			     int width, int height, int format,
> @@ -464,7 +409,7 @@ intel_create_image_from_renderbuffer(__DRIcontext *context,
>     image->data = loaderPrivate;
>     intel_region_reference(&image->region, irb->mt->region);
>     intel_setup_image_from_dimensions(image);
> -   image->dri_format = intel_dri_format(image->format);
> +   image->dri_format = driGLFormatToImageFormat(image->format);
>     image->has_depthstencil = irb->mt->stencil_mt? true : false;
>  
>     rb->NeedsFinishRenderTexture = true;
> @@ -519,7 +464,7 @@ intel_create_image_from_texture(__DRIcontext *context, int target,
>     image->format = obj->Image[face][level]->TexFormat;
>     image->data = loaderPrivate;
>     intel_setup_image_from_mipmap_tree(brw, image, iobj->mt, level, zoffset);
> -   image->dri_format = intel_dri_format(image->format);
> +   image->dri_format = driGLFormatToImageFormat(image->format);
>     image->has_depthstencil = iobj->mt->stencil_mt? true : false;
>     if (image->dri_format == MESA_FORMAT_NONE) {
>        *error = __DRI_IMAGE_ERROR_BAD_PARAMETER;
> -- 
> 1.8.4.2
> 

  reply	other threads:[~2013-11-05 22:37 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
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   ` Kristian Høgsberg [this message]
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=20131105223716.GC5220@tokamak.local \
    --to=hoegsberg@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=keithp@keithp.com \
    --cc=mesa3d-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