From dc21193e3252ba2d6526546ba1d0c02116baf3ee Mon Sep 17 00:00:00 2001 From: Paulo Sergio Travaglia Date: Mon, 16 Feb 2015 21:37:05 -0200 Subject: Changed format constants to match what vmwgfx driver expects When allocating a new buffer using pipe driver, pipe constants are used to define a format based on corresponding HAL_PIXEL_FORMAT However, vmwgfx driver expects other constants (SVGA3D_A8R8G8B8, SVGA3D_X8R8G8B8, SVGA3D_R5G6B5, etc) Changed the returning constants to match what driver expects. v2: [cwhuang] - Use the constants defined in svga3d_types.h. - Use C99 standard to avoid building errors with mesa 10.6. --- Android.mk | 3 +++ gralloc_drm_pipe.c | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Android.mk b/Android.mk index b31538b..18b02c4 100644 --- a/Android.mk +++ b/Android.mk @@ -83,6 +83,8 @@ include $(CLEAR_VARS) LOCAL_MODULE := libgralloc_drm LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS := -std=c99 + LOCAL_SRC_FILES := \ gralloc_drm.c \ gralloc_drm_kms.c @@ -130,6 +132,7 @@ LOCAL_SRC_FILES += gralloc_drm_pipe.c LOCAL_CFLAGS += -DENABLE_PIPE LOCAL_C_INCLUDES += \ external/mesa/include \ + external/mesa/src \ external/mesa/src/gallium/include \ external/mesa/src/gallium/winsys \ external/mesa/src/gallium/drivers \ diff --git a/gralloc_drm_pipe.c b/gralloc_drm_pipe.c index 477e98f..64b1e56 100644 --- a/gralloc_drm_pipe.c +++ b/gralloc_drm_pipe.c @@ -26,6 +26,8 @@ #include #include +#include +#include #include #include #include @@ -60,19 +62,19 @@ static enum pipe_format get_pipe_format(int format) switch (format) { case HAL_PIXEL_FORMAT_RGBA_8888: - fmt = PIPE_FORMAT_R8G8B8A8_UNORM; + fmt = SVGA3D_A8R8G8B8; break; case HAL_PIXEL_FORMAT_RGBX_8888: - fmt = PIPE_FORMAT_R8G8B8X8_UNORM; + fmt = SVGA3D_X8R8G8B8; break; case HAL_PIXEL_FORMAT_RGB_888: fmt = PIPE_FORMAT_R8G8B8_UNORM; break; case HAL_PIXEL_FORMAT_RGB_565: - fmt = PIPE_FORMAT_B5G6R5_UNORM; + fmt = SVGA3D_R5G6B5; break; case HAL_PIXEL_FORMAT_BGRA_8888: - fmt = PIPE_FORMAT_B8G8R8A8_UNORM; + fmt = SVGA3D_A8R8G8B8; break; case HAL_PIXEL_FORMAT_YV12: case HAL_PIXEL_FORMAT_DRM_NV12: -- cgit v1.1