mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-02 02:20:25 +01:00
use a fixed resolution defined in a config file
This commit is contained in:
parent
1e1e71e3a7
commit
deb5fe3b68
6 changed files with 219 additions and 180 deletions
|
|
@ -289,7 +289,8 @@ radeonCreateContext( const __GLcontextModes *glVisual,
|
|||
shareCtx = ((radeonContextPtr) sharedContextPrivate)->glCtx;
|
||||
else
|
||||
shareCtx = NULL;
|
||||
rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, (void *) rmesa, GL_TRUE);
|
||||
rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, (void *) rmesa,
|
||||
GL_TRUE);
|
||||
if (!rmesa->glCtx) {
|
||||
FREE(rmesa);
|
||||
return GL_FALSE;
|
||||
|
|
@ -435,42 +436,6 @@ radeonCreateContext( const __GLcontextModes *glVisual,
|
|||
rmesa->do_usleeps = !getenv("RADEON_NO_USLEEPS");
|
||||
|
||||
#if DO_DEBUG
|
||||
if (getenv("RADEON_DEBUG_FALLBACKS"))
|
||||
RADEON_DEBUG |= DEBUG_FALLBACKS;
|
||||
|
||||
if (getenv("RADEON_DEBUG_TEXTURE"))
|
||||
RADEON_DEBUG |= DEBUG_TEXTURE;
|
||||
|
||||
if (getenv("RADEON_DEBUG_IOCTL"))
|
||||
RADEON_DEBUG |= DEBUG_IOCTL;
|
||||
|
||||
if (getenv("RADEON_DEBUG_PRIMS"))
|
||||
RADEON_DEBUG |= DEBUG_PRIMS;
|
||||
|
||||
if (getenv("RADEON_DEBUG_VERTS"))
|
||||
RADEON_DEBUG |= DEBUG_VERTS;
|
||||
|
||||
if (getenv("RADEON_DEBUG_STATE"))
|
||||
RADEON_DEBUG |= DEBUG_STATE;
|
||||
|
||||
if (getenv("RADEON_DEBUG_CODEGEN"))
|
||||
RADEON_DEBUG |= DEBUG_CODEGEN;
|
||||
|
||||
if (getenv("RADEON_DEBUG_VTXFMT"))
|
||||
RADEON_DEBUG |= DEBUG_VFMT;
|
||||
|
||||
if (getenv("RADEON_DEBUG_VERBOSE"))
|
||||
RADEON_DEBUG |= DEBUG_VERBOSE;
|
||||
|
||||
if (getenv("RADEON_DEBUG_DRI"))
|
||||
RADEON_DEBUG |= DEBUG_DRI;
|
||||
|
||||
if (getenv("RADEON_DEBUG_DMA"))
|
||||
RADEON_DEBUG |= DEBUG_DMA;
|
||||
|
||||
if (getenv("RADEON_DEBUG_SANITY"))
|
||||
RADEON_DEBUG |= DEBUG_SANITY;
|
||||
|
||||
if (getenv("RADEON_DEBUG"))
|
||||
{
|
||||
const char *debug = getenv("RADEON_DEBUG");
|
||||
|
|
@ -510,8 +475,6 @@ radeonCreateContext( const __GLcontextModes *glVisual,
|
|||
if (strstr(debug, "san"))
|
||||
RADEON_DEBUG |= DEBUG_SANITY;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
if (getenv("RADEON_NO_RAST")) {
|
||||
|
|
|
|||
|
|
@ -427,6 +427,15 @@ static int radeonFlushCmdBufLocked( radeonContextPtr rmesa,
|
|||
cmd.boxes = (drmClipRect *)rmesa->pClipRects;
|
||||
}
|
||||
|
||||
if (0) {
|
||||
int i;
|
||||
for (i = 0 ; i < cmd.nbox ; i++)
|
||||
fprintf(stderr, "Emit box %d/%d %d,%d %d,%d\n",
|
||||
i, cmd.nbox,
|
||||
cmd.boxes[i].x1, cmd.boxes[i].y1,
|
||||
cmd.boxes[i].x2, cmd.boxes[i].y2);
|
||||
}
|
||||
|
||||
ret = drmCommandWrite( rmesa->dri.fd,
|
||||
DRM_RADEON_CMDBUF,
|
||||
&cmd, sizeof(cmd) );
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ static int RADEONEngineRestore( struct MiniGLXDisplayRec *dpy,
|
|||
OUTREG(RADEON_RB3D_CNTL, 0);
|
||||
RADEONEngineReset( dpy );
|
||||
|
||||
switch (dpy->VarInfo.bits_per_pixel) {
|
||||
switch (dpy->bpp) {
|
||||
case 16: datatype = 4; break;
|
||||
case 32: datatype = 6; break;
|
||||
default: return 0;
|
||||
|
|
@ -150,14 +150,14 @@ static int RADEONEngineRestore( struct MiniGLXDisplayRec *dpy,
|
|||
((datatype << RADEON_GMC_DST_DATATYPE_SHIFT)
|
||||
| RADEON_GMC_CLR_CMP_CNTL_DIS);
|
||||
|
||||
pitch64 = ((dpy->VarInfo.xres_virtual * (dpy->VarInfo.bits_per_pixel / 8) + 0x3f)) >> 6;
|
||||
pitch64 = ((dpy->virtualWidth * (dpy->bpp / 8) + 0x3f)) >> 6;
|
||||
|
||||
RADEONWaitForFifo(dpy, 1);
|
||||
OUTREG(RADEON_DEFAULT_OFFSET, ((INREG(RADEON_DEFAULT_OFFSET) & 0xC0000000)
|
||||
| (pitch64 << 22)));
|
||||
|
||||
/* RADEONWaitForFifo(dpy, 1); */
|
||||
/* OUTREG(RADEON_SURFACE_CNTL, info->ModeReg.surface_cntl); */
|
||||
RADEONWaitForFifo(dpy, 1);
|
||||
OUTREG(RADEON_SURFACE_CNTL, RADEON_SURF_TRANSLATION_DIS);
|
||||
|
||||
RADEONWaitForFifo(dpy, 1);
|
||||
OUTREG(RADEON_DEFAULT_SC_BOTTOM_RIGHT, (RADEON_DEFAULT_SC_RIGHT_MAX
|
||||
|
|
@ -179,7 +179,7 @@ static int RADEONEngineRestore( struct MiniGLXDisplayRec *dpy,
|
|||
OUTREG(RADEON_AUX_SC_CNTL, 0);
|
||||
|
||||
/* RADEONWaitForIdleMMIO(dpy); */
|
||||
/* sleep(2); */
|
||||
usleep(100);
|
||||
}
|
||||
|
||||
/* Compute log base 2 of val */
|
||||
|
|
@ -323,7 +323,7 @@ static int RADEONDRIAgpInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info)
|
|||
static int RADEONDRIKernelInit(struct MiniGLXDisplayRec *dpy,
|
||||
RADEONInfoPtr info)
|
||||
{
|
||||
int cpp = dpy->VarInfo.bits_per_pixel / 8;
|
||||
int cpp = dpy->bpp / 8;
|
||||
drmRadeonInit drmInfo;
|
||||
int ret;
|
||||
|
||||
|
|
@ -343,8 +343,8 @@ static int RADEONDRIKernelInit(struct MiniGLXDisplayRec *dpy,
|
|||
drmInfo.agp_size = info->agpSize*1024*1024;
|
||||
drmInfo.ring_size = info->ringSize*1024*1024;
|
||||
drmInfo.usec_timeout = 1000;
|
||||
drmInfo.fb_bpp = dpy->VarInfo.bits_per_pixel;
|
||||
drmInfo.depth_bpp = dpy->VarInfo.bits_per_pixel;
|
||||
drmInfo.fb_bpp = dpy->bpp;
|
||||
drmInfo.depth_bpp = dpy->bpp;
|
||||
drmInfo.front_offset = info->frontOffset;
|
||||
drmInfo.front_pitch = info->frontPitch * cpp;
|
||||
drmInfo.back_offset = info->backOffset;
|
||||
|
|
@ -443,16 +443,18 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
|
|||
drmVersionPtr version;
|
||||
int err;
|
||||
|
||||
usleep(100);
|
||||
|
||||
{
|
||||
int width_bytes = (dpy->VarInfo.xres_virtual * dpy->cpp);
|
||||
int width_bytes = (dpy->virtualWidth * dpy->cpp);
|
||||
int maxy = dpy->FrameBufferSize / width_bytes;
|
||||
|
||||
|
||||
if (maxy <= dpy->VarInfo.yres_virtual * 3) {
|
||||
if (maxy <= dpy->virtualHeight * 3) {
|
||||
fprintf(stderr,
|
||||
"Static buffer allocation failed -- "
|
||||
"need at least %d kB video memory (have %d kB)\n",
|
||||
(dpy->VarInfo.xres_virtual * dpy->VarInfo.yres_virtual *
|
||||
(dpy->virtualWidth * dpy->virtualHeight *
|
||||
dpy->cpp * 3 + 1023) / 1024,
|
||||
dpy->FrameBufferSize / 1024);
|
||||
return 0;
|
||||
|
|
@ -582,19 +584,19 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
|
|||
|
||||
/* Memory manager setup */
|
||||
{
|
||||
int width_bytes = dpy->VarInfo.xres_virtual * dpy->cpp;
|
||||
int width_bytes = dpy->virtualWidth * dpy->cpp;
|
||||
int cpp = dpy->cpp;
|
||||
int bufferSize = ((dpy->VarInfo.yres_virtual * width_bytes
|
||||
int bufferSize = ((dpy->virtualHeight * width_bytes
|
||||
+ RADEON_BUFFER_ALIGN)
|
||||
& ~RADEON_BUFFER_ALIGN);
|
||||
int depthSize = ((((dpy->VarInfo.yres_virtual+15) & ~15) * width_bytes
|
||||
int depthSize = ((((dpy->virtualHeight+15) & ~15) * width_bytes
|
||||
+ RADEON_BUFFER_ALIGN)
|
||||
& ~RADEON_BUFFER_ALIGN);
|
||||
int l;
|
||||
int scanlines;
|
||||
|
||||
info->frontOffset = 0;
|
||||
info->frontPitch = dpy->VarInfo.xres_virtual;
|
||||
info->frontPitch = dpy->virtualWidth;
|
||||
|
||||
fprintf(stderr,
|
||||
"Using %d MB AGP aperture\n", info->agpSize);
|
||||
|
|
@ -641,12 +643,12 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
|
|||
info->depthOffset = ((info->textureOffset - depthSize +
|
||||
RADEON_BUFFER_ALIGN) &
|
||||
~RADEON_BUFFER_ALIGN);
|
||||
info->depthPitch = dpy->VarInfo.xres_virtual;
|
||||
info->depthPitch = dpy->virtualWidth;
|
||||
|
||||
info->backOffset = ((info->depthOffset - bufferSize +
|
||||
RADEON_BUFFER_ALIGN) &
|
||||
~RADEON_BUFFER_ALIGN);
|
||||
info->backPitch = dpy->VarInfo.xres_virtual;
|
||||
info->backPitch = dpy->virtualWidth;
|
||||
|
||||
|
||||
fprintf(stderr,
|
||||
|
|
@ -725,10 +727,10 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
|
|||
dpy->driverClientMsgSize = sizeof(RADEONDRIRec);
|
||||
pRADEONDRI = (RADEONDRIPtr)dpy->driverClientMsg;
|
||||
pRADEONDRI->deviceID = info->Chipset;
|
||||
pRADEONDRI->width = dpy->VarInfo.xres_virtual;
|
||||
pRADEONDRI->height = dpy->VarInfo.yres_virtual;
|
||||
pRADEONDRI->depth = dpy->VarInfo.bits_per_pixel; /* XXX: depth */
|
||||
pRADEONDRI->bpp = dpy->VarInfo.bits_per_pixel;
|
||||
pRADEONDRI->width = dpy->virtualWidth;
|
||||
pRADEONDRI->height = dpy->virtualHeight;
|
||||
pRADEONDRI->depth = dpy->bpp; /* XXX: depth */
|
||||
pRADEONDRI->bpp = dpy->bpp;
|
||||
pRADEONDRI->IsPCI = 0;
|
||||
pRADEONDRI->AGPMode = info->agpMode;
|
||||
pRADEONDRI->frontOffset = info->frontOffset;
|
||||
|
|
@ -851,21 +853,14 @@ static int __driInitScreenConfigs(int *numConfigs, __GLXvisualConfig **configs)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Will fbdev set a pitch appropriate for 3d?
|
||||
*/
|
||||
static int __driValidateMode( struct MiniGLXDisplayRec *dpy )
|
||||
{
|
||||
int dummy = dpy->VarInfo.xres_virtual;
|
||||
|
||||
switch (dpy->VarInfo.bits_per_pixel / 8) {
|
||||
case 1: dummy = (dpy->VarInfo.xres_virtual + 127) & ~127; break;
|
||||
case 2: dummy = (dpy->VarInfo.xres_virtual + 31) & ~31; break;
|
||||
case 3:
|
||||
case 4: dummy = (dpy->VarInfo.xres_virtual + 15) & ~15; break;
|
||||
}
|
||||
|
||||
dpy->VarInfo.xres_virtual = dummy;
|
||||
return 1;
|
||||
/* Work around radeonfb.o bug: virtual resolution must equal real
|
||||
* resolution.
|
||||
*/
|
||||
dpy->VarInfo.xres = dpy->VarInfo.xres_virtual;
|
||||
dpy->VarInfo.yres = dpy->VarInfo.yres_virtual;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -874,6 +869,19 @@ static int __driInitFBDev( struct MiniGLXDisplayRec *dpy )
|
|||
{
|
||||
RADEONInfoPtr info = calloc(1, sizeof(*info));
|
||||
|
||||
{
|
||||
int dummy = dpy->virtualWidth;
|
||||
|
||||
switch (dpy->bpp / 8) {
|
||||
case 1: dummy = (dpy->virtualWidth + 127) & ~127; break;
|
||||
case 2: dummy = (dpy->virtualWidth + 31) & ~31; break;
|
||||
case 3:
|
||||
case 4: dummy = (dpy->virtualWidth + 15) & ~15; break;
|
||||
}
|
||||
|
||||
dpy->virtualWidth = dummy;
|
||||
}
|
||||
|
||||
dpy->driverInfo = (void *)info;
|
||||
|
||||
info->agpFastWrite = RADEON_DEFAULT_AGP_FAST_WRITE;
|
||||
|
|
@ -886,7 +894,7 @@ static int __driInitFBDev( struct MiniGLXDisplayRec *dpy )
|
|||
info->Chipset = dpy->chipset;
|
||||
get_chipfamily_from_chipset( info );
|
||||
|
||||
info->frontPitch = dpy->VarInfo.xres_virtual;
|
||||
info->frontPitch = dpy->virtualWidth;
|
||||
info->LinearAddr = dpy->FixedInfo.smem_start & 0xfc000000;
|
||||
|
||||
|
||||
|
|
@ -898,14 +906,16 @@ static int __driInitFBDev( struct MiniGLXDisplayRec *dpy )
|
|||
* the clear ioctl to do this, but would need to setup hw state
|
||||
* first.
|
||||
*/
|
||||
if (0) {
|
||||
memset(dpy->FrameBuffer + info->frontOffset,
|
||||
0,
|
||||
info->frontPitch * dpy->cpp * dpy->VarInfo.yres_virtual );
|
||||
info->frontPitch * dpy->cpp * dpy->virtualHeight );
|
||||
|
||||
memset(dpy->FrameBuffer + info->backOffset,
|
||||
0,
|
||||
info->backPitch * dpy->cpp * dpy->VarInfo.yres_virtual );
|
||||
|
||||
info->backPitch * dpy->cpp * dpy->virtualHeight );
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,10 +88,27 @@ It may be necessary to link directly against the minGLX libGL.so.
|
|||
|
||||
5) Reduced number of Xlib and GLX entrypoints.
|
||||
|
||||
Many, many Xlib and GLX entrypoints, structures and macros are not
|
||||
present in MiniGLX. It will be necessary to find and eliminate all
|
||||
references to non-supported entrypoints.
|
||||
By definition (MiniGLX is a subset of GLX), many Xlib and GLX
|
||||
entrypoints, structures and macros are not present in MiniGLX. It
|
||||
will be necessary to find and eliminate all references to
|
||||
non-supported entrypoints.
|
||||
|
||||
6) Must create context *after* window.
|
||||
|
||||
This is odd, and should probably be regarded as a bug in miniglx.
|
||||
---------------------------------------------------------------
|
||||
|
||||
Bugs in radeonfb.o -- the radeon framebuffer driver.
|
||||
----------------------------------------------------
|
||||
|
||||
Several bugs have been found in the radeonfb.o framebuffer driver.
|
||||
|
||||
1) Occasionally, after entering graphics mode, colors appear 'shifted'
|
||||
or 'translated', particularly in higher resolution modes. This is
|
||||
definitely a bug in radeonfb.o as this can be provoked even when using
|
||||
the software dri driver (fb_dri.so). Importance: High. Workaround:
|
||||
None, except restarting the application.
|
||||
|
||||
2) Modes with virtual resolutions different to displayed resolutions
|
||||
do not work. Importance: medium. Workaround: Avoid these situations
|
||||
by always setting the visible resolution to the virtual resolution
|
||||
specified in the configuration file.
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: miniglx.c,v 1.1.4.32 2003/01/14 16:52:47 keithw Exp $ */
|
||||
/* $Id: miniglx.c,v 1.1.4.33 2003/01/16 23:39:30 keithw Exp $ */
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -251,6 +251,43 @@ OpenFBDev( Display *dpy )
|
|||
/* make copy */
|
||||
dpy->VarInfo = dpy->OrigVarInfo; /* structure copy */
|
||||
|
||||
/* Get the fixed screen info */
|
||||
if (ioctl(dpy->FrameBufferFD, FBIOGET_FSCREENINFO, &dpy->FixedInfo)) {
|
||||
fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n",
|
||||
strerror(errno));
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* mmap the framebuffer into our address space */
|
||||
dpy->FrameBufferSize = dpy->FixedInfo.smem_len;
|
||||
dpy->FrameBuffer = (caddr_t) mmap(0, /* start */
|
||||
dpy->FrameBufferSize, /* bytes */
|
||||
PROT_READ | PROT_WRITE, /* prot */
|
||||
MAP_SHARED, /* flags */
|
||||
dpy->FrameBufferFD, /* fd */
|
||||
0 /* offset */);
|
||||
if (dpy->FrameBuffer == (caddr_t) - 1) {
|
||||
fprintf(stderr, "error: unable to mmap framebuffer: %s\n",
|
||||
strerror(errno));
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* mmap the MMIO region into our address space */
|
||||
dpy->MMIOSize = dpy->FixedInfo.mmio_len;
|
||||
dpy->MMIOAddress = (caddr_t) mmap(0, /* start */
|
||||
dpy->MMIOSize, /* bytes */
|
||||
PROT_READ | PROT_WRITE, /* prot */
|
||||
MAP_SHARED, /* flags */
|
||||
dpy->FrameBufferFD, /* fd */
|
||||
dpy->FixedInfo.smem_len /* offset */);
|
||||
if (dpy->MMIOAddress == (caddr_t) - 1) {
|
||||
fprintf(stderr, "error: unable to mmap mmio region: %s\n",
|
||||
strerror(errno));
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -271,21 +308,30 @@ SetupFBDev( Display *dpy, Window win )
|
|||
/* Bump size up to next supported mode.
|
||||
*/
|
||||
if (width <= 800 && height <= 600) {
|
||||
width = 800; height = 600;
|
||||
width = 800; height = 600;
|
||||
}
|
||||
else if (width <= 1024 && height <= 768) {
|
||||
width = 1024; height = 768;
|
||||
}
|
||||
else if (width <= 1280 && height <= 1024) {
|
||||
width = 1280; height = 1024;
|
||||
}
|
||||
else if (width <= 1024 && height <= 768) {
|
||||
width = 1024; height = 768;
|
||||
}
|
||||
else if (width <= 1280 && height <= 1024) {
|
||||
width = 1280; height = 1024;
|
||||
}
|
||||
|
||||
|
||||
if (width > dpy->virtualWidth ||
|
||||
height > dpy->virtualHeight ||
|
||||
win->visual->visInfo->bits_per_rgb != dpy->bpp) {
|
||||
fprintf(stderr,
|
||||
"width/height/bpp (%d/%d/%d) exceed display limits (%d/%d/%d)\n",
|
||||
width, height, win->visual->visInfo->bits_per_rgb,
|
||||
dpy->virtualWidth, dpy->virtualHeight, dpy->bpp);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* set the depth, resolution, etc */
|
||||
dpy->VarInfo = dpy->OrigVarInfo;
|
||||
dpy->VarInfo.bits_per_pixel = win->visual->visInfo->bits_per_rgb;
|
||||
dpy->VarInfo.xres_virtual = width;
|
||||
dpy->VarInfo.yres_virtual = height;
|
||||
dpy->VarInfo.bits_per_pixel = dpy->bpp;
|
||||
dpy->VarInfo.xres_virtual = dpy->virtualWidth;
|
||||
dpy->VarInfo.yres_virtual = dpy->virtualHeight;
|
||||
dpy->VarInfo.xres = width;
|
||||
dpy->VarInfo.yres = height;
|
||||
dpy->VarInfo.xoffset = 0;
|
||||
|
|
@ -327,7 +373,8 @@ SetupFBDev( Display *dpy, Window win )
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (width == 1280 && height == 1024) {
|
||||
if (dpy->VarInfo.xres == 1280 &&
|
||||
dpy->VarInfo.yres == 1024) {
|
||||
/* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */
|
||||
dpy->VarInfo.pixclock = 7408;
|
||||
dpy->VarInfo.left_margin = 248;
|
||||
|
|
@ -337,7 +384,8 @@ SetupFBDev( Display *dpy, Window win )
|
|||
dpy->VarInfo.hsync_len = 144;
|
||||
dpy->VarInfo.vsync_len = 3;
|
||||
}
|
||||
else if (width == 1024 && height == 768) {
|
||||
else if (dpy->VarInfo.xres == 1024 &&
|
||||
dpy->VarInfo.yres == 768) {
|
||||
/* timing values taken from /etc/fb.modes (1024x768 @ 75Hz) */
|
||||
dpy->VarInfo.pixclock = 12699;
|
||||
dpy->VarInfo.left_margin = 176;
|
||||
|
|
@ -347,7 +395,8 @@ SetupFBDev( Display *dpy, Window win )
|
|||
dpy->VarInfo.hsync_len = 96;
|
||||
dpy->VarInfo.vsync_len = 3;
|
||||
}
|
||||
else if (width == 800 && height == 600) {
|
||||
else if (dpy->VarInfo.xres == 800 &&
|
||||
dpy->VarInfo.yres == 600) {
|
||||
/* timing values taken from /etc/fb.modes (800x600 @ 75Hz) */
|
||||
dpy->VarInfo.pixclock = 20203;
|
||||
dpy->VarInfo.left_margin = 160;
|
||||
|
|
@ -360,13 +409,14 @@ SetupFBDev( Display *dpy, Window win )
|
|||
else {
|
||||
/* XXX need timings for other screen sizes */
|
||||
fprintf(stderr, "XXXX screen size %d x %d not supported at this time!\n",
|
||||
width, height);
|
||||
dpy->VarInfo.xres, dpy->VarInfo.yres);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* set variable screen info */
|
||||
if (ioctl(dpy->FrameBufferFD, FBIOPUT_VSCREENINFO, &dpy->VarInfo)) {
|
||||
fprintf(stderr, "Unable to set screen to depth %d\n", dpy->DesiredDepth);
|
||||
fprintf(stderr, "error: ioctl(FBIOPUT_VSCREENINFO) failed: %s\n",
|
||||
strerror(errno));
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -403,38 +453,6 @@ SetupFBDev( Display *dpy, Window win )
|
|||
}
|
||||
}
|
||||
|
||||
/* mmap the framebuffer into our address space */
|
||||
dpy->FrameBufferSize = dpy->FixedInfo.smem_len;
|
||||
dpy->FrameBuffer = (caddr_t) mmap(0, /* start */
|
||||
dpy->FrameBufferSize, /* bytes */
|
||||
PROT_READ | PROT_WRITE, /* prot */
|
||||
MAP_SHARED, /* flags */
|
||||
dpy->FrameBufferFD, /* fd */
|
||||
0 /* offset */);
|
||||
if (dpy->FrameBuffer == (caddr_t) - 1) {
|
||||
fprintf(stderr, "error: unable to mmap framebuffer: %s\n",
|
||||
strerror(errno));
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
dpy->cpp = dpy->VarInfo.bits_per_pixel / 8;
|
||||
|
||||
/* mmap the MMIO region into our address space */
|
||||
dpy->MMIOSize = dpy->FixedInfo.mmio_len;
|
||||
dpy->MMIOAddress = (caddr_t) mmap(0, /* start */
|
||||
dpy->MMIOSize, /* bytes */
|
||||
PROT_READ | PROT_WRITE, /* prot */
|
||||
MAP_SHARED, /* flags */
|
||||
dpy->FrameBufferFD, /* fd */
|
||||
dpy->FixedInfo.smem_len /* offset */);
|
||||
if (dpy->MMIOAddress == (caddr_t) - 1) {
|
||||
fprintf(stderr, "error: unable to mmap mmio region: %s\n",
|
||||
strerror(errno));
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* TODO: Tell kernel not to use accelerated functions -- see fbdevhw.c */
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -456,9 +474,6 @@ RestoreFBDev( Display *dpy )
|
|||
}
|
||||
dpy->VarInfo = dpy->OrigVarInfo;
|
||||
|
||||
munmap(dpy->FrameBuffer, dpy->FrameBufferSize);
|
||||
munmap(dpy->MMIOAddress, dpy->MMIOSize);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -473,6 +488,9 @@ CloseFBDev( Display *dpy )
|
|||
{
|
||||
struct vt_mode VT;
|
||||
|
||||
munmap(dpy->FrameBuffer, dpy->FrameBufferSize);
|
||||
munmap(dpy->MMIOAddress, dpy->MMIOSize);
|
||||
|
||||
/* restore text mode */
|
||||
ioctl(dpy->ConsoleFD, KDSETMODE, KD_TEXT);
|
||||
|
||||
|
|
@ -531,8 +549,6 @@ _glthread_GetID(void)
|
|||
* \return non-zeros on success, zero otherwise.
|
||||
*
|
||||
* \internal
|
||||
*
|
||||
* \todo Replace with a config file read at runtime, eventually...
|
||||
*/
|
||||
int __read_config_file( Display *dpy )
|
||||
{
|
||||
|
|
@ -549,6 +565,10 @@ int __read_config_file( Display *dpy )
|
|||
dpy->pciFunc = 0;
|
||||
dpy->chipset = 0;
|
||||
dpy->pciBusID = 0;
|
||||
dpy->virtualWidth = 1280;
|
||||
dpy->virtualHeight = 1024;
|
||||
dpy->bpp = 32;
|
||||
dpy->cpp = 4;
|
||||
|
||||
fname = getenv("MINIGLX_CONF");
|
||||
if (!fname) fname = "/etc/miniglx.conf";
|
||||
|
|
@ -596,7 +616,24 @@ int __read_config_file( Display *dpy )
|
|||
}
|
||||
else if (strcmp(opt, "chipset") == 0) {
|
||||
if (sscanf(val, "0x%x", &dpy->chipset) != 1)
|
||||
fprintf(stderr, "malformed chipset: %x\n", dpy->chipset);
|
||||
fprintf(stderr, "malformed chipset: %s\n", opt);
|
||||
}
|
||||
else if (strcmp(opt, "virtualWidth") == 0) {
|
||||
if (sscanf(val, "%d", &dpy->virtualWidth) != 1)
|
||||
fprintf(stderr, "malformed virtualWidth: %s\n", opt);
|
||||
}
|
||||
else if (strcmp(opt, "virtualHeight") == 0) {
|
||||
if (sscanf(val, "%d", &dpy->virtualHeight) != 1)
|
||||
fprintf(stderr, "malformed virutalHeight: %s\n", opt);
|
||||
}
|
||||
else if (strcmp(opt, "bpp") == 0) {
|
||||
if (sscanf(val, "%d", &dpy->bpp) != 1)
|
||||
fprintf(stderr, "malformed bpp: %s\n", opt);
|
||||
if (dpy->bpp != 32) {
|
||||
fprintf(stderr, "Only 32bpp modes currently supported\n");
|
||||
dpy->bpp = 32;
|
||||
}
|
||||
dpy->cpp = dpy->bpp / 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -689,6 +726,36 @@ XOpenDisplay( const char *display_name )
|
|||
dpy->driver->initScreenConfigs( &dpy->numConfigs, &dpy->configs );
|
||||
|
||||
|
||||
/* Perform the initialization normally done in the X server */
|
||||
if (!dpy->driver->initFBDev( dpy )) {
|
||||
fprintf(stderr, "%s: __driInitFBDev failed\n", __FUNCTION__);
|
||||
dlclose(dpy->dlHandle);
|
||||
FREE(dpy);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Perform the client-side initialization. Have to do this here as
|
||||
* it depends on the display resolution chosen, which in this
|
||||
* window system depends on the size of the "window" created.
|
||||
*
|
||||
* Clearly there is a limit of one on the number of windows in
|
||||
* existence at any time.
|
||||
*
|
||||
* Need to shut down drm and free dri data in XDestroyWindow, too.
|
||||
*/
|
||||
dpy->driScreen.private = (*dpy->createScreen)(dpy, 0,
|
||||
&(dpy->driScreen),
|
||||
dpy->numConfigs,
|
||||
dpy->configs);
|
||||
if (!dpy->driScreen.private) {
|
||||
fprintf(stderr, "%s: __driCreateScreen failed\n", __FUNCTION__);
|
||||
dlclose(dpy->dlHandle);
|
||||
FREE(dpy);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Setup some callbacks in the screen private.
|
||||
*/
|
||||
__driUtilInitScreen( dpy, 0, &(dpy->driScreen) );
|
||||
|
|
@ -721,6 +788,17 @@ XCloseDisplay( Display *display )
|
|||
if (display->NumWindows)
|
||||
XDestroyWindow( display, display->TheWindow );
|
||||
|
||||
/* As this is done in CreateWindow, need to undo it here:
|
||||
*/
|
||||
if (display->driScreen.private)
|
||||
(*display->driScreen.destroyScreen)(display, 0,
|
||||
display->driScreen.private);
|
||||
|
||||
/* As this is done in CreateWindow, need to undo it here:
|
||||
*/
|
||||
(*display->driver->haltFBDev)( display );
|
||||
|
||||
|
||||
dlclose(display->dlHandle);
|
||||
CloseFBDev(display);
|
||||
FREE(display);
|
||||
|
|
@ -812,7 +890,7 @@ XCreateWindow( Display *display, Window parent, int x, int y,
|
|||
}
|
||||
|
||||
|
||||
win->bytesPerPixel = display->VarInfo.bits_per_pixel / 8;
|
||||
win->bytesPerPixel = display->bpp / 8;
|
||||
win->rowStride = width * win->bytesPerPixel;
|
||||
win->size = win->rowStride * height * win->bytesPerPixel; /* XXX stride? */
|
||||
win->frontStart = display->FrameBuffer;
|
||||
|
|
@ -833,35 +911,6 @@ XCreateWindow( Display *display, Window parent, int x, int y,
|
|||
}
|
||||
|
||||
|
||||
/* Perform the initialization normally done in the X server */
|
||||
if (!display->driver->initFBDev( display )) {
|
||||
fprintf(stderr, "%s: __driInitFBDev failed\n", __FUNCTION__);
|
||||
RestoreFBDev(display);
|
||||
FREE(win);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Perform the client-side initialization. Have to do this here as
|
||||
* it depends on the display resolution chosen, which in this
|
||||
* window system depends on the size of the "window" created.
|
||||
*
|
||||
* Clearly there is a limit of one on the number of windows in
|
||||
* existence at any time.
|
||||
*
|
||||
* Need to shut down drm and free dri data in XDestroyWindow, too.
|
||||
*/
|
||||
display->driScreen.private = (*display->createScreen)(display, 0,
|
||||
&(display->driScreen),
|
||||
display->numConfigs,
|
||||
display->configs);
|
||||
if (!display->driScreen.private) {
|
||||
fprintf(stderr, "%s: __driCreateScreen failed\n", __FUNCTION__);
|
||||
RestoreFBDev(display);
|
||||
FREE(win);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
win->driDrawable.private = display->driScreen.createDrawable(display, 0, win,
|
||||
visual->visInfo->visualid, &(win->driDrawable));
|
||||
|
|
@ -910,16 +959,6 @@ XDestroyWindow( Display *display, Window w )
|
|||
if (w->driDrawable.private)
|
||||
(*w->driDrawable.destroyDrawable)(display, w->driDrawable.private);
|
||||
|
||||
/* As this is done in CreateWindow, need to undo it here:
|
||||
*/
|
||||
if (display->driScreen.private)
|
||||
(*display->driScreen.destroyScreen)(display, 0,
|
||||
display->driScreen.private);
|
||||
|
||||
/* As this is done in CreateWindow, need to undo it here:
|
||||
*/
|
||||
(*display->driver->haltFBDev)( display );
|
||||
|
||||
/* put framebuffer back to initial state */
|
||||
RestoreFBDev(display);
|
||||
|
||||
|
|
|
|||
|
|
@ -264,7 +264,6 @@ struct MiniGLXDisplayRec {
|
|||
struct fb_fix_screeninfo FixedInfo;
|
||||
struct fb_var_screeninfo OrigVarInfo, VarInfo;
|
||||
struct sigaction OrigSigUsr1;
|
||||
int DesiredDepth;
|
||||
int OriginalVT;
|
||||
int ConsoleFD;
|
||||
int FrameBufferFD;
|
||||
|
|
@ -275,8 +274,6 @@ struct MiniGLXDisplayRec {
|
|||
int NumWindows;
|
||||
Window TheWindow; /**< only allow one window for now */
|
||||
|
||||
int cpp;
|
||||
|
||||
/**
|
||||
* \name Visual configurations
|
||||
*/
|
||||
|
|
@ -319,6 +316,10 @@ struct MiniGLXDisplayRec {
|
|||
int pciDevice;
|
||||
int pciFunc;
|
||||
int chipset;
|
||||
int virtualWidth;
|
||||
int virtualHeight;
|
||||
int bpp;
|
||||
int cpp;
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue