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

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_device.cc

Issue 1028563003: Load and apply a vcgt table from an ICC file to the internal display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ozone build 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 unified diff | Download patch
OLDNEW
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>
11 #include <xf86drmMode.h> 11 #include <xf86drmMode.h>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/synchronization/waitable_event.h" 16 #include "base/synchronization/waitable_event.h"
17 #include "base/task_runner.h" 17 #include "base/task_runner.h"
18 #include "base/thread_task_runner_handle.h" 18 #include "base/thread_task_runner_handle.h"
19 #include "base/trace_event/trace_event.h" 19 #include "base/trace_event/trace_event.h"
20 #include "third_party/skia/include/core/SkImageInfo.h" 20 #include "third_party/skia/include/core/SkImageInfo.h"
21 #include "ui/display/types/gamma_ramp_rgb_entry.h"
21 #include "ui/ozone/platform/drm/gpu/drm_util.h" 22 #include "ui/ozone/platform/drm/gpu/drm_util.h"
22 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h" 23 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h"
23 24
24 #if defined(USE_DRM_ATOMIC) 25 #if defined(USE_DRM_ATOMIC)
25 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_atomic.h" 26 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_atomic.h"
26 #endif 27 #endif
27 28
28 namespace ui { 29 namespace ui {
29 30
30 namespace { 31 namespace {
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 bool DrmDevice::SetMaster() { 578 bool DrmDevice::SetMaster() {
578 DCHECK(file_.IsValid()); 579 DCHECK(file_.IsValid());
579 return (drmSetMaster(file_.GetPlatformFile()) == 0); 580 return (drmSetMaster(file_.GetPlatformFile()) == 0);
580 } 581 }
581 582
582 bool DrmDevice::DropMaster() { 583 bool DrmDevice::DropMaster() {
583 DCHECK(file_.IsValid()); 584 DCHECK(file_.IsValid());
584 return (drmDropMaster(file_.GetPlatformFile()) == 0); 585 return (drmDropMaster(file_.GetPlatformFile()) == 0);
585 } 586 }
586 587
588 bool DrmDevice::SetGammaRamp(uint32_t crtc_id,
589 const std::vector<GammaRampRGBEntry>& lut) {
590 ScopedDrmCrtcPtr crtc = GetCrtc(crtc_id);
591
592 // TODO(robert.bradford) resample the incoming ramp to match what the kernel
593 // expects.
594 if (static_cast<size_t>(crtc->gamma_size) != lut.size()) {
595 LOG(ERROR) << "Gamma table size mismatch: supplied " << lut.size()
596 << " expected " << crtc->gamma_size;
597 }
598
599 std::vector<uint16_t> r, g, b;
600 r.reserve(lut.size());
601 g.reserve(lut.size());
602 b.reserve(lut.size());
603
604 for (size_t i = 0; i < lut.size(); ++i) {
605 r.push_back(lut[i].r);
606 g.push_back(lut[i].g);
607 b.push_back(lut[i].b);
608 }
609
610 DCHECK(file_.IsValid());
611 TRACE_EVENT0("drm", "DrmDevice::SetGamma");
612 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0],
613 &g[0], &b[0]) == 0);
614 }
615
587 } // namespace ui 616 } // namespace ui
OLDNEW
« 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