#else
-
-
-
-
-
-
// DRM/DRI buffer swapping+access (driver specific) /////////////////////
static Eina_Bool tried = EINA_FALSE;
uint64_t u64;
} tbm_bo_handle;
+
static tbm_bo (*sym_tbm_bo_import) (tbm_bufmgr bufmgr, unsigned int key) = NULL;
static tbm_bo_handle (*sym_tbm_bo_map) (tbm_bo bo, int device, int opt) = NULL;
static int (*sym_tbm_bo_unmap) (tbm_bo bo) = NULL;
static void (*sym_tbm_bo_unref) (tbm_bo bo) = NULL;
static tbm_bufmgr (*sym_tbm_bufmgr_init) (int fd) = NULL;
static void (*sym_tbm_bufmgr_deinit) (tbm_bufmgr bufmgr) = NULL;
+
+// legacy compatibility
+static void *(*sym_drm_slp_bo_map) (tbm_bo bo, int device, int opt) = NULL;
+static int (*sym_drm_slp_bo_unmap) (tbm_bo bo, int device) = NULL;
+static tbm_bufmgr (*sym_drm_slp_bufmgr_init) (int fd, void *arg) = NULL;
+
////////////////////////////////////
// libdri2.so.0
#define DRI2BufferBackLeft 1
typedef struct
{
unsigned int name;
- tbm_bo buf_bo;
+ tbm_bo buf_bo;
} Buffer;
struct _X_Swapper
Drawable draw;
Visual *vis;
int w, h, depth;
- tbm_bo buf_bo;
+ tbm_bo buf_bo;
DRI2Buffer *buf;
void *buf_data;
int buf_w, buf_h;
static int drm_fd = -1;
static tbm_bufmgr bufmgr = NULL;
static int swap_debug = -1;
+static Eina_Bool slp_mode = EINA_FALSE;
static Eina_Bool
_drm_init(Display *disp, int scr)
if (swap_debug) ERR("Can't load libdrm.so.2");
goto err;
}
+ slp_mode = EINA_FALSE;
tbm_lib = dlopen("libtbm.so.1", RTLD_NOW | RTLD_LOCAL);
if (!tbm_lib)
{
if (swap_debug) ERR("Can't load libtbm.so.1");
- goto err;
+ tbm_lib = dlopen("libdrm_slp.so.1", RTLD_NOW | RTLD_LOCAL);
+ if (tbm_lib) slp_mode = EINA_TRUE;
+ else goto err;
}
dri_lib = dlopen("libdri2.so.0", RTLD_NOW | RTLD_LOCAL);
if (!dri_lib)
SYM(drm_lib, drmGetMagic);
- SYM(tbm_lib, tbm_bo_import);
- SYM(tbm_lib, tbm_bo_map);
- SYM(tbm_lib, tbm_bo_unmap);
- SYM(tbm_lib, tbm_bo_unref);
- SYM(tbm_lib, tbm_bufmgr_init);
- SYM(tbm_lib, tbm_bufmgr_deinit);
+ if (!slp_mode)
+ {
+ SYM(tbm_lib, tbm_bo_import);
+ SYM(tbm_lib, tbm_bo_map);
+ SYM(tbm_lib, tbm_bo_unmap);
+ SYM(tbm_lib, tbm_bo_unref);
+ SYM(tbm_lib, tbm_bufmgr_init);
+ SYM(tbm_lib, tbm_bufmgr_deinit);
+ }
+ else
+ {
+ // Looking up the legacy DRM SLP symbols. I don't believe this will
+ // ever happen, this code is here "just in case".
+ sym_tbm_bo_import = dlsym(tbm_lib, "drm_slp_bo_import");
+ sym_drm_slp_bo_map = dlsym(tbm_lib, "drm_slp_bo_map");
+ sym_drm_slp_bo_unmap = dlsym(tbm_lib, "drm_slp_bo_unmap");
+ sym_tbm_bo_unref = dlsym(tbm_lib, "drm_slp_bo_unref");
+ sym_drm_slp_bufmgr_init = dlsym(tbm_lib, "drm_slp_bufmgr_init");
+ sym_tbm_bufmgr_deinit = dlsym(tbm_lib, "drm_slp_bufmgr_destroy");
+ if (!sym_tbm_bo_import || !sym_drm_slp_bo_map || !sym_drm_slp_bo_unmap ||
+ !sym_tbm_bo_unref || !sym_drm_slp_bufmgr_init || !sym_tbm_bufmgr_deinit)
+ {
+ ERR("Can't load symbols from libdrm_slp.so.1");
+ goto err;
+ }
+ }
SYM(dri_lib, DRI2GetBuffers);
SYM(dri_lib, DRI2QueryExtension);
goto err;
}
- if (!(bufmgr = sym_tbm_bufmgr_init(drm_fd)))
+ if (!slp_mode)
+ bufmgr = sym_tbm_bufmgr_init(drm_fd);
+ else
+ bufmgr = sym_drm_slp_bufmgr_init(drm_fd, NULL);
+ if (!bufmgr)
{
if (swap_debug) ERR("DRM bufmgr init failed");
goto err;
}
}
- tbm_bo_handle bo_handle;
-
- bo_handle = sym_tbm_bo_map (swp->buf_bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
- /* If device is DEFAULT, 2D, 3D, MM,then swp->buf_data = bo_handle.u32 */
- swp->buf_data = bo_handle.ptr;
+ if (!slp_mode)
+ {
+ tbm_bo_handle bo_handle;
+ bo_handle = sym_tbm_bo_map(swp->buf_bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
+ /* If device is DEFAULT, 2D, 3D, MM,then swp->buf_data = bo_handle.u32 */
+ swp->buf_data = bo_handle.ptr;
+ }
+ else
+ {
+ swp->buf_data = sym_drm_slp_bo_map(swp->buf_bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
+ }
if (!swp->buf_data)
{
evas_xlib_swapper_buffer_unmap(X_Swapper *swp)
{
if (!swp->mapped) return;
- sym_tbm_bo_unmap(swp->buf_bo);
+ if (!slp_mode)
+ sym_tbm_bo_unmap(swp->buf_bo);
+ else
+ sym_drm_slp_bo_unmap(swp->buf_bo, TBM_DEVICE_CPU);
if (swap_debug) printf("Unmap buffer name %i\n", swp->buf->name);
free(swp->buf);
swp->buf = NULL;