Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Unified Diff: ui/ozone/platform/drm/gpu/drm_device.cc

Issue 1119113004: Reland "Load and apply a vcgt table from an ICC file to the internal display" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@vcgt-rebase
Patch Set: Add third_party/qcms to ash BUILD.gn Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_device.h ('k') | ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/gpu/drm_device.cc
diff --git a/ui/ozone/platform/drm/gpu/drm_device.cc b/ui/ozone/platform/drm/gpu/drm_device.cc
index 49b6f5e6c83982aeebd471747b78d68837b05002..b14d2293aab483cbea56a0eb05544e2a95ac747d 100644
--- a/ui/ozone/platform/drm/gpu/drm_device.cc
+++ b/ui/ozone/platform/drm/gpu/drm_device.cc
@@ -18,6 +18,7 @@
#include "base/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "third_party/skia/include/core/SkImageInfo.h"
+#include "ui/display/types/gamma_ramp_rgb_entry.h"
#include "ui/ozone/platform/drm/gpu/drm_util.h"
#include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h"
@@ -584,4 +585,32 @@ bool DrmDevice::DropMaster() {
return (drmDropMaster(file_.GetPlatformFile()) == 0);
}
+bool DrmDevice::SetGammaRamp(uint32_t crtc_id,
+ const std::vector<GammaRampRGBEntry>& lut) {
+ ScopedDrmCrtcPtr crtc = GetCrtc(crtc_id);
+
+ // TODO(robert.bradford) resample the incoming ramp to match what the kernel
+ // expects.
+ if (static_cast<size_t>(crtc->gamma_size) != lut.size()) {
+ LOG(ERROR) << "Gamma table size mismatch: supplied " << lut.size()
+ << " expected " << crtc->gamma_size;
+ }
+
+ std::vector<uint16_t> r, g, b;
+ r.reserve(lut.size());
+ g.reserve(lut.size());
+ b.reserve(lut.size());
+
+ for (size_t i = 0; i < lut.size(); ++i) {
+ r.push_back(lut[i].r);
+ g.push_back(lut[i].g);
+ b.push_back(lut[i].b);
+ }
+
+ DCHECK(file_.IsValid());
+ TRACE_EVENT0("drm", "DrmDevice::SetGamma");
+ return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0],
+ &g[0], &b[0]) == 0);
+}
+
} // namespace ui
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_device.h ('k') | ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698