Home | History | Annotate | Download | only in flinger_headers
      1 /*
      2  * Copyright 2017 The Chromium Authors.
      3  *
      4  * Permission is hereby granted, free of charge, to any person obtaining a
      5  * copy of this software and associated documentation files (the "Software"),
      6  * to deal in the Software without restriction, including without limitation
      7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      8  * and/or sell copies of the Software, and to permit persons to whom the
      9  * Software is furnished to do so, subject to the following conditions:
     10  *
     11  * The above copyright notice and this permission notice (including the next
     12  * paragraph) shall be included in all copies or substantial portions of the
     13  * Software.
     14  *
     15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
     18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     21  * DEALINGS IN THE SOFTWARE.
     22  */
     23 
     24 #ifndef ANDROID_SF_PRIVATE_HWCOMPOSER2_ARC_PRIVATE_H
     25 #define ANDROID_SF_PRIVATE_HWCOMPOSER2_ARC_PRIVATE_H
     26 
     27 __BEGIN_DECLS
     28 
     29 /* Optional ARC private capabilities. The particular set of supported private
     30  * capabilities for a given device may be retrieved using
     31  * getArcPrivateCapabilities. */
     32 typedef enum {
     33     HWC2_ARC_PRIVATE_CAPABILITY_INVALID = 0,
     34 
     35     /* Specifies that the device supports ARC attribute data. Decoding the data
     36      * is an implementation detail for the device. Note that ordinarily the
     37      * Android framework does not send this data. It is assumed that a vendor
     38      * that wants this data has also modified the framework to send it. */
     39     HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES = 1,
     40 
     41     /* Specifies that the device is an ARC windowing composer. A windowing
     42      * composer generates windowed output inside some external
     43      * implementation-defined windowing environment. It means that there is no
     44      * longer a single output frame buffer being used. The device must handle
     45      * all composition, and the client must not do so. The client cannot do any
     46      * culling of layers either -- it may not have full knowledge of what is
     47      * actually visible or not. */
     48     HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER = 2,
     49 } hwc2_arc_private_capability_t;
     50 
     51 /* ARC private function descriptors for use with getFunction.
     52  * The first entry needs to be maintained so there is no overlap with the
     53  * constants there. */
     54 typedef enum {
     55     HWC2_ARC_PRIVATE_FUNCTION_GET_CAPABILITIES = 0x10000,
     56 
     57     // For HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER
     58     HWC2_ARC_PRIVATE_FUNCTION_GET_DISPLAY_ATTRIBUTE,
     59 
     60     // For HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES
     61     HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_ATTRIBUTES,
     62 
     63     // For HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER
     64     HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_HIDDEN,
     65 
     66     // For HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES
     67     HWC2_ARC_PRIVATE_FUNCTION_ATTRIBUTES_SHOULD_FORCE_UPDATE,
     68 } hwc2_arc_private_function_descriptor_t;
     69 
     70 typedef enum {
     71     HWC2_ARC_PRIVATE_DISPLAY_ATTRIBUTE_INVALID = 0,
     72     HWC2_ARC_PRIVATE_DISPLAY_ATTRIBUTE_OUTPUT_ROTATION = 1,
     73 } hwc2_arc_private_display_attribute_t;
     74 
     75 typedef enum {
     76     HWC2_ARC_PRIVATE_HIDDEN_INVALID = 0,
     77     HWC2_ARC_PRIVATE_HIDDEN_ENABLE = 1,
     78     HWC2_ARC_PRIVATE_HIDDEN_DISABLE = 2,
     79 } hwc2_arc_private_hidden_t;
     80 
     81 /*
     82  * Stringification Functions
     83  */
     84 
     85 #ifdef HWC2_INCLUDE_STRINGIFICATION
     86 
     87 static inline const char* getArcPrivateCapabilityName(hwc2_arc_private_capability_t capability)
     88 {
     89     switch (capability) {
     90     case HWC2_ARC_PRIVATE_CAPABILITY_INVALID:
     91         return "Invalid";
     92     case HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES:
     93         return "ArcAttributes";
     94     case HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER:
     95         return "ArcWindowingComposer";
     96     default:
     97         return "Unknown";
     98     }
     99 }
    100 
    101 static inline const char* getArcPrivateFunctionDescriptorName(
    102         hwc2_arc_private_function_descriptor_t desc)
    103 {
    104     switch (desc) {
    105     case HWC2_ARC_PRIVATE_FUNCTION_GET_CAPABILITIES:
    106         return "ArcGetCapabilities";
    107     case HWC2_ARC_PRIVATE_FUNCTION_GET_DISPLAY_ATTRIBUTE:
    108         return "ArcGetDisplayAttribute";
    109     case HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_ATTRIBUTES:
    110         return "ArcSetLayerAttributes";
    111     case HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_HIDDEN:
    112         return "ArcSetLayerHidden";
    113     case HWC2_ARC_PRIVATE_FUNCTION_ATTRIBUTES_SHOULD_FORCE_UPDATE:
    114         return "ArcAttributesShouldForceUpdate";
    115     default:
    116         return "Unknown";
    117     }
    118 }
    119 
    120 static inline const char* getArcPrivateDisplayAttributeName(hwc2_arc_private_display_attribute_t attribute)
    121 {
    122     switch (attribute) {
    123     case HWC2_ARC_PRIVATE_DISPLAY_ATTRIBUTE_INVALID:
    124         return "Invalid";
    125     case HWC2_ARC_PRIVATE_DISPLAY_ATTRIBUTE_OUTPUT_ROTATION:
    126         return "OutputRotation";
    127     default:
    128         return "Unknown";
    129     }
    130 }
    131 
    132 static inline const char* getArcPrivateHiddenName(hwc2_arc_private_hidden_t hidden)
    133 {
    134     switch (hidden) {
    135     case HWC2_ARC_PRIVATE_HIDDEN_INVALID:
    136         return "Invalid";
    137     case HWC2_ARC_PRIVATE_HIDDEN_ENABLE:
    138         return "Enable";
    139     case HWC2_ARC_PRIVATE_HIDDEN_DISABLE:
    140         return "Disable";
    141     default:
    142         return "Unknown";
    143     }
    144 }
    145 
    146 #endif  // HWC2_INCLUDE_STRINGIFICATION
    147 
    148 /*
    149  * C++11 features
    150  */
    151 
    152 #ifdef HWC2_USE_CPP11
    153 __END_DECLS
    154 
    155 #ifdef HWC2_INCLUDE_STRINGIFICATION
    156 #include <string>
    157 #endif
    158 
    159 namespace HWC2 {
    160 
    161 enum class ArcPrivateCapability : int32_t {
    162     Invalid = HWC2_ARC_PRIVATE_CAPABILITY_INVALID,
    163     Attributes = HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES,
    164     WindowingComposer = HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER,
    165 };
    166 TO_STRING(hwc2_arc_private_capability_t, ArcPrivateCapability, getArcPrivateCapabilityName)
    167 
    168 enum class ArcPrivateFunctionDescriptor : int32_t {
    169     // Since we are extending the HWC2 FunctionDescriptor, we duplicate
    170     // all of its
    171     GetCapabilities = HWC2_ARC_PRIVATE_FUNCTION_GET_CAPABILITIES,
    172     GetDisplayAttribute = HWC2_ARC_PRIVATE_FUNCTION_GET_DISPLAY_ATTRIBUTE,
    173     SetLayerAttributes = HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_ATTRIBUTES,
    174     SetLayerHidden = HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_HIDDEN,
    175     AttributesShouldForceUpdate = HWC2_ARC_PRIVATE_FUNCTION_ATTRIBUTES_SHOULD_FORCE_UPDATE,
    176 };
    177 TO_STRING(hwc2_arc_private_function_descriptor_t, ArcPrivateFunctionDescriptor,
    178         getArcPrivateFunctionDescriptorName)
    179 
    180 enum class ArcPrivateDisplayAttribute : int32_t {
    181     Invalid = HWC2_ARC_PRIVATE_DISPLAY_ATTRIBUTE_INVALID,
    182     OutputRotation = HWC2_ARC_PRIVATE_DISPLAY_ATTRIBUTE_OUTPUT_ROTATION,
    183 };
    184 TO_STRING(hwc2_arc_private_display_attribute_t, ArcPrivateDisplayAttribute,
    185         getArcPrivateDisplayAttributeName)
    186 
    187 enum class ArcPrivateHidden : int32_t {
    188     Invalid = HWC2_ARC_PRIVATE_HIDDEN_INVALID,
    189     Enable = HWC2_ARC_PRIVATE_HIDDEN_ENABLE,
    190     Disable = HWC2_ARC_PRIVATE_HIDDEN_DISABLE,
    191 };
    192 TO_STRING(hwc2_arc_private_hidden_t, ArcPrivateHidden, getArcPrivateHiddenName)
    193 
    194 }  // namespace HWC2
    195 
    196 __BEGIN_DECLS
    197 #endif  // HWC2_USE_CPP11
    198 
    199 /*
    200  * ARC Private device Functions
    201  *
    202  * All of these functions take as their first parameter a device pointer, so
    203  * this parameter is omitted from the described parameter lists.
    204  */
    205 
    206 /* arcGetCapabilities(..., outCount, outCapabilities)
    207  * Descriptor: HWC2_ARC_PRIVATE_FUNCTION_GET_CAPABILITIES
    208  *
    209  * Gets additional capabilities supported by the device.
    210  *
    211  * Parameters:
    212  *   outCount - if outCapabilities was NULL, the number of capabilities which
    213  *       would have been returned; if outCapabilities was not NULL, the number
    214  *       of capabilities returned, which must not exceed the value stored in
    215  *       outCount priort to the call; pointer will be non-NULL
    216  *   outCapabilities - an array of capabilities
    217  * */
    218 typedef void (*HWC2_ARC_PRIVATE_PFN_GET_CAPABILITIES)(hwc2_device_t* device, uint32_t* outCount,
    219         int32_t* /*hwc2_arc_private_capability_t*/ outCapabilities);
    220 
    221 /*
    222  * ARC Private display functions
    223  *
    224  * All of these functions take as their first two parameters a device pointer,
    225  * and a display handle for the display. These parameters are omitted from the
    226  * described parameter lists.
    227  */
    228 
    229 /* arcGetDisplayAttributes(..., attribute, outValue)
    230  * Descriptor: HWC2_ARC_PRIVATE_FUNCTION_GET_DISPLAY_ATTRIBUTE
    231  * Provided by HWC2 devices which support
    232  * HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER
    233  *
    234  * Gets additional display attribute data.
    235  *
    236  * Parameters:
    237  *   attribute - The attribute to get
    238  *   outValue - A location to store the value of the attribute
    239  *
    240  * Returns HWC2_ERROR_NONE if a value was set, or HWC2_ERROR_BAD_DISPLAY, or
    241  * HWC2_ERROR_BAD_PARAMETER
    242  */
    243 typedef int32_t /*hwc2_error_t*/ (*HWC2_ARC_PRIVATE_PFN_GET_DISPLAY_ATTRIBUTE)(
    244         hwc2_device_t* device, hwc2_display_t display, const int32_t attribute, int32_t* outValue);
    245 
    246 /*
    247  * ARC Private layer Functions
    248  *
    249  * These are functions which operate on layers, but which do not modify state
    250  * that must be validated before use. See also 'Layer State Functions' below.
    251  *
    252  * All of these functions take as their first three parameters a device pointer,
    253  * a display handle for the display which contains the layer, and a layer
    254  * handle, so these parameters are omitted from the described parameter lists.
    255  */
    256 
    257 /* arcSetLayerAttributes(..., numElements, ids, sizes, values)
    258  * Descriptor: HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_ATTRIBUTES
    259  * Provided by HWC2 devices which support
    260  * HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES
    261  *
    262  * Sets additional surface data in the form of id/value pairs sent down by the
    263  * framework. The meaning of each attribute is opaque to the client, and is
    264  * assumed to be understood by the device implementation.
    265  *
    266  * Parameters:
    267  *   numElements - the number of elements in each array.
    268  *   ids - an array of surface attribute ids
    269  *   sizes - an array of sizes, giving the size in bytes of each value
    270  *   values - an array of pointers to the data for each value
    271  *
    272  * Returns HWC2_ERROR_NONE or one of the following errors:
    273  *   HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in
    274  */
    275 typedef int32_t /*hwc2_error_t*/ (*HWC2_ARC_PRIVATE_PFN_SET_LAYER_ATTRIBUTES)(hwc2_device_t* device,
    276         hwc2_display_t display, hwc2_layer_t layer, uint32_t numElements, const int32_t* ids,
    277         const uint32_t* sizes, const uint8_t** values);
    278 
    279 /* arcSetLayerHidden(..., hidden)
    280  * Descriptor: HWC2_ARC_PRIVATE_FUNCTION_SET_LAYER_HIDDEN
    281  * Provided by HWC2 devices which support
    282  * HWC2_ARC_PRIVATE_CAPABILITY_WINDOWING_COMPOSER
    283  *
    284  * Indicates whether the layer should be hidden or not. This flag is set by the
    285  * window manager.
    286  *
    287  * Parameters:
    288  *   hidden - the setting to use.
    289  *
    290  * Returns HWC2_ERROR_NONE or one of the following errors:
    291  *   HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in
    292  */
    293 typedef int32_t /*hwc2_error_t*/ (*HWC2_ARC_PRIVATE_PFN_SET_LAYER_HIDDEN)(
    294         hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer,
    295         int32_t /* hwc2_arc_private_hidden_t */ hidden);
    296 
    297 /* arcAttributesShouldForceUpdate(..., numElements, ids, sizes, values, outShouldForceUpdate)
    298  * Descriptor: HWC2_ARC_PRIVATE_FUNCTION_ATTRIBUTES_SHOULD_FORCE_UPDATE
    299  * Provided by HWC2 devices which support
    300  * HWC2_ARC_PRIVATE_CAPABILITY_ATTRIBUTES
    301  *
    302  * Outputs to |outShouldForceUpdate| whether to send geometry updates without
    303  * waiting for a matching buffer, given the specified layer attributes.
    304  *
    305  * Parameters:
    306  *   numElements - the number of elements in each array.
    307  *   ids - an array of surface attribute ids
    308  *   sizes - an array of sizes, giving the size in bytes of each value
    309  *   values - an array of pointers to the data for each value
    310  *   outShouldForceUpdate - whether to send geometry updates without waiting
    311  *      for a matching buffer
    312  *
    313  * Returns HWC2_ERROR_NONE or one of the following errors:
    314  *   HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in
    315  */
    316 typedef int32_t /*hwc2_error_t*/ (*HWC2_ARC_PRIVATE_PFN_ATTRIBUTES_SHOULD_FORCE_UPDATE)(
    317     hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer,
    318     uint32_t numElements, const int32_t* ids, const uint32_t* sizes,
    319     const uint8_t** values, bool* outShouldForceUpdate);
    320 
    321 __END_DECLS
    322 
    323 #endif
    324