<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Sounds like your version of libva
ignores the DRI_PRIME environment parameter.<br>
<br>
Not sure what to do with this, but clearly a loader and not a
driver problem.<br>
<br>
Regards,<br>
Christian.<br>
<br>
Am 20.09.2016 um 15:36 schrieb Mike Lothian:<br>
</div>
<blockquote
cite="mid:CAHbf0-H3S8ECrPcNrA87h83rfQ0X405c0gS1OUU5jFuz7yFp1g@mail.gmail.com"
type="cite">
<div dir="ltr">Here's what I currently have:
<div><br>
</div>
<div>
<div>fireburn@axion ~ $ DRI_PRIME=1 vainfo</div>
<div>libva info: VA-API version 0.39.3</div>
<div>libva info: va_getDriverName() returns 0</div>
<div>libva info: Trying to open
/usr/lib64/va/drivers/i965_drv_video.so</div>
<div>libva info: Found init function __vaDriverInit_0_39</div>
<div>libva info: va_openDriver() returns 0</div>
<div>vainfo: VA-API version: 0.39 (libva 1.7.2)</div>
<div>vainfo: Driver version: Intel i965 driver for Intel(R)
Skylake - 1.7.2</div>
<div>vainfo: Supported profile and entrypoints</div>
<div> VAProfileMPEG2Simple : VAEntrypointVLD</div>
<div> VAProfileMPEG2Simple :
VAEntrypointEncSlice</div>
<div> VAProfileMPEG2Main : VAEntrypointVLD</div>
<div> VAProfileMPEG2Main :
VAEntrypointEncSlice</div>
<div> VAProfileH264ConstrainedBaseline: VAEntrypointVLD</div>
<div> VAProfileH264ConstrainedBaseline:
VAEntrypointEncSlice</div>
<div> VAProfileH264ConstrainedBaseline:
VAEntrypointEncSliceLP</div>
<div> VAProfileH264Main : VAEntrypointVLD</div>
<div> VAProfileH264Main :
VAEntrypointEncSlice</div>
<div> VAProfileH264Main :
VAEntrypointEncSliceLP</div>
<div> VAProfileH264High : VAEntrypointVLD</div>
<div> VAProfileH264High :
VAEntrypointEncSlice</div>
<div> VAProfileH264High :
VAEntrypointEncSliceLP</div>
<div> VAProfileH264MultiviewHigh : VAEntrypointVLD</div>
<div> VAProfileH264MultiviewHigh :
VAEntrypointEncSlice</div>
<div> VAProfileH264StereoHigh : VAEntrypointVLD</div>
<div> VAProfileH264StereoHigh :
VAEntrypointEncSlice</div>
<div> VAProfileVC1Simple : VAEntrypointVLD</div>
<div> VAProfileVC1Main : VAEntrypointVLD</div>
<div> VAProfileVC1Advanced : VAEntrypointVLD</div>
<div> VAProfileNone :
VAEntrypointVideoProc</div>
<div> VAProfileJPEGBaseline : VAEntrypointVLD</div>
<div> VAProfileJPEGBaseline :
VAEntrypointEncPicture</div>
<div> VAProfileVP8Version0_3 : VAEntrypointVLD</div>
<div> VAProfileVP8Version0_3 :
VAEntrypointEncSlice</div>
<div> VAProfileHEVCMain : VAEntrypointVLD</div>
<div> VAProfileHEVCMain :
VAEntrypointEncSlice</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>which picks up the i965 driver despite the DRI_PRIME=1
paramerter being fed in - I have to manually specify
LIBVA_DRIVER_NAME=radeonsi in order to get it to get the
details out of vainfo - the same goes for vdpauinfo</div>
<div><br>
</div>
<div>
<div>fireburn@axion ~ $ LIBVA_DRIVER_NAME=radeonsi DRI_PRIME=1
vainfo</div>
<div>libva info: VA-API version 0.39.3</div>
<div>libva info: va_getDriverName() returns 0</div>
<div>libva info: User requested driver 'radeonsi'</div>
<div>libva info: Trying to open
/usr/lib64/va/drivers/radeonsi_drv_video.so</div>
<div>libva info: Found init function __vaDriverInit_0_39</div>
<div>libva info: va_openDriver() returns 0</div>
<div>vainfo: VA-API version: 0.39 (libva 1.7.2)</div>
<div>vainfo: Driver version: mesa gallium vaapi</div>
<div>vainfo: Supported profile and entrypoints</div>
<div> VAProfileMPEG2Simple : VAEntrypointVLD</div>
<div> VAProfileMPEG2Main : VAEntrypointVLD</div>
<div> VAProfileVC1Simple : VAEntrypointVLD</div>
<div> VAProfileVC1Main : VAEntrypointVLD</div>
<div> VAProfileVC1Advanced : VAEntrypointVLD</div>
<div> VAProfileH264Baseline : VAEntrypointVLD</div>
<div> VAProfileH264Baseline :
VAEntrypointEncSlice</div>
<div> VAProfileH264Main : VAEntrypointVLD</div>
<div> VAProfileH264Main :
VAEntrypointEncSlice</div>
<div> VAProfileH264High : VAEntrypointVLD</div>
<div> VAProfileH264High :
VAEntrypointEncSlice</div>
<div> VAProfileNone :
VAEntrypointVideoProc</div>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Tue, 20 Sep 2016 at 14:13 Nayan Deshmukh <<a
moz-do-not-send="true"
href="mailto:nayan26deshmukh@gmail.com">nayan26deshmukh@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Mike,
<div><br>
</div>
<div class="gmail_extra"><br>
</div>
</div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Tue, Sep 20, 2016 at 5:45 PM,
Mike Lothian <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:mike@fireburn.co.uk" target="_blank">mike@fireburn.co.uk</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi
<div><br>
</div>
<div>I've just confirmed this works for getting
details from vainfo and vdpauinfo using
DRI_PRIME=1 without needing to set up offloading
with xrandr</div>
<div><br>
</div>
<div>I do however need to specify the driver still,
is that something being worked on? It would be
great if it autoselected based on the card running
at DRI_PRIME=1 (or x if there's more than one
card)</div>
<div><br>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div>I have a prime system and I don't need to specify
any drivers in my system. </div>
<div>Though I am not the right person to answer this
question. </div>
<div>Maybe Michel can answer this.</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Nayan </div>
</div>
</div>
</div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>Cheers</div>
<div><br>
</div>
<div>Mike</div>
</div>
<br>
<div class="gmail_quote">
<div>
<div>
<div dir="ltr">On Tue, 20 Sep 2016 at 05:52
Nayan Deshmukh <<a moz-do-not-send="true"
href="mailto:nayan26deshmukh@gmail.com"
target="_blank">nayan26deshmukh@gmail.com</a>>
wrote:<br>
</div>
</div>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>In case of prime when rendering is done on
GPU other then the<br>
server GPU, use a seprate linear buffer for
each back buffer<br>
which will be displayed using present
extension.<br>
<br>
v2: Use a seprate linear buffer for each back
buffer (Michel)<br>
v3: Change variable names and fix coding style
(Leo and Emil)<br>
v4: Use PIPE_BIND_SAMPLER_VIEW for back buffer
in case when<br>
a seprate linear buffer is used (Michel)<br>
v4.1: remove empty line<br>
v4.2: destroy the context and handle the case
when<br>
create_context fails (Emil)<br>
<br>
Signed-off-by: Nayan Deshmukh <<a
moz-do-not-send="true"
href="mailto:nayan26deshmukh@gmail.com"
target="_blank">nayan26deshmukh@gmail.com</a>><br>
Reviewed-by: Leo Liu <<a
moz-do-not-send="true"
href="mailto:leo.liu@amd.com"
target="_blank">leo.liu@amd.com</a>><br>
Acked-by: Michel Dänzer <<a
moz-do-not-send="true"
href="mailto:michel.daenzer@amd.com"
target="_blank">michel.daenzer@amd.com</a>><br>
---<br>
src/gallium/auxiliary/vl/vl_winsys_dri3.c |
66 +++++++++++++++++++++++++------<br>
1 file changed, 53 insertions(+), 13
deletions(-)<br>
<br>
diff --git
a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
b/src/gallium/auxiliary/vl/vl_winsys_dri3.c<br>
index 3d596a6..191a64b 100644<br>
---
a/src/gallium/auxiliary/vl/vl_winsys_dri3.c<br>
+++
b/src/gallium/auxiliary/vl/vl_winsys_dri3.c<br>
@@ -49,6 +49,7 @@<br>
struct vl_dri3_buffer<br>
{<br>
struct pipe_resource *texture;<br>
+ struct pipe_resource *linear_texture;<br>
<br>
uint32_t pixmap;<br>
uint32_t sync_fence;<br>
@@ -69,6 +70,8 @@ struct vl_dri3_screen<br>
xcb_present_event_t eid;<br>
xcb_special_event_t *special_event;<br>
<br>
+ struct pipe_context *pipe;<br>
+<br>
struct vl_dri3_buffer
*back_buffers[BACK_BUFFER_NUM];<br>
int cur_back;<br>
<br>
@@ -82,6 +85,7 @@ struct vl_dri3_screen<br>
int64_t last_ust, ns_frame, last_msc,
next_msc;<br>
<br>
bool flushed;<br>
+ bool is_different_gpu;<br>
};<br>
<br>
static void<br>
@@ -102,6 +106,8 @@
dri3_free_back_buffer(struct vl_dri3_screen
*scrn,<br>
xcb_sync_destroy_fence(scrn->conn,
buffer->sync_fence);<br>
xshmfence_unmap_shm(buffer->shm_fence);<br>
pipe_resource_reference(&buffer->texture,
NULL);<br>
+ if (buffer->linear_texture)<br>
+
pipe_resource_reference(&buffer->linear_texture,
NULL);<br>
FREE(buffer);<br>
}<br>
<br>
@@ -209,7 +215,7 @@
dri3_alloc_back_buffer(struct vl_dri3_screen
*scrn)<br>
xcb_sync_fence_t sync_fence;<br>
struct xshmfence *shm_fence;<br>
int buffer_fd, fence_fd;<br>
- struct pipe_resource templ;<br>
+ struct pipe_resource templ,
*pixmap_buffer_texture;<br>
struct winsys_handle whandle;<br>
unsigned usage;<br>
<br>
@@ -226,8 +232,7 @@
dri3_alloc_back_buffer(struct vl_dri3_screen
*scrn)<br>
goto close_fd;<br>
<br>
memset(&templ, 0, sizeof(templ));<br>
- templ.bind = PIPE_BIND_RENDER_TARGET |
PIPE_BIND_SAMPLER_VIEW |<br>
- PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED;<br>
+ templ.bind = PIPE_BIND_RENDER_TARGET |
PIPE_BIND_SAMPLER_VIEW;<br>
templ.format = PIPE_FORMAT_B8G8R8X8_UNORM;<br>
templ.target = PIPE_TEXTURE_2D;<br>
templ.last_level = 0;<br>
@@ -235,16 +240,34 @@
dri3_alloc_back_buffer(struct vl_dri3_screen
*scrn)<br>
templ.height0 = scrn->height;<br>
templ.depth0 = 1;<br>
templ.array_size = 1;<br>
- buffer->texture =
scrn->base.pscreen->resource_create(scrn->base.pscreen,<br>
-
&templ);<br>
- if (!buffer->texture)<br>
- goto unmap_shm;<br>
<br>
+ if (scrn->is_different_gpu) {<br>
+ buffer->texture =
scrn->base.pscreen->resource_create(scrn->base.pscreen,<br>
+
&templ);<br>
+ if (!buffer->texture)<br>
+ goto unmap_shm;<br>
+<br>
+ templ.bind |= PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED |<br>
+ PIPE_BIND_LINEAR;<br>
+ buffer->linear_texture =
scrn->base.pscreen->resource_create(scrn->base.pscreen,<br>
+
&templ);<br>
+ pixmap_buffer_texture =
buffer->linear_texture;<br>
+<br>
+ if (!buffer->linear_texture)<br>
+ goto no_linear_texture;<br>
+ } else {<br>
+ templ.bind |= PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED;<br>
+ buffer->texture =
scrn->base.pscreen->resource_create(scrn->base.pscreen,<br>
+
&templ);<br>
+ if (!buffer->texture)<br>
+ goto unmap_shm;<br>
+ pixmap_buffer_texture =
buffer->texture;<br>
+ }<br>
memset(&whandle, 0, sizeof(whandle));<br>
whandle.type= DRM_API_HANDLE_TYPE_FD;<br>
usage = PIPE_HANDLE_USAGE_EXPLICIT_FLUSH |
PIPE_HANDLE_USAGE_READ;<br>
scrn->base.pscreen->resource_get_handle(scrn->base.pscreen,
NULL,<br>
-
buffer->texture, &whandle,<br>
+
pixmap_buffer_texture, &whandle,<br>
usage);<br>
buffer_fd = whandle.handle;<br>
buffer->pitch = whandle.stride;<br>
@@ -271,6 +294,8 @@
dri3_alloc_back_buffer(struct vl_dri3_screen
*scrn)<br>
<br>
return buffer;<br>
<br>
+no_linear_texture:<br>
+
pipe_resource_reference(&buffer->texture,
NULL);<br>
unmap_shm:<br>
xshmfence_unmap_shm(shm_fence);<br>
close_fd:<br>
@@ -474,6 +499,7 @@
vl_dri3_flush_frontbuffer(struct pipe_screen
*screen,<br>
struct vl_dri3_screen *scrn = (struct
vl_dri3_screen *)context_private;<br>
uint32_t options =
XCB_PRESENT_OPTION_NONE;<br>
struct vl_dri3_buffer *back;<br>
+ struct pipe_box src_box;<br>
<br>
back =
scrn->back_buffers[scrn->cur_back];<br>
if (!back)<br>
@@ -485,6 +511,16 @@
vl_dri3_flush_frontbuffer(struct pipe_screen
*screen,<br>
return;<br>
}<br>
<br>
+ if (scrn->is_different_gpu) {<br>
+ u_box_origin_2d(scrn->width,
scrn->height, &src_box);<br>
+
scrn->pipe->resource_copy_region(scrn->pipe,<br>
+
back->linear_texture,<br>
+ 0, 0,
0, 0,<br>
+
back->texture,<br>
+ 0,
&src_box);<br>
+<br>
+ scrn->pipe->flush(scrn->pipe,
NULL, 0);<br>
+ }<br>
xshmfence_reset(back->shm_fence);<br>
back->busy = true;<br>
<br>
@@ -622,6 +658,7 @@
vl_dri3_screen_destroy(struct vl_screen
*vscreen)<br>
xcb_discard_reply(scrn->conn,
cookie.sequence);<br>
xcb_unregister_for_special_event(scrn->conn,
scrn->special_event);<br>
}<br>
+ scrn->pipe->destroy(scrn->pipe);<br>
scrn->base.pscreen->destroy(scrn->base.pscreen);<br>
pipe_loader_release(&scrn->base.dev,
1);<br>
FREE(scrn);<br>
@@ -638,7 +675,6 @@
vl_dri3_screen_create(Display *display, int
screen)<br>
xcb_dri3_open_reply_t *open_reply;<br>
xcb_get_geometry_cookie_t geom_cookie;<br>
xcb_get_geometry_reply_t *geom_reply;<br>
- int is_different_gpu;<br>
int fd;<br>
<br>
assert(display);<br>
@@ -677,10 +713,7 @@
vl_dri3_screen_create(Display *display, int
screen)<br>
fcntl(fd, F_SETFD, FD_CLOEXEC);<br>
free(open_reply);<br>
<br>
- fd = loader_get_user_preferred_fd(fd,
&is_different_gpu);<br>
- /* TODO support different GPU */<br>
- if (is_different_gpu)<br>
- goto close_fd;<br>
+ fd = loader_get_user_preferred_fd(fd,
&scrn->is_different_gpu);<br>
<br>
geom_cookie =
xcb_get_geometry(scrn->conn,
RootWindow(display, screen));<br>
geom_reply =
xcb_get_geometry_reply(scrn->conn,
geom_cookie, NULL);<br>
@@ -699,6 +732,11 @@
vl_dri3_screen_create(Display *display, int
screen)<br>
if (!scrn->base.pscreen)<br>
goto release_pipe;<br>
<br>
+ scrn->pipe =
scrn->base.pscreen->context_create(scrn->base.pscreen,<br>
+
&scrn->base, 0);<br>
+ if (!scrn->pipe)<br>
+ goto no_context;<br>
+<br>
scrn->base.destroy =
vl_dri3_screen_destroy;<br>
scrn->base.texture_from_drawable =
vl_dri3_screen_texture_from_drawable;<br>
scrn->base.get_dirty_area =
vl_dri3_screen_get_dirty_area;<br>
@@ -709,6 +747,8 @@
vl_dri3_screen_create(Display *display, int
screen)<br>
<br>
return &scrn->base;<br>
<br>
+no_context:<br>
+
scrn->base.pscreen->destroy(scrn->base.pscreen);<br>
release_pipe:<br>
if (scrn->base.dev) {<br>
pipe_loader_release(&scrn->base.dev,
1);<br>
--<br>
2.7.4<br>
<br>
</div>
</div>
_______________________________________________<br>
mesa-dev mailing list<br>
<a moz-do-not-send="true"
href="mailto:mesa-dev@lists.freedesktop.org"
target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a moz-do-not-send="true"
href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev"
rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
mesa-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a>
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>