Add DRM driver abstraction
This adds an abstraction interface in src/drmmode_driver.h for the
driver-specific values (and in future functions) that we need. It
also adds documentation and build system support (--with-drmmode)
to choose your supported driver.
Initially, the dumb allocation flags and page flip events flags
are abstracted with support for pl111 and eynos.
A template implementation is also provided for ease of adding new
driver support.
Change-Id: I98890ddab6b907c3007b72a662ecd7ee6caa4402
diff --git a/src/omap_dri2.c b/src/omap_dri2.c
index ebcaebe..4e2587c 100644
--- a/src/omap_dri2.c
+++ b/src/omap_dri2.c
@@ -41,6 +41,8 @@
# error "Requires newer DRI2"
#endif
+#include "drmmode_driver.h"
+
typedef struct {
DRI2BufferRec base;
@@ -541,12 +543,13 @@
* Error while flipping; bail.
*/
cmd->flags |= OMAP_SWAP_FAIL;
-#if !OMAP_USE_PAGE_FLIP_EVENTS
- cmd->swapCount = 0;
-#else
- cmd->swapCount = -(ret + 1);
+
+ if (pOMAP->drmmode->use_page_flip_events)
+ cmd->swapCount = -(ret + 1);
+ else
+ cmd->swapCount = 0;
+
if (cmd->swapCount == 0)
-#endif
{
OMAPDRI2SwapComplete(cmd);
}
@@ -554,12 +557,13 @@
} else {
if (ret == 0)
cmd->flags |= OMAP_SWAP_FAKE_FLIP;
-#if !OMAP_USE_PAGE_FLIP_EVENTS
- cmd->swapCount = 0;
-#else
- cmd->swapCount = ret;
+
+ if (pOMAP->drmmode->use_page_flip_events)
+ cmd->swapCount = ret;
+ else
+ cmd->swapCount = 0;
+
if (cmd->swapCount == 0)
-#endif
{
OMAPDRI2SwapComplete(cmd);
}