Mesa (master): i965: Implement basic modifier image creation

Ben Widawsky bwidawsk at kemper.freedesktop.org
Wed Mar 15 19:34:13 UTC 2017


Module: Mesa
Branch: master
Commit: 5e7d8d396196af61ce0b1663534d97bef7895993
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e7d8d396196af61ce0b1663534d97bef7895993

Author: Ben Widawsky <ben at bwidawsk.net>
Date:   Mon Mar 13 14:53:43 2017 -0700

i965: Implement basic modifier image creation

This is just a stub for now and will be filled in later.

This was split out of an earlier patch

Requested-by: Emil Velikov <emil.velikov at collabora.com>
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/mesa/drivers/dri/i965/intel_screen.c | 38 ++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 10dab23..5f9dea6 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -506,10 +506,12 @@ intel_destroy_image(__DRIimage *image)
 }
 
 static __DRIimage *
-intel_create_image(__DRIscreen *dri_screen,
-		   int width, int height, int format,
-		   unsigned int use,
-		   void *loaderPrivate)
+intel_create_image_common(__DRIscreen *dri_screen,
+                          int width, int height, int format,
+                          unsigned int use,
+                          const uint64_t *modifiers,
+                          unsigned count,
+                          void *loaderPrivate)
 {
    __DRIimage *image;
    struct intel_screen *screen = dri_screen->driverPrivate;
@@ -517,6 +519,12 @@ intel_create_image(__DRIscreen *dri_screen,
    int cpp;
    unsigned long pitch;
 
+   /* Callers of this may specify a modifier, or a dri usage, but not both. The
+    * newer modifier interface deprecates the older usage flags newer modifier
+    * interface deprecates the older usage flags.
+    */
+   assert(!(use && count));
+
    tiling = I915_TILING_X;
    if (use & __DRI_IMAGE_USE_CURSOR) {
       if (width != 64 || height != 64)
@@ -546,6 +554,27 @@ intel_create_image(__DRIscreen *dri_screen,
    return image;
 }
 
+static __DRIimage *
+intel_create_image(__DRIscreen *dri_screen,
+		   int width, int height, int format,
+		   unsigned int use,
+		   void *loaderPrivate)
+{
+   return intel_create_image_common(dri_screen, width, height, format, use, NULL, 0,
+                               loaderPrivate);
+}
+
+static __DRIimage *
+intel_create_image_with_modifiers(__DRIscreen *dri_screen,
+                                  int width, int height, int format,
+                                  const uint64_t *modifiers,
+                                  const unsigned count,
+                                  void *loaderPrivate)
+{
+   return intel_create_image_common(dri_screen, width, height, format, 0, NULL,
+                                    0, loaderPrivate);
+}
+
 static GLboolean
 intel_query_image(__DRIimage *image, int attrib, int *value)
 {
@@ -836,6 +865,7 @@ static const __DRIimageExtension intelImageExtension = {
     .getCapabilities                    = NULL,
     .mapImage                           = NULL,
     .unmapImage                         = NULL,
+    .createImageWithModifiers           = intel_create_image_with_modifiers,
 };
 
 static int




More information about the mesa-commit mailing list