From e291f71e0a25ac9bb39fb754c599b710ab8f59d5 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Sun, 13 May 2012 22:49:06 -0700 Subject: [PATCH] split hwcomposer.h hwcomposer_defs.h now contains enums, which are essentially names. This won't change when we rev the h/w composer API (new ones will be added instead). we do this to avoid having to abstract all these constants in higher level APIs; instead hwcomposer_defs.h can be included without exposing the hwcomposer's data structures (which are a lot more fragile wrt. backward compatibility) Change-Id: Ifb514f64de02a599fdd2d31c188327209ccb0ffc --- include/hardware/hwcomposer.h | 114 +--------------------------- include/hardware/hwcomposer_defs.h | 148 +++++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 112 deletions(-) create mode 100644 include/hardware/hwcomposer_defs.h diff --git a/include/hardware/hwcomposer.h b/include/hardware/hwcomposer.h index cb8ac9b..98e665c 100644 --- a/include/hardware/hwcomposer.h +++ b/include/hardware/hwcomposer.h @@ -24,16 +24,12 @@ #include #include +#include + __BEGIN_DECLS /*****************************************************************************/ -#define HWC_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1) - -#define HWC_DEVICE_API_VERSION_0_1 HARDWARE_DEVICE_API_VERSION(0, 1) -#define HWC_DEVICE_API_VERSION_0_2 HARDWARE_DEVICE_API_VERSION(0, 2) -#define HWC_DEVICE_API_VERSION_0_3 HARDWARE_DEVICE_API_VERSION(0, 3) - // for compatibility #define HWC_MODULE_API_VERSION HWC_MODULE_API_VERSION_0_1 #define HWC_DEVICE_API_VERSION HWC_DEVICE_API_VERSION_0_1 @@ -50,112 +46,6 @@ __BEGIN_DECLS #define HWC_HARDWARE_COMPOSER "composer" -enum { - /* hwc_composer_device_t::set failed in EGL */ - HWC_EGL_ERROR = -1 -}; - -/* - * hwc_layer_t::hints values - * Hints are set by the HAL and read by SurfaceFlinger - */ -enum { - /* - * HWC can set the HWC_HINT_TRIPLE_BUFFER hint to indicate to SurfaceFlinger - * that it should triple buffer this layer. Typically HWC does this when - * the layer will be unavailable for use for an extended period of time, - * e.g. if the display will be fetching data directly from the layer and - * the layer can not be modified until after the next set(). - */ - HWC_HINT_TRIPLE_BUFFER = 0x00000001, - - /* - * HWC sets HWC_HINT_CLEAR_FB to tell SurfaceFlinger that it should clear the - * framebuffer with transparent pixels where this layer would be. - * SurfaceFlinger will only honor this flag when the layer has no blending - * - */ - HWC_HINT_CLEAR_FB = 0x00000002 -}; - -/* - * hwc_layer_t::flags values - * Flags are set by SurfaceFlinger and read by the HAL - */ -enum { - /* - * HWC_SKIP_LAYER is set by SurfaceFlnger to indicate that the HAL - * shall not consider this layer for composition as it will be handled - * by SurfaceFlinger (just as if compositionType was set to HWC_OVERLAY). - */ - HWC_SKIP_LAYER = 0x00000001, -}; - -/* - * hwc_layer_t::compositionType values - */ -enum { - /* this layer is to be drawn into the framebuffer by SurfaceFlinger */ - HWC_FRAMEBUFFER = 0, - - /* this layer will be handled in the HWC */ - HWC_OVERLAY = 1, - - /* this is the background layer. it's used to set the background color. - * there is only a single background layer */ - HWC_BACKGROUND = 2, -}; - -/* - * hwc_layer_t::blending values - */ -enum { - /* no blending */ - HWC_BLENDING_NONE = 0x0100, - - /* ONE / ONE_MINUS_SRC_ALPHA */ - HWC_BLENDING_PREMULT = 0x0105, - - /* SRC_ALPHA / ONE_MINUS_SRC_ALPHA */ - HWC_BLENDING_COVERAGE = 0x0405 -}; - -/* - * hwc_layer_t::transform values - */ -enum { - /* flip source image horizontally */ - HWC_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H, - /* flip source image vertically */ - HWC_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V, - /* rotate source image 90 degrees clock-wise */ - HWC_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90, - /* rotate source image 180 degrees */ - HWC_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180, - /* rotate source image 270 degrees clock-wise */ - HWC_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270, -}; - -/* attributes queriable with query() */ -enum { - /* - * availability: HWC_DEVICE_API_VERSION_0_2 - * must return 1 if the background layer is supported, 0 otherwise - */ - HWC_BACKGROUND_LAYER_SUPPORTED = 0, - - /* - * availability: HWC_DEVICE_API_VERSION_0_3 - * returns the vsync period in nanosecond - */ - HWC_VSYNC_PERIOD = 1, -}; - -/* Allowed events for hwc_methods::eventControl() */ -enum { - HWC_EVENT_VSYNC = 0 -}; - struct hwc_composer_device; /* diff --git a/include/hardware/hwcomposer_defs.h b/include/hardware/hwcomposer_defs.h new file mode 100644 index 0000000..99465d3 --- /dev/null +++ b/include/hardware/hwcomposer_defs.h @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2010 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 ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H +#define ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H + +#include +#include + +#include +#include +#include + +__BEGIN_DECLS + +/*****************************************************************************/ + +#define HWC_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1) + +#define HWC_DEVICE_API_VERSION_0_1 HARDWARE_DEVICE_API_VERSION(0, 1) +#define HWC_DEVICE_API_VERSION_0_2 HARDWARE_DEVICE_API_VERSION(0, 2) +#define HWC_DEVICE_API_VERSION_0_3 HARDWARE_DEVICE_API_VERSION(0, 3) + + +enum { + /* hwc_composer_device_t::set failed in EGL */ + HWC_EGL_ERROR = -1 +}; + +/* + * hwc_layer_t::hints values + * Hints are set by the HAL and read by SurfaceFlinger + */ +enum { + /* + * HWC can set the HWC_HINT_TRIPLE_BUFFER hint to indicate to SurfaceFlinger + * that it should triple buffer this layer. Typically HWC does this when + * the layer will be unavailable for use for an extended period of time, + * e.g. if the display will be fetching data directly from the layer and + * the layer can not be modified until after the next set(). + */ + HWC_HINT_TRIPLE_BUFFER = 0x00000001, + + /* + * HWC sets HWC_HINT_CLEAR_FB to tell SurfaceFlinger that it should clear the + * framebuffer with transparent pixels where this layer would be. + * SurfaceFlinger will only honor this flag when the layer has no blending + * + */ + HWC_HINT_CLEAR_FB = 0x00000002 +}; + +/* + * hwc_layer_t::flags values + * Flags are set by SurfaceFlinger and read by the HAL + */ +enum { + /* + * HWC_SKIP_LAYER is set by SurfaceFlnger to indicate that the HAL + * shall not consider this layer for composition as it will be handled + * by SurfaceFlinger (just as if compositionType was set to HWC_OVERLAY). + */ + HWC_SKIP_LAYER = 0x00000001, +}; + +/* + * hwc_layer_t::compositionType values + */ +enum { + /* this layer is to be drawn into the framebuffer by SurfaceFlinger */ + HWC_FRAMEBUFFER = 0, + + /* this layer will be handled in the HWC */ + HWC_OVERLAY = 1, + + /* this is the background layer. it's used to set the background color. + * there is only a single background layer */ + HWC_BACKGROUND = 2, +}; + +/* + * hwc_layer_t::blending values + */ +enum { + /* no blending */ + HWC_BLENDING_NONE = 0x0100, + + /* ONE / ONE_MINUS_SRC_ALPHA */ + HWC_BLENDING_PREMULT = 0x0105, + + /* SRC_ALPHA / ONE_MINUS_SRC_ALPHA */ + HWC_BLENDING_COVERAGE = 0x0405 +}; + +/* + * hwc_layer_t::transform values + */ +enum { + /* flip source image horizontally */ + HWC_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H, + /* flip source image vertically */ + HWC_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V, + /* rotate source image 90 degrees clock-wise */ + HWC_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90, + /* rotate source image 180 degrees */ + HWC_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180, + /* rotate source image 270 degrees clock-wise */ + HWC_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270, +}; + +/* attributes queriable with query() */ +enum { + /* + * availability: HWC_DEVICE_API_VERSION_0_2 + * must return 1 if the background layer is supported, 0 otherwise + */ + HWC_BACKGROUND_LAYER_SUPPORTED = 0, + + /* + * availability: HWC_DEVICE_API_VERSION_0_3 + * returns the vsync period in nanosecond + */ + HWC_VSYNC_PERIOD = 1, +}; + +/* Allowed events for hwc_methods::eventControl() */ +enum { + HWC_EVENT_VSYNC = 0 +}; + +/*****************************************************************************/ + +__END_DECLS + +#endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H */ -- 2.11.0