OSDN Git Service

drm_hwcomposer: fix incorrect layer_count usage
authorRoman Stratiienko <r.stratiienko@gmail.com>
Tue, 1 Sep 2020 10:39:17 +0000 (13:39 +0300)
committerRoman Stratiienko <r.stratiienko@gmail.com>
Tue, 1 Sep 2020 20:12:47 +0000 (23:12 +0300)
According to [1] DRM YCrCb planes is not the same as gralloc layers.
DRMHWC2 has no information about number of layers used in the buffer.
Also supplying value other than 1 will allways fail validation on
passthrough MapperHal@2.1 and probably other passthrough implementations [2].

[1] - https://cs.android.com/android/platform/superproject/+/master:hardware/libhardware/include/hardware/gralloc1.h;l=467;drc=1155c41d016a118801fe97b55af9918e531f7f84
[2] - https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/graphics/mapper/2.1/utils/passthrough/include/mapper-passthrough/2.1/Gralloc0Hal.h;l=40;drc=e308ceb1e9940d1d90a11177782a7cfe8630bb95

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Change-Id: Idbfea8eaa74a557b98ecdff728e6c67aeea9cea6

utils/hwcutils.cpp

index 87e3c42..324d855 100644 (file)
@@ -114,13 +114,9 @@ int DrmHwcLayer::ImportBuffer(Importer *importer) {
 
   const hwc_drm_bo *bo = buffer.operator->();
 
-  unsigned int layer_count;
-  for (layer_count = 0; layer_count < HWC_DRM_BO_MAX_PLANES; ++layer_count)
-    if (bo->gem_handles[layer_count] == 0)
-      break;
-
-  ret = handle.CopyBufferHandle(sf_handle, bo->width, bo->height, layer_count,
-                                bo->hal_format, bo->usage, bo->pixel_stride);
+  ret = handle.CopyBufferHandle(sf_handle, bo->width, bo->height,
+                                1 /*layer_count*/, bo->hal_format, bo->usage,
+                                bo->pixel_stride);
   if (ret)
     return ret;