summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorKeith Packard <[email protected]>2013-11-04 17:33:34 -0800
committerEric Anholt <[email protected]>2013-11-07 19:08:09 -0800
commit1f085ba18fb11ca7d378bb2b4423702b1c823786 (patch)
tree15ed0930b6f373ed8bfd65853eeb2e3cfc6f12ba /src/mesa/drivers/dri
parentb7818b8c36f9850acb17402d05593cff6c2532f0 (diff)
dri/i915,dri/i965: Use driGLFormatToImageFormat and driImageFormatToGLFormat
Remove private versions of these functions Signed-off-by: Keith Packard <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c53
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c63
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 d46d0eb19cb..d93bd9be59e 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -245,32 +245,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;
}
@@ -319,27 +295,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,
@@ -397,7 +352,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;
@@ -451,7 +406,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 a319b9951a9..099cabfb9d0 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -299,38 +299,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;
}
@@ -382,31 +352,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,
@@ -465,7 +410,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;
@@ -520,7 +465,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;