Received: from eggs.gnu.org ([2001:4830:134:3::10]:34091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDWky-0001Dy-88 for qemu-devel@nongnu.org; Tue, 20 Jan 2015 06:14:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDWku-0007gH-0m for qemu-devel@nongnu.org; Tue, 20 Jan 2015 06:14:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55601) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDWkt-0007fz-PB for qemu-devel@nongnu.org; Tue, 20 Jan 2015 06:13:55 -0500 Message-ID: <1421752430.3606.42.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Tue, 20 Jan 2015 12:13:50 +0100 In-Reply-To: <54BD2F35.9060008@redhat.com> References: <1421674603-31575-1-git-send-email-kraxel@redhat.com> <1421674603-31575-8-git-send-email-kraxel@redhat.com> <54BD2F35.9060008@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 7/7] sdl2: add support for display rendering using opengl. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Paolo Bonzini , qemu-devel@nongnu.org, Anthony Liguori Hi, > > +void sdl2_gl_switch(DisplayChangeListener *dcl, > > + DisplaySurface *new_surface) > > +{ > > + struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl); > > + DisplaySurface *old_surface = scon->surface; > > + > > + assert(scon->opengl); > > + > > + SDL_GL_MakeCurrent(scon->real_window, scon->winctx); > > + surface_gl_destroy_texture(scon->gls, scon->surface); > > Same question as for v1: Can a surface be in use by multiple DCLs? Oops, I remember that comment for the last series, forgot to answer ... Yes. Old surface is released after notifying all DCLs about the new one (see dpy_gfx_replace_surface() in console.c), so the old is still valid at this point. That way refcounting should not be needed in most cases. If a DCL needs the old surface image stay around after it returns from the switch callback (say due to threads still holding pointers to it) it can grab a reference on the pixman image backing the surface: pixman_image_ref(surface->image). The surfaces itself are not reference counted. > > + } else if (old_surface && > > + ((surface_width(old_surface) != surface_width(new_surface)) || > > + (surface_height(old_surface) != surface_height(new_surface)))) { > > And as in v1: If the window is scaled, this will reset the scaling to > 100 %, which is fine. However, if the new surface has the same > dimensions as the old surface, the window will not be scaled. That would > seem strange to me (why is the scaling reset for some surface changes > but not for others?). Yea, there are some corner cases. But they are not specific to opengl, they happen in sdl2-2d mode too, so that is something for another patch series ... cheers, Gerd