Linux – Steam – Half life 2

I have started to use Arch linux as my main linux distro and to be honest it is very close to gentoo linux with regards to custom building what type of setup you are wanting, but without the pain of compiling.

You do lose some of the configuration options compared to gentoo, but to be honest not enough to be spending that time compiling!.

So I am using kde, with also having steam to play some games :), but the half life 2 game kept on crashing and upon ssh’ing onto the box there was the error within dmesg of

[ 2334.498295] INFO: task hl2_linux:4442 blocked for more than 120 seconds.
[ 2334.498298]       Not tainted 4.8.13-1-ARCH #1
[ 2334.498300] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 2334.498303] hl2_linux       D ffff8807cdeeba88     0  4442      1 0x20020006
[ 2334.498308]  ffff8807cdeeba88 00ff8807cdeebb50 ffff88081af15580 ffff8807c8169c80
[ 2334.498312]  0000000000000000 ffff8807cdeec000 ffff880817c1c580 ffff880817c1c548
[ 2334.498317]  ffff880817c18000 ffff8807641ef828 ffff8807cdeebaa0 ffffffff815f40ec
[ 2334.498321] Call Trace:
[ 2334.498324]  [<ffffffff815f40ec>] schedule+0x3c/0x90
[ 2334.498359]  [<ffffffffa0144ab8>] amd_sched_entity_fini+0x68/0x100 [amdgpu]
[ 2334.498364]  [<ffffffff810c0450>] ? wake_atomic_t_function+0x60/0x60
[ 2334.498396]  [<ffffffffa010c2dd>] amdgpu_ctx_fini+0xcd/0x110 [amdgpu]
[ 2334.498427]  [<ffffffffa010cb65>] amdgpu_ctx_mgr_fini+0x65/0xa0 [amdgpu]
[ 2334.498454]  [<ffffffffa00e520e>] amdgpu_driver_postclose_kms+0x3e/0xd0 [amdgpu]
[ 2334.498465]  [<ffffffffa0004703>] drm_release+0x203/0x380 [drm]
[ 2334.498469]  [<ffffffff8120b42f>] __fput+0x9f/0x1e0
[ 2334.498472]  [<ffffffff8120b5ae>] ____fput+0xe/0x10
[ 2334.498475]  [<ffffffff8109a0d0>] task_work_run+0x80/0xa0
[ 2334.498479]  [<ffffffff810806e2>] do_exit+0x2c2/0xb50
[ 2334.498483]  [<ffffffff810b4155>] ? put_prev_entity+0x35/0x8c0
[ 2334.498487]  [<ffffffff81080feb>] do_group_exit+0x3b/0xb0
[ 2334.498490]  [<ffffffff8108be08>] get_signal+0x268/0x640
[ 2334.498494]  [<ffffffff8102d0f7>] do_signal+0x37/0x6b0
[ 2334.498498]  [<ffffffff815f7241>] ? do_nanosleep+0x91/0xf0
[ 2334.498501]  [<ffffffff810ecdb0>] ? hrtimer_init+0x120/0x120
[ 2334.498504]  [<ffffffff815f720a>] ? do_nanosleep+0x5a/0xf0
[ 2334.498508]  [<ffffffff81003651>] exit_to_usermode_loop+0xa1/0xc0
[ 2334.498511]  [<ffffffff81003df7>] do_fast_syscall_32+0x157/0x170
[ 2334.498515]  [<ffffffff815f987b>] entry_SYSCALL_compat+0x3b/0x40

of which was to do with the AMDGPU-PRO graphics driver.

So with some digging around you are able to alter the video settings within half life 2, so if you goto “options->Video” the below will be shown

Then click on “advanced”, which will show

If you turn “Multicore Rendering” to disabled and also “Wait for vertical sync” to Enabled, this should stop half life 2 from crashing.

Happy gaming.!!!.

php 7 – generator – yield’s

php 7 has now implement generators where you are able to return (yield) results from a method and only the ones that you will need.

// define the output as type Generator -- e.g. yield results.. the compiler will still work without this Generator keyword
function yieldSomeNumbers() : Generator {  
    yield 10;
    yield 13;
}
 
foreach (yieldSomeNumbers() as $v) {
    var_dump($v);
}

Will output

10
13

The ‘Generator’ at the end of the method ” : Generator” is not actual needed as the compiler will append it as such on the fly since the method is yield results.

For example, lets say that you are doing a search of numbers from 1-100 and are searching for the value of 10, so before generators the code would have been something like

function generateNumbers() {
    return range(1,100);   // load up a array of values 1-100 e.g. 1,2,3,4,5...
}
 
foreach (generateNumbers() as $v){
    var_dump($v);
    if ($v == 10) {
        var_dump("FOUND");
        break;
    }
}

The ‘foreach (generateNumbers()’ will be using the full array where as

function generateSomeNumbers() : Generator {
    foreach (range(1,100) as $v) {
        yield $v;
    }
}
 
foreach (generateSomeNumbers() as $v){
    var_dump($v);
    if ($v == 10) {
        var_dump("FOUND");
        break;
    }
}

will only return each yield upon request.