From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: intel-xe@lists.freedesktop.org, matthew.brost@intel.com,
maarten.lankhorst@linux.intel.com, philippe.lecluse@intel.com,
mchehab@kernel.org
Subject: Re: [Intel-xe] [PATCH 17/37] drm/xe: Allow fbdev to allocate stolen memory
Date: Tue, 24 Jan 2023 10:42:42 -0500 [thread overview]
Message-ID: <Y8/8cifwO0Xsn4Rf@intel.com> (raw)
In-Reply-To: <20230112222538.2000142-18-rodrigo.vivi@intel.com>
On Thu, Jan 12, 2023 at 05:25:18PM -0500, Rodrigo Vivi wrote:
> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Hi Maarten, could you please reply here with a commit msg for this patch?
I will add that on the next round or while merging it.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_fbdev.c | 55 ++++++++++++----------
> 1 file changed, 31 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
> index 176e0e44a268..52dc33c5f6d8 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
> @@ -45,6 +45,7 @@
> #include "gem/i915_gem_lmem.h"
> #else
> #include "xe_gt.h"
> +#include "xe_ttm_stolen_mgr.h"
> #endif
>
> #include "i915_drv.h"
> @@ -171,8 +172,8 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
>
> size = mode_cmd.pitches[0] * mode_cmd.height;
> size = PAGE_ALIGN(size);
> -#ifdef I915
> obj = ERR_PTR(-ENODEV);
> +#ifdef I915
> if (HAS_LMEM(dev_priv)) {
> obj = i915_gem_object_create_lmem(dev_priv, size,
> I915_BO_ALLOC_CONTIGUOUS);
> @@ -188,11 +189,22 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
> obj = i915_gem_object_create_shmem(dev_priv, size);
> }
> #else
> - /* XXX: Care about stolen? */
> - obj = xe_bo_create_pin_map(dev_priv, to_gt(dev_priv), NULL, size,
> - ttm_bo_type_kernel,
> - XE_BO_CREATE_VRAM_IF_DGFX(to_gt(dev_priv)) |
> - XE_BO_CREATE_PINNED_BIT | XE_BO_SCANOUT_BIT);
> + if (!IS_DGFX(dev_priv)) {
> + obj = xe_bo_create_pin_map(dev_priv, to_gt(dev_priv), NULL, size,
> + ttm_bo_type_kernel, XE_BO_SCANOUT_BIT |
> + XE_BO_CREATE_STOLEN_BIT |
> + XE_BO_CREATE_PINNED_BIT);
> + if (!IS_ERR(obj))
> + drm_info(&dev_priv->drm, "Allocated fbdev into stolen\n");
> + else
> + drm_info(&dev_priv->drm, "Allocated fbdev into stolen failed: %li\n", PTR_ERR(obj));
> + }
> + if (IS_ERR(obj)) {
> + obj = xe_bo_create_pin_map(dev_priv, to_gt(dev_priv), NULL, size,
> + ttm_bo_type_kernel, XE_BO_SCANOUT_BIT |
> + XE_BO_CREATE_VRAM_IF_DGFX(to_gt(dev_priv)) |
> + XE_BO_CREATE_PINNED_BIT);
> + }
> #endif
>
> if (IS_ERR(obj)) {
> @@ -317,33 +329,28 @@ static int intelfb_create(struct drm_fb_helper *helper,
> info->fix.smem_len = vma->size;
> }
> vaddr = i915_vma_pin_iomap(vma);
> -
> #else
> - /* XXX: Could be pure fiction.. */
> - if (obj->flags & XE_BO_CREATE_VRAM0_BIT) {
> - struct xe_gt *gt = to_gt(dev_priv);
> + info->apertures->ranges[0].base = pci_resource_start(pdev, 2);
> + info->apertures->ranges[0].size = pci_resource_len(pdev, 2);
> + if (!(obj->flags & XE_BO_CREATE_SYSTEM_BIT)) {
> bool lmem;
>
> - info->apertures->ranges[0].base = gt->mem.vram.io_start;
> - info->apertures->ranges[0].size = gt->mem.vram.size;
> + if (obj->flags & XE_BO_CREATE_STOLEN_BIT)
> + info->fix.smem_start = xe_ttm_stolen_io_offset(obj, 0);
> + else
> + info->fix.smem_start =
> + pci_resource_start(pdev, 2) +
> + xe_bo_addr(obj, 0, GEN8_PAGE_SIZE, &lmem);
>
> - info->fix.smem_start =
> - (unsigned long)(gt->mem.vram.io_start + xe_bo_addr(obj, 0, 4096, &lmem));
> info->fix.smem_len = obj->ttm.base.size;
> -
> } else {
> - struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
> -
> - info->apertures->ranges[0].base = pci_resource_start(pdev, 2);
> - info->apertures->ranges[0].size =
> - pci_resource_end(pdev, 2) - pci_resource_start(pdev, 2);
> -
> - info->fix.smem_start = info->apertures->ranges[0].base + xe_bo_ggtt_addr(obj);
> + /* XXX: Pure fiction, as the BO may not be physically accessible.. */
> + info->fix.smem_start = 0;
> info->fix.smem_len = obj->ttm.base.size;
> }
>
> - /* TODO: ttm_bo_kmap? */
> - vaddr = obj->vmap.vaddr;
> + XE_WARN_ON(iosys_map_is_null(&obj->vmap));
> + vaddr = obj->vmap.vaddr_iomem;
> #endif
>
> if (IS_ERR(vaddr)) {
> --
> 2.38.1
>
next prev parent reply other threads:[~2023-01-24 15:42 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 22:25 [Intel-xe] [PATCH 00/37] Catching up since we went public Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 01/37] drm/msm: Fix compile error Rodrigo Vivi
2023-01-31 18:48 ` Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 02/37] drm/xe: Implement a local xe_mmio_wait32 Rodrigo Vivi
2023-01-31 18:49 ` Rodrigo Vivi
2023-02-01 4:44 ` Matthew Brost
2023-01-12 22:25 ` [Intel-xe] [PATCH 03/37] drm/xe: Stop using i915's range_overflows_t macro Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 04/37] drm/xe: Let's return last value read on xe_mmio_wait32 Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 05/37] drm/xe: Convert guc_ready to regular xe_mmio_wait32 Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 06/37] drm/xe: Wait for success on guc done Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 07/37] drm/xe: Remove i915_utils dependency from xe_guc_pc Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 08/37] drm/xe: Stop using i915_utils in xe_wopcm Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 09/37] drm/xe: Let's avoid i915_utils in the xe_force_wake Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 10/37] drm/xe: Convert xe_mmio_wait32 to us so we can stop using wait_for_us Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 11/37] drm/xe: Remove i915_utils dependency from xe_pcode Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 12/37] drm/xe/migrate: Add kerneldoc for the migrate subsystem Rodrigo Vivi
2023-01-20 23:03 ` Mauro Carvalho Chehab
2023-01-12 22:25 ` [Intel-xe] [PATCH 13/37] drm/xe: Take memory ref on kernel job creation Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 14/37] drm/xe: Add intel_pps support too Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 15/37] drm/xe: Rework initialisation ordering slightly so we can inherit fb Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 16/37] drm/xe: Implement stolen memory Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 17/37] drm/xe: Allow fbdev to allocate " Rodrigo Vivi
2023-01-24 15:42 ` Rodrigo Vivi [this message]
2023-01-12 22:25 ` [Intel-xe] [PATCH 18/37] drm/xe: Implement initial hw readout for framebuffer Rodrigo Vivi
2023-01-24 15:43 ` Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 19/37] drm/xe: Put DPT into stolen memory, if available Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 20/37] drm/xe: Implement FBC support Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 21/37] drm/i915: Remove i915_drm_suspend_mode Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 22/37] drm/xe: Fix compilation when Xe driver is builtin Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 23/37] drm/xe: Fix dumb bo create Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 24/37] drm/i915: Expand force_probe to block probe of devices as well Rodrigo Vivi
2023-01-20 23:08 ` Mauro Carvalho Chehab
2023-01-12 22:25 ` [Intel-xe] [PATCH 25/37] drm/xe: Introduce force_probe parameter Rodrigo Vivi
2023-01-20 23:07 ` Mauro Carvalho Chehab
2023-01-12 22:25 ` [Intel-xe] [PATCH 26/37] Revert "drm/xe: Validate BO on CPU fault" Rodrigo Vivi
2023-01-24 15:44 ` Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 27/37] drm/xe: Ensure VMA not userptr before calling xe_bo_is_stolen Rodrigo Vivi
2023-02-03 19:56 ` Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 28/37] drm/xe: Don't use engine_mask until after hwconfig parse Rodrigo Vivi
2023-01-31 18:51 ` Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 29/37] drm/xe: Fake pulling gt->info.engine_mask from hwconfig blob Rodrigo Vivi
2023-01-31 19:03 ` Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 30/37] drm/xe/guc: Report submission version of GuC firmware Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 31/37] drm/xe/guc: s/xe_guc_send_mmio/xe_guc_mmio_send Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 32/37] drm/xe/guc: Add support GuC MMIO send / recv Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 33/37] drm/xe: Make FBC check stolen at use time Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 34/37] drm/xe: Move xe_ttm_stolen_mgr_init back Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 35/37] drm/xe: Fix hidden gotcha regression with bo create Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 36/37] drm/xe: Fix xe_mmio_wait32 timeouts Rodrigo Vivi
2023-01-12 22:25 ` [Intel-xe] [PATCH 37/37] drm/xe: enforce GSMBASE for DG1 instead of BAR2 Rodrigo Vivi
2023-01-24 15:46 ` Rodrigo Vivi
2023-01-24 16:25 ` Lecluse, Philippe
2023-01-31 19:11 ` Rodrigo Vivi
2023-01-31 19:13 ` Rodrigo Vivi
2023-02-01 9:12 ` Matthew Auld
2023-02-01 9:13 ` Matthew Auld
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=Y8/8cifwO0Xsn4Rf@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.brost@intel.com \
--cc=mchehab@kernel.org \
--cc=philippe.lecluse@intel.com \
/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