Commit 481827b4 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Record logical context support in driver caps

Avoid looking at the magical engines[RCS] to decide if the HW and driver
supports logical contexts, and instead record that knowledge during
initialisation.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180706101442.21279-1-chris@chris-wilson.co.uk
parent b79ebe74
...@@ -2306,6 +2306,7 @@ intel_info(const struct drm_i915_private *dev_priv) ...@@ -2306,6 +2306,7 @@ intel_info(const struct drm_i915_private *dev_priv)
} }
#define INTEL_INFO(dev_priv) intel_info((dev_priv)) #define INTEL_INFO(dev_priv) intel_info((dev_priv))
#define DRIVER_CAPS(dev_priv) (&(dev_priv)->caps)
#define INTEL_GEN(dev_priv) ((dev_priv)->info.gen) #define INTEL_GEN(dev_priv) ((dev_priv)->info.gen)
#define INTEL_DEVID(dev_priv) ((dev_priv)->info.device_id) #define INTEL_DEVID(dev_priv) ((dev_priv)->info.device_id)
......
...@@ -512,8 +512,8 @@ int i915_gem_contexts_init(struct drm_i915_private *dev_priv) ...@@ -512,8 +512,8 @@ int i915_gem_contexts_init(struct drm_i915_private *dev_priv)
} }
DRM_DEBUG_DRIVER("%s context support initialized\n", DRM_DEBUG_DRIVER("%s context support initialized\n",
dev_priv->engine[RCS]->context_size ? "logical" : DRIVER_CAPS(dev_priv)->has_logical_contexts ?
"fake"); "logical" : "fake");
return 0; return 0;
} }
...@@ -720,7 +720,7 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, ...@@ -720,7 +720,7 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
struct i915_gem_context *ctx; struct i915_gem_context *ctx;
int ret; int ret;
if (!dev_priv->engine[RCS]->context_size) if (!DRIVER_CAPS(dev_priv)->has_logical_contexts)
return -ENODEV; return -ENODEV;
if (args->pad != 0) if (args->pad != 0)
......
...@@ -858,6 +858,8 @@ void intel_device_info_runtime_init(struct intel_device_info *info) ...@@ -858,6 +858,8 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
void intel_driver_caps_print(const struct intel_driver_caps *caps, void intel_driver_caps_print(const struct intel_driver_caps *caps,
struct drm_printer *p) struct drm_printer *p)
{ {
drm_printf(p, "Has logical contexts? %s\n",
yesno(caps->has_logical_contexts));
drm_printf(p, "scheduler: %x\n", caps->scheduler); drm_printf(p, "scheduler: %x\n", caps->scheduler);
} }
......
...@@ -186,6 +186,7 @@ struct intel_device_info { ...@@ -186,6 +186,7 @@ struct intel_device_info {
struct intel_driver_caps { struct intel_driver_caps {
unsigned int scheduler; unsigned int scheduler;
bool has_logical_contexts:1;
}; };
static inline unsigned int sseu_subslice_total(const struct sseu_dev_info *sseu) static inline unsigned int sseu_subslice_total(const struct sseu_dev_info *sseu)
......
...@@ -302,6 +302,8 @@ intel_engine_setup(struct drm_i915_private *dev_priv, ...@@ -302,6 +302,8 @@ intel_engine_setup(struct drm_i915_private *dev_priv,
engine->class); engine->class);
if (WARN_ON(engine->context_size > BIT(20))) if (WARN_ON(engine->context_size > BIT(20)))
engine->context_size = 0; engine->context_size = 0;
if (engine->context_size)
DRIVER_CAPS(dev_priv)->has_logical_contexts = true;
/* Nothing to do here, execute in order of dependencies */ /* Nothing to do here, execute in order of dependencies */
engine->schedule = NULL; engine->schedule = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment