ui: opengl fixes, for spice and egl-helpers.

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJYqutOAAoJEEy22O7T6HE4YBYP/2zwW2vJuf6uAjrw6a8856hk
 97VEKeFVtb2nE5jcdNAK18VUI+vhpOnW+dR4UQpfVH25ttU0VmYUAaaQXiXxJNuu
 6rL0l34gNueRi3TMMggazMurAWJgPE8Yhsgs4YiD3ipBTOLa1X9PSuoR8lgYGg6i
 eifujonMQjiyIeDXOeeDZpUF244ccvYamUy8cfrcRb72N3uzQWQMaJlFjsxptWcd
 0G4EVvWjx9RTdJDZd26rbhH0eL/z5MPQpcprLW0JlSg2FBawxluvhUMCudUqlvy2
 ZgYKlj3LNp+vuz2BMmpx2QyqhkJFwo5UZsPVM7UAYQYDWqaH6jOxYdZEgsOnbXdO
 Ml7/Ac3c4f/auIqXg4adHuLZXFvLKlwNz8a3payGkXDsNDh4b2OsXPVH4/0fv39e
 o5xs97rZ8+Nns+ladqzesDEviaMQY/xCAGcpor1a7v2US22h3wD8+e4Q7HSNNgOS
 x2rpsb0bV77e3Bj4pDQ8IcUuh9cLl0XuJmXJsOrh+fIYTHWduOjgQe6mj3PbmsX/
 EbCzi7SmeSJlrtnyd9vL+OayeYD351abuPEqK2tcap+EiMcCAC+KFI7wuGEeSFB3
 TwDJ/ou7nICQF3fDdiWaW6LFhUV3AMUmIu4I3cFdRSrqqR+/RAIBLtrZszsAmxRP
 A1GA3SfkEj8hUwi+Ih6Y
 =JJEF
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20170220-1' into staging

ui: opengl fixes, for spice and egl-helpers.

# gpg: Signature made Mon 20 Feb 2017 13:12:46 GMT
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/pull-ui-20170220-1:
  egl-helpers: Support newer MESA versions
  spice: allow to specify drm rendernode

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-02-20 16:31:38 +00:00
commit c8f21dbfc3
4 changed files with 21 additions and 7 deletions

View File

@ -14,8 +14,7 @@ extern int qemu_egl_rn_fd;
extern struct gbm_device *qemu_egl_rn_gbm_dev;
extern EGLContext qemu_egl_rn_ctx;
int qemu_egl_rendernode_open(void);
int egl_rendernode_init(void);
int egl_rendernode_init(const char *rendernode);
int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc);
#endif

View File

@ -1066,7 +1066,7 @@ DEF("spice", HAS_ARG, QEMU_OPTION_spice,
" [,streaming-video=[off|all|filter]][,disable-copy-paste]\n"
" [,disable-agent-file-xfer][,agent-mouse=[on|off]]\n"
" [,playback-compression=[on|off]][,seamless-migration=[on|off]]\n"
" [,gl=[on|off]]\n"
" [,gl=[on|off]][,rendernode=<file>]\n"
" enable spice\n"
" at least one of {port, tls-port} is mandatory\n",
QEMU_ARCH_ALL)
@ -1161,6 +1161,10 @@ Enable/disable spice seamless migration. Default is off.
@item gl=[on|off]
Enable/disable OpenGL context. Default is off.
@item rendernode=<file>
DRM render node for OpenGL rendering. If not specified, it will pick
the first available. (Since 2.9)
@end table
ETEXI

View File

@ -44,13 +44,17 @@ int qemu_egl_rn_fd;
struct gbm_device *qemu_egl_rn_gbm_dev;
EGLContext qemu_egl_rn_ctx;
int qemu_egl_rendernode_open(void)
static int qemu_egl_rendernode_open(const char *rendernode)
{
DIR *dir;
struct dirent *e;
int r, fd;
char *p;
if (rendernode) {
return open(rendernode, O_RDWR | O_CLOEXEC | O_NOCTTY | O_NONBLOCK);
}
dir = opendir("/dev/dri");
if (!dir) {
return -1;
@ -85,11 +89,11 @@ int qemu_egl_rendernode_open(void)
return fd;
}
int egl_rendernode_init(void)
int egl_rendernode_init(const char *rendernode)
{
qemu_egl_rn_fd = -1;
qemu_egl_rn_fd = qemu_egl_rendernode_open();
qemu_egl_rn_fd = qemu_egl_rendernode_open(rendernode);
if (qemu_egl_rn_fd == -1) {
error_report("egl: no drm render node available");
goto err;
@ -219,7 +223,11 @@ int qemu_egl_init_dpy(EGLNativeDisplayType dpy, bool gles, bool debug)
}
egl_dbg("eglGetDisplay (dpy %p) ...\n", dpy);
#ifdef EGL_MESA_platform_gbm
qemu_egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, dpy, NULL);
#else
qemu_egl_display = eglGetDisplay(dpy);
#endif
if (qemu_egl_display == EGL_NO_DISPLAY) {
error_report("egl: eglGetDisplay failed");
return -1;

View File

@ -501,6 +501,9 @@ static QemuOptsList qemu_spice_opts = {
},{
.name = "gl",
.type = QEMU_OPT_BOOL,
},{
.name = "rendernode",
.type = QEMU_OPT_STRING,
#endif
},
{ /* end of list */ }
@ -833,7 +836,7 @@ void qemu_spice_init(void)
"incompatible with -spice port/tls-port");
exit(1);
}
if (egl_rendernode_init() != 0) {
if (egl_rendernode_init(qemu_opt_get(opts, "rendernode")) != 0) {
error_report("Failed to initialize EGL render node for SPICE GL");
exit(1);
}