ルギア君の戯言

雑多な記事。

Sand Storm

KDEのアプリを使うとよく砂嵐になる。
だが、KDEがデバイス内部まで割り込んでくることは考え難い(GLを使うエフェクトを除けば)ので、リソースの問題なのかな・・・


Windows 上ではメインメモリ内に 128MB の VRAM があるという説明があった(気がする)が、dmesg で kernel が BIOS から取得したメモリマップでは

BIOS-provided physical RAM map:
 BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
 BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
 BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
 BIOS-e820: 0000000000100000 - 000000003f7d0000 (usable)
 BIOS-e820: 000000003f7d0000 - 000000003f7e5600 (reserved)
 BIOS-e820: 000000003f7e5600 - 000000003f7f8000 (ACPI NVS)
 BIOS-e820: 000000003f7f8000 - 000000003f800000 (reserved)
 BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved)
 BIOS-e820: 00000000fed20000 - 00000000fed9b000 (reserved)
 BIOS-e820: 00000000feda0000 - 00000000fedc0000 (reserved)
 BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
 BIOS-e820: 00000000ffb00000 - 00000000ffc00000 (reserved)
 BIOS-e820: 00000000fff00000 - 0000000100000000 (reserved)

このように見当たらない。

 BIOS-e820: 0000000000100000 - 000000003f7d0000 (usable)

はメインメモリのほとんど全てを占めている。

[lugia@lugia-castle ~]$ cat a.c
#include<stdio.h>
#include <SDL/SDL.h>

#define SCREEN_WIDTH  640
#define SCREEN_HEIGHT 480
#define SCREEN_BPP    32
#define GAME_CAPTION  "SDLTutorial"

int Init();      // 初期化処理
void End();       // 終了処理
int PollEvent(); // イベント処理

SDL_Surface *gScreenSurface;

int main(int argc, char* argv[])
{
  // 初期化
  if( !Init() ){
    printf( "初期化に失敗しました" );
    return 0;
  }
  
  const struct SDL_VideoInfo *vinfo;
  vinfo=SDL_GetVideoInfo();
  
  if(vinfo != NULL)
    printf("video_mem=%d\n", vinfo->video_mem);
  else
    printf("Failed to get.\n");

  char buffer[100];
  SDL_VideoDriverName(buffer, sizeof(buffer));
  printf("driver name=%s\n", buffer);

  // メインループ
  while( 1 ){

    // イベント処理
    if( !PollEvent() )break;
  }

  // 終了処理
  End();

  return 0;
}

// 初期化処理
int Init()
{
  // SDLの初期化
  if( SDL_Init( SDL_INIT_VIDEO ) < 0 )return 0;

  // キャプションの設定
  SDL_WM_SetCaption( GAME_CAPTION, NULL );

  // ウィンドウの初期化
  gScreenSurface = SDL_SetVideoMode(
				    SCREEN_WIDTH,
				    SCREEN_HEIGHT,
				    SCREEN_BPP,
				    SDL_SWSURFACE//|SDL_FULLSCREEN
				    );

  // マウスカーソルを消す場合は
  // SDL_ShowCursor(SDL_DISABLE );
}

// 終了処理
void End()
{
  // SDLの終了
  SDL_Quit();
}

// イベント処理
int PollEvent()
{
  SDL_Event ev;
  SDLKey *key;
  while(SDL_PollEvent(&ev) )
    {
      switch(ev.type){
      case SDL_QUIT:// ウィンドウの×ボタンが押された時など
	return 0;
      case SDL_KEYDOWN:// キーボードからの入力があった時
	{
	  key=&(ev.key.keysym.sym); // どのキーが押されたかを取得
	  if(*key==27){// ESCキー
	    return 0;
	  }
	}
	break;
      }
    }
  return 1;
}

[lugia@lugia-castle ~]$ gcc -lSDL a.c
[lugia@lugia-castle ~]$ ./a.out
video_mem=0
driver name=x11
[lugia@lugia-castle ~]$

こんな風にSDLでVRAMの容量を取得してみたが0であった。*1


もし、VRAM にする容量を X が独占していれば他のアプリによる破壊は起きないから(kernelの管理がしっかりしているなら)、変えてみようかな・・・。

$ man intel

より。

       By  default,  the i810/i815 will use 8 MB of system memory for graphics
       if AGP allocable memory is < 128 MB, 16 MB if < 192  MB  or  24  MB  if
       higher. Use the VideoRam option to change the default value.

       For  the  830M and later, the driver will automatically size its memory
       allocation according to the features it will support.   Therefore,  the
       VideoRam  option,  which  in  the past had been necessary to allow more
       than some small amount of memory to be allocated, is now ignored.

というわけで、指定してみたが、

(WW) intel(0): VideoRam configuration found, which is no longer recommended.
(II) intel(0): Continuing with default 0kB VideoRam instead of 131072 kB.

拒否されたw


だが、そのあとで

(**) intel(0): Kernel mode setting active, disabling FBC.
(**) intel(0): Framebuffer compression disabled
(**) intel(0): Tiling enabled
(**) intel(0): VideoRam: 4194303 KB

ってなっているのが気になるw
4194303 kB とはほぼ 4GB であり、そんなメモリはどこにもない(はず)。
謎過ぎる・・・


なんか参考になりそうなところ: http://ult.riise.hiroshima-u.ac.jp/~nagato/?ThinkPad+X200s
(というか google:4194303 KBをGBに で出てきたw)

*1:ソースはhttp://tokyo.cool.ne.jp/sdl/index2.htmlを改変。