Overlord I & II on radeonsi (hd 7970 gallium-nine vs “native” port)

 

Kerbal Space Program on radeonsi (hd 7970 native)

Perspective on radeonsi (hd 7970 wine dx11)

Gears on Gallium 2016.07.25

Released an updated Gears on Gallium iso image:
openSUSE – Leap 42.1
Mesa-git – 12.1_git2016.07.25 + (vendor and gl render override patch)
Kernel – 4.7
libdrm – 2.4.99_git2016.07.22
Mesa-demos – 9.1.0_git2016.04.05
wine – 1.9.15-gallium-nine+staging (use WINEARCH=win32 winecfg) + (id Software games patch)
xorg-server – 1.18.99 with threaded input
xf86-video-ati – 7.99.99_2016.07.22
xf86-video-amdgpu – 1.1.99_2016.07.22
xf86-video-intel – 2.9.99_2016.07.22
xf86-video-nouveau – 1.1.99_2016.07.22
KDE – 5.24.0 (5.6.90git) + plasma5 wayland session
LLVM – 4.0svn
Phoronix Test Suite – 6.4
Steam – 1.0.0.48
LXDE – 0.8.0

Users root and gog has empty password.
The image is the hybrid iso, can be written as the CD and as USB flash drive (use dd for writing).
Download 927 mb
md5 673e741e4feb53b415819b084059353c
sha256 f2e2cefb0b620dfd9d4f8d69d9f6c8b7747f0512ed0348a34f42420943f81293

How to use wine on livecd:
It’s better make /home/gog/.wine as symlink to external hdd\usb (ram disk is only 700 mb) or add ramdisk_size=1024000 (1gb) to kernel parameters to increase ramdisk size.

For VAAPI and VDPAU use
VDPAU_DRIVER=radeonsi | r600 | nouveau
LIBVA_DRIVER_NAME=radeonsi | r600 | nouveau | i965

Mesa vendor and gl renderer override

HMESA_VENDOR_OVERRIDE=”AMD inc.” HMESA_RENDERER_OVERRIDE=”Radeon HD 7970″ glxinfo|grep OpenGL
OpenGL vendor string: AMD inc.
OpenGL renderer string: Radeon HD 7970
OpenGL core profile version string: 4.3 (Core Profile) Mesa 12.1.0-devel (git-0420666 pontostroy:X11)
OpenGL core profile shading language version string: 4.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

How to run Rage and other newest id Software games on Mesa

Newest d Software games like Rage or Wolfenstein: The New Order does not work on mesa ( FATAL ERROR: wglCreateContextAttribsARB failed,  missed compatibility profile context GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB).
So for run this games we need

  1. Disable WGL_CONTEXT_PROFILE_MASK_ARB attribute(patch for wine).
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 932b217..0b218bc 100644                                                                                                                                
--- a/dlls/opengl32/wgl.c                                                                                                                                    
+++ b/dlls/opengl32/wgl.c                                                                                                                                    
@@ -261,6 +261,31 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)                                                                                        
     return ret;                                                                                                                                             
 }                                                                                                                                                           
 
