sna: Add fault-injection for cursor ioctls

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson
2015-12-20 18:37:38 +00:00
parent 2788914ea6
commit ec92e2584f

View File

@@ -90,6 +90,8 @@ void *alloca(size_t);
#include <memcheck.h>
#endif
#define FAIL_CURSOR_IOCTL 0
#define COLDPLUG_DELAY_MS 2000
/* Minor discrepancy between 32-bit/64-bit ABI in old kernels */
@@ -5729,7 +5731,8 @@ sna_show_cursors(ScrnInfoPtr scrn)
arg.width = arg.height = cursor->size;
arg.handle = cursor->handle;
if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_CURSOR, &arg) == 0) {
if (!FAIL_CURSOR_IOCTL &&
drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_CURSOR, &arg) == 0) {
if (sna_crtc->cursor) {
assert(sna_crtc->cursor->ref > 0);
sna_crtc->cursor->ref--;
@@ -5955,7 +5958,8 @@ disable:
if (arg.flags == 0)
continue;
if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_CURSOR, &arg) == 0) {
if (!FAIL_CURSOR_IOCTL &&
drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_CURSOR, &arg) == 0) {
if (arg.flags & DRM_MODE_CURSOR_BO) {
if (sna_crtc->cursor) {
assert(sna_crtc->cursor->ref > 0);