OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/ozone/platform/drm/gpu/drm_device.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_device.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <sys/mman.h> | 8 #include <sys/mman.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 #include <xf86drm.h> | 10 #include <xf86drm.h> |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 int DestroyPropertyBlob(int fd, uint32_t id) { | 172 int DestroyPropertyBlob(int fd, uint32_t id) { |
173 DrmModeDestroyBlob destroy; | 173 DrmModeDestroyBlob destroy; |
174 int ret; | 174 int ret; |
175 | 175 |
176 memset(&destroy, 0, sizeof(destroy)); | 176 memset(&destroy, 0, sizeof(destroy)); |
177 destroy.blob_id = id; | 177 destroy.blob_id = id; |
178 ret = drmIoctl(fd, DRM_IOCTL_MODE_DESTROYPROPBLOB, &destroy); | 178 ret = drmIoctl(fd, DRM_IOCTL_MODE_DESTROYPROPBLOB, &destroy); |
179 return ret < 0 ? -errno : ret; | 179 return ret < 0 ? -errno : ret; |
180 } | 180 } |
181 | 181 |
182 using ScopedDrmColorLutPtr = scoped_ptr<DrmColorLut, base::FreeDeleter>; | 182 using ScopedDrmColorLutPtr = std::unique_ptr<DrmColorLut, base::FreeDeleter>; |
183 using ScopedDrmColorCtmPtr = scoped_ptr<DrmColorCtm, base::FreeDeleter>; | 183 using ScopedDrmColorCtmPtr = std::unique_ptr<DrmColorCtm, base::FreeDeleter>; |
184 | 184 |
185 ScopedDrmColorLutPtr CreateLutBlob( | 185 ScopedDrmColorLutPtr CreateLutBlob( |
186 const std::vector<GammaRampRGBEntry>& source) { | 186 const std::vector<GammaRampRGBEntry>& source) { |
187 TRACE_EVENT0("drm", "CreateLutBlob"); | 187 TRACE_EVENT0("drm", "CreateLutBlob"); |
188 ScopedDrmColorLutPtr lut( | 188 ScopedDrmColorLutPtr lut( |
189 static_cast<DrmColorLut*>(malloc(sizeof(DrmColorLut) * source.size()))); | 189 static_cast<DrmColorLut*>(malloc(sizeof(DrmColorLut) * source.size()))); |
190 DrmColorLut* p = lut.get(); | 190 DrmColorLut* p = lut.get(); |
191 for (size_t i = 0; i < source.size(); ++i) { | 191 for (size_t i = 0; i < source.size(); ++i) { |
192 p[i].red = source[i].r; | 192 p[i].red = source[i].r; |
193 p[i].green = source[i].g; | 193 p[i].green = source[i].g; |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 reinterpret_cast<unsigned char*>(ctm_blob_data.get()), | 763 reinterpret_cast<unsigned char*>(ctm_blob_data.get()), |
764 sizeof(DrmColorCtm))) | 764 sizeof(DrmColorCtm))) |
765 return false; | 765 return false; |
766 } | 766 } |
767 } | 767 } |
768 | 768 |
769 return true; | 769 return true; |
770 } | 770 } |
771 | 771 |
772 } // namespace ui | 772 } // namespace ui |
OLD | NEW |