Skip to content

Commit

Permalink
intel-gpu-tools: add script to set colorspace. thanks to fritsch
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansaraev committed Feb 4, 2013
1 parent 1a9508d commit 09109e9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/x11/other/intel-gpu-tools/install
Expand Up @@ -24,3 +24,4 @@


mkdir -p $INSTALL/usr/bin mkdir -p $INSTALL/usr/bin
cp -R $PKG_BUILD/tools/intel_reg_write $INSTALL/usr/bin cp -R $PKG_BUILD/tools/intel_reg_write $INSTALL/usr/bin
cp -P $PKG_DIR/scripts/set-intel-color-space $INSTALL/usr/bin
47 changes: 47 additions & 0 deletions packages/x11/other/intel-gpu-tools/scripts/set-intel-color-space
@@ -0,0 +1,47 @@
#!/bin/sh

################################################################################
# Copyright (C) 2009-2010 OpenELEC.tv
# http://www.openelec.tv
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
# Enable Limited or RGB full on intel Computers
# Usage:
# Set Limited mode:
# ./set-intel-color-space limited
# Set Full mode:
# ./set-intel-color-space full
################################################################################

if [ $# -gt 0 ] ; then
OUTPUT=`xrandr -display :0 -q | sed '/ connected/!d;s/ .*//;q'`
if [ "$1" = "limited" ] ; then
# limited modes
intel_reg_write 0x70008 0xC0000000
intel_reg_write 0x70180 0xD8004400
xrandr --output $OUTPUT --set "Broadcast RGB" "Limited 16:235"
elif [ "$1" == "full" ] ; then
# reset old mode
xrandr --output $OUTPUT --set "Broadcast RGB" "Limited 16:235"
intel_reg_write 0x70008 0xC4002000
intel_reg_write 0x70180 0xDA004400
# set new mode
xrandr --output $OUTPUT --set "Broadcast RGB" "Full"

This comment has been minimized.

Copy link
@fritsch

fritsch Feb 24, 2013

Contributor

@stefansaraev: We need to issue the intel_reg_write here again: intel_reg_write 0x70180 0xDA004400 concerning the original freedesktop bug: https://bugs.freedesktop.org/show_bug.cgi?id=46800

This comment has been minimized.

Copy link
@stefansaraev

stefansaraev Feb 24, 2013

Author Contributor

ok, will add, do we need this also for "limited" (after line 36) ?

This comment has been minimized.

Copy link
@fritsch

fritsch Feb 24, 2013

Contributor

This whole thingy is a mess ... writing registers of the gpu hardware is nothing funny :-) I link someone to this report, that has a good understanding of color.

This comment has been minimized.

Copy link
@Stephen-Neal

Stephen-Neal Feb 24, 2013

I think that might be me (aka noggin aka noggin72?)

Are there are any docs on the Intel registers?

This comment has been minimized.

Copy link
@fritsch

fritsch Feb 24, 2013

Contributor

This comment has been minimized.

Copy link
@Stephen-Neal

Stephen-Neal Feb 25, 2013

OK - haven't had time to do much reading - but decided to see where we were by using a known-good player that can be configured for 0-255 (aka Full) or 16-235 (aka Limited) output (a Popcorn Hour) and compare that with OpenElec running on a G630. The source content was the 0-25 black-level test on the excellent AVC HD test disc ISO from here : http://www.w6rz.net. This contains bars which are below and above black level 16. Correctly displayed those bars at 16 or below should be invisible against the background, those above 17 should be visible and be flashing. (First bit of the Black Clipping Basic Settings sequence)

Comparing Open Elec in "Limited Mode" with the Popcorn Hour, it's actually in "Full" mode. (i.e. source black at 16 is mapped to output black at 0)

When Open Elec is in "Full Mode" it's in a bizarrely very "set-up blacks" mode that doesn't match any real-world video format. Blacks appear to be at levels much higher than 16 (could be 32?)

Neither mode is "Limited" where source 16 black should be output as 16.

fi
else
echo "Usage: $0 limited | full"
fi

0 comments on commit 09109e9

Please sign in to comment.