aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_drv.h
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2012-06-04 17:42:42 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-06-14 11:36:16 -0400
commit254f965c39e3918544395f4ebac8c589d890bae6 (patch)
tree84006b2ad284d07cb1fc57e9eda7ead98bc93f11 /drivers/gpu/drm/i915/i915_drv.h
parentfe1cc68fcb11ca14f420068d1806eb5e719ac772 (diff)
drm/i915: preliminary context support
Very basic code for context setup/destruction in the driver. Adds the file i915_gem_context.c This file implements HW context support. On gen5+ a HW context consists of an opaque GPU object which is referenced at times of context saves and restores. With RC6 enabled, the context is also referenced as the GPU enters and exists from RC6 (GPU has it's own internal power context, except on gen5). Though something like a context does exist for the media ring, the code only supports contexts for the render ring. In software, there is a distinction between contexts created by the user, and the default HW context. The default HW context is used by GPU clients that do not request setup of their own hardware context. The default context's state is never restored to help prevent programming errors. This would happen if a client ran and piggy-backed off another clients GPU state. The default context only exists to give the GPU some offset to load as the current to invoke a save of the context we actually care about. In fact, the code could likely be constructed, albeit in a more complicated fashion, to never use the default context, though that limits the driver's ability to swap out, and/or destroy other contexts. All other contexts are created as a request by the GPU client. These contexts store GPU state, and thus allow GPU clients to not re-emit state (and potentially query certain state) at any time. The kernel driver makes certain that the appropriate commands are inserted. There are 4 entry points into the contexts, init, fini, open, close. The names are self-explanatory except that init can be called during reset, and also during pm thaw/resume. As we expect our context to be preserved across these events, we do not reinitialize in this case. As Adam Jackson pointed out, The cutoff of 1MB where a HW context is considered too big is arbitrary. The reason for this is even though context sizes are increasing with every generation, they have yet to eclipse even 32k. If we somehow read back way more than that, it probably means BIOS has done something strange, or we're running on a platform that wasn't designed for this. v2: rename load/unload to init/fini (daniel) remove ILK support for get_size() (indirectly daniel) add HAS_HW_CONTEXTS macro to clarify supported platforms (daniel) added comments (Ben) Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.h')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index ae4129b3cb3e..8d02951b988b 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -821,6 +821,8 @@ typedef struct drm_i915_private {
821 struct drm_property *force_audio_property; 821 struct drm_property *force_audio_property;
822 822
823 struct work_struct parity_error_work; 823 struct work_struct parity_error_work;
824 bool hw_contexts_disabled;
825 uint32_t hw_context_size;
824} drm_i915_private_t; 826} drm_i915_private_t;
825 827
826/* Iterate over initialised rings */ 828/* Iterate over initialised rings */
@@ -1075,6 +1077,7 @@ struct drm_i915_file_private {
1075#define HAS_LLC(dev) (INTEL_INFO(dev)->has_llc) 1077#define HAS_LLC(dev) (INTEL_INFO(dev)->has_llc)
1076#define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws) 1078#define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws)
1077 1079
1080#define HAS_HW_CONTEXTS(dev) (INTEL_INFO(dev)->gen >= 6)
1078#define HAS_ALIASING_PPGTT(dev) (INTEL_INFO(dev)->gen >=6) 1081#define HAS_ALIASING_PPGTT(dev) (INTEL_INFO(dev)->gen >=6)
1079 1082
1080#define HAS_OVERLAY(dev) (INTEL_INFO(dev)->has_overlay) 1083#define HAS_OVERLAY(dev) (INTEL_INFO(dev)->has_overlay)
@@ -1363,6 +1366,11 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev,
1363struct dma_buf *i915_gem_prime_export(struct drm_device *dev, 1366struct dma_buf *i915_gem_prime_export(struct drm_device *dev,
1364 struct drm_gem_object *gem_obj, int flags); 1367 struct drm_gem_object *gem_obj, int flags);
1365 1368
1369/* i915_gem_context.c */
1370void i915_gem_context_init(struct drm_device *dev);
1371void i915_gem_context_fini(struct drm_device *dev);
1372void i915_gem_context_open(struct drm_device *dev, struct drm_file *file);
1373void i915_gem_context_close(struct drm_device *dev, struct drm_file *file);
1366 1374
1367/* i915_gem_gtt.c */ 1375/* i915_gem_gtt.c */
1368int __must_check i915_gem_init_aliasing_ppgtt(struct drm_device *dev); 1376int __must_check i915_gem_init_aliasing_ppgtt(struct drm_device *dev);