diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-03-24 21:05:58 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-03-24 21:05:58 +0000 |
commit | d377fd3d11a6ed29f8bce9e7b05a8db82e33764e (patch) | |
tree | 385917cb5659b49524c09c42b0db84d64e8b97df /src | |
parent | 019402f8ca670234908df00f52650d2173a5011a (diff) |
sna: Detect Y-tiled scanout feature
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/kgem.c | 29 | ||||
-rw-r--r-- | src/sna/kgem.h | 1 | ||||
-rw-r--r-- | src/sna/sna_present.c | 1 |
3 files changed, 31 insertions, 0 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 6f16cbac..83c75108 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -84,6 +84,7 @@ search_snoop_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags); #define DBG_NO_HANDLE_LUT 0 #define DBG_NO_WT 0 #define DBG_NO_WC_MMAP 0 +#define DBG_NO_SCANOUT_Y 0 #define DBG_DUMP 0 #define DBG_NO_MALLOC_CACHE 0 @@ -1231,6 +1232,30 @@ static bool test_has_create2(struct kgem *kgem) #endif } +static bool test_can_scanout_y(struct kgem *kgem) +{ + struct drm_mode_fb_cmd arg; + bool ret = false; + + if (DBG_NO_SCANOUT_Y) + return false; + + VG_CLEAR(arg); + arg.width = 32; + arg.height = 32; + arg.pitch = 4*32; + arg.bpp = 32; + arg.depth = 24; + arg.handle = gem_create(kgem->fd, 1); + + if (gem_set_tiling(kgem->fd, arg.handle, I915_TILING_Y, arg.pitch)) + ret = do_ioctl(kgem->fd, DRM_IOCTL_MODE_ADDFB, &arg) == 0; + do_ioctl(kgem->fd, DRM_IOCTL_MODE_RMFB, &arg.fb_id); + gem_close(kgem->fd, arg.handle); + + return ret; +} + static bool test_has_secure_batches(struct kgem *kgem) { if (DBG_NO_SECURE_BATCHES) @@ -1604,6 +1629,10 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, unsigned gen) DBG(("%s: can render to Y-tiled surfaces? %d\n", __FUNCTION__, kgem->can_render_y)); + kgem->can_scanout_y = test_can_scanout_y(kgem); + DBG(("%s: can render to Y-tiled surfaces? %d\n", __FUNCTION__, + kgem->can_scanout_y)); + kgem->has_secure_batches = test_has_secure_batches(kgem); DBG(("%s: can use privileged batchbuffers? %d\n", __FUNCTION__, kgem->has_secure_batches)); diff --git a/src/sna/kgem.h b/src/sna/kgem.h index f98d3b6d..51072e29 100644 --- a/src/sna/kgem.h +++ b/src/sna/kgem.h @@ -190,6 +190,7 @@ struct kgem { uint32_t can_blt_cpu :1; uint32_t can_render_y :1; + uint32_t can_scanout_y :1; uint16_t fence_max; uint16_t half_cpu_cache_pages; diff --git a/src/sna/sna_present.c b/src/sna/sna_present.c index 836c89d7..d6638db3 100644 --- a/src/sna/sna_present.c +++ b/src/sna/sna_present.c @@ -583,6 +583,7 @@ get_flip_bo(PixmapPtr pixmap) } if (priv->gpu_bo->tiling == I915_TILING_Y && + !sna->kgem.can_scanout_y && !sna_pixmap_change_tiling(pixmap, I915_TILING_X)) { DBG(("%s: invalid Y-tiling, cannot convert\n", __FUNCTION__)); return NULL; |