Move GL format defines to a separate header file
We are going to use them in another place.
Bug: 141385612
Test: build
Change-Id: I4dd791ec7c104ef235021f05b84dd2c019b39ab0
Signed-off-by: Roman Kiryanov <rkir@google.com>
diff --git a/system/gralloc/gralloc_common.h b/system/gralloc/gralloc_common.h
new file mode 100644
index 0000000..574e659
--- /dev/null
+++ b/system/gralloc/gralloc_common.h
@@ -0,0 +1,41 @@
+/*
+* Copyright 2019 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __GRALLOC_COMMON_H__
+#define __GRALLOC_COMMON_H__
+
+#ifndef GL_RGBA16F
+#define GL_RGBA16F 0x881A
+#endif // GL_RGBA16F
+
+#ifndef GL_HALF_FLOAT
+#define GL_HALF_FLOAT 0x140B
+#endif // GL_HALF_FLOAT
+
+#ifndef GL_RGB10_A2
+#define GL_RGB10_A2 0x8059
+#endif // GL_RGB10_A2
+
+#ifndef GL_UNSIGNED_INT_2_10_10_10_REV
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#endif // GL_UNSIGNED_INT_2_10_10_10_REV
+
+// defined in hardware/interfaces/graphics/common/1.0/types.hal
+#ifndef GOLDFISH_GRALLOC_USAGE_GPU_DATA_BUFFER
+#define GOLDFISH_GRALLOC_USAGE_GPU_DATA_BUFFER (1ULL << 24)
+#endif // GOLDFISH_GRALLOC_USAGE_GPU_DATA_BUFFER
+
+#endif //__GRALLOC_COMMON_H__
diff --git a/system/gralloc/gralloc_old.cpp b/system/gralloc/gralloc_old.cpp
index 2880391..773f786 100644
--- a/system/gralloc/gralloc_old.cpp
+++ b/system/gralloc/gralloc_old.cpp
@@ -28,6 +28,8 @@
#include "../../shared/OpenglCodecCommon/gralloc_cb_old.h"
#endif
+#include "gralloc_common.h"
+
#include "goldfish_dma.h"
#include "goldfish_address_space.h"
#include "FormatConversions.h"
@@ -511,18 +513,6 @@
}
}
-#ifndef GL_RGBA16F
-#define GL_RGBA16F 0x881A
-#endif // GL_RGBA16F
-#ifndef GL_HALF_FLOAT
-#define GL_HALF_FLOAT 0x140B
-#endif // GL_HALF_FLOAT
-#ifndef GL_RGB10_A2
-#define GL_RGB10_A2 0x8059
-#endif // GL_RGB10_A2
-#ifndef GL_UNSIGNED_INT_2_10_10_10_REV
-#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-#endif // GL_UNSIGNED_INT_2_10_10_10_REV
//
// gralloc device functions (alloc interface)
//
@@ -716,10 +706,8 @@
//
DEFINE_AND_VALIDATE_HOST_CONNECTION;
#if PLATFORM_SDK_VERSION >= 17
- // GPU_DATA_BUFFER is defined in hardware/interfaces/graphics/common/1.0/types.hal
-# define _GRALLOC_USAGE_GPU_DATA_BUFFER 0x1000000
bool needHostCb = ((!yuv_format && frameworkFormat != HAL_PIXEL_FORMAT_BLOB) ||
- usage & _GRALLOC_USAGE_GPU_DATA_BUFFER ||
+ usage & GOLDFISH_GRALLOC_USAGE_GPU_DATA_BUFFER ||
#else
bool needHostCb = (!yuv_format ||
#endif // !(PLATFORM_SDK_VERSION >= 17)