summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2012-08-31 12:54:45 +0300
committerDaniel Leung <daniel.leung@intel.com>2012-10-12 08:20:45 -0700
commit49ae83276a0a7e1351cedd27a1d7f7cc72ed52a0 (patch)
tree4415c2f2aec3472235690ef0673947201f68d7ce
parenta86ecd9036df3862f7289378609509e50ef38cb3 (diff)
downloadexternal_drm_gralloc-49ae83276a0a7e1351cedd27a1d7f7cc72ed52a0.zip
external_drm_gralloc-49ae83276a0a7e1351cedd27a1d7f7cc72ed52a0.tar.gz
external_drm_gralloc-49ae83276a0a7e1351cedd27a1d7f7cc72ed52a0.tar.bz2
gralloc: introduce planeresources
maintain planeresources and additional helper structure gralloc_drm_plane_t for planes, also prints out plane formats on startup. Change-Id: Ibc717d646acd581b8c247c22d269260e78d92fd9 Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
-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 {