sna: Call EnterVT from sna_screen_init.
PATCH 1/2 sna: Call EnterVT from sna_screen_init.
From: Christopher James Halse Rogers <[email protected]>
It's documented to do so. It might as well.
--- src/sna/sna_driver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
src/sna/sna_driver.c +3 -1
@@ -936,6 +936,8 @@ agp_aperture_size(struct pci_device *dev, int gen)return dev->regions[gen <030 ?0 :2 ].size; } +static Bool sna_enter_vt (VT_FUNC_ARGS_DECL ); +static Bool sna_screen_init (SCREEN_INIT_ARGS_DECL ) {
@@ -1072,7 +1074,7 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL)sna_uevent_init (scrn); -return TRUE; +return sna_enter_vt (VT_FUNC_ARGS (0 )); }static void sna_adjust_frame (ADJUST_FRAME_ARGS_DECL )
Signature · 1 line
1.8.3.2
RFC PATCH 2/2 sna: Support running nested in Mir
From: Christopher James Halse Rogers <[email protected]>
This is pretty much functional for both SNA and UXA, but can't reasonably 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.
--- src/intel.h | 7 ++ src/intel_display.c | 18 +++++ src/intel_dri.c | 23 +++++++ src/intel_driver.c | 191 ++++++++++++++++++++++++++++++++++++++++++++------- src/intel_module.c | 30 +++++++- src/sna/sna.h | 12 ++++ src/sna/sna_accel.c | 28 ++++++++ src/sna/sna_dri.c | 5 ++ src/sna/sna_driver.c | 140 +++++++++++++++++++++++++++++++------ 9 files changed, 406 insertions(+), 48 deletions(-)
src/intel.h +7 -0
@@ -76,6 +76,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.#include <libudev.h> #endif +#if XMIR +#include "xmir.h" +#else +typedef struct xmir_screen xmir_screen ; +#endif +/* remain compatible to xorg-server 1.6 */ #ifndef MONITOR_EDID_COMPLETE_RAWDATA #define MONITOR_EDID_COMPLETE_RAWDATA EDID_COMPLETE_RAWDATA
@@ -350,6 +356,7 @@ typedef struct intel_screen_private {InputHandlerProc uevent_handler;#endif Bool has_prime_vmap_flush; +xmir_screen *xmir; } intel_screen_private;#ifndef I915_PARAM_HAS_PRIME_VMAP_FLUSH
src/intel_display.c +18 -0
@@ -1872,6 +1872,17 @@ intel_mode_init(struct intel_screen_private *intel) {struct intel_mode *mode = intel->modes; +if (intel->modes ==NULL ) { + mode =calloc (sizeof *mode,1 ); + mode->fd = intel->drmSubFD; + + mode->event_context.version =DRM_EVENT_CONTEXT_VERSION ; + mode->event_context.vblank_handler = intel_vblank_handler; + mode->event_context.page_flip_handler = intel_page_flip_handler; + + intel->modes = mode; + } +/* We need to re-register the mode->fd for the synchronisation * feedback on every server generation, so perform the * registration within ScreenInit and not PreInit.
@@ -1967,6 +1978,13 @@ Bool intel_crtc_on(xf86CrtcPtr crtc)Bool ret;int i; +/* We're not in control of this crtc, probably because we're running nested. +* We can't say anything useful about whether the CRTC's on or not, so say +* off. +*/ +if (!intel_crtc) +return FALSE; +if (!crtc->enabled)return FALSE;
src/intel_dri.c +23 -0
@@ -68,6 +68,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.#include "intel_glamor.h" #include "uxa.h" +#ifdef XMIR +#include "xmir.h" +#include "xf86Priv.h" +#endif + typedef struct { int refcnt; PixmapPtr pixmap;
@@ -1545,6 +1550,19 @@ static const char *dri_driver_name(intel_screen_private *intel)return s; } +#if DRI2INFOREC_VERSION >=8 && defined(XMIR ) +static int I830DRI2AuthMagic (ScreenPtr screen,uint32_t magic) +{ +ScrnInfoPtr scrn =xf86ScreenToScrn (screen); +intel_screen_private *intel =intel_get_screen_private (scrn); + +if (xorgMir) +return xmir_auth_drm_magic (intel->xmir, magic); +else +return drmAuthMagic (intel->drmSubFD, magic); +} +#endif +Bool I830DRI2ScreenInit (ScreenPtr screen) {ScrnInfoPtr scrn =xf86ScreenToScrn (screen);
@@ -1625,6 +1643,11 @@ Bool I830DRI2ScreenInit(ScreenPtr screen) driverNames[0 ] = info.driverName;#endif +#if DRI2INFOREC_VERSION >=8 &&XMIR + info.version =8 ; + info.AuthMagic2 = I830DRI2AuthMagic; +#endif +return DRI2ScreenInit (screen, &info); }
src/intel_driver.c +165 -26
289 lines not on this page · raw message
src/intel_module.c +29 -1
@@ -51,6 +51,11 @@#include <xf86platformBus.h> #endif +#ifdef XMIR +#include <xf86Priv.h> +#include <xmir.h> +#endif +static const struct intel_device_info intel_generic_info = { .gen =-1 , };
@@ -428,6 +433,11 @@ static Bool intel_driver_func(ScrnInfoPtr pScrn,#else (*flag) =HW_IO |HW_MMIO ;#endif + +#ifdef XMIR +if (xorgMir) + (*flag) =HW_SKIP_CONSOLE ; +#endif return TRUE;default :/* Unknown or deprecated function */
@@ -483,6 +493,21 @@ static Bool has_kernel_mode_setting(const struct pci_device *dev)return ret; } +static Bool has_mir_support (const struct pci_device *dev) +{ +char id[20 ]; + +snprintf (id,sizeof (id), +"pci:%04x:%02x:%02x.%d" , + dev->domain, dev->bus, dev->dev, dev->func); + +if (xmir_get_drm_fd (id) <0 ) +return FALSE; + +return TRUE; +} + +#if !UMS_ONLY extern XF86ConfigPtr xf86configptr;
@@ -578,7 +603,7 @@ static Bool intel_pci_probe(DriverPtr driver, struct pci_device *device, intptr_t match_data) { -if (!has_kernel_mode_setting (device)) { +if (!has_kernel_mode_setting (device) && !xorgMir) {#if KMS_ONLY return FALSE;#else
@@ -609,6 +634,9 @@ intel_platform_probe(DriverPtr driver,if (!dev->pdev)return FALSE; +if (xorgMir && !has_mir_support (dev->pdev)) +return FALSE; +if (!has_kernel_mode_setting (dev->pdev))return FALSE;
src/sna/sna.h +12 -0
@@ -75,6 +75,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.#include <libudev.h> #endif +#if XMIR +#include <xf86Priv.h> +#include "xmir.h" +#else +typedef struct xmir_screen xmir_screen ; +#define xorgMir 0 +#endif +#if HAS_DEBUG_FULL #define DBG (x) ErrorF x#else
@@ -306,6 +314,7 @@ struct sna {#endif struct sna_render render; +xmir_screen *xmir; #if DEBUG_MEMORY struct {
@@ -725,6 +734,9 @@ void sna_accel_watch_flush(struct sna *sna, int enable);void sna_accel_close (struct sna *sna);void sna_accel_free (struct sna *sna); +void sna_xmir_copy_pixmap_to_mir (PixmapPtr src,int dst_fd); +int sna_dri_auth_magic2 (ScreenPtr screen,uint32_t magic); +void sna_copy_fbcon (struct sna *sna);bool sna_composite_create (struct sna *sna);
src/sna/sna_accel.c +28 -0
@@ -14770,6 +14770,34 @@ void sna_accel_close(struct sna *sna)kgem_cleanup_cache (&sna->kgem); } +#ifdef XMIR +void +sna_xmir_copy_pixmap_to_mir (PixmapPtr src,int dst_fd) +{ +ScreenPtr pScreen = src->drawable.pScreen; +ScrnInfoPtr scrn =xf86ScreenToScrn (pScreen); +struct sna *sna =to_sna_from_pixmap (src); +struct sna_pixmap *priv =sna_pixmap (src); +struct kgem_bo *bo; +unsigned int pitch = priv->gpu_bo->pitch; +BoxRec box; + + bo =kgem_create_for_prime (&sna->kgem, dst_fd, pitch * src->drawable.height); +if (!bo) +return ; + bo->pitch = pitch; + + box.x1 = box.y1 =0 ; + box.x2 = scrn->virtualX; + box.y2 = scrn->virtualY; + + sna->render.copy_boxes (sna, GXcopy, src,sna_pixmap (src)->gpu_bo,0 ,0 , + src, bo,0 ,0 , &box,1 ,0 ); +kgem_submit (&sna->kgem); +kgem_bo_destroy (&sna->kgem, bo); +} +#endif +void sna_accel_block_handler (struct sna *sna,struct timeval **tv) {if (sna->kgem.need_retire)
src/sna/sna_dri.c +5 -0
@@ -2469,6 +2469,11 @@ bool sna_dri_open(struct sna *sna, ScreenPtr screen) info.ReuseBufferNotify =NULL ;#endif +#if DRI2INFOREC_VERSION >=8 &&XMIR + info.version =8 ; + info.AuthMagic2 = sna_dri_auth_magic2; +#endif +#if USE_ASYNC_SWAP info.version =10 ; info.AsyncSwap = sna_dri_async_swap;
src/sna/sna_driver.c +119 -21
250 lines not on this page · raw message
Signature · 1 line
1.8.3.2
Re: [RFC PATCH 2/2] sna: Support running nested in Mir
With xorgMir this is not going to fly. Make sure the compatibility cruft, first of all, exists and is out of line in a header. And expose the driving heartbeat of when to refresh the screen pixmap from Xmir. -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [RFC PATCH 2/2] sna: Support running nested in Mir
Quoted 3 lines · Chris Wilson
With xorgMir this is not going to fly. Make sure the compatibility cruft, first of all, exists and is out of line in a header.
Do you mean remove the various #ifdef XMIR bits, or *all* the bits gated on xorgMir? Some of that's not going to be trivial to hide away in a header.
Quoted 3 lines
And expose the driving heartbeat of when to refresh the screen
pixmap from Xmir.
I'm not sure what you mean here - Xmir exposes the on-buffer-available callback, which gets triggered when swap_buffers has returned the next buffer to render to. This is what I'd think of as the refresh heartbeat. Is this not what you mean?
If you're rendering as fast as possible, this will be a once-per-compositor-vblank event.
Re: [RFC PATCH 2/2] sna: Support running nested in Mir
Quoted 9 lines · Christopher James Halse Rogers
Quoted 3 lines · Chris Wilson
With xorgMir this is not going to fly. Make sure the compatibility cruft, first of all, exists and is out of line in a header.
Do you mean remove the various #ifdef XMIR bits, or *all* the bits gated on xorgMir? Some of that's not going to be trivial to hide away in a header.
It looked like it could be done quite simply. The most important part is to avoid the extern xorgMir - as that will be a major nuisance.
Quoted 7 lines
Quoted 3 lines
And expose the driving heartbeat of when to refresh the screen pixmap from Xmir.
I'm not sure what you mean here - Xmir exposes the on-buffer-available callback, which gets triggered when
swap_buffershas returned the next buffer to render to. This is what I'd think of as the refresh heartbeat. Is this not what you mean?
Yes, that's what it looked like. But I didn't see how that was being coupled into how fast we updated.
Quoted 2 lines
If you're rendering as fast as possible, this will be a once-per-compositor-vblank event.
That's what I would expect, so I am just missing the logic between that and us sending updates.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [RFC PATCH 2/2] sna: Support running nested in Mir
In reply to [email protected]Quoted 10 lines · On Mon, Jul 22, 2013 at 04:44:40PM +1000…
From: Christopher James Halse Rogers <[email protected]>
This is pretty much functional for both SNA and UXA, but can't reasonably 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.
git-am doesn't like the base sha1, can you point me to a branch? -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [RFC PATCH 2/2] sna: Support running nested in Mir
Quoted 10 lines · Chris Wilson
Quoted 9 lines · On Mon, Jul 22, 2013 at 04:44:40PM +1000…
From: Christopher James Halse Rogers <[email protected]>
This is pretty much functional for both SNA and UXA, but can't
reasonably
be applied until the Xserver patch has landed, and that needs more
work.This demonstrates the approach, however.
Quoted 8 lines
Quoted 6 lines
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.git-am doesn't like the base sha1, can you point me to a branch?
Oh.
Well, doesn't that make me look rather stupid. It's based on sha 2770655371, ie: 2.21.9, because that's what my master branch was up to, and I didn't notice that it wasn't set to track origin/master. Git fail!