From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: apoorva1.singh@intel.com
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t, v2 1/3] lib/i915: Introduce libraries i915_blt and intel_mocs
Date: Mon, 22 Nov 2021 10:03:31 +0100 [thread overview]
Message-ID: <20211122090331.GC7458@zkempczy-mobl2> (raw)
In-Reply-To: <20211122064849.785894-2-apoorva1.singh@intel.com>
On Mon, Nov 22, 2021 at 12:18:47PM +0530, apoorva1.singh@intel.com wrote:
<cut>
I've also wondered - should be the code below part of separate patch?
--
Zbigniew
> diff --git a/lib/i915/intel_mocs.c b/lib/i915/intel_mocs.c
> new file mode 100644
> index 00000000..cbb1cc69
> --- /dev/null
> +++ b/lib/i915/intel_mocs.c
> @@ -0,0 +1,75 @@
> +/*
> + * Copyright © 2021 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + *
> + * Authors:
> + * Apoorva Singh <apoorva1.singh@intel.com>
> + *
> + */
> +#include "igt.h"
> +#include "i915/gem.h"
> +#include "intel_mocs.h"
> +
> +static void get_mocs_index(int fd, struct drm_i915_mocs_index *mocs)
> +{
> + uint16_t devid = intel_get_drm_devid(fd);
> +
> + /*
> + * Gen >= 12 onwards don't have a setting for PTE,
> + * so using I915_MOCS_PTE as mocs index may leads to
> + * some undefined MOCS behavior.
> + * Correct MOCS index should be referred from BSPCES
> + * and programmed accordingly.
> + * This helper function is providing current UC as well
> + * as WB MOCS index based on platform.
> +
> + */
> + if (IS_DG1(devid)) {
> + mocs->uc_index = 1;
> + mocs->wb_index = 5;
> + } else if (IS_GEN12(devid)) {
> + mocs->uc_index = 3;
> + mocs->wb_index = 2;
> + } else {
> + mocs->uc_index = I915_MOCS_PTE;
> + mocs->wb_index = I915_MOCS_CACHED;
> + }
> +}
> +
> +/* BitField [6:1] represents index to MOCS Tables
> + * BitField [0] represents Encryption/Decryption
> + */
> +
> +uint8_t intel_get_wb_mocs(int fd)
> +{
> + struct drm_i915_mocs_index mocs;
> +
> + get_mocs_index(fd, &mocs);
> + return mocs.wb_index << 1;
> +}
> +
> +uint8_t intel_get_uc_mocs(int fd)
> +{
> + struct drm_i915_mocs_index mocs;
> +
> + get_mocs_index(fd, &mocs);
> + return mocs.uc_index << 1;
> +}
> diff --git a/lib/i915/intel_mocs.h b/lib/i915/intel_mocs.h
> new file mode 100644
> index 00000000..8289ab1f
> --- /dev/null
> +++ b/lib/i915/intel_mocs.h
> @@ -0,0 +1,43 @@
> +/*
> + * Copyright © 2021 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + *
> + * Authors:
> + * Apoorva Singh <apoorva1.singh@intel.com>
> + *
> + */
> +#ifndef _INTEL_MOCS_H
> +#define _INTEL_MOCS_H
> +
> +#define XY_FAST_COLOR_BLT_MOCS_SHIFT 21
> +#define XY_BLOCK_COPY_BLT_MOCS_SHIFT 21
> +#define XY_FAST_COPY_BLT_MOCS_SHIFT 17
> +#define XY_CTRL_SURF_COPY_BLT_MOCS_SHIFT 25
> +#define MEM_COPY_MOCS_SHIFT 25
> +
> +struct drm_i915_mocs_index {
> + uint8_t uc_index;
> + uint8_t wb_index;
> +};
> +
> +uint8_t intel_get_wb_mocs(int fd);
> +uint8_t intel_get_uc_mocs(int fd);
> +#endif /* _INTEL_MOCS_H */
> diff --git a/lib/meson.build b/lib/meson.build
> index 297b0ad2..525d62f9 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -11,6 +11,8 @@ lib_sources = [
> 'i915/gem_mman.c',
> 'i915/gem_vm.c',
> 'i915/intel_memory_region.c',
> + 'i915/intel_mocs.c',
> + 'i915/i915_blt.c',
> 'igt_collection.c',
> 'igt_color_encoding.c',
> 'igt_debugfs.c',
> --
> 2.25.1
>
next prev parent reply other threads:[~2021-11-22 9:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 6:48 [igt-dev] [PATCH i-g-t,v2 0/3] Add testing for CCS apoorva1.singh
2021-11-22 6:48 ` [igt-dev] [PATCH i-g-t, v2 1/3] lib/i915: Introduce libraries i915_blt and intel_mocs apoorva1.singh
2021-11-22 9:00 ` Zbigniew Kempczyński
2021-11-22 9:03 ` Zbigniew Kempczyński [this message]
2021-11-23 12:34 ` Zbigniew Kempczyński
2021-11-23 13:23 ` Zbigniew Kempczyński
2021-11-22 6:48 ` [igt-dev] [PATCH i-g-t, v2 2/3] lib/intel_chipset.h: Add has_flat_ccs flag apoorva1.singh
2021-11-22 8:15 ` Zbigniew Kempczyński
2021-11-22 6:48 ` [igt-dev] [PATCH i-g-t,v2 3/3] i915/gem_ccs: Add testing for CCS apoorva1.singh
2021-11-25 7:55 ` [igt-dev] [PATCH i-g-t, v2 " Zbigniew Kempczyński
2021-11-22 8:36 ` [igt-dev] ✓ Fi.CI.BAT: success for Add testing for CCS (rev2) Patchwork
2021-11-22 10:13 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211122090331.GC7458@zkempczy-mobl2 \
--to=zbigniew.kempczynski@intel.com \
--cc=apoorva1.singh@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox