title: How to enable OpenGL 3.3 using Mesa 10.1 on Ubuntu
body: <p>I am trying to get an OpenGL-based rendering engine that relies on OpenGL 3.3 and GLSL 3.3 to run on Ubuntu 13.10 using an AMD Radeon 6950. I want to use the open source drivers (<code>radeon</code>), which rely on Mesa for their OpenGL implementation. Ubuntu 13.10 only provides Mesa 9.2 (implementing OpenGL 3.1) "out of the box". It is however possible to install Mesa 10.1 (implementing OpenGL 3.3) from <a href="https://launchpad.net/~oibaf/+archive/graphics-drivers/" rel="nofollow noreferrer">this PPA</a> as explained in this thread:</p>
  
  <p>StackOverflow: <a href="https://stackoverflow.com/questions/14123895/opengl-glsl-3-3-on-an-hd-graphics-4000-under-ubuntu-12-04">OpenGL &amp; GLSL 3.3 on an HD Graphics 4000 under Ubuntu 12.04</a></p>
  
  <p>I used the exact same steps as explained there:</p>
  
  <pre><code>1.) Add the PPA Repository
    $ sudo add-apt-repository ppa:oibaf/graphics-drivers
  2.) Update sources
    $ sudo apt-get update
  3.) Dist-upgrade (rebuilds many packages)
    $ sudo apt-get dist-upgrade
  4.) Then I rebooted.
  </code></pre>
  
  <p>Mesa 10.1 was successfully installed. However, <code>glxinfo</code>, while it now reports that Mesa 10.1 is in use, still reports only OpenGL 3.0 (compat profile) and OpenGL 3.1 (core profile):</p>
  
  <pre><code>$ glxinfo | grep OpenGL
  OpenGL vendor string: X.Org
  OpenGL renderer string: Gallium 0.4 on AMD CAYMAN
  OpenGL core profile version string: 3.1 (Core Profile) Mesa 10.1.0-devel (git-7f57408 saucy-oibaf-ppa+curaga)
  OpenGL core profile shading language version string: 1.40
  OpenGL core profile context flags: (none)
  OpenGL core profile extensions:
  OpenGL version string: 3.0 Mesa 10.1.0-devel (git-7f57408 saucy-oibaf-ppa+curaga)
  OpenGL shading language version string: 1.30
  OpenGL context flags: (none)
  OpenGL extensions:
  </code></pre>
  
  <p>Why is that? How can I enable OpenGL 3.3? As can be seen by comparison in <a href="https://stackoverflow.com/questions/14123895/opengl-glsl-3-3-on-an-hd-graphics-4000-under-ubuntu-12-04">the StackOverflow thread</a> that I mentioned, it is possible to have <code>glxinfo</code> report OpenGL 3.3. I am aware that <code>glxinfo</code> may report the wrong version numbers as per <a href="http://www.mesa3d.org/relnotes/10.1.html" rel="nofollow noreferrer">the Mesa 10.1 Release Notes</a>, however <em>the rendering engine I'm trying to run fails because of this</em>.</p>
  
  <p>I use the following code to spawn a window:</p>
  
  <pre><code>glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
  glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
  glfwOpenWindowHint(GLFW_OPENGL_PROFILE, 0);
  
  if(GL_TRUE != glfwOpenWindow(
      _windowDimensions.x, _windowDimensions.y,
      0, 0, 0, 0, 32, 0, GLFW_WINDOW))
  {
      THROW("GLFW error: failed to create window.");
  }
  </code></pre>
  
  <p>When I try to run the rendering engine using this setup, the above exception gets thrown as OpenGL 3.3 is not supported. I can set <code>GLFW_OPENGL_VERSION_MINOR</code> to <code>0</code> and then the window opens fine, but an exception will be thrown later as GLSL 3.3 shaders are required.</p>
  
  <p>Also note that the rendering engine runs fine when I use the proprietary <code>fglrx</code> drivers (and then <code>glxinfo</code> reports OpenGL version 4.2), so the application itself really is not the problem, but the supported OpenGL is.</p>
  
  <p>So what am I doing wrong? Why doesn't Mesa 10.1 support OpenGL 3.3 for me? My graphics card certainly supports it.</p>
  
  <p>Here's some additional information that may be useful.</p>
  
  <pre><code>$ apt-cache policy libgl1-mesa-glx
  libgl1-mesa-glx:
    Installed: 10.1~git1402041945.7f5740+curaga~gd~s
    Candidate: 10.1~git1402041945.7f5740+curaga~gd~s
    Version table:
   *** 10.1~git1402041945.7f5740+curaga~gd~s 0
          500 http://ppa.launchpad.net/oibaf/graphics-drivers/ubuntu/ saucy/main amd64 Packages
          100 /var/lib/dpkg/status
       9.2.1-1ubuntu3 0
          500 http://archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
  
  
  $ lspci -vv
  ...snip...
  01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cayman PRO [Radeon HD 6950] (prog-if 00 [VGA controller])
      Subsystem: Hightech Information System Ltd. Device 2307
      Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
      Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast &gt;TAbort- &lt;TAbort- &lt;MAbort- &gt;SERR- &lt;PERR- INTx-
      Latency: 0, Cache Line Size: 64 bytes
      Interrupt: pin A routed to IRQ 53
      Region 0: Memory at c0000000 (64-bit, prefetchable) [size=256M]
      Region 2: Memory at fe620000 (64-bit, non-prefetchable) [size=128K]
      Region 4: I/O ports at e000 [size=256]
      Expansion ROM at fe600000 [disabled] [size=128K]
      Capabilities: &lt;access denied&gt;
      Kernel driver in use: radeon
  ...snip...
  
  
  $ lsmod | egrep 'radeon|fglrx'
  radeon               1402995  3
  i2c_algo_bit           13413  1 radeon
  ttm                    84169  1 radeon
  drm_kms_helper         52710  1 radeon
  drm                   297056  5 ttm,drm_kms_helper,radeon
  
  
  $ modinfo radeon
  filename:       /lib/modules/3.11.0-15-generic/kernel/drivers/gpu/drm/radeon/radeon.ko
  license:        GPL and additional rights
  description:    ATI Radeon
  author:         Gareth Hughes, Keith Whitwell, others.
  ...snip...
  firmware:       radeon/CAYMAN_smc.bin
  firmware:       radeon/CAYMAN_rlc.bin
  firmware:       radeon/CAYMAN_mc.bin
  firmware:       radeon/CAYMAN_me.bin
  firmware:       radeon/CAYMAN_pfp.bin
  ...snip...
  srcversion:     D174B1E4686391B33437915
  alias:          pci:v00001002d000099A4sv*sd*bc*sc*i*
  alias:          pci:v00001002d000099A2sv*sd*bc*sc*i*
  ...snip...
  depends:        drm,drm_kms_helper,ttm,i2c-algo-bit
  intree:         Y
  vermagic:       3.11.0-15-generic SMP mod_unload modversions 
  parm:           no_wb:Disable AGP writeback for scratch registers (int)
  parm:           modeset:Disable/Enable modesetting (int)
  parm:           dynclks:Disable/Enable dynamic clocks (int)
  parm:           r4xx_atom:Enable ATOMBIOS modesetting for R4xx (int)
  parm:           vramlimit:Restrict VRAM for testing (int)
  parm:           agpmode:AGP Mode (-1 == PCI) (int)
  parm:           gartsize:Size of PCIE/IGP gart to setup in megabytes (32, 64, etc) (int)
  parm:           benchmark:Run benchmark (int)
  parm:           test:Run tests (int)
  parm:           connector_table:Force connector table (int)
  parm:           tv:TV enable (0 = disable) (int)
  parm:           audio:Audio enable (1 = enable) (int)
  parm:           disp_priority:Display Priority (0 = auto, 1 = normal, 2 = high) (int)
  parm:           hw_i2c:hw i2c engine enable (0 = disable) (int)
  parm:           pcie_gen2:PCIE Gen2 mode (-1 = auto, 0 = disable, 1 = enable) (int)
  parm:           msi:MSI support (1 = enable, 0 = disable, -1 = auto) (int)
  parm:           lockup_timeout:GPU lockup timeout in ms (defaul 10000 = 10 seconds, 0 = disable) (int)
  parm:           fastfb:Direct FB access for IGP chips (0 = disable, 1 = enable) (int)
  parm:           dpm:DPM support (1 = enable, 0 = disable, -1 = auto) (int)
  parm:           aspm:ASPM support (1 = enable, 0 = disable, -1 = auto) (int)
  
  
  $ dpkg -S /lib/modules/3.11.0-15-generic/kernel/drivers/gpu/drm/radeon/radeon.ko
  linux-image-extra-3.11.0-15-generic: /lib/modules/3.11.0-15-generic/kernel/drivers/gpu/drm/radeon/radeon.ko
  
  
  $ apt-cache policy linux-image-extra-3.11.0-15-generic
  linux-image-extra-3.11.0-15-generic:
    Installed: 3.11.0-15.25
    Candidate: 3.11.0-15.25
    Version table:
   *** 3.11.0-15.25 0
          500 http://archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
          500 http://archive.ubuntu.com/ubuntu/ saucy-security/main amd64 Packages
          100 /var/lib/dpkg/status
  </code></pre>