OSDN Git Service

Revert "i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag"
authorHirokazu Honda <hiroh@chromium.org>
Mon, 21 May 2018 06:32:57 +0000 (06:32 +0000)
committerHirokazu Honda <hiroh@chromium.org>
Tue, 22 May 2018 08:06:31 +0000 (08:06 +0000)
This reverts commit 1bd7b04a3ae68c0314bdee06c559093de9e5a304.

Reason for revert: Breaks video decoding on most intel platforms, e.g., caroline and samus

Original change's description:
> i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag
>
> This flag is used to indicate that the platform video decoder will be
> writing into this buffer and that it should be allocated
> accordingly. On Intel, this means that we have to allocate y-tiled
> NV12 for libva to be able to decode to the buffer.
>
> We force gralloc NV12 allocations to be linear for now, since ARC++
> doesn't properly pass modifiers to ChromeOS.
>
> BUG=822346
> TEST=test_that graphics_Gbm
>
> Change-Id: I840c30d22355d26816df718b49717407e2e4620f
> Reviewed-on: https://chromium-review.googlesource.com/996648
> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
> Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
> Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>

Bug: 822346, 845076
Change-Id: I7681ddb66e4789951e840821993fc5562a55d1af
Reviewed-on: https://chromium-review.googlesource.com/1066032
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kuo Jen Wei <inker@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
cros_gralloc/cros_gralloc_driver.cc
drv.h
gbm.h
gbm_helpers.c
i915.c

index 31282bc..a68023e 100644 (file)
@@ -91,23 +91,13 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto
        size_t num_planes;
        uint32_t resolved_format;
        uint32_t bytes_per_pixel;
-       uint64_t use_flags;
 
        struct bo *bo;
        struct cros_gralloc_handle *hnd;
 
        resolved_format = drv_resolve_format(drv_, descriptor->drm_format, descriptor->use_flags);
-       use_flags = descriptor->use_flags;
-       /*
-        * TODO(b/79682290): ARC++ assumes NV12 is always linear and doesn't
-        * send modifiers across Wayland protocol, so we or in the
-        * BO_USE_LINEAR flag here. We need to fix ARC++ to allocate and work
-        * with tiled buffers.
-        */
-       if (resolved_format == DRM_FORMAT_NV12)
-               use_flags |= BO_USE_LINEAR;
        bo = drv_bo_create(drv_, descriptor->width, descriptor->height, resolved_format,
-                          use_flags);
+                          descriptor->use_flags);
        if (!bo) {
                drv_log("Failed to create bo.\n");
                return -ENOMEM;
diff --git a/drv.h b/drv.h
index d27e845..9ca77d3 100644 (file)
--- a/drv.h
+++ b/drv.h
@@ -37,8 +37,6 @@ extern "C" {
 #define BO_USE_CAMERA_READ             (1ull << 14)
 #define BO_USE_RENDERSCRIPT            (1ull << 16)
 #define BO_USE_TEXTURE                 (1ull << 17)
-#define BO_USE_HW_VIDEO_DECODER                (1ull << 18)
-
 
 /* Map flags */
 #define BO_MAP_NONE 0
diff --git a/gbm.h b/gbm.h
index ce05ce3..da993c2 100644 (file)
--- a/gbm.h
+++ b/gbm.h
@@ -265,10 +265,6 @@ enum gbm_bo_flags {
    GBM_BO_USE_SW_READ_RARELY = (1 << 10),
    GBM_BO_USE_SW_WRITE_OFTEN = (1 << 11),
    GBM_BO_USE_SW_WRITE_RARELY = (1 << 12),
-   /**
-    * The buffer will be written by a video decode accelerator.
-    */
-   GBM_BO_USE_HW_VIDEO_DECODER = (1 << 13),
 };
 
 int
index 81d1680..2683669 100644 (file)
@@ -40,8 +40,6 @@ uint64_t gbm_convert_usage(uint32_t usage)
                use_flags |= BO_USE_SW_WRITE_OFTEN;
        if (usage & GBM_BO_USE_SW_WRITE_RARELY)
                use_flags |= BO_USE_SW_WRITE_RARELY;
-       if (usage & GBM_BO_USE_HW_VIDEO_DECODER)
-               use_flags |= BO_USE_HW_VIDEO_DECODER;
 
        return use_flags;
 }
diff --git a/i915.c b/i915.c
index 6df6dcc..8e1871a 100644 (file)
--- a/i915.c
+++ b/i915.c
@@ -101,10 +101,6 @@ static int i915_add_kms_item(struct driver *drv, const struct kms_item *item)
                        combo->use_flags |= item->use_flags & ~BO_USE_CURSOR;
                }
 
-               /* If we can scanout NV12, we support all tiling modes. */
-               if (item->format == DRM_FORMAT_NV12)
-                       combo->use_flags |= item->use_flags;
-
                if (combo->metadata.modifier == item->modifier)
                        combo->use_flags |= item->use_flags;
        }
@@ -182,11 +178,6 @@ static int i915_add_combinations(struct driver *drv)
                             ARRAY_SIZE(tileable_texture_source_formats), &metadata,
                             texture_use_flags);
 
-       /* Support y-tiled NV12 for libva */
-       const uint32_t nv12_format = DRM_FORMAT_NV12;
-       drv_add_combinations(drv, &nv12_format, 1, &metadata,
-                            BO_USE_TEXTURE | BO_USE_HW_VIDEO_DECODER);
-
        kms_items = drv_query_kms(drv);
        if (!kms_items)
                return 0;