From: Jani Nikula <jani.nikula@linux.intel.com>
To: Jocelyn Falempe <jfalempe@redhat.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Tvrtko Ursulin <tursulin@ursulin.net>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Jocelyn Falempe <jfalempe@redhat.com>
Subject: Re: [PATCH v6 5/8] drm/i915/display: Add drm_panic support
Date: Tue, 01 Apr 2025 16:48:07 +0300 [thread overview]
Message-ID: <87ldsk2dt4.fsf@intel.com> (raw)
In-Reply-To: <20250401125818.333033-6-jfalempe@redhat.com>
On Tue, 01 Apr 2025, Jocelyn Falempe <jfalempe@redhat.com> wrote:
> This adds drm_panic support for a wide range of Intel GPU. I've
> tested it only on 4 laptops, Haswell (with 128MB of eDRAM),
> Comet Lake, Raptor Lake, and Lunar Lake.
> For hardware using DPT, it's not possible to disable tiling, as you
> will need to reconfigure the way the GPU is accessing the
> framebuffer.
>
> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
> ---
>
> v4:
> * Add support for Xe driver.
>
> v6:
> * Use struct intel_display instead of drm_i915_private for intel_atomic_plane.c
>
> .../gpu/drm/i915/display/intel_atomic_plane.c | 79 ++++++++++++++++++-
> 1 file changed, 78 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> index 7276179df878..eebf20fafaeb 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> @@ -33,13 +33,16 @@
>
> #include <linux/dma-fence-chain.h>
> #include <linux/dma-resv.h>
> +#include <linux/iosys-map.h>
>
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_blend.h>
> #include <drm/drm_damage_helper.h>
> +#include <drm/drm_cache.h>
> #include <drm/drm_fourcc.h>
> #include <drm/drm_gem.h>
> #include <drm/drm_gem_atomic_helper.h>
> +#include <drm/drm_panic.h>
>
> #include "gem/i915_gem_object.h"
> #include "i915_config.h"
> @@ -47,6 +50,7 @@
> #include "i915_vma.h"
> #include "i9xx_plane_regs.h"
> #include "intel_atomic_plane.h"
> +#include "intel_bo.h"
> #include "intel_cdclk.h"
> #include "intel_cursor.h"
> #include "intel_display_rps.h"
> @@ -54,6 +58,7 @@
> #include "intel_display_types.h"
> #include "intel_fb.h"
> #include "intel_fb_pin.h"
> +#include "intel_fbdev.h"
> #include "skl_scaler.h"
> #include "skl_universal_plane.h"
> #include "skl_watermark.h"
> @@ -1251,14 +1256,86 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
> intel_plane_unpin_fb(old_plane_state);
> }
>
> +/* Only used by drm_panic get_scanout_buffer() and panic_flush(), so it is
> + * protected by the drm panic spinlock
> + */
> +static struct iosys_map panic_map;
> +
> +static void intel_panic_flush(struct drm_plane *plane)
> +{
> + struct intel_plane_state *plane_state = to_intel_plane_state(plane->state);
> + struct intel_plane *iplane = to_intel_plane(plane);
> + struct intel_display *display = to_intel_display(iplane);
> + struct drm_framebuffer *fb = plane_state->hw.fb;
> +
> + /* Force a cache flush, otherwise the new pixels won't show up */
> + drm_clflush_virt_range(panic_map.vaddr, fb->height * fb->pitches[0]);
> +
> + /* Don't disable tiling if it's the fbdev framebuffer.*/
> + if (to_intel_framebuffer(fb) == intel_fbdev_framebuffer(display->fbdev.fbdev)) {
> + return;
> +
Mismatched {}
> + if (fb->modifier && iplane->disable_tiling)
> + iplane->disable_tiling(iplane);
> +}
> +
> +static int intel_get_scanout_buffer(struct drm_plane *plane,
> + struct drm_scanout_buffer *sb)
> +{
> + struct intel_plane_state *plane_state;
> + struct drm_gem_object *obj;
> + struct drm_framebuffer *fb;
> + struct intel_display *display = to_intel_display(plane->dev);
> +
> + if (!plane->state || !plane->state->fb || !plane->state->visible)
> + return -ENODEV;
> +
> + plane_state = to_intel_plane_state(plane->state);
> + fb = plane_state->hw.fb;
> + obj = intel_fb_bo(fb);
> + if (!obj)
> + return -ENODEV;
> +
> + iosys_map_clear(&panic_map);
> + if (to_intel_framebuffer(fb) == intel_fbdev_framebuffer(display->fbdev.fbdev)) {
> + intel_fbdev_get_map(display->fbdev.fbdev, &panic_map);
> + } else {
> + /* Can't disable tiling if DPT is in use */
> + if (intel_fb_uses_dpt(fb))
> + return -EOPNOTSUPP;
> +
> + intel_bo_panic_map(obj, &panic_map);
> + }
> + if (iosys_map_is_null(&panic_map))
> + return -ENOMEM;
> +
> + sb->map[0] = panic_map;
> + sb->width = fb->width;
> + sb->height = fb->height;
> + sb->format = fb->format;
> + sb->pitch[0] = fb->pitches[0];
> +
> + return 0;
> +}
> +
> static const struct drm_plane_helper_funcs intel_plane_helper_funcs = {
> .prepare_fb = intel_prepare_plane_fb,
> .cleanup_fb = intel_cleanup_plane_fb,
> };
>
> +static const struct drm_plane_helper_funcs intel_primary_plane_helper_funcs = {
> + .prepare_fb = intel_prepare_plane_fb,
> + .cleanup_fb = intel_cleanup_plane_fb,
> + .get_scanout_buffer = intel_get_scanout_buffer,
> + .panic_flush = intel_panic_flush,
> +};
> +
> void intel_plane_helper_add(struct intel_plane *plane)
> {
> - drm_plane_helper_add(&plane->base, &intel_plane_helper_funcs);
> + if (plane->base.type == DRM_PLANE_TYPE_PRIMARY)
> + drm_plane_helper_add(&plane->base, &intel_primary_plane_helper_funcs);
> + else
> + drm_plane_helper_add(&plane->base, &intel_plane_helper_funcs);
> }
>
> void intel_plane_init_cursor_vblank_work(struct intel_plane_state *old_plane_state,
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-04-01 13:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 12:51 [PATCH v6 0/8] drm/i915: Add drm_panic support Jocelyn Falempe
2025-04-01 12:51 ` [PATCH v6 1/8] drm/i915/fbdev: Add intel_fbdev_get_map() Jocelyn Falempe
2025-04-01 12:51 ` [PATCH v6 2/8] drm/i915/display/i9xx: Add a disable_tiling() for i9xx planes Jocelyn Falempe
2025-04-01 17:38 ` Ville Syrjälä
2025-04-01 22:15 ` Jocelyn Falempe
2025-04-01 12:51 ` [PATCH v6 3/8] drm/i915/display: Add a disable_tiling() for skl planes Jocelyn Falempe
2025-04-01 12:51 ` [PATCH v6 4/8] drm/i915/gem: Add i915_gem_object_panic_map() Jocelyn Falempe
2025-04-01 17:47 ` Ville Syrjälä
2025-04-01 17:57 ` Ville Syrjälä
2025-04-01 22:38 ` Jocelyn Falempe
2025-04-01 22:27 ` Jocelyn Falempe
2025-04-01 12:51 ` [PATCH v6 5/8] drm/i915/display: Add drm_panic support Jocelyn Falempe
2025-04-01 13:48 ` Jani Nikula [this message]
2025-04-01 13:56 ` Jocelyn Falempe
2025-04-01 12:51 ` [PATCH v6 6/8] drm/i915/display: Flush the front buffer in panic handler Jocelyn Falempe
2025-04-01 12:51 ` [PATCH v6 7/8] drm/i915/display: Add drm_panic support for Y-tiling with DPT Jocelyn Falempe
2025-04-01 12:51 ` [PATCH v6 8/8] drm/i915/display: Add drm_panic support for 4-tiling " Jocelyn Falempe
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=87ldsk2dt4.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jfalempe@redhat.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=tursulin@ursulin.net \
/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;
as well as URLs for NNTP newsgroup(s).