1cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel/*
2cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* Copyright (c) 2017, The Linux Foundation. All rights reserved.
3cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel*
4cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* Redistribution and use in source and binary forms, with or without
5cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* modification, are permitted provided that the following conditions are
6cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* met:
7cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel*     * Redistributions of source code must retain the above copyright
8cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel*       notice, this list of conditions and the following disclaimer.
9cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel*     * Redistributions in binary form must reproduce the above
10cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel*       copyright notice, this list of conditions and the following
11cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel*       disclaimer in the documentation and/or other materials provided
12cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel*       with the distribution.
13cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel*     * Neither the name of The Linux Foundation nor the names of its
14cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel*       contributors may be used to endorse or promote products derived
15cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel*       from this software without specific prior written permission.
16cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel*
17cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel*/
29cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel
30cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel#ifndef __HW_COLOR_MANAGER_DRM_H__
31cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel#define __HW_COLOR_MANAGER_DRM_H__
32cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel
33cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel#include <drm_interface.h>
34cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel#include <private/color_params.h>
35cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel
36cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudelusing sde_drm::DRMPPFeatureID;
37cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudelusing sde_drm::DRMPPFeatureInfo;
38cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel
39cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudelnamespace sdm {
40cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel
41cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudelclass HWColorManagerDrm {
42cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel public:
43cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel  static DisplayError (*GetDrmFeature[kMaxNumPPFeatures])(const PPFeatureInfo &in_data,
44cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel                                                          DRMPPFeatureInfo *out_data);
45cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel  static void FreeDrmFeatureData(DRMPPFeatureInfo *feature);
46cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel  static uint32_t GetFeatureVersion(const DRMPPFeatureInfo &feature);
47cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel  static DRMPPFeatureID ToDrmFeatureId(uint32_t id);
48cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel protected:
49cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel  HWColorManagerDrm() {}
50cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel
51cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel private:
52cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel  static DisplayError GetDrmPCC(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
53cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel  static DisplayError GetDrmIGC(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
54cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel  static DisplayError GetDrmPGC(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
55cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel  static DisplayError GetDrmMixerGC(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
56cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel  static DisplayError GetDrmPAV2(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
57cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel  static DisplayError GetDrmDither(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
58cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel  static DisplayError GetDrmGamut(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
59cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel  static DisplayError GetDrmPADither(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
60cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel};
61cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel
62cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel}  // namespace sdm
63cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel
64cd66324640d3290ee75bf5bf41826fbcbc55a13aThierry Strudel#endif  // __HW_COLOR_MANAGER_DRM_H__
65