Support running nested in a Mir compositor
RFC PATCH 1/1 Support running nested in a Mir compositor
From: Christopher James Halse Rogers <[email protected]>
Barring some (admittedly significant) missing optimisations¹ this is reasonably complete, but can't be applied until the Xserver patch has landed, and that needs more work.
This demonstrates the approach, however.
There's probably some code to be shared with XWayland support, around the output handling (or lack thereof) and possibly integration with the underlying compositor for SwapBuffers etc.
¹: Such as not doing a fullscreen blit on all damage, integration with DRI2 and SwapBuffers to avoid copies, etc.
Signed-off-by Christopher James Halse Rogers <[email protected]>
--- src/nouveau_dri2.c | 22 ++++++- src/nv_driver.c | 170 +++++++++++++++++++++++++++++++++++++++++++++++++---- src/nv_type.h | 10 ++++ 3 files changed, 188 insertions(+), 14 deletions(-)
src/nouveau_dri2.c +20 -2
@@ -267,7 +267,7 @@ can_exchange(DrawablePtr draw, PixmapPtr dst_pix, PixmapPtr src_pix)NVPtr pNv =NVPTR (scrn);int i; -if (!xf86_config->num_crtc) +if (xorgMir || !xf86_config->num_crtc)return FALSE;for (i =0 ; i < xf86_config->num_crtc; i++) {
@@ -290,7 +290,7 @@ can_sync_to_vblank(DrawablePtr draw)ScrnInfoPtr scrn =xf86ScreenToScrn (draw->pScreen);NVPtr pNv =NVPTR (scrn); -return pNv->glx_vblank && +return pNv->glx_vblank && !xorgMir &&nv_window_belongs_to_crtc (scrn, draw->x, draw->y, draw->width, draw->height); }
@@ -766,6 +766,19 @@ nouveau_dri2_flip_event_handler(unsigned int frame, unsigned int tv_sec,free (flip); } +#if DRI2INFOREC_VERSION >=8 && defined(XMIR ) +static int nouveau_dri2_auth_magic (ScreenPtr pScreen,uint32_t magic) +{ +ScrnInfoPtr pScrn =xf86ScreenToScrn (pScreen); +NVPtr pNv =NVPTR (pScrn); + +if (xorgMir) +return xmir_auth_drm_magic (pNv->xmir, magic); +else +return drmAuthMagic (pNv->dev->fd, magic); +} +#endif +Bool nouveau_dri2_init (ScreenPtr pScreen) {
@@ -804,6 +817,11 @@ nouveau_dri2_init(ScreenPtr pScreen) dri2.GetParam =NULL ;#endif +#if DRI2INFOREC_VERSION >=8 && defined(XMIR ) + dri2.version =8 ; + dri2.AuthMagic2 = nouveau_dri2_auth_magic; +#endif +#if DRI2INFOREC_VERSION >=9 dri2.version =9 ; dri2.CreateBuffer2 = nouveau_dri2_create_buffer2;
src/nv_driver.c +158 -12
295 lines not on this page · raw message
src/nv_type.h +10 -0
@@ -9,6 +9,14 @@#include <stdint.h> #include "xf86Crtc.h" +#ifdef XMIR +#include "xmir.h" +#include "xf86Priv.h" +#else +typedef struct xmir_screen xmir_screen ; +#define xorgMir 0 +#endif +#if XF86_CRTC_VERSION >=5 #define NOUVEAU_PIXMAP_SHARING 1#endif
@@ -112,6 +120,8 @@ typedef struct _NVRec {PixmapPtr pspix, pmpix, pdpix;PicturePtr pspict, pmpict;Pixel fg_colour; + +xmir_screen *xmir; } NVRec;#define NVPTR (p) ((NVPtr)((p)->driverPrivate))
Signature · 6 lines
1.8.3.2 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau