OSDN Git Service

Add support for DRM_FORMAT_P010
authorMiguel Casas <mcasas@chromium.org>
Tue, 30 Apr 2019 22:11:40 +0000 (18:11 -0400)
committerchrome-bot <chrome-bot@chromium.org>
Thu, 2 May 2019 23:12:39 +0000 (16:12 -0700)
Test: Tested with chrome's ozone_gl_unittests: crrev.com/c/1561136
Bug: 911754
Change-Id: I8a9a28ba1c3a1186fd88b43c85098a5550fa1c8b
Reviewed-on: https://chromium-review.googlesource.com/1590464
Commit-Ready: Miguel Casas <mcasas@chromium.org>
Tested-by: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
drv.h
helpers.c
i915.c

diff --git a/drv.h b/drv.h
index d27e845..d3cf9d3 100644 (file)
--- a/drv.h
+++ b/drv.h
@@ -56,6 +56,11 @@ extern "C" {
 #define DRM_FORMAT_FLEX_IMPLEMENTATION_DEFINED fourcc_code('9', '9', '9', '8')
 #define DRM_FORMAT_FLEX_YCbCr_420_888          fourcc_code('9', '9', '9', '9')
 
+// TODO(crbug.com/958181): remove this definition once drm_fourcc.h contains it.
+#ifndef DRM_FORMAT_P010
+#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0')
+#endif
+
 // clang-format on
 struct driver;
 struct bo;
index b18cd6a..05ca9eb 100644 (file)
--- a/helpers.c
+++ b/helpers.c
@@ -68,6 +68,13 @@ static const struct planar_layout triplanar_yuv_420_layout = {
        .bytes_per_pixel = { 1, 1, 1 }
 };
 
+static const struct planar_layout biplanar_yuv_p010_layout = {
+       .num_planes = 2,
+       .horizontal_subsampling = { 1, 2 },
+       .vertical_subsampling = { 1, 2 },
+       .bytes_per_pixel = { 2, 4 }
+};
+
 // clang-format on
 
 static const struct planar_layout *layout_from_format(uint32_t format)
@@ -87,6 +94,9 @@ static const struct planar_layout *layout_from_format(uint32_t format)
        case DRM_FORMAT_NV21:
                return &biplanar_yuv_420_layout;
 
+       case DRM_FORMAT_P010:
+               return &biplanar_yuv_p010_layout;
+
        case DRM_FORMAT_ABGR1555:
        case DRM_FORMAT_ABGR4444:
        case DRM_FORMAT_ARGB1555:
diff --git a/i915.c b/i915.c
index fb74258..3d51d63 100644 (file)
--- a/i915.c
+++ b/i915.c
@@ -33,7 +33,7 @@ static const uint32_t tileable_texture_source_formats[] = { DRM_FORMAT_GR88, DRM
                                                            DRM_FORMAT_UYVY, DRM_FORMAT_YUYV };
 
 static const uint32_t texture_source_formats[] = { DRM_FORMAT_YVU420, DRM_FORMAT_YVU420_ANDROID,
-                                                  DRM_FORMAT_NV12 };
+                                                  DRM_FORMAT_NV12,   DRM_FORMAT_P010 };
 
 struct i915_device {
        uint32_t gen;