From 09efdccf4a83c62e632020e8a425eba67de8dc43 Mon Sep 17 00:00:00 2001 From: "Kristian H. Kristensen" Date: Fri, 22 May 2020 14:55:29 -0700 Subject: [PATCH] egl/android: Move get_format under HAVE_DRM_GRALLOC guard where it's used MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit src/egl/drivers/dri2/platform_android.c:159:12: warning: unused function 'get_format' [-Wunused-function] Reviewed-by: Rob Clark Reviewed-by: Marek Olšák Part-of: --- src/egl/drivers/dri2/platform_android.c | 40 ++++++++++++------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 6f90fd46688..eee336cca93 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -156,26 +156,6 @@ static int get_fourcc(int native) return -1; } -static int get_format(int format) -{ - switch (format) { - case HAL_PIXEL_FORMAT_BGRA_8888: return __DRI_IMAGE_FORMAT_ARGB8888; - case HAL_PIXEL_FORMAT_RGB_565: return __DRI_IMAGE_FORMAT_RGB565; - case HAL_PIXEL_FORMAT_RGBA_8888: return __DRI_IMAGE_FORMAT_ABGR8888; - case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED: - /* - * HACK: Hardcode this to RGBX_8888 as per cros_gralloc hack. - * TODO: Revert this once https://issuetracker.google.com/32077885 is fixed. - */ - case HAL_PIXEL_FORMAT_RGBX_8888: return __DRI_IMAGE_FORMAT_XBGR8888; - case HAL_PIXEL_FORMAT_RGBA_FP16: return __DRI_IMAGE_FORMAT_ABGR16161616F; - case HAL_PIXEL_FORMAT_RGBA_1010102: return __DRI_IMAGE_FORMAT_ABGR2101010; - default: - _eglLog(_EGL_WARNING, "unsupported native buffer format 0x%x", format); - } - return -1; -} - /* returns # of fds, and by reference the actual fds */ static unsigned get_native_buffer_fds(struct ANativeWindowBuffer *buf, int fds[3]) @@ -960,6 +940,26 @@ droid_create_image_from_prime_fds(_EGLDisplay *disp, _EGLContext *ctx, } #ifdef HAVE_DRM_GRALLOC +static int get_format(int format) +{ + switch (format) { + case HAL_PIXEL_FORMAT_BGRA_8888: return __DRI_IMAGE_FORMAT_ARGB8888; + case HAL_PIXEL_FORMAT_RGB_565: return __DRI_IMAGE_FORMAT_RGB565; + case HAL_PIXEL_FORMAT_RGBA_8888: return __DRI_IMAGE_FORMAT_ABGR8888; + case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED: + /* + * HACK: Hardcode this to RGBX_8888 as per cros_gralloc hack. + * TODO: Revert this once https://issuetracker.google.com/32077885 is fixed. + */ + case HAL_PIXEL_FORMAT_RGBX_8888: return __DRI_IMAGE_FORMAT_XBGR8888; + case HAL_PIXEL_FORMAT_RGBA_FP16: return __DRI_IMAGE_FORMAT_ABGR16161616F; + case HAL_PIXEL_FORMAT_RGBA_1010102: return __DRI_IMAGE_FORMAT_ABGR2101010; + default: + _eglLog(_EGL_WARNING, "unsupported native buffer format 0x%x", format); + } + return -1; +} + static _EGLImage * droid_create_image_from_name(_EGLDisplay *disp, _EGLContext *ctx, struct ANativeWindowBuffer *buf) -- 2.30.2