オープンソース開発と、あるフレームバッファコンソールの話~名古屋応用編~...
-
Upload
nullnilaki -
Category
Technology
-
view
213 -
download
2
Transcript of オープンソース開発と、あるフレームバッファコンソールの話~名古屋応用編~...
おやくそく
この資料は、OSC名古屋 2015で青山さんが発表されたUsing “C-bus” extension boards on LUNA-88K2 (at OSC 2015 Nagoya)に対抗して作られました。よって、事前に青山さんのスライドを一読しておくと、より楽しめる内容になっているよーな、なっていないよーな感じです…(↓青山さんのスライドはこちら!)http://www.slideshare.net/ao_kenji/osc2015-nagoya/
記事書いてみました
Permedia2なグラフィックカードを買ってみたら、pm2fbではなくgenfbしかアタッチしなかったので、色々調べて、パッチ書いて、投げて、議論して、取り込まれたというお話です。
AlphaのX?
/src/share/mk/bsd.own.mk
## Do we default to XFree86 or Xorg for this platform?#.if \ ${MACHINE} == "acorn32" || \ ${MACHINE} == "alpha" || \ ${MACHINE} == "amiga" || \ ${MACHINE} == "mac68k" || \ ${MACHINE} == "pmax" || \ ${MACHINE} == "sun3"X11FLAVOUR?= XFree86.elseX11FLAVOUR?= Xorg.endif
NetBSD/luna68Kですら、Xorgなのに...NetBSD/AlphaはXFree86…
AlphaのX?# startxauth: creating new authority file /root/.Xauthorityxauth: (argv):1: bad display name ":0" in "list" commandxauth: creating new authority file /root/.Xauthorityxauth: (stdin):1: bad display name ":0" in "add" commandxauth: creating new authority file /root/.Xauthorityxauth: (argv):1: bad display name ":0" in "list" commandxauth: creating new authority file /root/.Xauthorityxauth: (stdin):1: bad display name ":0" in "add" command unable to get frame buffer info: Inappropriate ioctl for deviceFatal server error:no screens foundX connection to :0.0 broken (explicit kill or server shutdown).xauth: creating new authority file /root/.Xauthorityxauth: (argv):1: bad display name ":0" in "remove" commandxauth: (argv):1: bad display name ":0" in "remove" command
# ls -l Xlrwxr-xr-x 1 root wheel 25 May 16 2015 X -> /usr/X11R6/bin/XdecNetBSD
Appian Graphics
/* * Copyright 2000-2001 by Sven Luther <luther (at) dpt-info.u-strasbg.fr>. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Sven Luther not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Sven Luther makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * SVEN LUTHER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL SVEN LUTHER BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * Authors: Sven Luther, <luther (at) dpt-info.u-strasbg.fr> * Alan Hourihane, <alanh (at) fairlite.demon.co.uk> *
* this work is sponsored by Appian Graphics. * * Permedia 3 accelerated options. */
/xfree/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c
XのPermedia3ドライバのスポンサー!
何故表示が崩れるのか?
/* * Some Power Mac G4 model could not initialize these registers, * Power Mac G4 (Mirrored Drive Doors), for example */
#if defined(__powerpc__)bus_space_write_4(sc->sc_memt, sc->sc_regh, PM3_LOCALMEMCAPS,
0x02e311B8);bus_space_write_4(sc->sc_memt, sc->sc_regh, PM3_LOCALMEMTIMINGS,
0x07424905);bus_space_write_4(sc->sc_memt, sc->sc_regh, PM3_LOCALMEMCONTROL,
0x0c000003);#endif
My Power Mac G4 Mirrored Drive Doors could not initialize these registers.(Display gets corrupted.)
レジスタを規定値で初期化したらうまくいきました!
64MBの罠
/* * Permedia 3 always return 64MB fbsize * 16 MB should be enough -- more just wastes map entries */if (sc->sc_fbsize != 0) sc->sc_fbsize = (16 << 20);
Permedia 3 always return 64MB frame buffer size.The minimum frame buffer size is 16MB in Permedia 3 product lines.I don't write frame buffer size check routine.I think that's enough.
グラフィックメモリの容量を聞くと、実際は16MBだったり、32MBだったりしても、常に64MBと返してくる…そこで製品ラインナップ最低の16MBを設定してみる
64MBの罠
Xではグラフィックメモリを読み書きして、実際の容量を割り出しています、が、8bppのフレームバッファコンソールでこんな複雑な処理が必要か?と思いました↓製品ラインの最低限の16MB設定しとこ!↓pm3fb0: 16 MB aperture at 0x84000000↓16MBの表示いらないんじゃ←イマココ(処理を書くのがメンドクサかった訳ではない)
xfree86/drivers/glint/pm3_dac.c
static void pm3fb_cfbX_putc(struct vc_data *conp, struct display *p, int c, int yy, int xx)
PM3_WRITE_REG(PM3AreaStippleMode, (o_x << 7) | (o_y << 12) | /* x_offset, y_offset in pattern */ (1 << 18) | /* BE */ 1 | (asx << 1) | (asy << 4) | /* address select x/y */ (1 << 20)); /* OpaqueSpan */
if (fontwidth(p) <= 8) {cdat = p->fontdata + (c & p->charmask) * fontheight(p);
} else {cdat = p->fontdata + ((c & p->charmask) * (fontheight(p) << 1));
}
PM3_WAIT(2 + fontheight(p));
for (i = 0; i < fontheight(p); i++) { /* assume fontheight <= 32 */if (fontwidth(p) <= 8) {
ldat = *cdat++;} else { /* assume fontwidth <= 16 ATM */
ldat = ((*cdat++) << 8);ldat |= *cdat++;
}PM3_WRITE_REG(AreaStipplePattern_indexed(i), ldat);
}
フォント?
linux/drivers/video/pm3fb.c
LinuxではAreaStippleModeで描画
フォント?static voidpm3fb_putchar(void *cookie, int row, int col, u_int c, long attr)
bus_space_write_4(sc->sc_memt, sc->sc_regh, PM3_RASTERIZER_MODE, mode);…
bus_space_write_4(sc->sc_memt, sc->sc_regh, PM3_SCISSORMINXY, ((y & 0x0fff) << 16) | (x & 0x0fff));
bus_space_write_4(sc->sc_memt, sc->sc_regh, PM3_SCISSORMAXXY, (((y + he) & 0x0fff) << 16) | ((x + wi) & 0x0fff));
bus_space_write_4(sc->sc_memt, sc->sc_regh, PM3_RECTANGLEPOSITION, (((y) & 0xffff)<<16) | ((x) & 0xffff));
…pm3fb_wait(sc, he);
switch (ri->ri_font->stride) {case 1: {
uint8_t *data8 = data;uint32_t reg;for (i = 0; i < he; i++) {
reg = *data8;bus_space_write_4(sc->sc_memt, sc->sc_regh, PM3_BITMASKPATTERN, reg);data8++;
}break;}
NetBSDではRASTERIZER_MODEで描画
manの書き方.Dd January 1, 2015.Dt PM3FB 4.Os.Sh NAME.Nm pm3fb.Nd 3Dlabs Permedia 3 / Oxygen VX1 / Proformance 3 framebuffer driver.Sh SYNOPSIS.Cd "pm3fb* at pci?".Cd "wsdisplay* at pm3fb?".Sh DESCRIPTIONThe.Nmdriver provides support for the 3Dlabs Permedia 3 / Oxygen VX1 / Proformance 3 series ofgraphics cards and provides an interface for machine independent.Xr wscons 4driver..PpCurrently
コピって作っていたが直感的でない…ちょっと書いてbuild.sh -releaseで確認効率が悪い
manの書き方PM3FB(4) Kernel Interfaces Manual PM3FB(4)
NAME pm3fb -- 3Dlabs Permedia 3 / Oxygen VX1 / Proformance 3 framebuffer driver
SYNOPSIS pm3fb* at pci? wsdisplay* at pm3fb?
DESCRIPTION The pm3fb driver provides support for the 3Dlabs Permedia 3 / Oxygen VX1 / Proformance 3 series of graphics cards and provides an interface for machine independent wscons(4) driver.
Currently pm3fb does not support Anti-alias font rendering and OpenLDI video interface. However, it is capable of changing the resolution and uses DDC2 to pick an appropriate video mode.
A 2D graphics engine is used to accelerate scrolling, rectangle fills and Bitmap font rendering.
SEE ALSO pci(4), wscons(4), wsdisplay(4)