summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2014-08-03 22:08:52 +0100
committerRussell King <rmk@arm.linux.org.uk>2014-08-14 01:11:23 +0100
commita180e2401ab92b62c7f70e27b1805b7289b81459 (patch)
tree51a19e2da66767d46e14861b5d49ec3c5b910c73
parenta178eccdb514ad641b2a48e6020b7afa7a78416c (diff)
downloadxf86-video-armada-a180e2401ab92b62c7f70e27b1805b7289b81459.tar.gz
src: avoid passing the Armada buffer manager for non-Armada hardware
Avoid passing the Armada buffer manager into the acceleration backend when we are not using the Armada-DRM kernel driver. The Armada buffer manager relies on some private IOCTLs which are not implemented by other driveres. Signed-off-by: Russell King <rmk@arm.linux.org.uk>
-rw-r--r--src/armada_drm.c31
-rw-r--r--src/armada_drm.h1
-rw-r--r--src/vivante.c4
3 files changed, 26 insertions, 10 deletions
diff --git a/src/armada_drm.c b/src/armada_drm.c
index 49d4e4b..8914835 100644
--- a/src/armada_drm.c
+++ b/src/armada_drm.c
@@ -389,10 +389,21 @@ static Bool armada_drm_ScreenInit(SCREEN_INIT_ARGS_DECL)
arm->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = armada_drm_CreateScreenResources;
- if (arm->accel && !vivante_ScreenInit(pScreen, arm->bufmgr)) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "[drm] Vivante initialization failed, running unaccelerated\n");
- arm->accel = FALSE;
+ if (arm->accel) {
+ struct drm_armada_bufmgr *mgr = arm->bufmgr;
+
+ /*
+ * Only pass the armada-drm bo manager if we are really
+ * driving armada-drm, other DRMs don't provide bo managers.
+ */
+ if (!arm->version || !strstr(arm->version->name, "armada"))
+ mgr = NULL;
+
+ if (!vivante_ScreenInit(pScreen, mgr)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "[drm] Vivante initialization failed, running unaccelerated\n");
+ arm->accel = FALSE;
+ }
}
arm->CloseScreen = pScreen->CloseScreen;
@@ -453,7 +464,6 @@ static Bool armada_drm_open_master(ScrnInfoPtr pScrn)
struct all_drm_info *drm;
EntityInfoPtr pEnt;
drmSetVersion sv;
- drmVersionPtr version;
const char *busid = DRM_DEFAULT_BUS_ID;
uint64_t val;
unsigned i;
@@ -538,12 +548,10 @@ static Bool armada_drm_open_master(ScrnInfoPtr pScrn)
SET_DRM_INFO(pScrn, &drm->common);
- version = drmGetVersion(drm->common.fd);
- if (version) {
+ drm->armada.version = drmGetVersion(drm->common.fd);
+ if (drm->armada.version)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "hardware: %s\n",
- version->name);
- drmFreeVersion(version);
- }
+ drm->armada.version->name);
return TRUE;
@@ -562,6 +570,9 @@ static void armada_drm_FreeScreen(FREE_SCREEN_ARGS_DECL)
struct armada_drm_info *arm = GET_ARMADA_DRM_INFO(pScrn);
drm_armada_fini(arm->bufmgr);
+
+ if (arm->version)
+ drmFreeVersion(arm->version);
}
common_drm_FreeScreen(FREE_SCREEN_ARGS(pScrn));
diff --git a/src/armada_drm.h b/src/armada_drm.h
index a7a9824..75bb69f 100644
--- a/src/armada_drm.h
+++ b/src/armada_drm.h
@@ -17,6 +17,7 @@ struct armada_drm_info {
OptionInfoPtr Options;
CloseScreenProcPtr CloseScreen;
CreateScreenResourcesProcPtr CreateScreenResources;
+ drmVersionPtr version;
struct drm_armada_bufmgr *bufmgr;
struct drm_armada_bo *front_bo;
Bool accel;
diff --git a/src/vivante.c b/src/vivante.c
index 609730b..127212d 100644
--- a/src/vivante.c
+++ b/src/vivante.c
@@ -571,6 +571,10 @@ Bool vivante_ScreenInit(ScreenPtr pScreen, struct drm_armada_bufmgr *mgr)
#endif
struct vivante *vivante;
+ /* We must have a buffer manager */
+ if (!mgr)
+ return FALSE;
+
if (!vivante_CreateKey(&vivante_pixmap_index, PRIVATE_PIXMAP) ||
!vivante_CreateKey(&vivante_screen_index, PRIVATE_SCREEN))
return FALSE;