miniglxtest runs to completion and exits with radeon driver,

but produces no graphical output.
This commit is contained in:
Keith Whitwell 2002-12-20 15:07:56 +00:00
parent d20f1768a6
commit 094eed79c2
5 changed files with 57 additions and 71 deletions

View file

@ -82,14 +82,7 @@ typedef struct {
RADEONChipFamily ChipFamily;
unsigned long LinearAddr; /* Frame buffer physical address */
unsigned long MMIOAddr; /* MMIO region physical address */
unsigned long BIOSAddr; /* BIOS physical address */
unsigned char *MMIO; /* Map of MMIO region */
unsigned char *FB; /* Map of frame buffer */
drmHandle fbHandle;
drmSize registerSize;
drmHandle registerHandle;

View file

@ -47,7 +47,7 @@ static int RADEONMinBits(int val)
*/
static int RADEONDRIAgpInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info)
{
unsigned char *RADEONMMIO = info->MMIO;
unsigned char *RADEONMMIO = dpy->MMIOAddress;
unsigned long mode;
unsigned int vendor, device;
int ret;
@ -253,7 +253,8 @@ static int RADEONDRIKernelInit(struct MiniGLXDisplayRec *dpy,
ret = drmCommandWrite(dpy->drmFD, DRM_RADEON_CP_INIT, &drmInfo,
sizeof(drmRadeonInit));
return ret < 0;
fprintf(stderr, "DRM_RADEON_CP_INIT: %d\n", ret);
return ret >= 0;
}
static void RADEONDRIAgpHeapInit(struct MiniGLXDisplayRec *dpy,
@ -334,7 +335,7 @@ static void RADEONDRIIrqInit(struct MiniGLXDisplayRec *dpy,
"[drm] falling back to irq-free operation\n");
info->irq = 0;
} else {
unsigned char *RADEONMMIO = info->MMIO;
unsigned char *RADEONMMIO = dpy->MMIOAddress;
info->gen_int_cntl = INREG( RADEON_GEN_INT_CNTL );
}
}
@ -463,6 +464,9 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
return 0;
}
dpy->SAREASize = DRM_PAGE_SIZE;
if (drmAddMap( dpy->drmFD,
0,
dpy->SAREASize,
@ -491,6 +495,37 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
dpy->hSAREA, dpy->pSAREA);
/* Need to AddMap the framebuffer and mmio regions here:
*/
if (drmAddMap( dpy->drmFD,
(drmHandle)dpy->FixedInfo.smem_start,
dpy->FixedInfo.smem_len,
DRM_FRAME_BUFFER,
0,
&dpy->hFrameBuffer) < 0)
{
drmUnmap(dpy->pSAREA, dpy->SAREASize);
drmClose(dpy->drmFD);
fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
return 0;
}
fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
dpy->hFrameBuffer);
info->registerSize = dpy->FixedInfo.mmio_len;
if (drmAddMap(dpy->drmFD,
dpy->FixedInfo.mmio_start,
dpy->FixedInfo.mmio_len,
DRM_REGISTERS,
DRM_READ_ONLY,
&info->registerHandle) < 0) {
fprintf(stderr, "[drm] drmAddMap mmio failed\n");
return 0;
}
fprintf(stderr,
"[drm] register handle = 0x%08lx\n", info->registerHandle);
/* Check the radeon DRM version */
version = drmGetVersion(dpy->drmFD);
@ -635,11 +670,13 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
*/
if (!DRIFinishScreenInit( dpy )) {
/* RADEONDRICloseScreen(info); */
fprintf(stderr, "DRIFinishScreenInit failed\n");
return 0;
}
/* Initialize the kernel data structures */
if (!RADEONDRIKernelInit(dpy, info)) {
fprintf(stderr, "RADEONDRIKernelInit failed\n");
DRM_UNLOCK(dpy->drmFD, dpy->pSAREA, dpy->serverContext);
/* RADEONDRICloseScreen(info); */
return 0;
@ -647,6 +684,7 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
/* Initialize the vertex buffers list */
if (!RADEONDRIBufInit(dpy, info)) {
fprintf(stderr, "RADEONDRIBufInit failed\n");
DRM_UNLOCK(dpy->drmFD, dpy->pSAREA, dpy->serverContext);
/* RADEONDRICloseScreen(info); */
return 0;
@ -654,12 +692,15 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
/* Initialize IRQ */
RADEONDRIIrqInit(dpy, info);
fprintf(stderr, "RADEONDRIIrqInit finished\n");
/* Initialize kernel agp memory manager */
RADEONDRIAgpHeapInit(dpy, info);
fprintf(stderr, "RADEONDRIAgpHeapInit finished\n");
/* Initialize and start the CP if required */
RADEONDRICPInit( dpy, info );
fprintf(stderr, "RADEONDRICPInit finished\n");
/* Initialize the SAREA private data structure */
{
@ -670,6 +711,7 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
/* Can release the lock now */
DRM_UNLOCK(dpy->drmFD, dpy->pSAREA, dpy->serverContext);
fprintf(stderr, "DRM_UNLOCK finished\n");
/* This is the struct passed to radeon_dri.so for its initialization */
@ -692,8 +734,8 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
pRADEONDRI->textureOffset = info->textureOffset;
pRADEONDRI->textureSize = info->textureSize;
pRADEONDRI->log2TexGran = info->log2TexGran;
pRADEONDRI->registerHandle = info->registerHandle;
pRADEONDRI->registerSize = info->registerSize;
pRADEONDRI->registerHandle = info->registerHandle; /* uninit */
pRADEONDRI->registerSize = info->registerSize; /* */
pRADEONDRI->statusHandle = info->ringReadPtrHandle;
pRADEONDRI->statusSize = info->ringReadMapSize;
pRADEONDRI->agpTexHandle = info->agpTexHandle;
@ -702,6 +744,7 @@ static int RADEONScreenInit( struct MiniGLXDisplayRec *dpy, RADEONInfoPtr info )
pRADEONDRI->agpTexOffset = info->agpTexStart;
pRADEONDRI->sarea_priv_offset = sizeof(XF86DRISAREARec);
fprintf(stderr, "%s succeeded\n", __FUNCTION__);
return 1;
}

View file

@ -270,7 +270,7 @@ static void *driCreateDrawable(Display *dpy, int scrn,
pdp->draw = draw;
pdp->refcount = 0;
pdp->pStamp = NULL;
pdp->pStamp = &pdp->lastStamp;
pdp->lastStamp = 0;
pdp->index = 0;
pdp->x = 0;
@ -372,7 +372,7 @@ static void *driCreateContext(Display *dpy, XVisualInfo *vis,
free(pcp);
return NULL;
}
printf(">>> drmCreateContext worked: 0x%x\n", (int) pcp->hHWContext);
fprintf(stderr, ">>> drmCreateContext worked: 0x%x\n", (int) pcp->hHWContext);
}
@ -396,6 +396,7 @@ static void *driCreateContext(Display *dpy, XVisualInfo *vis,
pctx->bindContext = driBindContext;
pctx->unbindContext = driUnbindContext;
fprintf(stderr, "%s: succeeded\n", __FUNCTION__);
return pcp;
}
@ -499,19 +500,7 @@ __driUtilCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
psp->fbWidth = dpy->VarInfo.xres;
psp->fbHeight = dpy->VarInfo.yres;
psp->fbBPP = dpy->VarInfo.bits_per_pixel;
/*
* Map the SAREA region. Further mmap regions may be setup in
* each DRI driver's "createScreen" function.
*/
if (drmMap(psp->fd, hSAREA, SAREA_MAX, (drmAddressPtr)&psp->pSAREA)) {
fprintf(stderr, "libGL error: drmMap of sarea failed\n");
free(psp->pDevPriv);
(void)drmClose(psp->fd);
free(psp);
return NULL;
}
psp->pSAREA = dpy->pSAREA;
/* Initialize the screen specific GLX driver */
if (psp->DriverAPI.InitDriver) {

View file

@ -1,4 +1,4 @@
/* $Id: miniglx.c,v 1.1.4.18 2002/12/20 01:28:15 jrfonseca Exp $ */
/* $Id: miniglx.c,v 1.1.4.19 2002/12/20 15:07:58 keithw Exp $ */
/*
* Mesa 3-D graphics library
@ -732,6 +732,7 @@ XCreateWindow( Display *dpy, Window parent, int x, int y,
/* Perform the initialization normally done in the X server */
if (!dpy->driverInitFBDev( dpy )) {
fprintf(stderr, "%s: __driInitFBDev failed\n", __FUNCTION__);
RestoreFBDev(dpy);
FREE(win);
return NULL;
@ -750,6 +751,7 @@ XCreateWindow( Display *dpy, Window parent, int x, int y,
dpy->numConfigs,
dpy->configs);
if (!dpy->driScreen.private) {
fprintf(stderr, "%s: __driCreateScreen failed\n", __FUNCTION__);
RestoreFBDev(dpy);
FREE(win);
return NULL;
@ -760,6 +762,7 @@ XCreateWindow( Display *dpy, Window parent, int x, int y,
win->driDrawable.private = dpy->driScreen.createDrawable(dpy, 0, win,
visual->visInfo->visualid, &(win->driDrawable));
if (!win->driDrawable.private) {
fprintf(stderr, "%s: dri.createDrawable failed\n", __FUNCTION__);
RestoreFBDev(dpy);
FREE(win);
return NULL;

View file

@ -1,45 +1,3 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
*/
/* $XFree86: xc/lib/GL/glx/glxclient.h,v 1.14 2002/02/22 21:32:53 dawes Exp $ */
/*
* Direct rendering support added by Precision Insight, Inc.
*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
*
*/
#ifndef _mini_GLX_client_h_
#define _mini_GLX_client_h_
@ -251,7 +209,6 @@ struct MiniGLXDisplayRec {
int NumWindows;
Window TheWindow; /* only allow one window for now */
/* int bpp; */
int cpp;
int numConfigs;
@ -280,6 +237,7 @@ struct MiniGLXDisplayRec {
*/
int drmFD;
unsigned long hSAREA;
unsigned long hFrameBuffer;
unsigned int serverContext; /* temporary drm context -- make an auto var? */
int SAREASize;
void *pSAREA;