Showing posts with label debug. Show all posts
Showing posts with label debug. Show all posts

Tuesday, February 12, 2013

amixer vs alsamixer: Master channel

A convenient method to change the Master volume that I use is via a custom KISS bash script that essentially calls amixer. One curious observation I made was that the return value of amixer for the Master channel did not correlate with alsamixer. A small research reveals why:

from the alsa-devel mailing list:

The percentage in amixer has nothing to do with dB level.
It's just the percentage of the raw value range of that mixer
element.  Thus showing 89% is correct.  It's 10% down from 100%
(1% is because of the resolution of the raw values).


Now, alsamixer shows the percentage in a different way.  It's
explained well in the source code (alsamixer/volume_mapping.c), but
not mentioned in the man page, unfortunately.

* The mapping is designed so that the position in the interval is proportional
* to the volume as a human ear would perceive it (i.e., the position is the
* cubic root of the linear sample multiplication factor).  For controls with
* a small range (24 dB or less), the mapping is linear in the dB values so
* that each step has the same size visually.  Only for controls without dB
* information, a linear mapping of the hardware volume register values is used
* (this is the same algorithm as used in the old alsamixer).

The percentage representation in alsamixer corresponds to this
mapping, thus it's neither dB nor linear percent.


Original discussion is here:
http://mailman.alsa-project.org/pipermail/alsa-devel/2012-March/050146.html

The script itself:

#!/bin/bash
##Amixer Script.
if [ $1 -eq 1 ]
then
    amixer set Master 5%+
    notify-send "Volume Increase +5%:" "Master Volume Level: $(amixer get Master | grep Mono: | grep [0-9]*% -o)"
fi

if [ $1 -eq 2 ]
then
    amixer set Master 5%-
    notify-send "Volume Decrease -5%:" "Master Volume Level: $(amixer get Master | grep Mono: | grep [0-9]*% -o)"
fi

#if [ $1 -eq 0 ]
#then
#       amixer set Master toggle
#       notify-send "Volume Master Toggle:" "Master Volume Level: "
#fi

#EOF

Running with arguments 1,2 or 0 increases, decreases or toggles(Mute) the Master channel respectively. I don't use the toggle segment thus its commented out.

Sunday, March 6, 2011

detailed kernel bootup debug messages

Users like me prefer as much debugging output in applications as possible because this makes performance and stability issues easy to understand. This also allows one to see what all is going on behind the scenes for crash debugging. A few amendments can be added to the kernel boot parameters of a Linux kernel to allow for detailed messages and verbose output:

By modifying the 'kernel' line in grub or editing the relevant boot file under /boot/grub and adding the following[in bold]:

kernel /boot/vmlinuz26 root=/dev/disk/by-label/Arch ro debug ignore_loglevel log_buf_len=10M print_fatal_signals=1 LOGLEVEL=8 earlyprintk=vga,keep sched_debug
heavy debugging can be easily activated.

debug = activates internal debugging.
ignore_loglevel =  ignores any sort of log level and maximizes debug output.
log_buf_len = increases the log buffer length to 10 MiB
print_fatal_signals = print any fatal signals.
LOGLEVEL = enables level 8 logging.
earlyprintk = enables early printing of messages to the vga screen
,keep = keeps the messages on for longer.
sched_debug = Enables verbose scheduler debug messages.

Ref:
http://www.kernel.org/doc/Documentation/kernel-parameters.txt
https://wiki.archlinux.org/index.php/GRUB#Advanced_Debugging

Tuesday, June 24, 2008

FBO, Stencil and the 'Blur Plugin' in Compiz Fusion.

For the past 1 year I have been endlessly trying to get the blur plugin to work in my laptop. I'm among the many people who suffer with this problem. Here's what I have understood till now after considerable amount of research.

I have an Intel GMA 950 card which comes as a default on the i945 chipset. In previous versions of CF i.e. <.7 builds, the plugin never worked due to a bug in the Mesa driver namely in the fragment_environment_variables section. Now in the new build (post .7), a new plugin with the name of 'Workarounds' attempted to provide a fix with the name 'AIGLX fragment program fix'. This helped in many ways by enabling effects like Water, Reflections to work properly on IGMA cards but the 'blur' system still had a problem.

Enabling the plugin caused the Mesa driver to kick compiz in software mode and effects fell to less than 1 FPS. Also, only the 4xBilinear filter(among the Gaussian & Mipmap filters) worked because a lack of FBOs (Frame Buffer Objects). Another small thing I noticed that while running compiz via terminal, is that a message 'Warn: No stencil buffer. Region based blur disabled', shows a faulty implementation of Mesa thus creating the problem in blur. Blur requires the stencil buffer system to work.

Many attempts are underway to port implementations such as 'Fake Blur' and 'BlurFx' into CF from the old Beryl system. Also, users are still sitting patient for the fixes in Mesa to come. Till then, no blur for IGMA users.