[Mesa-dev] [PATCH] vl/dri3: handle the case of different GPU
Nayan Deshmukh
nayan26deshmukh at gmail.com
Wed Sep 7 17:48:11 UTC 2016
use a linear buffer in case of back buffer
Signed-off-by: Nayan Deshmukh <nayan26deshmukh at gmail.com>
---
src/gallium/auxiliary/vl/vl_winsys_dri3.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index 3d596a6..a768a03 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -82,6 +82,7 @@ struct vl_dri3_screen
int64_t last_ust, ns_frame, last_msc, next_msc;
bool flushed;
+ bool is_different_gpu;
};
static void
@@ -226,8 +227,13 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)
goto close_fd;
memset(&templ, 0, sizeof(templ));
+ if (scrn->is_different_gpu)
+ templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW |
+ PIPE_BIND_SCANOUT | PIPE_BIND_SHARED | PIPE_BIND_LINEAR;
+ else
templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW |
PIPE_BIND_SCANOUT | PIPE_BIND_SHARED;
+
templ.format = PIPE_FORMAT_B8G8R8X8_UNORM;
templ.target = PIPE_TEXTURE_2D;
templ.last_level = 0;
@@ -248,6 +254,7 @@ dri3_alloc_back_buffer(struct vl_dri3_screen *scrn)
usage);
buffer_fd = whandle.handle;
buffer->pitch = whandle.stride;
+
xcb_dri3_pixmap_from_buffer(scrn->conn,
(pixmap = xcb_generate_id(scrn->conn)),
scrn->drawable,
@@ -678,9 +685,7 @@ vl_dri3_screen_create(Display *display, int screen)
free(open_reply);
fd = loader_get_user_preferred_fd(fd, &is_different_gpu);
- /* TODO support different GPU */
- if (is_different_gpu)
- goto close_fd;
+ scrn->is_different_gpu = is_different_gpu;
geom_cookie = xcb_get_geometry(scrn->conn, RootWindow(display, screen));
geom_reply = xcb_get_geometry_reply(scrn->conn, geom_cookie, NULL);
--
2.7.4
More information about the mesa-dev
mailing list