summaryrefslogtreecommitdiffstats
path: root/gralloc_drm_kms.c
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2013-01-21 14:58:33 +0200
committerTapani Pälli <tapani.palli@intel.com>2013-01-21 14:59:04 +0200
commit73e275e7be13df5c74e26510dcb9d9c0cc24981e (patch)
tree99774bfc9dfec1f413b319d0c98220680780bb89 /gralloc_drm_kms.c
parenta8f0334ef5706875f2c73a2690a2f1fc3e5fee27 (diff)
downloadexternal_drm_gralloc-73e275e7be13df5c74e26510dcb9d9c0cc24981e.zip
external_drm_gralloc-73e275e7be13df5c74e26510dcb9d9c0cc24981e.tar.gz
external_drm_gralloc-73e275e7be13df5c74e26510dcb9d9c0cc24981e.tar.bz2
gralloc: set supported planes for buffers on allocation
This is done so that we should not have to do it dynamically during composition. This information will be used later with hwcomposer module when using planes for composition. Change-Id: I2b6716fe9a8da81050645900c6c0955385946991 Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Diffstat (limited to 'gralloc_drm_kms.c')
-rw-r--r--gralloc_drm_kms.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gralloc_drm_kms.c b/gralloc_drm_kms.c
index a921e6c..91e7e63 100644
--- a/gralloc_drm_kms.c
+++ b/gralloc_drm_kms.c
@@ -87,6 +87,29 @@ static int resolve_drm_format(struct gralloc_drm_bo_t *bo,
}
/*
+ * Returns planes that are supported for a particular format
+ */
+unsigned int planes_for_format(struct gralloc_drm_t *drm,
+ int hal_format)
+{
+ unsigned int i, j, mask = 0;
+ unsigned int drm_format = drm_format_from_hal(hal_format);
+ struct gralloc_drm_plane_t *plane = drm->planes;
+
+ /* no planes available */
+ if (!plane)
+ return 0;
+
+ /* iterate through planes, mark those that match format */
+ for (i=0; i<drm->plane_resources->count_planes; i++, plane++)
+ for (j=0; j<plane->drm_plane->count_formats; j++)
+ if (plane->drm_plane->formats[j] == drm_format)
+ mask |= (2 << plane->drm_plane->plane_id);
+
+ return mask;
+}
+
+/*
* Add a fb object for a bo.
*/
int gralloc_drm_bo_add_fb(struct gralloc_drm_bo_t *bo)