[Mesa-dev] [PATCH 5/6] i965: introduce modifier selection.

Ben Widawsky ben at bwidawsk.net
Tue Mar 14 05:24:40 UTC 2017


Nothing special here other than a brief introduction to modifier
selection. Originally this was part of another patch but was split out
from
gbm: Introduce modifiers into surface/bo creation by request of Emil.

Requested-by: Emil Velikov <emil.velikov at collabora.com>
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 src/mesa/drivers/dri/i965/intel_screen.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 39289967cd..cc695d383b 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -41,6 +41,10 @@
 #include "utils.h"
 #include "xmlpool.h"
 
+#ifndef DRM_FORMAT_MOD_INVALID
+#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
+#endif
+
 static const __DRIconfigOptionsExtension brw_config_options = {
    .base = { __DRI_CONFIG_OPTIONS, 1 },
    .xml =
@@ -509,6 +513,15 @@ intel_destroy_image(__DRIimage *image)
    free(image);
 }
 
+static uint64_t
+select_best_modifier(struct gen_device_info *devinfo,
+                     const uint64_t *modifiers,
+                     const unsigned count)
+{
+   /* Modifiers are not supported by this DRI driver */
+   return DRM_FORMAT_MOD_INVALID;
+}
+
 static __DRIimage *
 intel_create_image_common(__DRIscreen *dri_screen,
                           int width, int height, int format,
@@ -529,6 +542,12 @@ intel_create_image_common(__DRIscreen *dri_screen,
     */
    assert(!(use && count));
 
+   uint64_t modifier = select_best_modifier(&screen->devinfo, modifiers, count);
+   assert(modifier == DRM_FORMAT_MOD_INVALID);
+
+   /* Historically, X-tiled was the default, and so lack of modifier means
+    * X-tiled.
+    */
    tiling = I915_TILING_X;
    if (use & __DRI_IMAGE_USE_CURSOR) {
       if (width != 64 || height != 64)
-- 
2.12.0



More information about the mesa-dev mailing list