diff options
Diffstat (limited to 'gralloc_drm.cpp')
-rw-r--r-- | gralloc_drm.cpp | 57 |
1 files changed, 10 insertions, 47 deletions
diff --git a/gralloc_drm.cpp b/gralloc_drm.cpp index 8826f73..ebff717 100644 --- a/gralloc_drm.cpp +++ b/gralloc_drm.cpp @@ -25,6 +25,7 @@ #include <cutils/log.h> #include <cutils/atomic.h> +#include <cutils/properties.h> #include <stdlib.h> #include <errno.h> #include <sys/types.h> @@ -36,8 +37,6 @@ #define unlikely(x) __builtin_expect(!!(x), 0) -#define GRALLOC_DRM_DEVICE "/dev/dri/card0" - static int32_t gralloc_drm_pid = 0; /* @@ -101,6 +100,7 @@ init_drv_from_fd(int fd) */ struct gralloc_drm_t *gralloc_drm_create(void) { + char path[PROPERTY_VALUE_MAX]; struct gralloc_drm_t *drm; int err; @@ -108,9 +108,10 @@ struct gralloc_drm_t *gralloc_drm_create(void) if (!drm) return NULL; - drm->fd = open(GRALLOC_DRM_DEVICE, O_RDWR); + property_get("gralloc.drm.device", path, "/dev/dri/renderD128"); + drm->fd = open(path, O_RDWR); if (drm->fd < 0) { - ALOGE("failed to open %s", GRALLOC_DRM_DEVICE); + ALOGE("failed to open %s", path); return NULL; } @@ -144,42 +145,6 @@ int gralloc_drm_get_fd(struct gralloc_drm_t *drm) } /* - * Get the magic for authentication. - */ -int gralloc_drm_get_magic(struct gralloc_drm_t *drm, int32_t *magic) -{ - return drmGetMagic(drm->fd, (drm_magic_t *) magic); -} - -/* - * Authenticate a magic. - */ -int gralloc_drm_auth_magic(struct gralloc_drm_t *drm, int32_t magic) -{ - return drmAuthMagic(drm->fd, (drm_magic_t) magic); -} - -/* - * Set as the master of a DRM device. - */ -int gralloc_drm_set_master(struct gralloc_drm_t *drm) -{ - ALOGD("set master"); - drmSetMaster(drm->fd); - drm->first_post = 1; - - return 0; -} - -/* - * Drop from the master of a DRM device. - */ -void gralloc_drm_drop_master(struct gralloc_drm_t *drm) -{ - drmDropMaster(drm->fd); -} - -/* * Validate a buffer handle and return the associated bo. */ static struct gralloc_drm_bo_t *validate_handle(buffer_handle_t _handle, @@ -191,6 +156,7 @@ static struct gralloc_drm_bo_t *validate_handle(buffer_handle_t _handle, return NULL; /* the buffer handle is passed to a new process */ + ALOGE("data_owner=%d gralloc_pid=%d data=%p\n", handle->data_owner, gralloc_drm_get_pid(), handle->data); if (unlikely(handle->data_owner != gralloc_drm_pid)) { struct gralloc_drm_bo_t *bo; @@ -198,8 +164,10 @@ static struct gralloc_drm_bo_t *validate_handle(buffer_handle_t _handle, if (!drm) return NULL; + ALOGE("handle: name=%d pfd=%d\n", handle->name, + handle->prime_fd); /* create the struct gralloc_drm_bo_t locally */ - if (handle->name) + if (handle->name || handle->prime_fd >= 0) bo = drm->drv->alloc(drm->drv, handle); else /* an invalid handle */ bo = NULL; @@ -263,6 +231,7 @@ static struct gralloc_drm_handle_t *create_bo_handle(int width, handle->height = height; handle->format = format; handle->usage = usage; + handle->prime_fd = -1; return handle; } @@ -347,12 +316,6 @@ buffer_handle_t gralloc_drm_bo_get_handle(struct gralloc_drm_bo_t *bo, int *stri return &bo->handle->base; } -int gralloc_drm_get_gem_handle(buffer_handle_t _handle) -{ - struct gralloc_drm_handle_t *handle = gralloc_drm_handle(_handle); - return (handle) ? handle->name : 0; -} - /* * Query YUV component offsets for a buffer handle */ |