toge's diary

コンピュータ関連の趣味をつらつらと。

Fusionの正体とその意味

id:ranha:20060523#1148374391

ranhaさんが暗礁に乗り上げてしまったみたいなので調べてみました。

ranhaさんが書いている通りDirectFBにはFusionという仕組みがあります。
このFusionという仕組みを使うことでDirectFBはぐっとくる仕組を提供しています。

その割にこの機能についての記述は圧倒的に少ないです。ドキュメントやWebを漁ると・・・

FusionSound supports multiple applications using Fusion IPC. It provides streams, static sound buffers and control over any number of concurrent playbacks. Sample data is always stored in shared memory, starting a playback simply adds an entry to the playlist of the mixer thread in the master application.

という記述があります。なんとな〜く何をやっているのか想像つきますね?
どうやらFusionはプロセス間通信を効率的に行う仕組みのようです。

で肝心のREADMEを見てみると・・・

DirectFB applications communicate through a layer we called Fusion. This layer was previously implemented completely in user space using semaphores and message queues. But since 0.9.15 the Fusion Kernel Device is required which implements critical parts of Fusion and thus lead to better performance and decent stability.

なるほど、ちょっと前(0.9.14)まではUser Spaceのライブラリだったのね、それが0.9.15からパフォーマンスを重視して、Kernel Deviceになったと。
続いて読み進めると、

To install this kernel module (only available for Linux yet), check out the linux-fusion module from our CVS repository or use the patch provided by this release (in the patches directory).

もうお分かりですね、FusionはKernel Moduleとして別に提供されているパッケージです。で、DirectFBのページにいくと・・・ありましたlinx-fusion-3.0.tar.gz。
これを展開するとlinux-fusion-3.0/linux/include/linux/fusion.hがあって、この中にranhaさんの求めていたFusionEnterがあります。めでたしめでたし。

/*
 * Entering a world
 */
typedef struct {
     struct {
          int            major;         /* Must be set to FUSION_API_MAJOR before entering. */
          int            minor;         /* Must be set to FUSION_API_MINOR before entering. */
     } api;

     FusionID            fusion_id;     /* Returns the fusion id of the entering process. */
} FusionEnter;

ちなみにFedora Core 5のextraに入っているDirectFBはfusion抜きでコンパイルされてますな。やっぱり面倒だが自前で全部コンパイルした方が良さそうだ。