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

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: Minor fixes 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 bool DrmDevice::SetMaster() { 498 bool DrmDevice::SetMaster() {
498 DCHECK(file_.IsValid()); 499 DCHECK(file_.IsValid());
499 return (drmSetMaster(file_.GetPlatformFile()) == 0); 500 return (drmSetMaster(file_.GetPlatformFile()) == 0);
500 } 501 }
501 502
502 bool DrmDevice::DropMaster() { 503 bool DrmDevice::DropMaster() {
503 DCHECK(file_.IsValid()); 504 DCHECK(file_.IsValid());
504 return (drmDropMaster(file_.GetPlatformFile()) == 0); 505 return (drmDropMaster(file_.GetPlatformFile()) == 0);
505 } 506 }
506 507
508 bool DrmDevice::SetGammaRamp(uint32_t crtc_id,
509 const std::vector<GammaRampRGBEntry>& lut) {
510 ScopedDrmCrtcPtr crtc = GetCrtc(crtc_id);
511
512 // TODO(robert.bradford) resample the incoming ramp to match what the kernel
513 // expects.
514 if (static_cast<size_t>(crtc->gamma_size) != lut.size()) {
515 LOG(ERROR) << "Gamma table size mismatch: supplied " << lut.size()
516 << " expected " << crtc->gamma_size;
517 }
518
519 std::vector<uint16_t> r, g, b;
520 r.resize(lut.size());
dcheng 2015/04/30 20:40:24 Nit: reserve instead of resize.
521 g.resize(lut.size());
522 b.resize(lut.size());
523
524 for (size_t i = 0; i < lut.size(); ++i) {
525 r[i] = lut[i].r;
526 g[i] = lut[i].g;
527 b[i] = lut[i].b;
528 }
529
530 DCHECK(file_.IsValid());
531 TRACE_EVENT0("drm", "DrmDevice::SetGamma");
532 return (drmModeCrtcSetGamma(file_.GetPlatformFile(), crtc_id, r.size(), &r[0],
533 &g[0], &b[0]) == 0);
534 }
535
507 } // namespace ui 536 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698