3D graphics on Linux

As I mentioned in my post about free software, one of the problems with my current Ubuntu installation is my use of a non-free graphics driver. I would prefer to find a way to use free software and still have some hardware acceleration support, e.g. for compiz and for video playback. (I found a good tutorial on how to fix video tearing.)

As a side note, I have a free graphics driver with hardware acceleration working on my Eee 900. This is mainly because the eee pc has Intel integrated graphics. On the other hand, its performance is nothing to write home about.

The target system is an HP Compaq dc7900, with an ATI Radeon HD 2400 XT (RV610). I am currently running Ubuntu Linux 10.04 LTS with the fglrx driver.

Testing your existing setup

The old way to check for hardware acceleration was the following:

$ glxinfo | grep rendering
 direct rendering: Yes

where a Yes means you do have rendering. However, I learned that a system can answer yes even if it is not using hardware acceleration. The proper command is:

$ glxinfo | grep OpenGL
 OpenGL vendor string: Tungsten Graphics, Inc
 OpenGL renderer string: Mesa DRI Intel(R) 915GM
GEM 20100330 DEVELOPMENT x86/MMX/SSE2
 OpenGL version string: 1.4 Mesa 7.10.2
 OpenGL extensions:

The item of interest is the “renderer string.” If it says “Software rasterizer,” then your system is emulating OpenGL instead of using hardware acceleration. Here is some more documentation on how to check your setup using glxinfo.

Some definitions

  • OpenGL is a standard specification for writing applications that produce 2D and 3D computer graphics. Basically, it is an API.
  • Mesa 3D is an open source implementation of OpenGL, providing the library that applications can call into.
  • Direct rendering interface (DRI) are drivers that Mesa uses to translate OpenGL function calls into GPU-instructions.

When the DRI is present, this would constitute hardware acceleration. It has a userspace component and a kernel space component, which is the direct rendering manager (DRM)

The “driver” that is specified in xorg.conf is actually a relatively basic driver that performs the 2D tasks, including compositing and video acceleration. All 3D calls are passed on to Mesa. See the section about DDX (Display Driver for X) in Linux Graphics Driver Stack Explained.

Kernel Mode Setting (KMS) is the notion that the code to set the video card’s mode is moved into the kernel. The mode is the color depth and resolution of a monitor. Previously, the mode setting code resided in the X server. In the new scheme, it resides in the kernel. This provides the following advantages, as given in Debian 6 Release Notes:

  • More reliable suspend and resume
  • Ability to use graphics devices without X
  • Faster VT switch
  • Native mode text console

Tools for syncing

Here’s the situation: I have accounts on multiple computers. Who doesn’t have this problem these days? (If you’re in the top 1% of the world’s richest who own a computer, that is.) I have a netbook running Xubuntu, a desktop triple booting Ubuntu, Debian unstable, and Windows Vista, and several accounts at school. I want to be able to sit at any one of these computers and be as productive as possible.

My solution has several parts to it. For me to be productive, I want to have access to several different kinds of information, including:

  • bookmarks
  • email, including contacts
  • documents

For each kind of information, I have a different way of accessing it, depending on the level of configuration I can perform on the particular computer I am using.

Bookmarks

I store my bookmarks on Google Bookmarks. Google bookmarks has a web interface for accessing and managing bookmarks. Bookmarks are stored by URL, so the URL is not editable except by deleting and creating a new bookmark. Otherwise, I can edit the title of the page, and tag the bookmark to organize it how I please.

The first software tool I used to access Google Bookmarks was GMarks. (GMarks is free software.) GMarks is a Firefox extension, so I can install it on any account where I have access to Firefox. Thankfully my school has the Firefox web browser on their lab computers, and they allow students to add their own extensions. GMarks adds a menu to the toolbar with bookmarks pulled from Google Bookmarks. The bookmark tags or labels are used to generate the menu, with the ‘>’ character used to represent subfolders. I prefer to sort my bookmarks by date, so the most recently added ones appear near the top.

More recently I have been using Google Chrome for my web browsing. The software tool I use in this browser is Yet Another Google Bookmarks Extension (YAGBE). As this tool is not free software, I am in the market for a replacement that behaves similarly. YAGBE adds a star to the toolbar next to the URL bar. (This is to the right of the star that is already in the URL bar, which is for Chrome Bookmarks.) This is handy, and a little more compact than the default GMarks behavior. The star turns yellow when you are on a page which you have already bookmarked. Clicking the star reveals a menu with your bookmarks.

Screenshot of the star that YAGBE puts in the toolbar

Email

The obvious solution to email is to use a provider with IMAP access. I prefer to use a native client to a web client where possible. I use Thunderbird on the machines I administer, and on the school lab computers, I have configured Outlook to interface with my personal email as well as my school email.

