summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/common
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2008-02-25 23:37:23 -0500
committerKristian Høgsberg <[email protected]>2008-02-29 15:05:39 -0500
commit16242a8007f41ab63f9a28bb9a750857c8cdb8af (patch)
treeef4dc590c76a1bb22bc99eae6da5910d9a20d1fb /src/mesa/drivers/dri/common
parent5197a31b8e64a047d058c4cb174efb9c8b816652 (diff)
Reduce the versioning madness required to create a DRI2 screen.
Right now the DRI2 screen constructor takes 3 different versions: DRI, DDX and DRM. This is mostly useless, though: DRI: The DRI driver doesn't actually care about the DRI protocol, it only talks to the loader, which in turn speaks DRI protocol. Thus, the DRI protocol version is of not interest to the DRI driver, but it needs to know what functionality the loader provides. At this point that's reflected in the __DRIinterfaceMethods struct and the internal_version integer. DDX: The DDX version number is essentially used to track extensions to the SAREA. With DRI2 the SAREA consists of a number of versioned, self-describing blocks, so the DDX version is no longer interesting. DRM: We have the fd, lets just ask the kernel ourselves.
Diffstat (limited to 'src/mesa/drivers/dri/common')
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 8e9f9167cae..b429a824abd 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -872,18 +872,15 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc,
PUBLIC void *
__DRI2_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- int fd,
- unsigned int sarea_handle,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes)
+ int fd, unsigned int sarea_handle,
+ const __DRIinterfaceMethods *interface,
+ __GLcontextModes **driver_modes)
{
__DRIscreenPrivate *psp;
static const __DRIextension *emptyExtensionList[] = { NULL };
dri_interface = interface;
unsigned int *p;
+ drmVersionPtr version;
__GLcontextModes *(*initScreen)(__DRIscreenPrivate *psc);
initScreen = dlsym(NULL, "__dri2DriverInitScreen");
@@ -896,9 +893,14 @@ __DRI2_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc,
psp->psc = psc;
- psp->drm_version = *drm_version;
- psp->ddx_version = *ddx_version;
- psp->dri_version = *dri_version;
+ version = drmGetVersion(fd);
+ if (version) {
+ psp->drm_version.major = version->version_major;
+ psp->drm_version.minor = version->version_minor;
+ psp->drm_version.patch = version->version_patchlevel;
+ drmFreeVersion(version);
+ }
+
psp->extensions = emptyExtensionList;
psp->fd = fd;
psp->myNum = scrn;