drm/i915/display: start a buffer object abstraction layer

The display code needs to deal with gem objects, and mostly uses struct
drm_i915_gem_object. That's not great, because for xe we need to
redefine it struct xe_bo during build.

Start a common interface using struct drm_gem_object, with separate
implementations for i915 and xe. For starters, convert i9xx_wm.c to use
it.

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/df6867523a0b5fdd4eb63f657f545603ae6f6e0b.1726589119.git.jani.nikula@intel.com
This commit is contained in:
Jani Nikula
2024-09-17 19:13:40 +03:00
parent dfecc2952e
commit 17cd58a8f1
8 changed files with 49 additions and 3 deletions

View File

@@ -225,6 +225,7 @@ i915-y += \
display/intel_atomic_plane.o \
display/intel_audio.o \
display/intel_bios.o \
display/intel_bo.o \
display/intel_bw.o \
display/intel_cdclk.o \
display/intel_color.o \

View File

@@ -7,6 +7,7 @@
#include "i915_reg.h"
#include "i9xx_wm.h"
#include "intel_atomic.h"
#include "intel_bo.h"
#include "intel_display.h"
#include "intel_display_trace.h"
#include "intel_fb.h"
@@ -2185,12 +2186,12 @@ static void i9xx_update_wm(struct drm_i915_private *dev_priv)
crtc = single_enabled_crtc(dev_priv);
if (IS_I915GM(dev_priv) && crtc) {
struct drm_i915_gem_object *obj;
struct drm_gem_object *obj;
obj = intel_fb_obj(crtc->base.primary->state->fb);
obj = intel_fb_bo(crtc->base.primary->state->fb);
/* self-refresh seems busted with untiled */
if (!i915_gem_object_is_tiled(obj))
if (!intel_bo_is_tiled(obj))
crtc = NULL;
}

View File

@@ -0,0 +1,10 @@
// SPDX-License-Identifier: MIT
/* Copyright © 2024 Intel Corporation */
#include "gem/i915_gem_object.h"
#include "intel_bo.h"
bool intel_bo_is_tiled(struct drm_gem_object *obj)
{
return i915_gem_object_is_tiled(to_intel_bo(obj));
}

View File

@@ -0,0 +1,13 @@
/* SPDX-License-Identifier: MIT */
/* Copyright © 2024 Intel Corporation */
#ifndef __INTEL_BO__
#define __INTEL_BO__
#include <linux/types.h>
struct drm_gem_object;
bool intel_bo_is_tiled(struct drm_gem_object *obj);
#endif /* __INTEL_BO__ */

View File

@@ -2125,3 +2125,8 @@ struct drm_i915_gem_object *intel_fb_obj(const struct drm_framebuffer *fb)
{
return fb ? to_intel_bo(fb->obj[0]) : NULL;
}
struct drm_gem_object *intel_fb_bo(const struct drm_framebuffer *fb)
{
return fb ? fb->obj[0] : NULL;
}

View File

@@ -12,6 +12,7 @@
struct drm_device;
struct drm_file;
struct drm_framebuffer;
struct drm_gem_object;
struct drm_i915_gem_object;
struct drm_i915_private;
struct drm_mode_fb_cmd2;
@@ -98,4 +99,6 @@ unsigned int intel_fb_modifier_to_tiling(u64 fb_modifier);
struct drm_i915_gem_object *intel_fb_obj(const struct drm_framebuffer *fb);
struct drm_gem_object *intel_fb_bo(const struct drm_framebuffer *fb);
#endif /* __INTEL_FB_H__ */

View File

@@ -165,6 +165,7 @@ $(obj)/i915-display/%.o: $(srctree)/drivers/gpu/drm/i915/display/%.c FORCE
xe-$(CONFIG_DRM_XE_DISPLAY) += \
display/ext/i915_irq.o \
display/ext/i915_utils.o \
display/intel_bo.o \
display/intel_fb_bo.o \
display/intel_fbdev_fb.o \
display/xe_display.o \

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: MIT
/* Copyright © 2024 Intel Corporation */
#include <drm/drm_gem.h>
#include "intel_bo.h"
bool intel_bo_is_tiled(struct drm_gem_object *obj)
{
/* legacy tiling is unused */
return false;
}