1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_DRM_GPU_UTIL_H_ 6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_GPU_UTIL_H_ 7 8 #include "ui/ozone/platform/drm/common/scoped_drm_types.h" 9 #include "ui/ozone/platform/drm/gpu/drm_device.h" 10 11 namespace ui { 12 13 // Helper function that finds the property with the specified name. 14 bool GetDrmPropertyForName(DrmDevice* drm, 15 drmModeObjectProperties* properties, 16 const std::string& name, 17 DrmDevice::Property* property); 18 19 // If the |property| has a valid ID add it to the |property_set| request. 20 bool AddPropertyIfValid(drmModeAtomicReq* property_set, 21 uint32_t object_id, 22 const DrmDevice::Property& property); 23 24 // Transforms the gamma ramp entries into the drm_color_lut format. 25 ScopedDrmColorLutPtr CreateLutBlob( 26 const std::vector<display::GammaRampRGBEntry>& source); 27 28 // Converts |color_matrix| to a drm_color_ctm in U31.32 format where the most 29 // significant bit is the sign. 30 // |color_matrix| represents a 3x3 matrix in vector form. 31 ScopedDrmColorCtmPtr CreateCTMBlob(const std::vector<float>& color_matrix); 32 33 // Creates a new look-up table of the desired size to fit the expectations of 34 // the DRM driver. 35 std::vector<display::GammaRampRGBEntry> ResampleLut( 36 const std::vector<display::GammaRampRGBEntry>& lut_in, 37 size_t desired_size); 38 39 // Check DRM driver name match. 40 bool IsDriverName(const char* device_file_name, const char* driver); 41 42 } // namespace ui 43 44 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_GPU_UTIL_H_ 45