drm/i915: Move the invalidate|flush information out of the device struct
... and into a local structure scoped for the single function in which it is used. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Родитель
13b2928933
Коммит
0f8c6d7ca9
|
@ -642,8 +642,6 @@ typedef struct drm_i915_private {
|
||||||
/* storage for physical objects */
|
/* storage for physical objects */
|
||||||
struct drm_i915_gem_phys_object *phys_objs[I915_MAX_PHYS_OBJECT];
|
struct drm_i915_gem_phys_object *phys_objs[I915_MAX_PHYS_OBJECT];
|
||||||
|
|
||||||
uint32_t flush_rings;
|
|
||||||
|
|
||||||
/* accounting, useful for userland debugging */
|
/* accounting, useful for userland debugging */
|
||||||
size_t object_memory;
|
size_t object_memory;
|
||||||
size_t pin_memory;
|
size_t pin_memory;
|
||||||
|
|
|
@ -36,6 +36,12 @@
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
#include <linux/intel-gtt.h>
|
#include <linux/intel-gtt.h>
|
||||||
|
|
||||||
|
struct change_domains {
|
||||||
|
uint32_t invalidate_domains;
|
||||||
|
uint32_t flush_domains;
|
||||||
|
uint32_t flush_rings;
|
||||||
|
};
|
||||||
|
|
||||||
static uint32_t i915_gem_get_gtt_alignment(struct drm_i915_gem_object *obj_priv);
|
static uint32_t i915_gem_get_gtt_alignment(struct drm_i915_gem_object *obj_priv);
|
||||||
static uint32_t i915_gem_get_gtt_size(struct drm_i915_gem_object *obj_priv);
|
static uint32_t i915_gem_get_gtt_size(struct drm_i915_gem_object *obj_priv);
|
||||||
|
|
||||||
|
@ -3167,10 +3173,9 @@ i915_gem_object_set_to_cpu_domain(struct drm_gem_object *obj, int write)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj,
|
i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj,
|
||||||
struct intel_ring_buffer *ring)
|
struct intel_ring_buffer *ring,
|
||||||
|
struct change_domains *cd)
|
||||||
{
|
{
|
||||||
struct drm_device *dev = obj->dev;
|
|
||||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
|
||||||
struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
|
struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
|
||||||
uint32_t invalidate_domains = 0;
|
uint32_t invalidate_domains = 0;
|
||||||
uint32_t flush_domains = 0;
|
uint32_t flush_domains = 0;
|
||||||
|
@ -3216,12 +3221,12 @@ i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj,
|
||||||
if (flush_domains == 0 && obj->pending_write_domain == 0)
|
if (flush_domains == 0 && obj->pending_write_domain == 0)
|
||||||
obj->pending_write_domain = obj->write_domain;
|
obj->pending_write_domain = obj->write_domain;
|
||||||
|
|
||||||
dev->invalidate_domains |= invalidate_domains;
|
cd->invalidate_domains |= invalidate_domains;
|
||||||
dev->flush_domains |= flush_domains;
|
cd->flush_domains |= flush_domains;
|
||||||
if (flush_domains & I915_GEM_GPU_DOMAINS)
|
if (flush_domains & I915_GEM_GPU_DOMAINS)
|
||||||
dev_priv->mm.flush_rings |= obj_priv->ring->id;
|
cd->flush_rings |= obj_priv->ring->id;
|
||||||
if (invalidate_domains & I915_GEM_GPU_DOMAINS)
|
if (invalidate_domains & I915_GEM_GPU_DOMAINS)
|
||||||
dev_priv->mm.flush_rings |= ring->id;
|
cd->flush_rings |= ring->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3590,30 +3595,26 @@ i915_gem_execbuffer_move_to_gpu(struct drm_device *dev,
|
||||||
struct drm_gem_object **objects,
|
struct drm_gem_object **objects,
|
||||||
int count)
|
int count)
|
||||||
{
|
{
|
||||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
struct change_domains cd;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
/* Zero the global flush/invalidate flags. These
|
cd.invalidate_domains = 0;
|
||||||
* will be modified as new domains are computed
|
cd.flush_domains = 0;
|
||||||
* for each object
|
cd.flush_rings = 0;
|
||||||
*/
|
|
||||||
dev->invalidate_domains = 0;
|
|
||||||
dev->flush_domains = 0;
|
|
||||||
dev_priv->mm.flush_rings = 0;
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
i915_gem_object_set_to_gpu_domain(objects[i], ring);
|
i915_gem_object_set_to_gpu_domain(objects[i], ring, &cd);
|
||||||
|
|
||||||
if (dev->invalidate_domains | dev->flush_domains) {
|
if (cd.invalidate_domains | cd.flush_domains) {
|
||||||
#if WATCH_EXEC
|
#if WATCH_EXEC
|
||||||
DRM_INFO("%s: invalidate_domains %08x flush_domains %08x\n",
|
DRM_INFO("%s: invalidate_domains %08x flush_domains %08x\n",
|
||||||
__func__,
|
__func__,
|
||||||
dev->invalidate_domains,
|
cd.invalidate_domains,
|
||||||
dev->flush_domains);
|
cd.flush_domains);
|
||||||
#endif
|
#endif
|
||||||
i915_gem_flush(dev, file,
|
i915_gem_flush(dev, file,
|
||||||
dev->invalidate_domains,
|
cd.invalidate_domains,
|
||||||
dev->flush_domains,
|
cd.flush_domains,
|
||||||
dev_priv->mm.flush_rings);
|
cd.flush_rings);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
|
|
|
@ -1041,8 +1041,6 @@ struct drm_device {
|
||||||
/*@{ */
|
/*@{ */
|
||||||
spinlock_t object_name_lock;
|
spinlock_t object_name_lock;
|
||||||
struct idr object_name_idr;
|
struct idr object_name_idr;
|
||||||
uint32_t invalidate_domains; /* domains pending invalidation */
|
|
||||||
uint32_t flush_domains; /* domains pending flush */
|
|
||||||
/*@} */
|
/*@} */
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче