Module: Mesa
Branch: main
Commit: 1d64308fe95b00c7f7aa1a8059cf8a0623a9bcdc
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d64308fe95b00c7f7aa1a8059cf8a0623a9bcdc

Author: Pierre-Eric Pelloux-Prayer <[email protected]>
Date:   Tue Aug  2 11:54:13 2022 +0200

gallium/dri2: make protected buffer checks opt-in

This check is an infinite source of issues when testing protected
content, so make it opt-in (eg for developers of applications dealing
with protected content buffers).

On AMD and Intel importing a protected buffer as non-protected will cause
the display to be incorrect (= garbage).

Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11449>

---

 src/gallium/auxiliary/pipe-loader/driinfo_gallium.h | 2 +-
 src/gallium/frontends/dri/dri2.c                    | 2 +-
 src/util/driconf.h                                  | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h 
b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
index a99b9dafbc9..218911959b0 100644
--- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
+++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
@@ -46,7 +46,7 @@ DRI_CONF_SECTION_DEBUG
    DRI_CONF_GLX_EXTENSION_OVERRIDE()
    DRI_CONF_MESA_EXTENSION_OVERRIDE()
    DRI_CONF_INDIRECT_GL_EXTENSION_OVERRIDE()
-   DRI_CONF_DISABLE_PROTECTED_CONTENT_CHECK(false)
+   DRI_CONF_FORCE_PROTECTED_CONTENT_CHECK(false)
    DRI_CONF_IGNORE_MAP_UNSYNCHRONIZED(false)
    DRI_CONF_FORCE_DIRECT_GLX_CONTEXT(false)
    DRI_CONF_ALLOW_INVALID_GLX_DESTROY_WINDOW(false)
diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c
index a606ba7cd26..400b94e8230 100644
--- a/src/gallium/frontends/dri/dri2.c
+++ b/src/gallium/frontends/dri/dri2.c
@@ -957,7 +957,7 @@ dri2_create_image_from_winsys(__DRIscreen *_screen,
        * content protection status of tex and img.
        */
       const struct driOptionCache *optionCache = &screen->dev->option_cache;
-      if (!driQueryOptionb(optionCache, "disable_protected_content_check") &&
+      if (driQueryOptionb(optionCache, "force_protected_content_check") &&
           (tex->bind & PIPE_BIND_PROTECTED) != (bind & PIPE_BIND_PROTECTED)) {
          pipe_resource_reference(&img->texture, NULL);
          pipe_resource_reference(&tex, NULL);
diff --git a/src/util/driconf.h b/src/util/driconf.h
index df619ad22d5..db095fdcd13 100644
--- a/src/util/driconf.h
+++ b/src/util/driconf.h
@@ -282,9 +282,9 @@
    DRI_CONF_OPT_S_NODEF(indirect_gl_extension_override, \
                   "Allow enabling/disabling a list of indirect-GL extensions")
 
-#define DRI_CONF_DISABLE_PROTECTED_CONTENT_CHECK(def) \
-   DRI_CONF_OPT_B(disable_protected_content_check, def, \
-                  "Don't reject image import if protected_content attribute 
doesn't match")
+#define DRI_CONF_FORCE_PROTECTED_CONTENT_CHECK(def) \
+   DRI_CONF_OPT_B(force_protected_content_check, def, \
+                  "Reject image import if protected_content attribute doesn't 
match")
 
 #define DRI_CONF_IGNORE_MAP_UNSYNCHRONIZED(def) \
    DRI_CONF_OPT_B(ignore_map_unsynchronized, def, \

Reply via email to