diff options
author | Russell King <rmk@armlinux.org.uk> | 2017-02-25 12:30:55 +0000 |
---|---|---|
committer | Russell King <rmk@armlinux.org.uk> | 2017-02-25 17:16:15 +0000 |
commit | ba91654fb427f8dd86e9a53f42a93e2c5dc39bf6 (patch) | |
tree | e433b18f910f194564db8d74111b4837b5f39cda | |
parent | 585f4c24a466783bc1dca10e5b221b1d82ec4644 (diff) |
src: Xv: get planes from common_drm_planes
Get the plane information from the common_drm_planes layer rather than
parsing this information ourselves.
Signed-off-by: Russell King <rmk@armlinux.org.uk>
-rw-r--r-- | src/armada_drm_xv.c | 73 |
1 files changed, 29 insertions, 44 deletions
diff --git a/src/armada_drm_xv.c b/src/armada_drm_xv.c index 44b56a0..5302ac6 100644 --- a/src/armada_drm_xv.c +++ b/src/armada_drm_xv.c @@ -1103,59 +1103,42 @@ static void armada_drm_property_setup(struct drm_xv *drmxv, } } -static Bool armada_drm_gather_planes(ScrnInfoPtr pScrn, struct drm_xv *drmxv) +static void armada_drm_parse_properties(ScrnInfoPtr pScrn, + struct drm_xv *drmxv, drmModeObjectPropertiesPtr props) { - drmModePlaneResPtr res; unsigned int i; - Bool ret = FALSE; - - /* Get the plane resources and the overlay planes */ - res = drmModeGetPlaneResources(drmxv->fd); - if (!res) - goto err; - - /* Get all plane information */ - for (i = 0; i < res->count_planes && - i < ARRAY_SIZE(drmxv->mode_planes); i++) { - drmModeObjectPropertiesPtr props; - drmModePlanePtr plane; - unsigned j; - - plane = drmModeGetPlane(drmxv->fd, res->planes[i]); - if (!plane) - goto err; - drmxv->mode_planes[drmxv->num_planes] = plane; - drmxv->num_planes++; + for (i = 0; i < props->count_props; i++) { + drmModePropertyPtr prop; + uint32_t prop_id = props->props[i]; + uint64_t prop_val = props->prop_values[i]; - props = drmModeObjectGetProperties(drmxv->fd, res->planes[i], - DRM_MODE_OBJECT_PLANE); - if (!props) - goto err; + prop = common_drm_plane_get_property(pScrn, prop_id); + if (!prop) + continue; - for (j = 0; j < props->count_props; j++) { - drmModePropertyPtr prop; + armada_drm_property_setup(drmxv, prop, prop_val); + } +} - prop = drmModeGetProperty(drmxv->fd, props->props[j]); - if (!prop) - continue; +static Bool armada_drm_gather_planes(ScrnInfoPtr pScrn, struct drm_xv *drmxv) +{ + struct common_drm_info *drm = GET_DRM_INFO(pScrn); + unsigned int i; - armada_drm_property_setup(drmxv, prop, - props->prop_values[j]); - drmModeFreeProperty(prop); - } - drmModeFreeObjectProperties(props); - } + if (!common_drm_init_plane_resources(pScrn)) + return FALSE; - ret = TRUE; + for (i = 0; i < drm->num_overlay_planes && + i < ARRAY_SIZE(drmxv->mode_planes); i++) { + drmxv->mode_planes[drmxv->num_planes++] = + drm->overlay_planes[i].mode_plane; -err: - if (res) { - /* Done with the plane resources */ - drmModeFreePlaneResources(res); + armada_drm_parse_properties(pScrn, drmxv, + drm->overlay_planes[i].mode_props); } - return ret; + return TRUE; } Bool armada_drm_XvInit(ScrnInfoPtr pScrn) @@ -1230,13 +1213,15 @@ Bool armada_drm_XvInit(ScrnInfoPtr pScrn) return TRUE; err_free: - for (i = 0; i < drmxv->num_planes; i++) - drmModeFreePlane(drmxv->mode_planes[i]); if (gpu_adap) { free(gpu_adap->pImages); free(gpu_adap->pPortPrivates); free(gpu_adap); } + free(drmxv); + + common_drm_cleanup_plane_resources(pScrn); + return FALSE; } |