xf86-video-intel: 3 commits - src/sna/kgem.c src/sna/sna_display.c src/sna/sna_dri2.c
Chris Wilson
ickle at kemper.freedesktop.org
Mon Jun 1 03:02:58 PDT 2015
src/sna/kgem.c | 3 ++-
src/sna/sna_display.c | 16 ++++++++++++++--
src/sna/sna_dri2.c | 28 +++++++++++++++++-----------
3 files changed, 33 insertions(+), 14 deletions(-)
New commits:
commit d1bf75f155f87d3a14d647316a0ba1f40d3957a6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Jun 1 08:56:43 2015 +0000
sna: Compilation fixes for stable distros
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index c3b848d..0d21f31 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -140,6 +140,7 @@ search_snoop_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags);
#define LOCAL_I915_PARAM_HAS_WT 27
#define LOCAL_I915_PARAM_MMAP_VERSION 30
+#define LOCAL_I915_EXEC_BLT (2<<0)
#define LOCAL_I915_EXEC_IS_PINNED (1<<10)
#define LOCAL_I915_EXEC_NO_RELOC (1<<11)
#define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)
@@ -1399,7 +1400,7 @@ static bool test_can_blt_y(struct kgem *kgem)
memset(&execbuf, 0, sizeof(execbuf));
execbuf.buffers_ptr = (uintptr_t)&object;
execbuf.buffer_count = 1;
- execbuf.flags = I915_EXEC_BLT;
+ execbuf.flags = LOCAL_I915_EXEC_BLT;
ret = do_ioctl(kgem->fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 6ef07a9..b313100 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -5216,11 +5216,23 @@ static inline void sigio_unblock(int was_blocked)
}
#endif
+static void enable_fb_access(ScrnInfoPtr scrn, int state)
+{
+ scrn->EnableDisableFBAccess(
+#ifdef XF86_HAS_SCRN_CONV
+ scrn,
+#else
+ scrn->scrnIndex,
+#endif
+ state);
+}
+
+
static void __restore_swcursor(ScrnInfoPtr scrn)
{
DBG(("%s: attempting to restore SW cursor\n", __FUNCTION__));
- scrn->EnableDisableFBAccess(scrn, FALSE);
- scrn->EnableDisableFBAccess(scrn, TRUE);
+ enable_fb_access(scrn, FALSE);
+ enable_fb_access(scrn, TRUE);
RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr)__restore_swcursor,
(WakeupHandlerProcPtr)NoopDDA,
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 3611270..cc01ba6 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -155,6 +155,20 @@ struct sna_dri2_event {
static void sna_dri2_flip_event(struct sna_dri2_event *flip);
inline static DRI2BufferPtr dri2_window_get_front(WindowPtr win);
+static struct kgem_bo *
+__sna_dri2_copy_region(struct sna *sna, DrawablePtr draw, RegionPtr region,
+ DRI2BufferPtr src, DRI2BufferPtr dst,
+ unsigned flags);
+
+inline static void
+__sna_dri2_copy_event(struct sna_dri2_event *info, unsigned flags)
+{
+ info->bo = __sna_dri2_copy_region(info->sna, info->draw, NULL,
+ info->back, info->front,
+ flags);
+ info->front->flags = info->back->flags;
+}
+
static int front_pitch(DrawablePtr draw)
{
DRI2BufferPtr buffer;
@@ -314,6 +328,7 @@ inline static DRI2BufferPtr dri2_window_get_front(WindowPtr win)
}
#else
inline static void *dri2_window_get_front(WindowPtr win) { return NULL; }
+#define APPLY_DAMAGE 0
#endif
#if DRI2INFOREC_VERSION < 6
@@ -537,7 +552,7 @@ sna_dri2_create_buffer(DrawablePtr draw,
if (draw->type != DRAWABLE_PIXMAP)
buffer = dri2_window_get_front((WindowPtr)draw);
if (buffer == NULL)
- buffer = sna_pixmap_get_buffer(pixmap);
+ buffer = (DRI2Buffer2Ptr)sna_pixmap_get_buffer(pixmap);
if (buffer) {
private = get_private(buffer);
@@ -1231,15 +1246,6 @@ __sna_dri2_copy_region(struct sna *sna, DrawablePtr draw, RegionPtr region,
return bo;
}
-inline static void
-__sna_dri2_copy_event(struct sna_dri2_event *info, unsigned flags)
-{
- info->bo = __sna_dri2_copy_region(info->sna, info->draw, NULL,
- info->back, info->front,
- flags);
- info->front->flags = info->back->flags;
-}
-
static void
sna_dri2_copy_region(DrawablePtr draw,
RegionPtr region,
@@ -1727,7 +1733,7 @@ can_flip(struct sna * sna,
if (sna_pixmap_get_buffer(pixmap) != front) {
DBG(("%s: no, DRI2 drawable is no longer attached (old name=%d, new name=%d) to pixmap=%ld\n",
__FUNCTION__, front->name,
- sna_pixmap_get_buffer(pixmap) ? ((DRI2BufferPtr)sna_pixmap_get_buffer(pixmap))->name : 0,
+ sna_pixmap_get_buffer(pixmap) ? sna_pixmap_get_buffer(pixmap)->name : 0,
pixmap->drawable.serialNumber));
return false;
}
commit 7a371f6befb2e49acbaf59c7adec3bcbbfa32622
Merge: c87e806 b792b2c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Jun 1 08:50:31 2015 +0000
Merge branch 'master' of 192.168.1.213:/usr/src/xf86-video-intel
commit c87e80637a077e76b6d354f8976c93f9bceafcbb
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Apr 15 08:31:35 2015 +0100
sna: Use addfb2.1 for extended scanout support
If at first you don't success, try, try again.
The kernel API is lame and requires a new interface for something that
is designed to be supported through the old inteface...
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 952f249..05fe407 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1262,6 +1262,32 @@ static bool test_can_scanout_y(struct kgem *kgem)
if (gem_set_tiling(kgem->fd, arg.handle, I915_TILING_Y, arg.pitch))
ret = do_ioctl(kgem->fd, DRM_IOCTL_MODE_ADDFB, &arg) == 0;
+ if (!ret) {
+ struct local_mode_fb_cmd2 {
+ uint32_t fb_id;
+ uint32_t width, height;
+ uint32_t pixel_format;
+ uint32_t flags;
+
+ uint32_t handles[4];
+ uint32_t pitches[4];
+ uint32_t offsets[4];
+ uint64_t modifiers[4];
+ } f;
+#define LOCAL_IOCTL_MODE_ADDFB2 DRM_IOWR(0xb8, struct local_mode_fb_cmd2)
+ memset(&f, 0, sizeof(f));
+ f.width = arg.width;
+ f.height = arg.height;
+ f.handles[0] = arg.handle;
+ f.pitches[0] = arg.pitch;
+ f.modifiers[0] = (uint64_t)1 << 56 | 2; /* MOD_Y_TILED */
+ f.pixel_format = 'X' | 'R' << 8 | '2' << 16 | '4' << 24; /* XRGB8888 */
+ f.flags = 1 << 1; /* + modifier */
+ if (drmIoctl(kgem->fd, LOCAL_IOCTL_MODE_ADDFB2, &f) == 0) {
+ ret = true;
+ arg.fb_id = f.fb_id;
+ }
+ }
do_ioctl(kgem->fd, DRM_IOCTL_MODE_RMFB, &arg.fb_id);
gem_close(kgem->fd, arg.handle);
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index c842d9a..6b2c3ef 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -442,6 +442,7 @@ static unsigned get_fb(struct sna *sna, struct kgem_bo *bo,
assert(bo->tiling != I915_TILING_Y || sna->kgem.can_scanout_y);
assert((bo->pitch & 63) == 0);
+ assert(scrn->vtSema); /* must be master */
VG_CLEAR(arg);
arg.width = width;
@@ -451,21 +452,83 @@ static unsigned get_fb(struct sna *sna, struct kgem_bo *bo,
arg.depth = scrn->depth;
arg.handle = bo->handle;
- assert(sna->scrn->vtSema); /* must be master */
if (drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_ADDFB, &arg)) {
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
- "%s: failed to add fb: %dx%d depth=%d, bpp=%d, pitch=%d: %d\n",
- __FUNCTION__, width, height,
- scrn->depth, scrn->bitsPerPixel, bo->pitch, errno);
- return 0;
+ /* Try again with the fancy version */
+ struct local_mode_fb_cmd2 {
+ uint32_t fb_id;
+ uint32_t width, height;
+ uint32_t pixel_format;
+ uint32_t flags;
+
+ uint32_t handles[4];
+ uint32_t pitches[4]; /* pitch for each plane */
+ uint32_t offsets[4]; /* offset of each plane */
+ uint64_t modifiers[4];
+ } f;
+#define LOCAL_IOCTL_MODE_ADDFB2 DRM_IOWR(0xb8, struct local_mode_fb_cmd2)
+ memset(&f, 0, sizeof(f));
+ f.width = width;
+ f.height = height;
+ /* XXX interlaced */
+ f.flags = 1 << 1; /* +modifiers */
+ f.handles[0] = bo->handle;
+ f.pitches[0] = bo->pitch;
+
+ switch (bo->tiling) {
+ case I915_TILING_NONE:
+ break;
+ case I915_TILING_X:
+ /* I915_FORMAT_MOD_X_TILED */
+ f.modifiers[0] = (uint64_t)1 << 56 | 1;
+ break;
+ case I915_TILING_Y:
+ /* I915_FORMAT_MOD_X_TILED */
+ f.modifiers[0] = (uint64_t)1 << 56 | 2;
+ break;
+ }
+
+#define fourcc(a,b,c,d) ((a) | (b) << 8 | (c) << 16 | (d) << 24)
+ switch (scrn->depth) {
+ default:
+ ERR(("%s: unhandled screen format, depth=%d\n",
+ __FUNCTION__, scrn->depth));
+ goto fail;
+ case 8:
+ f.pixel_format = fourcc('C', '8', ' ', ' ');
+ break;
+ case 15:
+ f.pixel_format = fourcc('X', 'R', '1', '5');
+ break;
+ case 16:
+ f.pixel_format = fourcc('R', 'G', '1', '6');
+ break;
+ case 24:
+ f.pixel_format = fourcc('X', 'R', '2', '4');
+ break;
+ case 30:
+ f.pixel_format = fourcc('X', 'R', '3', '0');
+ break;
+ }
+#undef fourcc
+
+ if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_ADDFB2, &f)) {
+fail:
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+ "%s: failed to add fb: %dx%d depth=%d, bpp=%d, pitch=%d: %d\n",
+ __FUNCTION__, width, height,
+ scrn->depth, scrn->bitsPerPixel, bo->pitch, errno);
+ return 0;
+ }
+
+ arg.fb_id = f.fb_id;
}
assert(arg.fb_id != 0);
-
+ bo->delta = arg.fb_id;
DBG(("%s: attached fb=%d to handle=%d\n",
- __FUNCTION__, arg.fb_id, arg.handle));
+ __FUNCTION__, bo->delta, arg.handle));
bo->scanout = true;
- return bo->delta = arg.fb_id;
+ return bo->delta;
}
static uint32_t gem_create(int fd, int size)
More information about the xorg-commit
mailing list