謎's キッチン

謎のひとりごと。Amazon欲しい物リストはこちら: https://www.amazon.co.jp/hz/wishlist/ls/CCPOV7C6JTD2

ディスプレイのオーバークロック

ついでだから、片方のディスプレイをオーバークロックしてみた。

$ cvt 1280 1024 76
# 1280x1024 75.98 Hz (CVT) hsync: 81.45 kHz; pclk: 140.75 MHz
Modeline "1280x1024_76.00"  140.75  1280 1368 1504 1728  1024 1027 1034 1072 -hsync +vsync
$ xrandr --newmode "1280x1024_76.00"  140.75  1280 1368 1504 1728  1024 1027 1034 1072 -hsync +vsync
$ xrandr --addmode HDMI-1-2 1280x1024_76.00
$ xrandr --output HDMI-1-2 --mode 1280x1024_76.00

削除は以下で。

$ xrandr --delmode HDMI-1-2 1280x1024_76.00
$ xrandr --rmmode 1280x1024_76.00

75Hz→76Hzにしかならなかったけど、しないよりはマシか。

NVIDIAとIntelでマルチディスプレイ

ハマったので書いておく。

BusIDを調べる

$ lspci | grep NVIDIA | grep -v Audio | sed -e "s/^0*\(.\+\):0*\(.\+\)\.\(.\)\ .*$/PCI:\1:\2:\3/"

xorg.confを設定

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "<BusID>"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    # Uncomment this line if your computer has no display devices connected to
    # the NVIDIA GPU.  Leave it commented if you have display devices
    # connected to the NVIDIA GPU that you would like to use.
    #Option "UseDisplayDevice" "none"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

ディスプレイIDを調べる

$ xrandr --setprovideroutputsource 1 0
$ xrandr | grep \ connected | sed -e "s/\ .*$//"

.xsessionrcを設定

xrandr --setprovideroutputsource 1 0
xrandr --auto
xrandr --output <ディスプレイID 1> --right-of <ディスプレイID 2>


補足。nvidia-settingsではIntel側のモニタをPRIME Displayとして表示しているものの、そのレンダリングNVIDIA GPU側で行っているようだ。それは良いとしても、二つのモニタの周波数が異なる場合に、セカンダリ側のアプリケーションのfpsNVIDIA側モニタの周波数に制限されてしまっているように見える (アプリケーションの問題かも?)。

GPU毎にディスプレイを立ち上げて、DISPLAY=:0.1 xfwm4&のようにすればどうかなと思ったけど、何故か上手くいかないので保留。

PR-S300SEからPR-400KIに

PR-S300SEのSPIによるパケット破棄問題に困っていたので、光回線終端装置を交換してもらった。もっと早くやっとくべきだったなぁ。
デバッグコマンド叩けなくなってしまったけれども、そもそもデバッグコマンド叩ける方がセキュリティ的に問題だから仕方ないか。

U2211Hのファクトリーモードに入る

電源OFF→一番目と二番目のボタンを押しながら電源を入れる→一番目のボタンを押すと、ファクトリーモードに入れる。


DEBUGMEGをONにすると、色々な情報が表示される。表示された表示名でググると、Realtek RTD2xxxのソースが引っかかるけど、これ使ってるのだろうか? 古くてあまり当てにならないけど、雰囲気は分かる。BANK SCALERの(一部の?)ADDR/VALUEの変更が出来るようだけど、何か良く分からん。


にしてもデジタルで使うのに不要な機能がいっぱいだなぁ。レイテンシが気になる。

簡略化 (simplify)

Octaveはsymbolicで対応しているらしい?が、Ubuntu 14.04のでは未対応みたい。Sympyは対応している。
これで楽になるかな…と思ったけど、結果を見るとうーむ。




補足すると、以下のが、

>>> t = Symbol('t')
>>> f = 0.3635819 + (0.4891775 + 0.0106411) * t * (4*t*t + 3) + 0.1365995 * (2*t*t-1);
>>> simplify(f)
1.99927439999666*t**3 + 0.273199*t**2 + 1.49945579999949*t + 0.2269824
>>> factor(f)
1.0*(1.99927439999666*t**3 + 0.273199*t**2 + 1.49945579999949*t + 0.2269824)

こうなる。そして、欲しかったのはこれ。


t*(t*(1.9992744*t + 0.273199) + 1.4994558) + 0.2269824
Wolfram|Alphaだと、候補の一つとして出してくれるようだ。
http://www.wolframalpha.com/input/?i=simplify%280.3635819+%2B+%280.4891775+%2B+0.0106411%29+*+t+*+%284*t*t+%2B+3%29+%2B+0.1365995+*+%282*t*t-1%29%29

1.99927*t**3 + 0.273199*t**2 + 1.49946*t + 0.226982
t(t(1.99927*t + 0.273199) + 1.49946) + 0.226982

フレッツ光ルーターのPR-S300SEでPPPoEの接続先を取得

必要性は不明。このPPPoEもONUでトンネリングして送られてるはず。

http://192.168.1.1/cgi-bin/debugcmd.cgi?cmd=func+pfwListShow


1 854dd000 SYS_PPP
http://192.168.1.1/cgi-bin/debugcmd.cgi?cmd=func+pfwObjGet+SYS_PPP

RET:-2058498048(0x854dd000)
http://192.168.1.1/cgi-bin/debugcmd.cgi?cmd=func+pfwStackObjGet+-2058498048+1

RET:-2058686528(0x854aefc0)
http://192.168.1.1/cgi-bin/debugcmd.cgi?cmd=func+pfwStackShow+-2058686528

Service Name =
AC Name =
AC Ethernet Addr. = xx:xx:xx:xx:xx:xx

参考元: https://bitbucket.org/frc-cpp11/windriver-headers-package-deb/src/default/h/ppp/?at=default

scope_exit文

GCC拡張のcleanup attribute使えば簡単にscope_exit文を作れそうだな、と思って作ってみた。ネスト関数のプロトタイプ関数に使うautoとか初めて使った。

#include <stdio.h>

#define scope_exit() \
auto void on_scope_exit(void *ptr);\
__attribute__((cleanup(on_scope_exit))) int __scope_exit[0];\
void on_scope_exit(void *ptr)

int foo(){
  scope_exit() {
    printf("foo exit\n");
  }
  printf("foo start\n");
}

int bar(){
  scope_exit() {
    printf("bar exit\n");
  }
  printf("bar start\n");
  foo();
}

int main(){
  foo();
  bar();
  return 0;
}