dri: fix error value returned by driGLFormatToImageFormat()
authorEric Engestrom <eric.engestrom@intel.com>
Fri, 18 May 2018 14:53:58 +0000 (15:53 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Tue, 29 May 2018 16:44:13 +0000 (17:44 +0100)
0 is not a valid value for the __DRI_IMAGE_FORMAT_* enum.
It is, however, the value of MESA_FORMAT_NONE, which two of the callers
(i915 & i965) checked for.

The other callers (that check for errors, ie. st/dri) already check for
__DRI_IMAGE_FORMAT_NONE.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/i915/intel_screen.c
src/mesa/drivers/dri/i965/intel_screen.c

index c58650491dfbb15bea9383562728bcea3463c64f..d7dff235f2e1a77c34dc8f19f71f7ca57540ebcc 100644 (file)
@@ -901,7 +901,7 @@ driGLFormatToImageFormat(mesa_format format)
    case MESA_FORMAT_B8G8R8A8_SRGB:
       return __DRI_IMAGE_FORMAT_SARGB8;
    default:
-      return 0;
+      return __DRI_IMAGE_FORMAT_NONE;
    }
 }
 
index 5024a69bd4160dcfc403a51765b077d0fa901752..882c498622f8b8a9c9a7c0ab13424e18cba68445 100644 (file)
@@ -415,7 +415,7 @@ intel_create_image_from_texture(__DRIcontext *context, int target,
    image->data = loaderPrivate;
    intel_setup_image_from_mipmap_tree(intel, image, iobj->mt, level, zoffset);
    image->dri_format = driGLFormatToImageFormat(image->format);
-   if (image->dri_format == MESA_FORMAT_NONE) {
+   if (image->dri_format == __DRI_IMAGE_FORMAT_NONE) {
       *error = __DRI_IMAGE_ERROR_BAD_PARAMETER;
       free(image);
       return NULL;
index ab6c003b0fe21aaebd9d3af24dc4a01953fe1313..935711106c0183bb80a882661679226ef61780b3 100644 (file)
@@ -591,7 +591,7 @@ intel_create_image_from_texture(__DRIcontext *context, int target,
    image->dri_format = driGLFormatToImageFormat(image->format);
    image->has_depthstencil = iobj->mt->stencil_mt? true : false;
    image->planar_format = iobj->planar_format;
-   if (image->dri_format == MESA_FORMAT_NONE) {
+   if (image->dri_format == __DRI_IMAGE_FORMAT_NONE) {
       *error = __DRI_IMAGE_ERROR_BAD_PARAMETER;
       free(image);
       return NULL;