summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Sergio Travaglia <pstglia@gmail.com>2015-02-16 21:37:05 -0200
committerChih-Wei Huang <cwhuang@linux.org.tw>2015-04-19 14:15:59 +0800
commitdc21193e3252ba2d6526546ba1d0c02116baf3ee (patch)
tree34c6b3a58796795d800661692aebe75cf50cf704
parent28207c005b70a1384c1f70fa107b172d6d469f22 (diff)
downloadexternal_drm_gralloc-dc21193e3252ba2d6526546ba1d0c02116baf3ee.zip
external_drm_gralloc-dc21193e3252ba2d6526546ba1d0c02116baf3ee.tar.gz
external_drm_gralloc-dc21193e3252ba2d6526546ba1d0c02116baf3ee.tar.bz2
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.
-rw-r--r--Android.mk3
-rw-r--r--gralloc_drm_pipe.c10
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 <cutils/log.h>
#include <errno.h>
+#include <svga_types.h>
+#include <svga3d_types.h>
#include <pipe/p_screen.h>
#include <pipe/p_context.h>
#include <state_tracker/drm_driver.h>
@@ -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: