mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-02 15:20:26 +01:00
Move dri initialization into XCreateWindow
This commit is contained in:
parent
3e13551969
commit
3e06eed70a
3 changed files with 46 additions and 25 deletions
|
|
@ -215,7 +215,7 @@ static int RADEONDRIAgpInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info)
|
|||
static int RADEONDRIKernelInit(struct MiniGLXDisplayRec *dpy,
|
||||
RADEONInfoPtr info)
|
||||
{
|
||||
int cpp = dpy->bpp / 8;
|
||||
int cpp = dpy->VarInfo.bits_per_pixel / 8;
|
||||
drmRadeonInit drmInfo;
|
||||
int ret;
|
||||
|
||||
|
|
@ -235,8 +235,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->bpp;
|
||||
drmInfo.depth_bpp = dpy->bpp;
|
||||
drmInfo.fb_bpp = dpy->VarInfo.bits_per_pixel;
|
||||
drmInfo.depth_bpp = dpy->VarInfo.bits_per_pixel;
|
||||
drmInfo.front_offset = info->frontOffset;
|
||||
drmInfo.front_pitch = info->frontPitch * cpp;
|
||||
drmInfo.back_offset = info->backOffset;
|
||||
|
|
@ -373,7 +373,7 @@ static int RADEONSetPitch (struct MiniGLXDisplayRec *dpy)
|
|||
int dummy = dpy->VarInfo.xres_virtual;
|
||||
|
||||
/* FIXME: May need to validate line pitch here */
|
||||
switch (dpy->bpp / 8) {
|
||||
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:
|
||||
|
|
@ -431,9 +431,10 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
|
|||
if (maxy <= dpy->VarInfo.yres_virtual * 3) {
|
||||
fprintf(stderr,
|
||||
"Static buffer allocation failed -- "
|
||||
"need at least %d kB video memory\n",
|
||||
"need at least %d kB video memory (have %d kB)\n",
|
||||
(dpy->VarInfo.xres_virtual * dpy->VarInfo.yres_virtual *
|
||||
dpy->cpp * 3 + 1023) / 1024);
|
||||
dpy->cpp * 3 + 1023) / 1024,
|
||||
dpy->FrameBufferSize / 1024);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -678,8 +679,8 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
|
|||
pRADEONDRI->deviceID = info->Chipset;
|
||||
pRADEONDRI->width = dpy->VarInfo.xres_virtual;
|
||||
pRADEONDRI->height = dpy->VarInfo.yres_virtual;
|
||||
pRADEONDRI->depth = dpy->bpp; /* XXX: was depth */
|
||||
pRADEONDRI->bpp = dpy->bpp;
|
||||
pRADEONDRI->depth = dpy->VarInfo.bits_per_pixel; /* XXX: was depth */
|
||||
pRADEONDRI->bpp = dpy->VarInfo.bits_per_pixel;
|
||||
pRADEONDRI->IsPCI = 0;
|
||||
pRADEONDRI->AGPMode = info->agpMode;
|
||||
pRADEONDRI->frontOffset = info->frontOffset;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: miniglx.c,v 1.1.4.16 2002/12/19 10:16:19 keithw Exp $ */
|
||||
/* $Id: miniglx.c,v 1.1.4.17 2002/12/19 13:48:27 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
|
|
@ -341,6 +341,8 @@ SetupFBDev( Display *dpy, Window win )
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
dpy->cpp = dpy->VarInfo.bits_per_pixel / 8;
|
||||
|
||||
if (0)
|
||||
{
|
||||
int x, y;
|
||||
|
|
@ -505,7 +507,7 @@ int __read_config_file( Display *dpy )
|
|||
{
|
||||
dpy->fbdevDevice = "/dev/fb0";
|
||||
dpy->clientDriverName = "radeon_dri.so";
|
||||
dpy->drmModuleName = "radeon.o";
|
||||
dpy->drmModuleName = "radeon";
|
||||
dpy->pciBus = 1;
|
||||
dpy->pciDevice = 0;
|
||||
dpy->pciFunc = 0;
|
||||
|
|
@ -567,7 +569,6 @@ XOpenDisplay( const char *display_name )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
dpy->createScreen = (CreateScreenFunc) dlsym(dpy->dlHandle,
|
||||
"__driCreateScreen");
|
||||
if (!dpy->createScreen) {
|
||||
|
|
@ -578,15 +579,6 @@ XOpenDisplay( const char *display_name )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* this effectively initializes the DRI driver - just an idea */
|
||||
dpy->driScreen.private = (*dpy->createScreen)(dpy, 0, &(dpy->driScreen),
|
||||
dpy->numConfigs,
|
||||
dpy->configs);
|
||||
if (!dpy->driScreen.private) {
|
||||
FREE(dpy);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return dpy;
|
||||
}
|
||||
|
||||
|
|
@ -637,7 +629,9 @@ XCreateWindow( Display *dpy, Window parent, int x, int y,
|
|||
win->h = height;
|
||||
win->visual = visual; /* ptr assignment */
|
||||
|
||||
/* do fbdev setup */
|
||||
/* do fbdev setup
|
||||
* TODO: Let the driver influence the choice of window pitch.
|
||||
*/
|
||||
if (!SetupFBDev(dpy, win)) {
|
||||
FREE(win);
|
||||
return NULL;
|
||||
|
|
@ -664,6 +658,34 @@ XCreateWindow( Display *dpy, Window parent, int x, int y,
|
|||
win->curBottom = win->frontBottom;
|
||||
}
|
||||
|
||||
|
||||
/* Perform the initialization normally done in the X server */
|
||||
if (!dpy->driverInitFBDev( dpy )) {
|
||||
RestoreFBDev(dpy);
|
||||
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.
|
||||
*/
|
||||
dpy->driScreen.private = (*dpy->createScreen)(dpy, 0, &(dpy->driScreen),
|
||||
dpy->numConfigs,
|
||||
dpy->configs);
|
||||
if (!dpy->driScreen.private) {
|
||||
RestoreFBDev(dpy);
|
||||
FREE(win);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
win->driDrawable.private = dpy->driScreen.createDrawable(dpy, 0, win,
|
||||
visual->visInfo->visualid, &(win->driDrawable));
|
||||
if (!win->driDrawable.private) {
|
||||
|
|
|
|||
|
|
@ -251,10 +251,8 @@ struct MiniGLXDisplayRec {
|
|||
int NumWindows;
|
||||
Window TheWindow; /* only allow one window for now */
|
||||
|
||||
int width;
|
||||
int height;
|
||||
int bpp;
|
||||
int cpp;
|
||||
/* int bpp; */
|
||||
int cpp;
|
||||
|
||||
int numConfigs;
|
||||
__GLXvisualConfig *configs;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue