diff options
author | Tapani Pälli <tapani.palli@intel.com> | 2013-05-03 10:08:54 +0300 |
---|---|---|
committer | Tapani Pälli <tapani.palli@intel.com> | 2013-05-07 13:10:51 +0300 |
commit | 6062311f2c2528a58b34436dce0bb542d9b3af13 (patch) | |
tree | 2591b8073f2ce143f9d129b511449390f50664a6 | |
parent | df57ea903b701669b315a48311c1535f64f5d37a (diff) | |
download | external_drm_gralloc-6062311f2c2528a58b34436dce0bb542d9b3af13.zip external_drm_gralloc-6062311f2c2528a58b34436dce0bb542d9b3af13.tar.gz external_drm_gralloc-6062311f2c2528a58b34436dce0bb542d9b3af13.tar.bz2 |
gralloc: check possible crtcs of plane against primary output
Current implementation supports planes only with primary
output, patch adds a check to guard this.
Change-Id: I537858122a4fe77a374031d11339eaaea27ad9bf
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
-rw-r--r-- | gralloc_drm_kms.c | 29 | ||||
-rw-r--r-- | gralloc_drm_priv.h | 1 |
2 files changed, 30 insertions, 0 deletions
diff --git a/gralloc_drm_kms.c b/gralloc_drm_kms.c index 4eb3dfa..1e64312 100644 --- a/gralloc_drm_kms.c +++ b/gralloc_drm_kms.c @@ -243,6 +243,16 @@ static int gralloc_drm_bo_setplane(struct gralloc_drm_t *drm, } /* + * Returns if a particular plane is supported with the implementation + */ +static unsigned is_plane_supported(const struct gralloc_drm_t *drm, + const struct gralloc_drm_plane_t *plane) +{ + /* Planes are only supported on primary pipe for now */ + return plane->drm_plane->possible_crtcs & (1 << drm->primary.pipe); +} + +/* * Sets all the active planes to be displayed. */ static void gralloc_drm_set_planes(struct gralloc_drm_t *drm) @@ -251,6 +261,15 @@ static void gralloc_drm_set_planes(struct gralloc_drm_t *drm) unsigned int i; for (i = 0; i < drm->plane_resources->count_planes; i++, plane++) { + /* plane is not in use at all */ + if (!plane->active && !plane->handle) + continue; + + /* plane is active, safety check if it is supported */ + if (!is_plane_supported(drm, plane)) + ALOGE("%s: plane %d is not supported", + __func__, plane->drm_plane->plane_id); + /* * Disable overlay if it is not active * or if there is error during setplane @@ -291,6 +310,15 @@ int gralloc_drm_reserve_plane(struct gralloc_drm_t *drm, } for (j = 0; j < plane_count; j++, plane++) { + + /* + * handle may be suitable to be shown on a plane, in + * addition we need to check that this particular plane + * is supported by the current implementation + */ + if (!is_plane_supported(drm, plane)) + continue; + /* if plane is available and can support this buffer */ if (!plane->active && drm_handle->plane_mask & @@ -723,6 +751,7 @@ static int drm_kms_init_with_connector(struct gralloc_drm_t *drm, output->bo = NULL; output->crtc_id = drm->resources->crtcs[i]; output->connector_id = connector->connector_id; + output->pipe = i; /* print connector info */ if (connector->count_modes > 1) { diff --git a/gralloc_drm_priv.h b/gralloc_drm_priv.h index eb4338c..d96702e 100644 --- a/gralloc_drm_priv.h +++ b/gralloc_drm_priv.h @@ -74,6 +74,7 @@ struct gralloc_drm_output { uint32_t crtc_id; uint32_t connector_id; + uint32_t pipe; drmModeModeInfo mode; int xdpi, ydpi; int fb_format; |