+static
+const int* remove_profile_mask(const int *attribs)
+{
+    int* ret = NULL;
+    int i = 0;
+    int j = 0;
+    int attr_num = 0;
+    int profile_mask = 0;
+    for (i = 0; attribs[i] != NULL; i += 2) {
+        if (attribs[i] == WGL_CONTEXT_PROFILE_MASK_ARB)
+            profile_mask = 1;
+        ++attr_num;
+    }
+    if (profile_mask == 0) return attribs;
+    ret = calloc(attr_num*2 - 1, sizeof(int));
+    for (i = 0; attribs[i] != NULL; i += 2) {
+        if (attribs[i] != WGL_CONTEXT_PROFILE_MASK_ARB) {
+            ret[j] = attribs[i];
+            ret[j+1] = attribs[i+1];
+            j += 2;
+        }
+    }
+    return ret;
+}
+
 /***********************************************************************
  *             wglCreateContextAttribsARB
  *
@@ -274,6 +299,8 @@ HGLRC WINAPI wglCreateContextAttribsARB( HDC hdc, HGLRC share, const int *attrib
     struct opengl_context *context;
     struct opengl_funcs *funcs = get_dc_funcs( hdc );
 
+    attribs = remove_profile_mask(attribs);
+
     if (!funcs || !funcs->ext.p_wglCreateContextAttribsARB) return 0;
     if (share && !(share_ptr = get_handle_ptr( share, HANDLE_CONTEXT ))) return 0;
     if ((drv_ctx = funcs->ext.p_wglCreateContextAttribsARB( hdc,

2. Run game and dump shader

MESA_SHADER_READ_PATH=/shader/read/  MESA_SHADER_DUMP_PATH=/shader/dump/  MESA_GL_VERSION_OVERRIDE=4.3COMPAT wine ./Rage.exe

3. Fix the vertex shader and copy shaders to /shader/read

cd /shader/dump/
sed -i 's/out vec4 gl_Position;//g' VS* && cp /shader/dump/* /shader/read/

4. Repeat step 2 and 3 until game does not start

5. Or just use my shaders dump (download and unpack)

MESA_SHADER_READ_PATH=/path/to/read/dir/   MESA_GL_VERSION_OVERRIDE=4.3COMPAT wine ./Rage.exe

Use 64 bit wine and mesa

How to run Divinity Original Sin Enhanced Edition on Mesa (r600\radeonsi)

Fix from Stil on linux.org.ru

For r600 and old Mesa you will need

export MESA_GL_VERSION_OVERRIDE=4.2 
export MESA_GLSL_VERSION_OVERRIDE=420

for all cards you need

export allow_glsl_extension_directive_midshader=true

or in drirc

 <application name="Divinity Original Sin Enhanced Edition" executable="EoCApp">
            <option name="allow_glsl_extension_directive_midshader" value="true" />
        </application>

In game directory create dir workaround
In workaround dir create file dos_ee_workaround.c (glXGetProcAddressARB and vendor string workaround)

#define _GNU_SOURCE
#include <GL/gl.h>
#include <string.h>
#include <dlfcn.h>

const char* vendor = "ATI Technologies Inc.";
const GLubyte* (*o_glGetString)(GLenum name);
void (*(*o_glXGetProcAddressARB)(const GLubyte*)) (void);
 
void _init(void)
{
    o_glGetString = dlsym(RTLD_NEXT, "glGetString");
    o_glXGetProcAddressARB = dlsym(RTLD_NEXT, "glXGetProcAddressARB");
}

const GLubyte* glGetString(GLenum name)
{
    if (name == GL_VENDOR)
        return (const GLubyte*) vendor;
    return o_glGetString(name);
}

void (*glXGetProcAddressARB(const GLubyte* procName)) (void)
{
    if (strcmp((const char*)procName, "glNamedStringARB") == 0 ||
        strcmp((const char*)procName, "glDeleteNamedStringARB") == 0 ||
        strcmp((const char*)procName, "glCompileShaderIncludeARB") == 0 ||
        strcmp((const char*)procName, "glIsNamedStringARB") == 0 ||
        strcmp((const char*)procName, "glGetNamedStringARB") == 0 ||
        strcmp((const char*)procName, "glGetNamedStringivARB") == 0)
        return NULL;
    return o_glXGetProcAddressARB(procName);
}

compile file

gcc -Wall -fPIC -DPIC -c dos_ee_workaround.c
ld -shared -o dos_ee_workaround.so dos_ee_workaround.o -ldl -lGL

Create new shell script newrun.sh

#!/bin/bash

GAME_DIR="/path/to/DivinityOriginalSinEnhancedEdition"
export allow_glsl_extension_directive_midshader=true
#MESA_SHADER_READ_PATH="${GAME_DIR}/workaround/read" \
#MESA_SHADER_DUMP_PATH="${GAME_DIR}/workaround/dump" \
LD_PRELOAD="${GAME_DIR}/workaround/dos_ee_workaround.so" \
LD_LIBRARY_PATH="${GAME_DIR}/game" \
${GAME_DIR}/game/EoCApp

Run newrun.sh and enjoy the game.


 

Fix for shaders if something wrong.

Uncomment in newrun.sh

MESA_SHADER_READ_PATH 
MESA_SHADER_DUMP_PATH

run newrun.sh(dump_shader to dir) and after segfault or graphics artifacts
create fix_shader.py in workaroud dir

#!/usr/bin/env python3

import sys
import os
import re

def fix_shaders(src_dir, dst_dir, ATI_PADDINGBUG=None):
    ati_re = re.compile(r'^\s*#define\sATI_PADDINGBUG')
    if ATI_PADDINGBUG != None:
        ati_str = '#define ATI_PADDINGBUG {:d}'.format(ATI_PADDINGBUG)
    ext_re = re.compile(r'^\s*#extension GL_ARB_gpu_shader5\s+:\s+enable')
    ext_str = '#extension GL_ARB_gpu_shader5 : enable\n'

    for filename in os.listdir(src_dir):
        src_file = '{:s}/{:s}'.format(src_dir, filename)
        with open(src_file, 'r') as f:
            src = f.readlines()
        dst = []
        for line in src:
            if ATI_PADDINGBUG != None and ati_re.match(line):
                dst.append(ati_str)
                continue
            if ext_re.match(line):
                dst.insert(2, ext_str)
                continue
            dst.append(line)
        dst_file = '{:s}/{:s}'.format(dst_dir, filename)
        with open(dst_file, 'w') as f:
            f.writelines(dst)

if __name__ == '__main__':
    if len(sys.argv) < 3:
        print('usage: ', file=sys.stderr)
        print('{:s} src_dir dst_dir [ATI_PADDINGBUG]'.format(sys.argv[0]),
              file=sys.stderr)
        exit(1)
    ATI_PADDINGBUG = None
    if len(sys.argv) > 3:
        ATI_PADDINGBUG = int(sys.argv[3])
    fix_shaders(sys.argv[1], sys.argv[2], ATI_PADDINGBUG)

run fix_shader.py

GAME_DIR="/path/to/DivinityOriginalSinEnhancedEdition"

${GAME_DIR}/workaround/fix-shaders.py "${GAME_DIR}/workaround/dump" "${GAME_DIR}/workaround/read" 0

run newrun.sh (comment only MESA_SHADER_DUMP_PATH for best berformance)

Fix for segmentation fault in libcrypto (steam-beta)

To fix this bug on openSUSE mesa must be compiled with libnettle

--with-sha1=libnettle

For openSUSE mesa-git+libnettle
http://download.opensuse.org/repositories/home:/pontostroy:/X11/

Max Payne 3 on radeonsi (hd 7970 gallium-nine)

Armello gallium-nine vs native vs windows 8.1

Gallium-nine

nine

Native

native

windows 8.1

2016-07-01 18_23_08-Armello

Packages for AMD Polaris on openSUSE

Mesa, llvm, libdrm – git
http://download.opensuse.org/repositories/home:/pontostroy:/X11/

Kernel 4.7-rcX
http://download.opensuse.org/repositories/home:/pontostroy:/drm-next/

Special kernel for polaris (only openSUSE 42.1)
http://www.gearsongallium.com/download/kernel/kernel-vanilla-4.7.rc2-0.x86_64.rpm

amd_05