Mesa (master): driconf: add disable_protected_content_check option

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 2 09:38:49 UTC 2020


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

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Tue Oct  6 16:00:55 2020 +0200

driconf: add disable_protected_content_check option

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5096>

---

 src/gallium/auxiliary/pipe-loader/driinfo_gallium.h | 1 +
 src/gallium/frontends/dri/dri2.c                    | 4 +++-
 src/util/driconf.h                                  | 3 +++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
index f90112f25d9..6a166f15fcb 100644
--- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
+++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
@@ -39,6 +39,7 @@ DRI_CONF_SECTION_DEBUG
    DRI_CONF_OVERRIDE_VRAM_SIZE()
    DRI_CONF_GLX_EXTENSION_OVERRIDE()
    DRI_CONF_INDIRECT_GL_EXTENSION_OVERRIDE()
+   DRI_CONF_DISABLE_PROTECTED_CONTENT_CHECK(false)
 DRI_CONF_SECTION_END
 
 DRI_CONF_SECTION_MISCELLANEOUS
diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c
index b464eaba6ee..6571b34cf6b 100644
--- a/src/gallium/frontends/dri/dri2.c
+++ b/src/gallium/frontends/dri/dri2.c
@@ -833,7 +833,9 @@ dri2_create_image_from_winsys(__DRIscreen *_screen,
       /* Reject image creation if there's an inconsistency between
        * content protection status of tex and img.
        */
-      if ((tex->bind & PIPE_BIND_PROTECTED) != is_protected_content) {
+      const struct driOptionCache *optionCache = &screen->dev->option_cache;
+      if (!driQueryOptionb(optionCache, "disable_protected_content_check") &&
+          (tex->bind & PIPE_BIND_PROTECTED) != is_protected_content) {
          pipe_resource_reference(&img->texture, NULL);
          pipe_resource_reference(&tex, NULL);
          FREE(img);
diff --git a/src/util/driconf.h b/src/util/driconf.h
index 60d1314f888..7f838cdf6ad 100644
--- a/src/util/driconf.h
+++ b/src/util/driconf.h
@@ -225,6 +225,9 @@
    DRI_CONF_OPT_S(indirect_gl_extension_override, def, \
                   "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")
 
 /**
  * \brief Image quality-related options



More information about the mesa-commit mailing list