diff options
author | John Stultz <john.stultz@linaro.org> | 2019-03-04 14:04:47 -0800 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2019-03-04 14:05:11 -0800 |
commit | bea3b4ca9bd3b4bc4bc920b492c401d7b55cacbc (patch) | |
tree | eaec022a4aa6cbf002558dd8ad9c8acbbcf7bbba | |
parent | bdf5d72c1b71e23ca396f3703cbc3778753812d1 (diff) | |
parent | 6230703e2a00b79e551460b958d2496934726e9e (diff) | |
download | drm_hwcomposer-bea3b4ca9bd3b4bc4bc920b492c401d7b55cacbc.tar.gz |
Merge remote-tracking branch 'aosp/upstream-master' into HEADandroid-q-preview-1android-o-mr1-iot-release-1.0.10
* aosp/upstream-master:
drm_hwcomposer: Initialize buffer_ pointer to NULL
drm_hwcomposer: platformhisi: Conditionalize some of the AFBC support
drm_hwcomposer: Add support for Arm Framebuffer Compression (AFBC) modifiers.
drm_hwcomposer: Fix check commit script to ignore case and extra spaces
Change-Id: Ia0cad33541d783bea37bc6458a03024d696a30c3
Signed-off-by: John Stultz <john.stultz@linaro.org>
-rwxr-xr-x | .gitlab-ci-checkcommit.sh | 29 | ||||
-rw-r--r-- | drmhwctwo.h | 2 | ||||
-rw-r--r-- | platformhisi.cpp | 63 | ||||
-rw-r--r-- | platformhisi.h | 4 |
4 files changed, 91 insertions, 7 deletions
diff --git a/.gitlab-ci-checkcommit.sh b/.gitlab-ci-checkcommit.sh index fc8963a..d76baf7 100755 --- a/.gitlab-ci-checkcommit.sh +++ b/.gitlab-ci-checkcommit.sh @@ -4,6 +4,29 @@ echoerr() { printf "ERROR: %s\n" "$*" >&2 } +findtag() { + local commit_body tag person + commit_body=$1 + tag=$2 + person=$3 + + # trim duplicate spaces from commit body and person + match="$tag: $(echo $person | tr -s ' ')" + + if [ -z "$(echo "$commit_body" | tr -s ' ' | grep -i "$match")" ]; then + echoerr "Tag is missing from commit body" + echoerr "" + echoerr "Looking for '"$match"' in: " + echoerr "-----------------------------------------------------" + echoerr "$commit_body" + echoerr "-----------------------------------------------------" + echoerr "" + return 0 + fi + + return 1 +} + git fetch https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer.git git log --pretty='%h' FETCH_HEAD..HEAD | while read h; do @@ -16,15 +39,13 @@ git log --pretty='%h' FETCH_HEAD..HEAD | while read h; do commit_body=$(git show -s --pretty=%b "$h") author=$(git show -s --format='%an <%ae>') - sob=$(echo "$commit_body" | grep "Signed-off-by: $author") - if [ -z "$sob" ] ; then + if findtag "$commit_body" "Signed-off-by" "$author"; then echoerr "Author SoB tag is missing from commit $h" exit 1 fi committer=$(git show -s --format='%cn <%ce>') - sob=$(echo "$commit_body" | grep "Signed-off-by: $committer") - if [ -z "$sob" ] ; then + if findtag "$commit_body" "Signed-off-by" "$committer"; then echoerr "Committer SoB tag is missing from commit $h" exit 1 fi diff --git a/drmhwctwo.h b/drmhwctwo.h index fd14b1f..d9ced9b 100644 --- a/drmhwctwo.h +++ b/drmhwctwo.h @@ -111,7 +111,7 @@ class DrmHwcTwo : public hwc2_device_t { HWC2::Composition validated_type_ = HWC2::Composition::Invalid; HWC2::BlendMode blending_ = HWC2::BlendMode::None; - buffer_handle_t buffer_; + buffer_handle_t buffer_ = NULL; UniqueFd acquire_fence_; int release_fence_raw_ = -1; UniqueFd release_fence_; diff --git a/platformhisi.cpp b/platformhisi.cpp index 76fe1e7..d4002f1 100644 --- a/platformhisi.cpp +++ b/platformhisi.cpp @@ -70,7 +70,59 @@ int HisiImporter::Init() { return 0; } +#ifdef MALI_GRALLOC_INTFMT_AFBC_BASIC +uint64_t HisiImporter::ConvertGrallocFormatToDrmModifiers(uint64_t flags, + bool is_rgb) { + uint64_t features = 0UL; + + if (flags & MALI_GRALLOC_INTFMT_AFBC_BASIC) + features |= AFBC_FORMAT_MOD_BLOCK_SIZE_16x16; + + if (flags & MALI_GRALLOC_INTFMT_AFBC_SPLITBLK) + features |= (AFBC_FORMAT_MOD_SPLIT | AFBC_FORMAT_MOD_SPARSE); + + if (flags & MALI_GRALLOC_INTFMT_AFBC_WIDEBLK) + features |= AFBC_FORMAT_MOD_BLOCK_SIZE_32x8; + + if (flags & MALI_GRALLOC_INTFMT_AFBC_TILED_HEADERS) + features |= AFBC_FORMAT_MOD_TILED; + + if (features) { + if (is_rgb) + features |= AFBC_FORMAT_MOD_YTR; + + return DRM_FORMAT_MOD_ARM_AFBC(features); + } + + return 0; +} +#else +uint64_t HisiImporter::ConvertGrallocFormatToDrmModifiers(uint64_t /* flags */, + bool /* is_rgb */) { + return 0; +} +#endif + +bool HisiImporter::IsDrmFormatRgb(uint32_t drm_format) { + switch (drm_format) { + case DRM_FORMAT_ARGB8888: + case DRM_FORMAT_XBGR8888: + case DRM_FORMAT_ABGR8888: + case DRM_FORMAT_BGR888: + case DRM_FORMAT_BGR565: + return true; + case DRM_FORMAT_YVU420: + return false; + default: + ALOGE("Unsupported format %u assuming rgb?", drm_format); + return true; + } +} + int HisiImporter::ImportBuffer(buffer_handle_t handle, hwc_drm_bo_t *bo) { + bool is_rgb; + uint64_t modifiers[4] = {0}; + memset(bo, 0, sizeof(hwc_drm_bo_t)); private_handle_t const *hnd = reinterpret_cast<private_handle_t const *>( @@ -94,6 +146,10 @@ int HisiImporter::ImportBuffer(buffer_handle_t handle, hwc_drm_bo_t *bo) { if (fmt < 0) return fmt; + is_rgb = IsDrmFormatRgb(fmt); + modifiers[0] = ConvertGrallocFormatToDrmModifiers(hnd->internal_format, + is_rgb); + bo->width = hnd->width; bo->height = hnd->height; bo->hal_format = hnd->req_format; @@ -129,8 +185,11 @@ int HisiImporter::ImportBuffer(buffer_handle_t handle, hwc_drm_bo_t *bo) { break; } - ret = drmModeAddFB2(drm_->fd(), bo->width, bo->height, bo->format, - bo->gem_handles, bo->pitches, bo->offsets, &bo->fb_id, 0); + ret = drmModeAddFB2WithModifiers(drm_->fd(), bo->width, bo->height, + bo->format, bo->gem_handles, bo->pitches, + bo->offsets, modifiers, &bo->fb_id, + modifiers[0] ? DRM_MODE_FB_MODIFIERS : 0); + if (ret) { ALOGE("could not create drm fb %d", ret); return ret; diff --git a/platformhisi.h b/platformhisi.h index 927da17..14a58b9 100644 --- a/platformhisi.h +++ b/platformhisi.h @@ -39,6 +39,10 @@ class HisiImporter : public DrmGenericImporter { bool CanImportBuffer(buffer_handle_t handle) override; private: + uint64_t ConvertGrallocFormatToDrmModifiers(uint64_t flags, bool is_rgb); + + bool IsDrmFormatRgb(uint32_t drm_format); + DrmDevice *drm_; const gralloc_module_t *gralloc_; |