sna: Be more lenient wrt switching rings if the kernel supports semaphores
If the kernel uses GPU semaphores for its coherency mechanism between rings rather than CPU waits, allow the ring to be chosen on the basis of the subsequent operation following a submission of batch. (However, since batches are likely to be submitted in the middle of a draw, then the likelihood is for ddx to remain on one ring until forced to switch for an operation or idle, which is the same situation as before and so the difference is miniscule.) Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
295a22d270
commit
b64751dbdb
|
|
@ -85,6 +85,7 @@ static inline void list_replace(struct list *old,
|
|||
#define DBG_NO_HW 0
|
||||
#define DBG_NO_TILING 0
|
||||
#define DBG_NO_VMAP 0
|
||||
#define DBG_NO_SEMAPHORES 0
|
||||
#define DBG_NO_MADV 0
|
||||
#define DBG_NO_MAP_UPLOAD 0
|
||||
#define DBG_NO_RELAXED_FENCING 0
|
||||
|
|
@ -531,6 +532,25 @@ static int gem_param(struct kgem *kgem, int name)
|
|||
return v;
|
||||
}
|
||||
|
||||
static bool semaphores_enabled(void)
|
||||
{
|
||||
FILE *file;
|
||||
bool detected = false;
|
||||
|
||||
if (DBG_NO_SEMAPHORES)
|
||||
return false;
|
||||
|
||||
file = fopen("/sys/module/i915/parameters/semaphores", "r");
|
||||
if (file) {
|
||||
int value;
|
||||
if (fscanf(file, "%d", &value) == 1)
|
||||
detected = value > 0;
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
return detected;
|
||||
}
|
||||
|
||||
void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
|
||||
{
|
||||
struct drm_i915_gem_get_aperture aperture;
|
||||
|
|
@ -579,9 +599,15 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
|
|||
}
|
||||
} else
|
||||
kgem->has_relaxed_fencing = 1;
|
||||
DBG(("%s: has relaxed fencing=%d\n", __FUNCTION__,
|
||||
DBG(("%s: has relaxed fencing? %d\n", __FUNCTION__,
|
||||
kgem->has_relaxed_fencing));
|
||||
|
||||
kgem->has_semaphores = false;
|
||||
if (gen >= 60 && semaphores_enabled())
|
||||
kgem->has_semaphores = true;
|
||||
DBG(("%s: semaphores enabled? %d\n", __FUNCTION__,
|
||||
kgem->has_semaphores));
|
||||
|
||||
VG_CLEAR(aperture);
|
||||
aperture.aper_size = 64*1024*1024;
|
||||
(void)drmIoctl(fd, DRM_IOCTL_I915_GEM_GET_APERTURE, &aperture);
|
||||
|
|
@ -1380,6 +1406,8 @@ void kgem_reset(struct kgem *kgem)
|
|||
kgem->nbatch = 0;
|
||||
kgem->surface = kgem->max_batch_size;
|
||||
kgem->mode = KGEM_NONE;
|
||||
if (kgem->has_semaphores)
|
||||
kgem->ring = KGEM_NONE;
|
||||
kgem->flush = 0;
|
||||
kgem->scanout = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ struct kgem {
|
|||
|
||||
uint32_t has_vmap :1;
|
||||
uint32_t has_relaxed_fencing :1;
|
||||
uint32_t has_semaphores :1;
|
||||
|
||||
uint16_t fence_max;
|
||||
uint16_t half_cpu_cache_pages;
|
||||
|
|
|
|||
Loading…
Reference in New Issue