The more interesting part is contacts. At some point I got fed up with all my Thunderbird instances pulling their own contacts into the “Collected Addresses” list. I was also fed up with searching my email inbox to confirm a particular email address for one of my friends. I decided to use Google Contacts (part of gmail) to store all the email addresses for my contacts. Similar to tags, Google allows you to add a contact to multiple groups.

There is a Thunderbird extension called (you guessed it) Google Contacts. This extension is free software. If you set up your Gmail account in Thunderbird for email, it will automatically use your username and password to pull in your contacts and add them as another address book. All of the groups from Gmail are created as Thunderbird Mailing Lists, so you can use them to find a contact if you desire. Otherwise, it behaves like the other address books, so you can use autocomplete.

Screenshot of the Google Contacts address book in Thunderbird

Documents

For my documents, I simply use Dropbox. (This is not free software.) On computers where I can install it, I do. When I cannot, I use their web interface to get the files I need.

In some situations, I’ll make an exception, and put a document on Google Documents so other people can edit it. I have also used Zoho Notebook to create a paged log of my computer hacking adventures. This allows me to edit the same notebook from whichever computer is running, which is usually not the same as the one that is being experimented on!

Do what you enjoy

The CEO of Securian Financial Group told me, “If you’re not having fun, you’re not doing it right.” The CIO told me, “Do what you enjoy.” I’ve been spending the past few weeks thinking about what I will do after completing my undergraduate degree here at St. Cloud State University. I’ve found that many different sources of career advice focus on doing what you enjoy.

Scott Belsky has an article entitled “Finding Your Work Sweet Spot.” He describes this sweet spot as an intersection of three different factors: interests, skills, and opportunities. Interests is defined by what you love to do. “A genuine interest is not about what promises the most economic gain. On the contrary, it is a topic that trumps economic concerns because you love it so much.”

I am learning to use my interests and skills to navigate some of the many opportunities that confront me. A quote from Dan Pink on Matt Perman’s blog says that choices should be based on your values, not based on utilitarian reasons.

You can do something for instrumental reasons — because you think it’s going to lead to something else, regardless of whether you enjoy it or it’s worthwhile.

Or you can do something for fundamental reasons — because you think it’s inherently valuable, regardless of what it may or may not lead to.

If I am focusing on doing what I enjoy, I can make every decision based on fundamental reasons. I won’t always know where I am going, but I am enjoying the steps on the way. Belsky agrees, writing: “Define ‘opportunity’ as an action or experience that brings you a step closer to your genuine interest. Opportunity is less about leaps forward and more about the slow advance.”

I don’t know where I’m going, but I know where I am. There is no master plan, other than pursuing what I enjoy. A quote from Peter Drucker supports this:

Successful careers are not planned.

They develop when people are prepared for opportunities because they know their strengths, their method of work, and their values. Knowing where one belongs can transform an ordinary person — hardworking and competent but otherwise mediocre — into an outstanding performer.

(The quote is from a PDF entitled Managing Oneself.)

I think to be prepared for opportunities entails

  • finding opportunities around you (networking)
  • choosing to engage those opportunities or not
  • engaging opportunities for fundamental reasons

Power usage

I recently purchased the P3 Kill A Watt EZ (model 4460), and I have been using it to measure the power usage of a few items around my dorm room. I was originally inspired to do this from one of Jeff Atwood’s posts on power usage.

Desktop power usage

The first item I measured was my tower, the HP Compaq dc7900. It has the following specifications:

Intel Core 2 Duo E8400
4 GB RAM
Seagate 160GB
Western Digital 500 GB
ATI Radeon HD 2400 XT

The power measurements are as follows:

switched off 3 watts
on, idle 60 watts
on, BOINC at 50% 80 watts
on, BOINC at 100% 90 watts
suspend 4 watts

BOINC is free software that allows you to participate in a variety of distributed computing projects, and I used it to perform some CPU-intensive tasks for my testing. When I say BOINC at 50% and BOINC at 100%, I was utilizing BOINC preferences. It has an option, “On multiprocessor systems, use at most __% of the processors.” My system has 2 cores, so the 50% roughly corresponds to one core at full utilization, and 100% corresponds to both cores at full utilization.

It is interesting to compare these measurements to Jeff Atwood’s measurements. Two articles from 2005 give measurements of 118 w for a desktop, and 160 w for a server. My dc7900 specs are strikingly similar to Jeff’s 2005 desktop, and mine was a budget model purchased in 2009. For similar performance computers, we come to the conclusion that idle wattages have dropped by half in 5 years.

Probably more instructive is a comparison with Jeff’s 2011 Home Theater PC, which draws 22 watts idle. This is with a Mini-ITX board, and other power-saving goodies.

