qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Frediano Ziglio <fziglio@redhat.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
	"David Airlie" <airlied@redhat.com>,
	"Marc-André Lureau" <mlureau@redhat.com>,
	qemu-devel@nongnu.org, "Cole Robinson" <crobinso@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] egl-helpers: Support newer MESA versions
Date: Mon, 13 Mar 2017 05:39:10 -0400 (EDT)	[thread overview]
Message-ID: <1376895221.1392101.1489397950418.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <cf298d66-cc10-0cf5-b5d1-b36c20fb05f7@redhat.com>

> 
> <resend with some more people added to the Cc>
> 
> Hi,
> 
> On 20-02-17 10:50, Frediano Ziglio wrote:
> > According to
> > https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_platform_gbm.txt
> > if MESA_platform_gbm is supported display should be initialized
> > from a GBM handle using eglGetPlatformDisplayEXT.
> >
> > Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> > ---
> > This should fix
> > http://www.spinics.net/linux/fedora/libvir/msg142837.html
> >
> > Tested on Fedora rawhide.
> > ---
> >  ui/egl-helpers.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
> > index cd24568..964c5a5 100644
> > --- a/ui/egl-helpers.c
> > +++ b/ui/egl-helpers.c
> > @@ -219,7 +219,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;
> >
> 
> That fix is incomplete, you need some magic to work properly on older libGL
> versions.
> 
> Attached is a (compile tested only) proper patch. I do not have a qemu git
> clone
> handy atm, so this is not a git format-patch patch, it is against the Fedora
> Rawhide
> srpm. I've a test build with these patches here:
> 
> https://fedorapeople.org/~jwrdegoede/qemu-glvnd/
> 
> I was planning on doing a git clone qemu and send a proper patch after I got
> some
> testing feedback. Feel free to use this as a base for a v2 of your patch.
> 
> Regards,
> 
> Hans
> 

Wouldn't be easier to call the "old" eglGetDisplay if eglGetPlatformDisplayEXT
returns EGL_NO_DISPLAY ? Kind of

     egl_dbg("eglGetDisplay (dpy %p) ...\n", dpy);
-    qemu_egl_display = eglGetDisplay(dpy);
+#ifdef EGL_MESA_platform_gbm
+    qemu_egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, dpy, NULL);
+#else
+    qemu_egl_display = EGL_NO_DISPLAY;
+#endif
+    if (qemu_egl_display == EGL_NO_DISPLAY)
+        qemu_egl_display = eglGetDisplay(dpy);
     if (qemu_egl_display == EGL_NO_DISPLAY) {
         error_report("egl: eglGetDisplay failed");
         return -1;

Your patch should not even compile on older system which does not define
EGL_PLATFORM_GBM_MESA.

I tested my patch and works on both rawhide and FC25 (with very recent Mesa version)

Frediano

  reply	other threads:[~2017-03-13  9:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-20  9:50 [Qemu-devel] [PATCH] egl-helpers: Support newer MESA versions Frediano Ziglio
2017-03-13  9:26 ` Hans de Goede
2017-03-13  9:27 ` Hans de Goede
2017-03-13  9:39   ` Frediano Ziglio [this message]
2017-03-13 10:02     ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376895221.1392101.1489397950418.JavaMail.zimbra@redhat.com \
    --to=fziglio@redhat.com \
    --cc=airlied@redhat.com \
    --cc=crobinso@redhat.com \
    --cc=hdegoede@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mlureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).