summaryrefslogtreecommitdiffstats
path: root/ash/content
diff options
context:
space:
mode:
authorjochen <jochen@chromium.org>2015-05-05 06:49:15 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-05 14:18:11 +0000
commite005ecc8ce2f29011df0dad07ccfd7eb2d61c207 (patch)
treecf4f9fc1654b64599408002906561e61f0308216 /ash/content
parenta780ea970b120b2129b540b3a761ad92a50bde03 (diff)
downloadchromium_src-e005ecc8ce2f29011df0dad07ccfd7eb2d61c207.zip
chromium_src-e005ecc8ce2f29011df0dad07ccfd7eb2d61c207.tar.gz
chromium_src-e005ecc8ce2f29011df0dad07ccfd7eb2d61c207.tar.bz2
Revert of Load and apply a vcgt table from an ICC file to the internal display (patchset #15 id:300001 of https://codereview.chromium.org/1028563003/)
Reason for revert: breaks compilation https://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20GN%20(dbg)/builds/1084 Original issue's description: > Load and apply a vcgt table from an ICC file to the internal display > > When the command line switch --internal-display-color-profile-file is provided > load the given ICC file using qcms and extract the VCGT data. Use this VCGT > data to apply a gamma ramp to change the output on the internal display using > drmModeCrtcSetGammaRamp. > > BUG=471749 > TEST=On a link_freon device add the command line option to load a sample ICC > file (e.g. Bluish.icc to give a blue tint) and observe on startup that the > internal display is blue tinted. > > Committed: https://crrev.com/46134a86af1eac76e97b062a68afeaa6c8801216 > Cr-Commit-Position: refs/heads/master@{#328318} TBR=dcheng@chromium.org,dnicoara@chromium.org,noel@chromium.org,oshima@chromium.org,sievers@chromium.org,spang@chromium.org,robert.bradford@intel.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=471749 Review URL: https://codereview.chromium.org/1118373006 Cr-Commit-Position: refs/heads/master@{#328321}
Diffstat (limited to 'ash/content')
-rw-r--r--ash/content/display/DEPS2
-rw-r--r--ash/content/display/display_color_manager_chromeos.cc139
-rw-r--r--ash/content/display/display_color_manager_chromeos.h66
3 files changed, 0 insertions, 207 deletions
diff --git a/ash/content/display/DEPS b/ash/content/display/DEPS
index 07d93bc..42cea3c 100644
--- a/ash/content/display/DEPS
+++ b/ash/content/display/DEPS
@@ -2,9 +2,7 @@ include_rules = [
"+content/public/browser/screen_orientation_delegate.h",
"+content/public/browser/screen_orientation_provider.h",
"+content/public/browser/browser_context.h",
- "+content/public/browser/browser_thread.h",
"+content/public/browser/web_contents.h",
- "+third_party/qcms/src/qcms.h",
"+third_party/WebKit/public/platform/WebScreenOrientationLockType.h",
]
diff --git a/ash/content/display/display_color_manager_chromeos.cc b/ash/content/display/display_color_manager_chromeos.cc
deleted file mode 100644
index 0d7252f..0000000
--- a/ash/content/display/display_color_manager_chromeos.cc
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/content/display/display_color_manager_chromeos.h"
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/command_line.h"
-#include "base/files/file_path.h"
-#include "base/logging.h"
-#include "chromeos/chromeos_switches.h"
-#include "content/public/browser/browser_thread.h"
-#include "third_party/qcms/src/qcms.h"
-#include "ui/display/types/display_snapshot.h"
-#include "ui/display/types/gamma_ramp_rgb_entry.h"
-#include "ui/display/types/native_display_delegate.h"
-#include "ui/gfx/display.h"
-#include "ui/gfx/screen.h"
-
-using content::BrowserThread;
-
-namespace ash {
-
-namespace {
-
-bool ParseFile(const base::FilePath& path,
- DisplayColorManager::ColorCalibrationData* data) {
- qcms_profile* display_profile = qcms_profile_from_path(path.value().c_str());
-
- if (!display_profile) {
- LOG(WARNING) << "Unable to load ICC file: " << path.value();
- return false;
- }
-
- size_t vcgt_channel_length =
- qcms_profile_get_vcgt_channel_length(display_profile);
- if (!vcgt_channel_length) {
- LOG(WARNING) << "No vcgt table in ICC file: " << path.value();
- return false;
- }
-
- std::vector<uint16_t> vcgt_data;
- vcgt_data.resize(vcgt_channel_length * 3);
- if (!qcms_profile_get_vcgt_rgb_channels(display_profile, &vcgt_data[0])) {
- LOG(WARNING) << "Unable to get vcgt data";
- qcms_profile_release(display_profile);
- return false;
- }
-
- data->lut.resize(vcgt_channel_length);
- for (size_t i = 0; i < vcgt_channel_length; ++i) {
- data->lut[i].r = vcgt_data[i];
- data->lut[i].g = vcgt_data[vcgt_channel_length + i];
- data->lut[i].b = vcgt_data[(vcgt_channel_length * 2) + i];
- }
- qcms_profile_release(display_profile);
- return true;
-}
-
-} // namespace
-
-DisplayColorManager::DisplayColorManager(ui::DisplayConfigurator* configurator)
- : configurator_(configurator) {
- configurator_->AddObserver(this);
- LoadInternalFromCommandLine();
-}
-
-DisplayColorManager::~DisplayColorManager() {
- configurator_->RemoveObserver(this);
-
- for (auto it : calibration_map_) {
- delete it.second;
- calibration_map_.erase(it.first);
- }
-}
-
-void DisplayColorManager::OnDisplayModeChanged(
- const ui::DisplayConfigurator::DisplayStateList& display_states) {
- for (const ui::DisplaySnapshot* state : display_states)
- ApplyDisplayColorCalibration(state->display_id());
-}
-
-void DisplayColorManager::ApplyDisplayColorCalibration(uint64_t display_id) {
- if (calibration_map_.find(display_id) != calibration_map_.end()) {
- ColorCalibrationData* ramp = calibration_map_[display_id];
- if (!configurator_->SetGammaRamp(display_id, ramp->lut))
- LOG(WARNING) << "Error applying gamma ramp";
- }
-}
-
-void DisplayColorManager::LoadInternalFromCommandLine() {
- const base::CommandLine* command_line =
- base::CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(
- chromeos::switches::kInternalDisplayColorProfileFile)) {
- const base::FilePath& path = command_line->GetSwitchValuePath(
- chromeos::switches::kInternalDisplayColorProfileFile);
- VLOG(1) << "Loading ICC file : " << path.value()
- << "for internal display id: " << gfx::Display::InternalDisplayId();
- LoadCalibrationForDisplay(gfx::Display::InternalDisplayId(), path);
- }
-}
-
-void DisplayColorManager::LoadCalibrationForDisplay(
- int64_t display_id,
- const base::FilePath& path) {
- if (display_id == gfx::Display::kInvalidDisplayID) {
- LOG(WARNING) << "Trying to load calibration data for invalid display id";
- return;
- }
-
- scoped_ptr<ColorCalibrationData> data(new ColorCalibrationData());
- base::Callback<bool(void)> request(
- base::Bind(&ParseFile, path, base::Unretained(data.get())));
- base::PostTaskAndReplyWithResult(
- BrowserThread::GetBlockingPool(), FROM_HERE, request,
- base::Bind(&DisplayColorManager::UpdateCalibrationData, AsWeakPtr(),
- display_id, base::Passed(data.Pass())));
-}
-
-void DisplayColorManager::UpdateCalibrationData(
- uint64_t display_id,
- scoped_ptr<ColorCalibrationData> data,
- bool success) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (success) {
- // The map takes over ownership of the underlying memory.
- calibration_map_[display_id] = data.release();
- }
-}
-
-DisplayColorManager::ColorCalibrationData::ColorCalibrationData() {
-}
-
-DisplayColorManager::ColorCalibrationData::~ColorCalibrationData() {
-}
-
-} // namespace ash
diff --git a/ash/content/display/display_color_manager_chromeos.h b/ash/content/display/display_color_manager_chromeos.h
deleted file mode 100644
index 7f21c32..0000000
--- a/ash/content/display/display_color_manager_chromeos.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_
-#define ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_
-
-#include <map>
-#include <vector>
-
-#include "ash/ash_export.h"
-#include "base/basictypes.h"
-#include "base/files/file_path.h"
-#include "base/memory/weak_ptr.h"
-#include "ui/display/chromeos/display_configurator.h"
-#include "ui/gfx/display.h"
-#include "ui/gfx/display_observer.h"
-
-namespace ui {
-struct GammaRampRGBEntry;
-} // namespace ui
-
-namespace ash {
-
-// An object that observes changes in display configuration applies any color
-// calibration where needed.
-class ASH_EXPORT DisplayColorManager
- : public ui::DisplayConfigurator::Observer,
- public base::SupportsWeakPtr<DisplayColorManager> {
- public:
- explicit DisplayColorManager(ui::DisplayConfigurator* configurator);
- ~DisplayColorManager() override;
-
- // ui::DisplayConfigurator::Observer
- void OnDisplayModeChanged(
- const ui::DisplayConfigurator::DisplayStateList& outputs) override;
- void OnDisplayModeChangeFailed(
- const ui::DisplayConfigurator::DisplayStateList& displays,
- ui::MultipleDisplayState failed_new_state) override {}
-
- struct ColorCalibrationData {
- ColorCalibrationData();
- ~ColorCalibrationData();
-
- std::vector<ui::GammaRampRGBEntry> lut;
- };
-
- private:
- void ApplyDisplayColorCalibration(uint64_t display_id);
- void LoadInternalFromCommandLine();
- void LoadCalibrationForDisplay(int64_t display_id,
- const base::FilePath& path);
- void UpdateCalibrationData(
- uint64_t display_id,
- scoped_ptr<DisplayColorManager::ColorCalibrationData> data,
- bool success);
-
- ui::DisplayConfigurator* configurator_;
- std::map<uint64_t, ColorCalibrationData*> calibration_map_;
-
- DISALLOW_COPY_AND_ASSIGN(DisplayColorManager);
-};
-
-} // namespace ash
-
-#endif // ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_