mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-25 00:52:45 -04:00
drm/i915: hide mkwrite_device_info() better
The goal has been to just make device info a pointer to static const data, i.e. the static const structs in i915_pci.c. See [1]. However, there were issues with intel_device_info_runtime_init() clearing the display sub-struct of device info on the !HAS_DISPLAY() path, which consequently disables a lot of display functionality, like it should. Looks like we'd have to cover all those paths, and maybe sprinkle HAS_DISPLAY() checks in them, which we haven't gotten around to. In the mean time, hide mkwrite_device_info() better within intel_device_info.c by adding a intel_device_info_driver_create() for the very early initialization of the device info and initial runtime info. This also lets us declutter i915_drv.h a bit, and stops promoting mkwrite_device_info() as something that could be used. [1] https://lore.kernel.org/r/a0422f0a8ac055f65b7922bcd3119b180a41e79e.1655712106.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230411105643.292416-1-jani.nikula@intel.com
This commit is contained in:
@@ -381,6 +381,13 @@ void intel_device_info_runtime_init_early(struct drm_i915_private *i915)
|
||||
intel_device_info_subplatform_init(i915);
|
||||
}
|
||||
|
||||
/* FIXME: Remove this, and make device info a const pointer to rodata. */
|
||||
static struct intel_device_info *
|
||||
mkwrite_device_info(struct drm_i915_private *i915)
|
||||
{
|
||||
return (struct intel_device_info *)INTEL_INFO(i915);
|
||||
}
|
||||
|
||||
/**
|
||||
* intel_device_info_runtime_init - initialize runtime info
|
||||
* @dev_priv: the i915 device
|
||||
@@ -548,6 +555,28 @@ void intel_device_info_runtime_init(struct drm_i915_private *dev_priv)
|
||||
dev_priv->drm.driver_features &= ~DRIVER_ATOMIC;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up device info and initial runtime info at driver create.
|
||||
*
|
||||
* Note: i915 is only an allocated blob of memory at this point.
|
||||
*/
|
||||
void intel_device_info_driver_create(struct drm_i915_private *i915,
|
||||
u16 device_id,
|
||||
const struct intel_device_info *match_info)
|
||||
{
|
||||
struct intel_device_info *info;
|
||||
struct intel_runtime_info *runtime;
|
||||
|
||||
/* Setup the write-once "constant" device info */
|
||||
info = mkwrite_device_info(i915);
|
||||
memcpy(info, match_info, sizeof(*info));
|
||||
|
||||
/* Initialize initial runtime info from static const data and pdev. */
|
||||
runtime = RUNTIME_INFO(i915);
|
||||
memcpy(runtime, &INTEL_INFO(i915)->__runtime, sizeof(*runtime));
|
||||
runtime->device_id = device_id;
|
||||
}
|
||||
|
||||
void intel_driver_caps_print(const struct intel_driver_caps *caps,
|
||||
struct drm_printer *p)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user