summaryrefslogtreecommitdiff
path: root/exa
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@seketeli.org>2007-07-16 17:37:21 +0200
committerDodji Seketeli <dodji@openedhand.com>2007-10-02 16:45:01 +0200
commit95fadbd4022ec99f42ba78ec8a18a064903e8a7f (patch)
tree434b4bdcd0227108f8b48a70e30d31944241df39 /exa
parente5e6514ffa0fd132e0cc1b15b94119e6e8755f43 (diff)
Add basic Exa driver entry point validation.
In exaDriverInit(), quickly check if the programmer forgot to set some mandadory driver hooks, in that case display a meaningful error message.
Diffstat (limited to 'exa')
-rw-r--r--exa/exa.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/exa/exa.c b/exa/exa.c
index 3e8054da9..fc1f419bc 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -722,6 +722,48 @@ exaDriverAlloc(void)
return xcalloc(1, sizeof(ExaDriverRec));
}
+static Bool
+exaDriverValidateEntryPoints (ExaDriverPtr pExaDriver)
+{
+ Bool res=TRUE ;
+
+ if (!pExaDriver)
+ return FALSE ;
+
+ if (!pExaDriver->memoryBase) {
+ LogMessage(X_ERROR,
+ "Exa: Exa::memoryBase member "
+ "must be assigned to a value different from zero\n") ;
+ res = FALSE ;
+ }
+ if (!pExaDriver->memorySize) {
+ LogMessage(X_ERROR,
+ "Exa: Exa::memorySize member must be different from zero\n") ;
+ res = FALSE ;
+ }
+ if (pExaDriver->offScreenBase > pExaDriver->memorySize) {
+ LogMessage(X_ERROR,
+ "Exa: Exa::ffscreenBase must be <= pExaDriver->memorySize member\n") ;
+ res = FALSE ;
+ }
+ if (!pExaDriver->PrepareSolid) {
+ LogMessage(X_ERROR,
+ "Exa: Exa::PrepareSolid member is required to be non NULL\n") ;
+ res = FALSE ;
+ }
+ if (!pExaDriver->PrepareCopy) {
+ LogMessage(X_ERROR,
+ "Exa: Exa::PrepareCopy member is required to be non NULL\n") ;
+ res = FALSE ;
+ }
+ if (!pExaDriver->WaitMarker) {
+ LogMessage(X_ERROR,
+ "Exa: Exa::WaitWarker member is required to be non NULL\n") ;
+ res = FALSE ;
+ }
+ return res ;
+}
+
/**
* @param pScreen screen being initialized
* @param pScreenInfo EXA driver record
@@ -806,6 +848,12 @@ exaDriverInit (ScreenPtr pScreen,
{
pScreenInfo->maxPitchPixels = pScreenInfo->maxX;
}
+ if (!exaDriverValidateEntryPoints(pScreenInfo))
+ {
+ LogMessage(X_ERROR, "Exa(%d): EXA driver entry points validation failed\n",
+ pScreen->myNum) ;
+ return FALSE ;
+ }
#ifdef RENDER
ps = GetPictureScreenIfSet(pScreen);