summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gralloc_drm_kms.c39
-rw-r--r--gralloc_drm_priv.h8
2 files changed, 47 insertions, 0 deletions
diff --git a/gralloc_drm_kms.c b/gralloc_drm_kms.c
index 4664ecb..2d9bca1 100644
--- a/gralloc_drm_kms.c
+++ b/gralloc_drm_kms.c
@@ -563,6 +563,32 @@ int gralloc_drm_init_kms(struct gralloc_drm_t *drm)
return -EINVAL;
}
+ drm->plane_resources = drmModeGetPlaneResources(drm->fd);
+ if (!drm->plane_resources) {
+ ALOGD("no planes found from drm resources");
+ } else {
+ ALOGD("supported drm planes and formats");
+ /* fill a helper structure for hwcomposer */
+ drm->planes = calloc(drm->plane_resources->count_planes,
+ sizeof(struct gralloc_drm_plane_t));
+
+ for (i = 0; i < drm->plane_resources->count_planes; i++) {
+
+ unsigned int j;
+
+ drm->planes[i].drm_plane = drmModeGetPlane(drm->fd,
+ drm->plane_resources->planes[i]);
+
+ ALOGD("plane id %d", drm->planes[i].drm_plane->plane_id);
+ for (j = 0; j < drm->planes[i].drm_plane->count_formats; j++)
+ ALOGD(" format %c%c%c%c",
+ (drm->planes[i].drm_plane->formats[j]),
+ (drm->planes[i].drm_plane->formats[j])>>8,
+ (drm->planes[i].drm_plane->formats[j])>>16,
+ (drm->planes[i].drm_plane->formats[j])>>24);
+ }
+ }
+
/* find the crtc/connector/mode to use */
for (i = 0; i < drm->resources->count_connectors; i++) {
drmModeConnectorPtr connector;
@@ -620,6 +646,19 @@ void gralloc_drm_fini_kms(struct gralloc_drm_t *drm)
drm->resources = NULL;
}
+ if (drm->planes) {
+ unsigned int i;
+ for (i = 0; i < drm->plane_resources->count_planes; i++)
+ drmModeFreePlane(drm->planes[i].drm_plane);
+ free(drm->planes);
+ drm->planes = NULL;
+ }
+
+ if (drm->plane_resources) {
+ drmModeFreePlaneResources(drm->plane_resources);
+ drm->plane_resources = NULL;
+ }
+
drm_singleton = NULL;
}
diff --git a/gralloc_drm_priv.h b/gralloc_drm_priv.h
index 33f688d..d22fea0 100644
--- a/gralloc_drm_priv.h
+++ b/gralloc_drm_priv.h
@@ -37,6 +37,10 @@ enum drm_swap_mode {
DRM_SWAP_SETCRTC,
};
+struct gralloc_drm_plane_t {
+ drmModePlane *drm_plane;
+};
+
struct gralloc_drm_t {
/* initialized by gralloc_drm_create */
int fd;
@@ -66,6 +70,10 @@ struct gralloc_drm_t {
struct gralloc_drm_bo_t *current_front, *next_front;
int waiting_flip;
unsigned int last_swap;
+
+ /* plane support */
+ drmModePlaneResPtr plane_resources;
+ struct gralloc_drm_plane_t *planes;
};
struct gralloc_drm_drv_t {