mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 20:54:03 +02:00
drm/{i915, xe}/panic: drop dependency on struct intel_framebuffer
Store tiling function pointer in struct intel_panic instead of struct intel_framebuffer, and store struct intel_panic pointer instead of struct intel_framebuffer pointer in struct drm_scanout_buffer private member. To make this happen, pass the tiling function pointer to panic setup hook, and initialize sb->private in the hook for clarity. This allows us to drop the dependency on struct intel_framebuffer from i915 and xe panic code. Note: It would be less verbose to have a typedef for the tiling function pointer. However, there isn't a nice location for it that wouldn't also increase header interdependencies. Cc: Jocelyn Falempe <jfalempe@redhat.com> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patch.msgid.link/d97abae79db3437c617cd4cb6193ba017b3a8d78.1780394867.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
parent
d9608402ff
commit
53f12a266c
|
|
@ -151,7 +151,6 @@ struct intel_framebuffer {
|
|||
unsigned int min_alignment;
|
||||
unsigned int vtd_guard;
|
||||
|
||||
unsigned int (*panic_tiling)(unsigned int x, unsigned int y, unsigned int width);
|
||||
struct intel_panic *panic;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -252,9 +252,10 @@ struct intel_panic *intel_parent_panic_alloc(struct intel_display *display)
|
|||
}
|
||||
|
||||
int intel_parent_panic_setup(struct intel_display *display, struct intel_panic *panic,
|
||||
struct drm_scanout_buffer *sb, struct drm_gem_object *obj)
|
||||
struct drm_scanout_buffer *sb, struct drm_gem_object *obj,
|
||||
unsigned int (*tiling)(unsigned int x, unsigned int y, unsigned int width))
|
||||
{
|
||||
return display->parent->panic->setup(panic, sb, obj);
|
||||
return display->parent->panic->setup(panic, sb, obj, tiling);
|
||||
}
|
||||
|
||||
void intel_parent_panic_finish(struct intel_display *display, struct intel_panic *panic)
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ void intel_parent_overlay_cleanup(struct intel_display *display);
|
|||
/* panic */
|
||||
struct intel_panic *intel_parent_panic_alloc(struct intel_display *display);
|
||||
int intel_parent_panic_setup(struct intel_display *display, struct intel_panic *panic,
|
||||
struct drm_scanout_buffer *sb, struct drm_gem_object *obj);
|
||||
struct drm_scanout_buffer *sb, struct drm_gem_object *obj,
|
||||
unsigned int (*tiling)(unsigned int x, unsigned int y, unsigned int width));
|
||||
void intel_parent_panic_finish(struct intel_display *display, struct intel_panic *panic);
|
||||
|
||||
/* pc8 */
|
||||
|
|
|
|||
|
|
@ -1617,17 +1617,17 @@ static int intel_get_scanout_buffer(struct drm_plane *plane,
|
|||
if (fb == intel_fbdev_framebuffer(display->fbdev.fbdev)) {
|
||||
intel_fbdev_get_map(display, &sb->map[0]);
|
||||
} else {
|
||||
unsigned int (*tiling)(unsigned int x, unsigned int y, unsigned int width) = NULL;
|
||||
int ret;
|
||||
/* Can't disable tiling if DPT is in use */
|
||||
if (intel_fb_uses_dpt(&fb->base)) {
|
||||
if (fb->base.format->cpp[0] != 4)
|
||||
return -EOPNOTSUPP;
|
||||
fb->panic_tiling = intel_get_tiling_func(fb->base.modifier);
|
||||
if (!fb->panic_tiling)
|
||||
tiling = intel_get_tiling_func(fb->base.modifier);
|
||||
if (!tiling)
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
sb->private = fb;
|
||||
ret = intel_parent_panic_setup(display, fb->panic, sb, obj);
|
||||
ret = intel_parent_panic_setup(display, fb->panic, sb, obj, tiling);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include <drm/drm_panic.h>
|
||||
#include <drm/intel/display_parent_interface.h>
|
||||
|
||||
#include "display/intel_display_types.h"
|
||||
#include "i915_gem_object.h"
|
||||
#include "i915_gem_panic.h"
|
||||
|
||||
|
|
@ -13,6 +12,8 @@ struct intel_panic {
|
|||
struct page **pages;
|
||||
int page;
|
||||
void *vaddr;
|
||||
|
||||
unsigned int (*tiling)(unsigned int x, unsigned int y, unsigned int width);
|
||||
};
|
||||
|
||||
static void i915_panic_kunmap(struct intel_panic *panic)
|
||||
|
|
@ -45,8 +46,8 @@ static struct page **i915_gem_object_panic_pages(struct drm_i915_gem_object *obj
|
|||
static void i915_gem_object_panic_map_set_pixel(struct drm_scanout_buffer *sb, unsigned int x,
|
||||
unsigned int y, u32 color)
|
||||
{
|
||||
struct intel_framebuffer *fb = (struct intel_framebuffer *)sb->private;
|
||||
unsigned int offset = fb->panic_tiling(sb->width, x, y);
|
||||
struct intel_panic *panic = sb->private;
|
||||
unsigned int offset = panic->tiling(sb->width, x, y);
|
||||
|
||||
iosys_map_wr(&sb->map[0], offset, u32, color);
|
||||
}
|
||||
|
|
@ -59,13 +60,12 @@ static void i915_gem_object_panic_map_set_pixel(struct drm_scanout_buffer *sb, u
|
|||
static void i915_gem_object_panic_page_set_pixel(struct drm_scanout_buffer *sb, unsigned int x,
|
||||
unsigned int y, u32 color)
|
||||
{
|
||||
struct intel_panic *panic = sb->private;
|
||||
unsigned int new_page;
|
||||
unsigned int offset;
|
||||
struct intel_framebuffer *fb = (struct intel_framebuffer *)sb->private;
|
||||
struct intel_panic *panic = fb->panic;
|
||||
|
||||
if (fb->panic_tiling)
|
||||
offset = fb->panic_tiling(sb->width, x, y);
|
||||
if (panic->tiling)
|
||||
offset = panic->tiling(sb->width, x, y);
|
||||
else
|
||||
offset = y * sb->pitch[0] + x * sb->format->cpp[0];
|
||||
|
||||
|
|
@ -98,14 +98,15 @@ static struct intel_panic *i915_gem_object_alloc_panic(void)
|
|||
* pfn is not supported yet.
|
||||
*/
|
||||
static int i915_gem_object_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *sb,
|
||||
struct drm_gem_object *_obj)
|
||||
struct drm_gem_object *_obj,
|
||||
unsigned int (*tiling)(unsigned int x, unsigned int y, unsigned int width))
|
||||
{
|
||||
struct intel_framebuffer *fb = sb->private;
|
||||
bool panic_tiling = fb->panic_tiling;
|
||||
enum i915_map_type has_type;
|
||||
struct drm_i915_gem_object *obj = to_intel_bo(_obj);
|
||||
void *ptr;
|
||||
|
||||
sb->private = panic;
|
||||
|
||||
ptr = page_unpack_bits(obj->mm.mapping, &has_type);
|
||||
if (ptr) {
|
||||
if (i915_gem_object_has_iomem(obj))
|
||||
|
|
@ -113,8 +114,10 @@ static int i915_gem_object_panic_setup(struct intel_panic *panic, struct drm_sca
|
|||
else
|
||||
iosys_map_set_vaddr(&sb->map[0], ptr);
|
||||
|
||||
if (panic_tiling)
|
||||
if (tiling) {
|
||||
panic->tiling = tiling;
|
||||
sb->set_pixel = i915_gem_object_panic_map_set_pixel;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (i915_gem_object_has_struct_page(obj)) {
|
||||
|
|
@ -122,6 +125,7 @@ static int i915_gem_object_panic_setup(struct intel_panic *panic, struct drm_sca
|
|||
if (!panic->pages)
|
||||
return -ENOMEM;
|
||||
panic->page = -1;
|
||||
panic->tiling = tiling;
|
||||
sb->set_pixel = i915_gem_object_panic_page_set_pixel;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include <drm/drm_panic.h>
|
||||
#include <drm/intel/display_parent_interface.h>
|
||||
|
||||
#include "intel_display_types.h"
|
||||
#include "xe_bo.h"
|
||||
#include "xe_panic.h"
|
||||
#include "xe_res_cursor.h"
|
||||
|
|
@ -17,6 +16,7 @@ struct intel_panic {
|
|||
int page;
|
||||
|
||||
struct xe_bo *bo;
|
||||
unsigned int (*tiling)(unsigned int x, unsigned int y, unsigned int width);
|
||||
};
|
||||
|
||||
static void xe_panic_kunmap(struct intel_panic *panic)
|
||||
|
|
@ -37,14 +37,13 @@ static void xe_panic_kunmap(struct intel_panic *panic)
|
|||
static void xe_panic_page_set_pixel(struct drm_scanout_buffer *sb, unsigned int x,
|
||||
unsigned int y, u32 color)
|
||||
{
|
||||
struct intel_framebuffer *fb = (struct intel_framebuffer *)sb->private;
|
||||
struct intel_panic *panic = fb->panic;
|
||||
struct intel_panic *panic = sb->private;
|
||||
struct xe_bo *bo = panic->bo;
|
||||
unsigned int new_page;
|
||||
unsigned int offset;
|
||||
|
||||
if (fb->panic_tiling)
|
||||
offset = fb->panic_tiling(sb->width, x, y);
|
||||
if (panic->tiling)
|
||||
offset = panic->tiling(sb->width, x, y);
|
||||
else
|
||||
offset = y * sb->pitch[0] + x * sb->format->cpp[0];
|
||||
|
||||
|
|
@ -86,7 +85,8 @@ static struct intel_panic *xe_panic_alloc(void)
|
|||
}
|
||||
|
||||
static int xe_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *sb,
|
||||
struct drm_gem_object *obj)
|
||||
struct drm_gem_object *obj,
|
||||
unsigned int (*tiling)(unsigned int x, unsigned int y, unsigned int width))
|
||||
{
|
||||
struct xe_bo *bo = gem_to_xe_bo(obj);
|
||||
|
||||
|
|
@ -95,8 +95,11 @@ static int xe_panic_setup(struct intel_panic *panic, struct drm_scanout_buffer *
|
|||
|
||||
panic->page = -1;
|
||||
panic->bo = bo;
|
||||
panic->tiling = tiling;
|
||||
|
||||
sb->private = panic;
|
||||
sb->set_pixel = xe_panic_page_set_pixel;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,8 @@ struct intel_display_overlay_interface {
|
|||
struct intel_display_panic_interface {
|
||||
struct intel_panic *(*alloc)(void);
|
||||
int (*setup)(struct intel_panic *panic, struct drm_scanout_buffer *sb,
|
||||
struct drm_gem_object *obj);
|
||||
struct drm_gem_object *obj,
|
||||
unsigned int (*tiling)(unsigned int x, unsigned int y, unsigned int width));
|
||||
void (*finish)(struct intel_panic *panic);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user