Monitor power usage

The next item I measured was my 22 inch widescreen monitor, an HP L2245wg. I learned that switched off and in power save mode, it uses the same amount of power, 3 watts. Switched on, it uses different wattage depending on the screen brightness.

on, 0 brightness 21 watts
on, 50 brightness 29 watts
on, 100 brightness 42 watts

Looking at the results, I was rather shocked that the power usage doubles when the brightness is turned up. It is better to keep your monitor’s brightness down, and this is best practice for monitors anyway.

Laptop power usage

Finally, I measured the power usage of my Eee PC 900, which I had recently installed Xubuntu 11.04 on. The power measurements are as follows:

idle at Xubuntu desktop, minimum brightness 16 watts
idle, wireless switched off 14 watts
idle, wireless on, maximum brightness 17 watts

Then, out of curiosity, I booted my Eee PC with Minix 3, since it is a small operating system designed for embedded use. I used version 3.1.2a for USB stick, which can be found in the MINIX previous versions. (The latest stable release is 3.1.8.) The power usage of this was 15 watts.

In summary, for my laptop, there is strikingly little difference between minimum brightness and maximum brightness. The difference between MINIX and a full-fledged operating system, Xubuntu, is minor as well.

It is also interesting to compare my Eee PC’s power usage with some of Jeff Atwood’s measurements. His Dell XPS M1330 (in 2008) used 20 watts idle, and his Dell Inspiron 300m (in 2006) used 15 watts idle. From this small amount of data, I can jump to the conclusion that, unlike desktops, laptops have not significantly improved their power usage.

Free software Firefox extensions

As a follow up to my previous post about free software, I decided to look at another type of software: browser extensions. Ubuntu 10.04 has Firefox 3.6.18 on it, and I added some extensions to bring the browser’s features a little up to date. I wanted to see if these extensions that I use are under a free software compatible license. The majority of them were, but some took more hunting than others to confirm this.

  • Advertising Cookie Opt-out Apache License 2.0 (Google code)
  • CookieCuller Mozilla Public License (mozdev.org)
  • Download Statusbar This and CookieCuller stumped me until I looked at the legal notice at mozdev.org where it states “All code for each project hosted on the Site must be made available under the Mozilla Public License (MPL) unless otherwise noted on the project pages.”
  • Firebug From the extension home page, go to “Get Involved,” then to the page on google code. It uses the New BSD License.
  • FlashGot The only mention I could find is on the features page, where they say “Alternatively, since FlashGot is open source (GPL)…” This license could be more clearly stated.
  • GMarks Mozilla Public License version 1.1 (addons.mozilla.org)
  • Hide Menubar Mozilla Public License version 1.1 (addons.mozilla.org)
  • HTTPS-Everywhere GNU GPL version 2
  • New Tab JumpStart Mozilla Public License version 1.1 (Google code)
  • SQLite Manager Mozilla Public License version 1.1 (Google code)
  • Stop-or-Reload Button The developer’s home page is no longer active, but the extension’s page on addons.mozilla.org states the license as BSD license. In newer versions of Firefox, this extension is no longer needed because the functionality is built in.
  • Ubuntu Firefox Modifications

Extensions without a free license:

  • Personal Menu (can’t find any documentation on the license, though the source code is publicized here)
  • Resizeable Textarea Trying to visit the home page on this one locks up the Add-ons window. In newer versions of Firefox, this extension is no longer needed because the functionality is built in.

Why I am writing this blog

After writing 3 posts, I think I am starting to get the hang of this blogging thing. I wanted to write about why I started blogging. I had been kicking around ideas for blogging in my head for quite some time, but I just wasn’t able to sit down and start it.

Taking Strengths Finder was the impetus I needed to start blogging. I took the test, and learned that my themes are input, deliberative, intellection, responsibility, and consistency. As I read through the strengths insights, something stuck out to me: three of my strengths mentioned the written word.

For example, the input theme includes the following insight: “You school yourself by reading, investigating, examining, experiencing, or receiving instruction in a subject.” As a follow-up to that, a suggested action was to share advice with others, or write about what I have learned. “Remember that you must be more than just a collector of information. … Make a point of identifying the facts and data that would be most valuable to others, and use this information to their advantage.”

I hope this blog is able to pull valuable information out of my own knowledge, and it is my hope that this information is of value to you.

The second reason I decided to jump in and start writing was because of an article I read on Coding Horror. How to Write Without Writing. Basically, writing and communication is the differentiator between a decent programmer, and an excellent programmer. Jeff Atwood’s article mentions two ways to train yourself to write: blogging, and cheating. Cheating in this case would be getting programmers to participate in Stack Overflow, where they learn to write by answering and asking questions.

