1d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema/* Copyright (c) 2015-2017, The Linux Foundataion. All rights reserved.
2d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema*
3d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* Redistribution and use in source and binary forms, with or without
4d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* modification, are permitted provided that the following conditions are
5d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* met:
6d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema*     * Redistributions of source code must retain the above copyright
7d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema*       notice, this list of conditions and the following disclaimer.
8d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema*     * Redistributions in binary form must reproduce the above
9d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema*       copyright notice, this list of conditions and the following
10d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema*       disclaimer in the documentation and/or other materials provided
11d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema*       with the distribution.
12d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema*     * Neither the name of The Linux Foundation nor the names of its
13d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema*       contributors may be used to endorse or promote products derived
14d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema*       from this software without specific prior written permission.
15d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema*
16d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema*
28d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema*/
29d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
30d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema#ifndef __COLOR_INTERFACE_H__
31d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema#define __COLOR_INTERFACE_H__
32d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
33d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema#include "core/sdm_types.h"
34d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema#include "color_params.h"
35d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
36d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennemanamespace sdm {
37d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
38d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema#define COLORMGR_LIBRARY_NAME "libsdm-color.so"
39d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema#define CREATE_COLOR_INTERFACE_NAME "CreateColorInterface"
40d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema#define DESTROY_COLOR_INTERFACE_NAME "DestroyColorInterface"
41d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema#define COLOR_REVISION_MAJOR (1)
42d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema#define COLOR_REVISION_MINOR (0)
43d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
44d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema#define COLOR_VERSION_TAG ((uint16_t)((COLOR_REVISION_MAJOR << 8) | COLOR_REVISION_MINOR))
45d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
46d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennemaclass ColorInterface;
47d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
48d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennematypedef DisplayError (*CreateColorInterface)(uint16_t version, DisplayType type,
49d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                             const PPHWAttributes &attributes,
50d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                             ColorInterface **interface);
51d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
52d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennematypedef DisplayError (*DestroyColorInterface)(DisplayType type);
53d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
54d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennemaclass ColorInterface {
55d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema public:
56d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema  virtual DisplayError ColorSVCRequestRoute(const PPDisplayAPIPayload &in_payload,
57d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                            PPDisplayAPIPayload *out_payload,
58d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                            PPFeaturesConfig *out_features,
59d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                            PPPendingParams *pending_action) = 0;
60d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
61d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema  virtual DisplayError ApplyDefaultDisplayMode(PPFeaturesConfig *out_features) = 0;
62d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
63d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema  virtual DisplayError ColorIntfSetColorTransform(PPFeaturesConfig *out_features,
64d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                                uint32_t disp_id, uint32_t length,
65d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                                const double *trans_data) = 0;
66d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
67d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema  virtual DisplayError ColorIntfSetDisplayMode(PPFeaturesConfig *out_features,
68d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                             uint32_t disp_id, int32_t mode_id) = 0;
69d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
70d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema  virtual DisplayError ColorIntfGetNumDisplayModes(PPFeaturesConfig *out_features,
71d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                                 uint32_t disp_id, uint32_t *mode_cnt) = 0;
72d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
73d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema  virtual DisplayError ColorIntfEnumerateDisplayModes(PPFeaturesConfig *out_features,
74d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                                uint32_t disp_id, SDEDisplayMode *modes,
75d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                                uint32_t *mode_cnt) = 0;
76d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema  virtual DisplayError ColorIntfGetModeInfo(PPFeaturesConfig *out_features,
77d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                            uint32_t disp_id, int32_t mode_id,
78d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                            AttrVal *query) = 0;
79d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema  virtual DisplayError ColorIntfGetDefaultModeID(PPFeaturesConfig *out_features,
80d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema                                                 uint32_t disp_id, int32_t *mode_id) = 0;
81d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
82d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema protected:
83d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema  virtual ~ColorInterface() {}
84d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema};
85d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
86d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema}  // namespace sdm
87d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema
88d39a514dd0540cf47e121775a77e9ac1b578bdb1Ben Fennema#endif  // __COLOR_INTERFACE_H__
89