Mesa (master): i965/dri: Enable modifier queries

Ben Widawsky bwidawsk at kemper.freedesktop.org
Tue Mar 21 22:00:33 UTC 2017


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

Author: Ben Widawsky <ben at bwidawsk.net>
Date:   Fri Mar 17 13:29:08 2017 -0700

i965/dri: Enable modifier queries

New to the patch series after reordering things for landing smaller
chunks.

This will essentially enable modifiers from clients that were just
enabled in previous patches. A client could use the modifiers by
setting all of them at create, but had no way to actually query them
after creating the surface (ie. stupid clients could be broken before
this patch, but in more ways than this).

Obviously, there are no modifiers being actually stored yet - so this
patch shouldn't do anything other than allow the API to get back 0 (or
the LINEAR modifier).

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/mesa/drivers/dri/i965/intel_image.h  | 1 +
 src/mesa/drivers/dri/i965/intel_screen.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_image.h b/src/mesa/drivers/dri/i965/intel_image.h
index fd63919b2d..a362c76689 100644
--- a/src/mesa/drivers/dri/i965/intel_image.h
+++ b/src/mesa/drivers/dri/i965/intel_image.h
@@ -71,6 +71,7 @@ struct __DRIimageRec {
    GLenum internal_format;
    uint32_t dri_format;
    GLuint format;
+   uint64_t modifier; /**< fb modifier (fourcc) */
    uint32_t offset;
 
    /*
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 90223bab2b..26ab5a8e19 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -635,6 +635,12 @@ intel_query_image(__DRIimage *image, int attrib, int *value)
    case __DRI_IMAGE_ATTRIB_OFFSET:
       *value = image->offset;
       return true;
+   case __DRI_IMAGE_ATTRIB_MODIFIER_LOWER:
+      *value = (image->modifier & 0xffffffff);
+      return true;
+   case __DRI_IMAGE_ATTRIB_MODIFIER_UPPER:
+      *value = ((image->modifier >> 32) & 0xffffffff);
+      return true;
 
   default:
       return false;




More information about the mesa-commit mailing list