I’ll try out blogging first. As I blog, my aim is to challenge myself to write longer, in-depth articles about things I have personally explored. I do not want to merely react to the latest tech topics. Jakob Nielsen’s article, Write Articles, Not Blog Postings, presents an excellent article about how to differentiate yourself by being proactive rather than reactive in your writing. We’ll see how this manifests myself in this blog.

Free software on my computer

I am intrigued by Richard Stallman’s free software philosophy, and while I would not consider myself a free software fanatic, I wanted to see how much non-free software I have on my primary computer.

My primary computer is an HP Compaq dc7900. I’m running Ubuntu 10.04 LTS as my main operating system. Right now I have the following non-free software programs on it, and I think this is a representative list for many GNU/Linux enthusiasts:

  • Graphics driver
  • A few games (Sauerbraten, Urban Terror, Assault Cube)
  • Skype
  • Flash plugin
  • Microsoft fonts

These packages can be easily found by using “Virtual RMS” (ubuntu package vrms), which basically gives advice that Richard M Stallman would give if he looked at the list of software on my computer.

Web browser extensions

Then I thought I should examine the list of web browser extensions I use regularly to see if they are open source.

Chrome

Lately Chrome has been my main browser. I like Chrome’s default feature set, and I’ve only needed to add 3 extensions to it.

  • RSS Subscription Extension (by Google). I guess this really is by Google, because all the bug links on the extension info page link to crbug.com, which redirects to the chromium google code project. This doesn’t make clear which license is used.
  • Super Full Feeds for Google Reader. This extension is simple. As soon as you visit the developer website, you can see that the code license is GNU GPL v3
  • Yet Another Google Bookmarks Extension. This developer page does not make clear what license is used.

The Social Factor

My boss’s boss at my summer internship loaned me “The Social Factor: Innovate, Ignite, and Win through Mass Collaboration and Social Networking,” by Maria Azua. (IBM Press, 2010)

The book focuses on some societal changes that are happening. The thesis of the book is that companies need to respond to these changes in order to succeed.

Ready for a history lesson? Chapter 1, “The Dawn of the Social Age,” covers some important background in communication technology. Each new communication technology (Radio, TV, Computer, Internet) had a faster adoption rate than the technology before it, and the result is a shift in how people communicate and share information. Chapter 2 discusses the implications for companies: employees are better able to share information if they can use these new technologies.

The next chapters discuss a number of social tools: blogs, wikis, tagging, Twitter, Facebook, and LinkedIn. As I read, I compared the tools the author discussed with tools that I have used. I am somewhat familiar with blogging, as I blog here and at midmncru.com. I have contributed to Wikipedia. My summer internship is at Securian, and our company uses SocialText for several internal Wikis. I have a Facebook account, but I haven’t tried Twitter or LinkedIn yet. Reading this book definitely swayed me toward trying out these services.

On the other hand, after taking my Computing Ethics class at SCSU, I am increasingly cautious about sharing information online. A recent article I found through ACM confirmed this. The Obama administration released a roadmap that discussed cyber security, saying “The public is insufficiently aware of the risk of sharing information in cyberspace — which can affect personal and national security.” Whenever you’re using the internet, your every action is tracked and cataloged somewhere, and you don’t always have control over it.

A Linux OS for my Eee PC

Two years ago I purchased an Eee PC 900 with a 16GB SSD and Windows XP. I left Windows XP on it and installed Eeebuntu 3.0. At this point I don’t remember if I installed Base or Standard. The Eeebuntu people became the Aurora OS people, and they have not released a stable OS since Eeebuntu 3.0.

Eeebuntu 3.0 is based on Ubuntu Jaunty 9.04, and support for Jaunty recently ended, so I will not be able to get security updates for it. To top it off, Google Chrome realized this, and has been complaining to me that my operating system is obsolete.

Windows XP itself is a bit old, and I don’t use it anyway. I decided to wipe out the entire hard drive and install a new operating system. I picked Xubuntu to try out first. I downloaded the Xubuntu ISO and used Ubuntu’s Startup Disk Creator tool to put it on a usb stick.

Backing up

I booted Xubuntu and used the command line to backup using an external hard drive with enough free space for a 16GB image of the entire Eee PC disk.

First, identify the name of the hard drive:

sudo fdisk -l

Then I ran the following command to backup the hard drive:

time sudo dd if=/dev/sda of=/media/ubuntu-backup/home/bobby/eeepcharddisk-20110620.dd
31522176+0 records in
31522176+0 records out
16139354112 bytes (16 GB) copied, 642.54 s, 25.1 MB/s

real    10m43.059s
user    0m40.083s
sys     5m36.741s

Installing Xubuntu

I used the shortcut on the desktop to start the installation.