From 6458697e7c14880754a2bb4402b44e9729c21543 Mon Sep 17 00:00:00 2001 From: renchenglei Date: Mon, 3 Jun 2019 23:34:54 +0800 Subject: [PATCH 1/6] Do not expose BO_USE_RENDERING usage to NV12 format We don't support glEGLImageTargetRenderbufferStorageOES with format NV12. However, we expose rendering usage in our gralloc. Remove this flag and pass following CTS issues on CtsNativeHardwareTestCases module SingleLayer_ColorTest_GpuColorOutputIsRenderable_Y8Cb8Cr8_420 SingleLayer_ColorTest_GpuColorOutputCpuRead_Y8Cb8Cr8_420 SingleLayer_ColorTest_GpuColorOutputAndSampledImage_Y8Cb8Cr8_420 Jira: OAM-81090 Test: No regression on CTS test Signed-off-by: Chenglei Ren --- i915_private.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i915_private.c b/i915_private.c index 7a20a2e..3cb5b6d 100644 --- a/i915_private.c +++ b/i915_private.c @@ -83,7 +83,7 @@ int i915_private_add_combinations(struct driver *drv) drv_modify_combination(drv, DRM_FORMAT_ABGR8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT); drv_modify_combination(drv, DRM_FORMAT_NV12, &metadata, - BO_USE_RENDERING | BO_USE_TEXTURE | BO_USE_CAMERA_MASK); + BO_USE_TEXTURE | BO_USE_CAMERA_MASK); drv_modify_combination(drv, DRM_FORMAT_YUYV, &metadata, BO_USE_TEXTURE | BO_USE_CAMERA_MASK | BO_USE_RENDERING); drv_modify_combination(drv, DRM_FORMAT_VYUY, &metadata, From e4aa7f301b40815e4db159643ad276a35079f483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Fri, 24 May 2019 11:05:35 +0300 Subject: [PATCH 2/6] support Iris driver in build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Jira: None Signed-off-by: Tapani Pälli --- Android.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Android.mk b/Android.mk index 2a598c6..8b88ca6 100644 --- a/Android.mk +++ b/Android.mk @@ -6,7 +6,7 @@ ifeq ($(strip $(BOARD_USES_MINIGBM)), true) MINIGBM_GRALLOC_MK := $(call my-dir)/Android.gralloc.mk LOCAL_PATH := $(call my-dir) -intel_drivers := i915 i965 +intel_drivers := i915 i965 iris include $(CLEAR_VARS) SUBDIRS := cros_gralloc From 09718210576394b06fd7421a45c75efc3cc9e36e Mon Sep 17 00:00:00 2001 From: "Yuanzhe, Liu" Date: Thu, 6 Jun 2019 11:06:08 +0800 Subject: [PATCH 3/6] Fix klocwork issues in GFX domain Add handle closing function to avoid resource leak. Test: Compile successful Tracked-On: https://jira.devtools.intel.com/browse/OAM-80984 Sighed-off-by: Yuanzhe, Liu Change-Id: Ib39eefd406eca5285375251d86f4bba0081f50d6 --- cros_gralloc/cros_gralloc_driver.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cros_gralloc/cros_gralloc_driver.cc b/cros_gralloc/cros_gralloc_driver.cc index a0e312a..e1f0a7e 100644 --- a/cros_gralloc/cros_gralloc_driver.cc +++ b/cros_gralloc/cros_gralloc_driver.cc @@ -73,8 +73,12 @@ int32_t cros_gralloc_driver::init() drmFreeVersion(version); drv_ = drv_create(fd); - if (drv_) + if (drv_) { + close(fd); return 0; + } + + close(fd); } } From 49a8582ed427e9b0a2623a4185a8843e6ec73fcb Mon Sep 17 00:00:00 2001 From: "Yuanzhe, Liu" Date: Thu, 6 Jun 2019 11:35:02 +0800 Subject: [PATCH 4/6] Correct some format errors Use clang-format-3.9 to correct some format errors. Separate with "fix klocwork issues" to make it easier to track. Test: Compile successful Tracked-On: No Sighed-off-by: Yuanzhe, Liu Change-Id: I1691fb48d1889b677b6b569c3fbb03556da28b33 --- cros_gralloc/cros_gralloc_driver.cc | 31 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/cros_gralloc/cros_gralloc_driver.cc b/cros_gralloc/cros_gralloc_driver.cc index e1f0a7e..0153ba7 100644 --- a/cros_gralloc/cros_gralloc_driver.cc +++ b/cros_gralloc/cros_gralloc_driver.cc @@ -9,11 +9,11 @@ #include "i915_private_android.h" -#include #include +#include #include -#include #include +#include cros_gralloc_driver::cros_gralloc_driver() : drv_(nullptr) { @@ -63,7 +63,7 @@ int32_t cros_gralloc_driver::init() if (!version) { close(fd); continue; - } + } if (undesired[i] && !strcmp(version->name, undesired[i])) { drmFreeVersion(version); @@ -74,11 +74,11 @@ int32_t cros_gralloc_driver::init() drmFreeVersion(version); drv_ = drv_create(fd); if (drv_) { - close(fd); + close(fd); return 0; - } + } - close(fd); + close(fd); } } @@ -157,7 +157,7 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto hnd->magic = cros_gralloc_magic; int32_t format = i915_private_invert_format(hnd->format); if (format == 0) { - format = descriptor->droid_format; + format = descriptor->droid_format; } hnd->droid_format = format; hnd->usage = descriptor->producer_usage; @@ -167,7 +167,7 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto id = drv_bo_get_plane_handle(bo, 0).u32; auto buffer = new cros_gralloc_buffer(id, bo, hnd); - SCOPED_SPIN_LOCK(mutex_); + SCOPED_SPIN_LOCK(mutex_); buffers_.emplace(id, buffer); handles_.emplace(hnd, std::make_pair(buffer, 1)); *out_handle = &hnd->base; @@ -177,7 +177,7 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto int32_t cros_gralloc_driver::retain(buffer_handle_t handle) { uint32_t id; - SCOPED_SPIN_LOCK(mutex_); + SCOPED_SPIN_LOCK(mutex_); auto hnd = cros_gralloc_convert_handle(handle); if (!hnd) { @@ -234,7 +234,7 @@ int32_t cros_gralloc_driver::retain(buffer_handle_t handle) int32_t cros_gralloc_driver::release(buffer_handle_t handle) { - SCOPED_SPIN_LOCK(mutex_); + SCOPED_SPIN_LOCK(mutex_); auto hnd = cros_gralloc_convert_handle(handle); if (!hnd) { @@ -252,13 +252,11 @@ int32_t cros_gralloc_driver::release(buffer_handle_t handle) if (buffers_.count(id)) { buffer = buffers_[id]; buffer->increase_refcount(); - } - else { + } else { cros_gralloc_error("Could not found reference"); return -EINVAL; } - } - else if (!--handles_[hnd].second) + } else if (!--handles_[hnd].second) handles_.erase(hnd); if (buffer->decrease_refcount() == 0) { @@ -294,7 +292,8 @@ int32_t cros_gralloc_driver::lock(buffer_handle_t handle, int32_t acquire_fence, int32_t cros_gralloc_driver::unlock(buffer_handle_t handle, int32_t *release_fence) { - SCOPED_SPIN_LOCK(mutex_);; + SCOPED_SPIN_LOCK(mutex_); + ; auto hnd = cros_gralloc_convert_handle(handle); if (!hnd) { @@ -320,7 +319,7 @@ int32_t cros_gralloc_driver::unlock(buffer_handle_t handle, int32_t *release_fen int32_t cros_gralloc_driver::get_backing_store(buffer_handle_t handle, uint64_t *out_store) { - SCOPED_SPIN_LOCK(mutex_); + SCOPED_SPIN_LOCK(mutex_); auto hnd = cros_gralloc_convert_handle(handle); if (!hnd) { From 5e1334800d29a843f08f62da93e2b497f422a6fb Mon Sep 17 00:00:00 2001 From: renchenglei Date: Fri, 14 Jun 2019 20:29:05 +0800 Subject: [PATCH 5/6] Revert "Correct some format errors" This reverts commit 49a8582ed427e9b0a2623a4185a8843e6ec73fcb. --- cros_gralloc/cros_gralloc_driver.cc | 31 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/cros_gralloc/cros_gralloc_driver.cc b/cros_gralloc/cros_gralloc_driver.cc index 0153ba7..e1f0a7e 100644 --- a/cros_gralloc/cros_gralloc_driver.cc +++ b/cros_gralloc/cros_gralloc_driver.cc @@ -9,11 +9,11 @@ #include "i915_private_android.h" -#include #include +#include #include -#include #include +#include cros_gralloc_driver::cros_gralloc_driver() : drv_(nullptr) { @@ -63,7 +63,7 @@ int32_t cros_gralloc_driver::init() if (!version) { close(fd); continue; - } + } if (undesired[i] && !strcmp(version->name, undesired[i])) { drmFreeVersion(version); @@ -74,11 +74,11 @@ int32_t cros_gralloc_driver::init() drmFreeVersion(version); drv_ = drv_create(fd); if (drv_) { - close(fd); + close(fd); return 0; - } + } - close(fd); + close(fd); } } @@ -157,7 +157,7 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto hnd->magic = cros_gralloc_magic; int32_t format = i915_private_invert_format(hnd->format); if (format == 0) { - format = descriptor->droid_format; + format = descriptor->droid_format; } hnd->droid_format = format; hnd->usage = descriptor->producer_usage; @@ -167,7 +167,7 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto id = drv_bo_get_plane_handle(bo, 0).u32; auto buffer = new cros_gralloc_buffer(id, bo, hnd); - SCOPED_SPIN_LOCK(mutex_); + SCOPED_SPIN_LOCK(mutex_); buffers_.emplace(id, buffer); handles_.emplace(hnd, std::make_pair(buffer, 1)); *out_handle = &hnd->base; @@ -177,7 +177,7 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto int32_t cros_gralloc_driver::retain(buffer_handle_t handle) { uint32_t id; - SCOPED_SPIN_LOCK(mutex_); + SCOPED_SPIN_LOCK(mutex_); auto hnd = cros_gralloc_convert_handle(handle); if (!hnd) { @@ -234,7 +234,7 @@ int32_t cros_gralloc_driver::retain(buffer_handle_t handle) int32_t cros_gralloc_driver::release(buffer_handle_t handle) { - SCOPED_SPIN_LOCK(mutex_); + SCOPED_SPIN_LOCK(mutex_); auto hnd = cros_gralloc_convert_handle(handle); if (!hnd) { @@ -252,11 +252,13 @@ int32_t cros_gralloc_driver::release(buffer_handle_t handle) if (buffers_.count(id)) { buffer = buffers_[id]; buffer->increase_refcount(); - } else { + } + else { cros_gralloc_error("Could not found reference"); return -EINVAL; } - } else if (!--handles_[hnd].second) + } + else if (!--handles_[hnd].second) handles_.erase(hnd); if (buffer->decrease_refcount() == 0) { @@ -292,8 +294,7 @@ int32_t cros_gralloc_driver::lock(buffer_handle_t handle, int32_t acquire_fence, int32_t cros_gralloc_driver::unlock(buffer_handle_t handle, int32_t *release_fence) { - SCOPED_SPIN_LOCK(mutex_); - ; + SCOPED_SPIN_LOCK(mutex_);; auto hnd = cros_gralloc_convert_handle(handle); if (!hnd) { @@ -319,7 +320,7 @@ int32_t cros_gralloc_driver::unlock(buffer_handle_t handle, int32_t *release_fen int32_t cros_gralloc_driver::get_backing_store(buffer_handle_t handle, uint64_t *out_store) { - SCOPED_SPIN_LOCK(mutex_); + SCOPED_SPIN_LOCK(mutex_); auto hnd = cros_gralloc_convert_handle(handle); if (!hnd) { From 3ccd27e798dd320515d7e8ea8c56d566b430fe56 Mon Sep 17 00:00:00 2001 From: renchenglei Date: Fri, 14 Jun 2019 20:29:10 +0800 Subject: [PATCH 6/6] Revert "Fix klocwork issues in GFX domain" This reverts commit 09718210576394b06fd7421a45c75efc3cc9e36e. --- cros_gralloc/cros_gralloc_driver.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cros_gralloc/cros_gralloc_driver.cc b/cros_gralloc/cros_gralloc_driver.cc index e1f0a7e..a0e312a 100644 --- a/cros_gralloc/cros_gralloc_driver.cc +++ b/cros_gralloc/cros_gralloc_driver.cc @@ -73,12 +73,8 @@ int32_t cros_gralloc_driver::init() drmFreeVersion(version); drv_ = drv_create(fd); - if (drv_) { - close(fd); + if (drv_) return 0; - } - - close(fd); } }