Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6AC4C6EB23 for ; Thu, 25 Mar 2021 05:45:53 +0000 (UTC) From: Alan Previn Date: Wed, 24 Mar 2021 22:45:41 -0700 Message-Id: <20210325054549.465386-8-alan.previn.teres.alexis@intel.com> In-Reply-To: <20210325054549.465386-1-alan.previn.teres.alexis@intel.com> References: <20210325054549.465386-1-alan.previn.teres.alexis@intel.com> MIME-Version: 1.0 Subject: [igt-dev] [PATCH i-g-t v2 07/15] Add subtest to copy raw source to protected dest List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: igt-dev@lists.freedesktop.org Cc: Alan Previn List-ID: Add subtest to 3d-copy raw source buffer (with known readible content) to a destination buffer marked as protected with a protected session using default session keys. The destination buffer is verified to be different from the source (when read via CPU) because its encrypted. Signed-off-by: Alan Previn --- tests/i915/gem_pxp.c | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/tests/i915/gem_pxp.c b/tests/i915/gem_pxp.c index 7071cd0e..825edbf1 100644 --- a/tests/i915/gem_pxp.c +++ b/tests/i915/gem_pxp.c @@ -425,7 +425,9 @@ static uint32_t alloc_and_fill_dest_buff(int i915, bool protected, #define TSTSURF_STRIDE (TSTSURF_WIDTH*TSTSURF_BYTESPP) #define TSTSURF_SIZE (TSTSURF_STRIDE*TSTSURF_HEIGHT) #define TSTSURF_FILLCOLOR1 0xfaceface +#define TSTSURF_FILLCOLOR2 0xdeaddead #define TSTSURF_INITCOLOR1 0x12341234 +#define TSTSURF_INITCOLOR2 0x56785678 static void test_render_protected_buffer(int i915, uint32_t test_cfg) { @@ -480,6 +482,48 @@ static void test_render_protected_buffer(int i915, uint32_t test_cfg) gem_context_destroy(i915, ctx); break; + case COPY3D_PROTECTED_SRC_TO_PROTDST: + /* Perform a protected render operation but only label + * the dest as protected. After rendering, the content + * should be encrypted + */ + ctx = create_protected_ctx(i915, true, true, + true, false, 0); + assert_ctx_protected_param(i915, ctx, true); + + dstbo = alloc_and_fill_dest_buff(i915, true, + TSTSURF_SIZE, TSTSURF_INITCOLOR2); + dstbuf = intel_buf_create_using_handle(bops, dstbo, + TSTSURF_WIDTH, TSTSURF_HEIGHT, + TSTSURF_BYTESPP*8, 0, I915_TILING_NONE, 0); + intel_buf_set_pxp(dstbuf, true); + + srcbo = alloc_and_fill_dest_buff(i915, false, + TSTSURF_SIZE, TSTSURF_FILLCOLOR2); + srcbuf = intel_buf_create_using_handle(bops, srcbo, + TSTSURF_WIDTH, TSTSURF_HEIGHT, + TSTSURF_BYTESPP*8, 0, I915_TILING_NONE, 0); + + ibb = intel_bb_create_with_context(i915, ctx, 4096); + igt_assert(ibb); + + intel_bb_set_pxp(ibb, true, DISPLAY_APPTYPE, + I915_PROTECTED_CONTENT_DEFAULT_SESSION); + + gen12_render_copyfunc(ibb, srcbuf, 0, 0, + TSTSURF_WIDTH, TSTSURF_HEIGHT, dstbuf, 0, 0); + gem_sync(i915, dstbo); + + assert_bo_content_check(i915, dstbo, COMPARE_COLOR_UNREADIBLE, + TSTSURF_SIZE, TSTSURF_FILLCOLOR2); + + intel_bb_destroy(ibb); + intel_buf_destroy(srcbuf); + gem_close(i915, srcbo); + intel_buf_destroy(dstbuf); + gem_close(i915, dstbo); + gem_context_destroy(i915, ctx); + break; default: igt_info("Skipping unknown render test_cfg = %d\n", test_cfg); @@ -575,6 +619,9 @@ igt_main igt_subtest("regular-baseline-src-copy-readible") test_render_protected_buffer(i915, COPY3D_BASELINE_SRC_TO_DST); + igt_subtest("protected-raw-src-copy-not-readible") + test_render_protected_buffer(i915, + COPY3D_PROTECTED_SRC_TO_PROTDST); } igt_fixture { -- 2.25.1 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev