|
|
9ab42d |
From d9769c193765ac303ad4d4760e57ff368df1f663 Mon Sep 17 00:00:00 2001
|
|
|
9ab42d |
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
|
|
|
9ab42d |
Date: Mon, 24 Sep 2012 15:01:09 -0400
|
|
|
9ab42d |
Subject: [PATCH 1/2] xwayland: Add xwayland support
|
|
|
9ab42d |
|
|
|
9ab42d |
---
|
|
|
9ab42d |
src/intel_device.c | 18 ++++++----
|
|
|
9ab42d |
src/intel_driver.h | 6 +++-
|
|
|
9ab42d |
src/intel_module.c | 8 +++++
|
|
|
9ab42d |
src/uxa/intel.h | 2 ++
|
|
|
9ab42d |
src/uxa/intel_dri.c | 38 +++++++++++++++++++--
|
|
|
9ab42d |
src/uxa/intel_driver.c | 89 ++++++++++++++++++++++++++++++++++++++++++++------
|
|
|
9ab42d |
6 files changed, 140 insertions(+), 21 deletions(-)
|
|
|
9ab42d |
|
|
|
9ab42d |
diff --git a/src/intel_device.c b/src/intel_device.c
|
|
|
9ab42d |
index d9ff8bc..370b03c 100644
|
|
|
9ab42d |
--- a/src/intel_device.c
|
|
|
9ab42d |
+++ b/src/intel_device.c
|
|
|
9ab42d |
@@ -181,14 +181,18 @@ int intel_open_device(int entity_num,
|
|
|
9ab42d |
if (dev)
|
|
|
9ab42d |
return dev->fd;
|
|
|
9ab42d |
|
|
|
9ab42d |
- local_path = path ? strdup(path) : NULL;
|
|
|
9ab42d |
+ if (!xorgWayland) {
|
|
|
9ab42d |
+ local_path = path ? strdup(path) : NULL;
|
|
|
9ab42d |
|
|
|
9ab42d |
- fd = __intel_open_device(pci, &local_path);
|
|
|
9ab42d |
- if (fd == -1)
|
|
|
9ab42d |
- goto err_path;
|
|
|
9ab42d |
+ fd = __intel_open_device(pci, &local_path);
|
|
|
9ab42d |
+ if (fd == -1)
|
|
|
9ab42d |
+ goto err_path;
|
|
|
9ab42d |
|
|
|
9ab42d |
- if (!__intel_check_device(fd))
|
|
|
9ab42d |
- goto err_close;
|
|
|
9ab42d |
+ if (!__intel_check_device(fd))
|
|
|
9ab42d |
+ goto err_close;
|
|
|
9ab42d |
+ } else {
|
|
|
9ab42d |
+ fd = -1;
|
|
|
9ab42d |
+ }
|
|
|
9ab42d |
|
|
|
9ab42d |
dev = malloc(sizeof(*dev));
|
|
|
9ab42d |
if (dev == NULL)
|
|
|
9ab42d |
@@ -207,7 +211,7 @@ int intel_open_device(int entity_num,
|
|
|
9ab42d |
|
|
|
9ab42d |
xf86GetEntityPrivate(entity_num, intel_device_key)->ptr = dev;
|
|
|
9ab42d |
|
|
|
9ab42d |
- return fd;
|
|
|
9ab42d |
+ return xorgWayland ? 0 : fd;
|
|
|
9ab42d |
|
|
|
9ab42d |
err_close:
|
|
|
9ab42d |
close(fd);
|
|
|
9ab42d |
diff --git a/src/intel_driver.h b/src/intel_driver.h
|
|
|
9ab42d |
index 4768536..103d31e 100644
|
|
|
9ab42d |
--- a/src/intel_driver.h
|
|
|
9ab42d |
+++ b/src/intel_driver.h
|
|
|
9ab42d |
@@ -129,6 +129,10 @@ void intel_put_device(ScrnInfoPtr scrn);
|
|
|
9ab42d |
|
|
|
9ab42d |
void __intel_uxa_release_device(ScrnInfoPtr scrn);
|
|
|
9ab42d |
|
|
|
9ab42d |
-#define hosted() (0)
|
|
|
9ab42d |
+#include <xorg-server.h>
|
|
|
9ab42d |
+#ifdef XORG_WAYLAND
|
|
|
9ab42d |
+#include <xf86Priv.h>
|
|
|
9ab42d |
+#define hosted() (xorgWayland)
|
|
|
9ab42d |
+#endif
|
|
|
9ab42d |
|
|
|
9ab42d |
#endif /* INTEL_DRIVER_H */
|
|
|
9ab42d |
diff --git a/src/intel_module.c b/src/intel_module.c
|
|
|
9ab42d |
index b91152e..ec6d8b8 100644
|
|
|
9ab42d |
--- a/src/intel_module.c
|
|
|
9ab42d |
+++ b/src/intel_module.c
|
|
|
9ab42d |
@@ -30,6 +30,7 @@
|
|
|
9ab42d |
|
|
|
9ab42d |
#include <xf86.h>
|
|
|
9ab42d |
#include <xf86Parser.h>
|
|
|
9ab42d |
+#include <xf86Priv.h>
|
|
|
9ab42d |
#include <xorgVersion.h>
|
|
|
9ab42d |
|
|
|
9ab42d |
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,6,99,0,0)
|
|
|
9ab42d |
@@ -387,6 +388,10 @@ static Bool intel_driver_func(ScrnInfoPtr pScrn,
|
|
|
9ab42d |
(*flag) = HW_SKIP_CONSOLE;
|
|
|
9ab42d |
#endif
|
|
|
9ab42d |
|
|
|
9ab42d |
+#ifdef HW_WAYLAND
|
|
|
9ab42d |
+ if (xorgWayland)
|
|
|
9ab42d |
+ (*flag) = HW_WAYLAND;
|
|
|
9ab42d |
+#endif
|
|
|
9ab42d |
return TRUE;
|
|
|
9ab42d |
default:
|
|
|
9ab42d |
/* Unknown or deprecated function */
|
|
|
9ab42d |
@@ -415,6 +420,9 @@ static enum accel_method { UXA, SNA } get_accel_method(void)
|
|
|
9ab42d |
enum accel_method accel_method = DEFAULT_ACCEL_METHOD;
|
|
|
9ab42d |
XF86ConfDevicePtr dev;
|
|
|
9ab42d |
|
|
|
9ab42d |
+ if (xorgWayland)
|
|
|
9ab42d |
+ return UXA;
|
|
|
9ab42d |
+
|
|
|
9ab42d |
if (hosted())
|
|
|
9ab42d |
return SNA;
|
|
|
9ab42d |
|
|
|
9ab42d |
diff --git a/src/uxa/intel.h b/src/uxa/intel.h
|
|
|
9ab42d |
index 9b696cd..0b3b95c 100644
|
|
|
9ab42d |
--- a/src/uxa/intel.h
|
|
|
9ab42d |
+++ b/src/uxa/intel.h
|
|
|
9ab42d |
@@ -350,6 +350,8 @@ typedef struct intel_screen_private {
|
|
|
9ab42d |
InputHandlerProc uevent_handler;
|
|
|
9ab42d |
#endif
|
|
|
9ab42d |
Bool has_prime_vmap_flush;
|
|
|
9ab42d |
+
|
|
|
9ab42d |
+ struct xwl_screen *xwl_screen;
|
|
|
9ab42d |
} intel_screen_private;
|
|
|
9ab42d |
|
|
|
9ab42d |
#define INTEL_INFO(intel) ((intel)->info)
|
|
|
9ab42d |
diff --git a/src/uxa/intel_dri.c b/src/uxa/intel_dri.c
|
|
|
9ab42d |
index 0370034..74dabe6 100644
|
|
|
9ab42d |
--- a/src/uxa/intel_dri.c
|
|
|
9ab42d |
+++ b/src/uxa/intel_dri.c
|
|
|
9ab42d |
@@ -50,6 +50,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
9ab42d |
|
|
|
9ab42d |
#include "xf86.h"
|
|
|
9ab42d |
#include "xf86_OSproc.h"
|
|
|
9ab42d |
+#include "xf86Priv.h"
|
|
|
9ab42d |
|
|
|
9ab42d |
#include "xf86Pci.h"
|
|
|
9ab42d |
#include "xf86drm.h"
|
|
|
9ab42d |
@@ -58,6 +59,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
9ab42d |
#include "shadow.h"
|
|
|
9ab42d |
#include "fb.h"
|
|
|
9ab42d |
|
|
|
9ab42d |
+#ifdef XORG_WAYLAND
|
|
|
9ab42d |
+#include <xwayland.h>
|
|
|
9ab42d |
+#endif
|
|
|
9ab42d |
+
|
|
|
9ab42d |
#include "intel.h"
|
|
|
9ab42d |
#include "i830_reg.h"
|
|
|
9ab42d |
|
|
|
9ab42d |
@@ -1520,6 +1525,22 @@ out_complete:
|
|
|
9ab42d |
return TRUE;
|
|
|
9ab42d |
}
|
|
|
9ab42d |
|
|
|
9ab42d |
+#if DRI2INFOREC_VERSION >= 10
|
|
|
9ab42d |
+static int intel_auth_magic3(ClientPtr client, ScreenPtr screen, uint32_t magic)
|
|
|
9ab42d |
+
|
|
|
9ab42d |
+{
|
|
|
9ab42d |
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
|
|
|
9ab42d |
+ intel_screen_private *intel = intel_get_screen_private(scrn);
|
|
|
9ab42d |
+
|
|
|
9ab42d |
+ /* Not wayland, go stragight to drm */
|
|
|
9ab42d |
+ if (!xorgWayland)
|
|
|
9ab42d |
+ return drmAuthMagic(intel->drmSubFD, magic);
|
|
|
9ab42d |
+
|
|
|
9ab42d |
+ /* Forward the request to our host */
|
|
|
9ab42d |
+ return xwl_drm_authenticate(client, intel->xwl_screen, magic);
|
|
|
9ab42d |
+}
|
|
|
9ab42d |
+#endif
|
|
|
9ab42d |
+
|
|
|
9ab42d |
static int dri2_server_generation;
|
|
|
9ab42d |
#endif
|
|
|
9ab42d |
|
|
|
9ab42d |
@@ -1617,14 +1638,25 @@ Bool I830DRI2ScreenInit(ScreenPtr screen)
|
|
|
9ab42d |
info.CopyRegion = I830DRI2CopyRegion;
|
|
|
9ab42d |
#if DRI2INFOREC_VERSION >= 4
|
|
|
9ab42d |
info.version = 4;
|
|
|
9ab42d |
- info.ScheduleSwap = I830DRI2ScheduleSwap;
|
|
|
9ab42d |
- info.GetMSC = I830DRI2GetMSC;
|
|
|
9ab42d |
- info.ScheduleWaitMSC = I830DRI2ScheduleWaitMSC;
|
|
|
9ab42d |
+ if (!xorgWayland) {
|
|
|
9ab42d |
+ info.ScheduleSwap = I830DRI2ScheduleSwap;
|
|
|
9ab42d |
+ info.GetMSC = I830DRI2GetMSC;
|
|
|
9ab42d |
+ info.ScheduleWaitMSC = I830DRI2ScheduleWaitMSC;
|
|
|
9ab42d |
+ } else {
|
|
|
9ab42d |
+ info.ScheduleSwap = NULL;
|
|
|
9ab42d |
+ info.GetMSC = NULL;
|
|
|
9ab42d |
+ info.ScheduleWaitMSC = NULL;
|
|
|
9ab42d |
+ }
|
|
|
9ab42d |
info.numDrivers = 1;
|
|
|
9ab42d |
info.driverNames = driverNames;
|
|
|
9ab42d |
driverNames[0] = info.driverName;
|
|
|
9ab42d |
#endif
|
|
|
9ab42d |
|
|
|
9ab42d |
+#if DRI2INFOREC_VERSION >= 10
|
|
|
9ab42d |
+ info.version = 10;
|
|
|
9ab42d |
+ info.AuthMagic3 = intel_auth_magic3;
|
|
|
9ab42d |
+#endif
|
|
|
9ab42d |
+
|
|
|
9ab42d |
return DRI2ScreenInit(screen, &info;;
|
|
|
9ab42d |
}
|
|
|
9ab42d |
|
|
|
9ab42d |
diff --git a/src/uxa/intel_driver.c b/src/uxa/intel_driver.c
|
|
|
9ab42d |
index 675408d..e74ba60 100644
|
|
|
9ab42d |
--- a/src/uxa/intel_driver.c
|
|
|
9ab42d |
+++ b/src/uxa/intel_driver.c
|
|
|
9ab42d |
@@ -70,12 +70,17 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
9ab42d |
#include "intel_xvmc.h"
|
|
|
9ab42d |
#endif
|
|
|
9ab42d |
|
|
|
9ab42d |
+#ifdef XORG_WAYLAND
|
|
|
9ab42d |
+#include <xwayland.h>
|
|
|
9ab42d |
+#endif
|
|
|
9ab42d |
+
|
|
|
9ab42d |
#include "legacy/legacy.h"
|
|
|
9ab42d |
#include "uxa.h"
|
|
|
9ab42d |
|
|
|
9ab42d |
#include <sys/ioctl.h>
|
|
|
9ab42d |
#include "i915_drm.h"
|
|
|
9ab42d |
#include <xf86drmMode.h>
|
|
|
9ab42d |
+#include <xf86Priv.h>
|
|
|
9ab42d |
|
|
|
9ab42d |
#include "intel_glamor.h"
|
|
|
9ab42d |
#include "intel_options.h"
|
|
|
9ab42d |
@@ -167,10 +172,16 @@ static Bool i830CreateScreenResources(ScreenPtr screen)
|
|
|
9ab42d |
if (!(*screen->CreateScreenResources) (screen))
|
|
|
9ab42d |
return FALSE;
|
|
|
9ab42d |
|
|
|
9ab42d |
+#ifdef XORG_WAYLAND
|
|
|
9ab42d |
+ if (intel->xwl_screen)
|
|
|
9ab42d |
+ xwl_screen_init(intel->xwl_screen, screen);
|
|
|
9ab42d |
+#endif
|
|
|
9ab42d |
+
|
|
|
9ab42d |
if (!intel_uxa_create_screen_resources(screen))
|
|
|
9ab42d |
return FALSE;
|
|
|
9ab42d |
|
|
|
9ab42d |
- intel_copy_fb(scrn);
|
|
|
9ab42d |
+ if (!intel->xwl_screen)
|
|
|
9ab42d |
+ intel_copy_fb(scrn);
|
|
|
9ab42d |
return TRUE;
|
|
|
9ab42d |
}
|
|
|
9ab42d |
|
|
|
9ab42d |
@@ -463,6 +474,27 @@ static void intel_setup_capabilities(ScrnInfoPtr scrn)
|
|
|
9ab42d |
#endif
|
|
|
9ab42d |
}
|
|
|
9ab42d |
|
|
|
9ab42d |
+#ifdef XORG_WAYLAND
|
|
|
9ab42d |
+static int intel_create_window_buffer(struct xwl_window *xwl_window,
|
|
|
9ab42d |
+ PixmapPtr pixmap)
|
|
|
9ab42d |
+{
|
|
|
9ab42d |
+ uint32_t name;
|
|
|
9ab42d |
+ dri_bo *bo;
|
|
|
9ab42d |
+
|
|
|
9ab42d |
+ bo = intel_get_pixmap_bo(pixmap);
|
|
|
9ab42d |
+ if (bo == NULL || dri_bo_flink(bo, &name) != 0)
|
|
|
9ab42d |
+ return BadDrawable;
|
|
|
9ab42d |
+
|
|
|
9ab42d |
+ return xwl_create_window_buffer_drm(xwl_window, pixmap, name);
|
|
|
9ab42d |
+}
|
|
|
9ab42d |
+
|
|
|
9ab42d |
+static struct xwl_driver xwl_driver = {
|
|
|
9ab42d |
+ .version = 1,
|
|
|
9ab42d |
+ .use_drm = 1,
|
|
|
9ab42d |
+ .create_window_buffer = intel_create_window_buffer
|
|
|
9ab42d |
+};
|
|
|
9ab42d |
+#endif
|
|
|
9ab42d |
+
|
|
|
9ab42d |
/**
|
|
|
9ab42d |
* This is called before ScreenInit to do any require probing of screen
|
|
|
9ab42d |
* configuration.
|
|
|
9ab42d |
@@ -517,12 +549,6 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
|
|
|
9ab42d |
|
|
|
9ab42d |
intel->PciInfo = xf86GetPciInfoForEntity(intel->pEnt->index);
|
|
|
9ab42d |
|
|
|
9ab42d |
- if (!intel_open_drm_master(scrn)) {
|
|
|
9ab42d |
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
|
|
9ab42d |
- "Failed to become DRM master.\n");
|
|
|
9ab42d |
- return FALSE;
|
|
|
9ab42d |
- }
|
|
|
9ab42d |
-
|
|
|
9ab42d |
scrn->monitor = scrn->confScreen->monitor;
|
|
|
9ab42d |
scrn->progClock = TRUE;
|
|
|
9ab42d |
scrn->rgbBits = 8;
|
|
|
9ab42d |
@@ -561,6 +587,31 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
|
|
|
9ab42d |
intel_check_chipset_option(scrn);
|
|
|
9ab42d |
intel_check_dri_option(scrn);
|
|
|
9ab42d |
|
|
|
9ab42d |
+#ifdef XORG_WAYLAND
|
|
|
9ab42d |
+ if (xorgWayland) {
|
|
|
9ab42d |
+ intel->xwl_screen = xwl_screen_create();
|
|
|
9ab42d |
+ if (!intel->xwl_screen) {
|
|
|
9ab42d |
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
|
|
9ab42d |
+ "Failed to initialize xwayland.\n");
|
|
|
9ab42d |
+ return FALSE;
|
|
|
9ab42d |
+ }
|
|
|
9ab42d |
+
|
|
|
9ab42d |
+ if (!xwl_screen_pre_init(scrn, intel->xwl_screen,
|
|
|
9ab42d |
+ 0, &xwl_driver)) {
|
|
|
9ab42d |
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
|
|
9ab42d |
+ "Failed to pre-init xwayland screen\n");
|
|
|
9ab42d |
+ xwl_screen_destroy(intel->xwl_screen);
|
|
|
9ab42d |
+ }
|
|
|
9ab42d |
+
|
|
|
9ab42d |
+ intel->drmSubFD = xwl_screen_get_drm_fd(intel->xwl_screen);
|
|
|
9ab42d |
+ }
|
|
|
9ab42d |
+#endif
|
|
|
9ab42d |
+
|
|
|
9ab42d |
+ if (!intel->xwl_screen && !intel_open_drm_master(scrn))
|
|
|
9ab42d |
+ xf86DrvMsg(scrn->scrnIndex, X_ERROR,
|
|
|
9ab42d |
+ "Failed to become DRM master.\n");
|
|
|
9ab42d |
+
|
|
|
9ab42d |
+
|
|
|
9ab42d |
if (!intel_init_bufmgr(intel)) {
|
|
|
9ab42d |
PreInitCleanup(scrn);
|
|
|
9ab42d |
return FALSE;
|
|
|
9ab42d |
@@ -599,6 +650,9 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
|
|
|
9ab42d |
intel->swapbuffers_wait = xf86ReturnOptValBool(intel->Options,
|
|
|
9ab42d |
OPTION_SWAPBUFFERS_WAIT,
|
|
|
9ab42d |
TRUE);
|
|
|
9ab42d |
+ if (!intel->xwl_screen)
|
|
|
9ab42d |
+ intel->swapbuffers_wait = TRUE;
|
|
|
9ab42d |
+
|
|
|
9ab42d |
xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "Wait on SwapBuffers? %s\n",
|
|
|
9ab42d |
intel->swapbuffers_wait ? "enabled" : "disabled");
|
|
|
9ab42d |
|
|
|
9ab42d |
@@ -620,7 +674,8 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
|
|
|
9ab42d |
|
|
|
9ab42d |
I830XvInit(scrn);
|
|
|
9ab42d |
|
|
|
9ab42d |
- if (!intel_mode_pre_init(scrn, intel->drmSubFD, intel->cpp)) {
|
|
|
9ab42d |
+ if (!intel->xwl_screen &&
|
|
|
9ab42d |
+ !intel_mode_pre_init(scrn, intel->drmSubFD, intel->cpp)) {
|
|
|
9ab42d |
PreInitCleanup(scrn);
|
|
|
9ab42d |
return FALSE;
|
|
|
9ab42d |
}
|
|
|
9ab42d |
@@ -757,6 +812,11 @@ I830BlockHandler(BLOCKHANDLER_ARGS_DECL)
|
|
|
9ab42d |
#ifdef INTEL_PIXMAP_SHARING
|
|
|
9ab42d |
intel_dirty_update(screen);
|
|
|
9ab42d |
#endif
|
|
|
9ab42d |
+
|
|
|
9ab42d |
+#ifdef XORG_WAYLAND
|
|
|
9ab42d |
+ if (intel->xwl_screen)
|
|
|
9ab42d |
+ xwl_screen_post_damage(intel->xwl_screen);
|
|
|
9ab42d |
+#endif
|
|
|
9ab42d |
}
|
|
|
9ab42d |
|
|
|
9ab42d |
static Bool
|
|
|
9ab42d |
@@ -792,9 +852,16 @@ intel_flush_callback(CallbackListPtr *list,
|
|
|
9ab42d |
pointer user_data, pointer call_data)
|
|
|
9ab42d |
{
|
|
|
9ab42d |
ScrnInfoPtr scrn = user_data;
|
|
|
9ab42d |
+ intel_screen_private *intel = intel_get_screen_private(scrn);
|
|
|
9ab42d |
+
|
|
|
9ab42d |
if (scrn->vtSema) {
|
|
|
9ab42d |
intel_batch_submit(scrn);
|
|
|
9ab42d |
intel_glamor_flush(intel_get_screen_private(scrn));
|
|
|
9ab42d |
+
|
|
|
9ab42d |
+#ifdef XORG_WAYLAND
|
|
|
9ab42d |
+ if (intel->xwl_screen)
|
|
|
9ab42d |
+ xwl_screen_post_damage(intel->xwl_screen);
|
|
|
9ab42d |
+#endif
|
|
|
9ab42d |
}
|
|
|
9ab42d |
}
|
|
|
9ab42d |
|
|
|
9ab42d |
@@ -1067,7 +1134,8 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)
|
|
|
9ab42d |
if (serverGeneration == 1)
|
|
|
9ab42d |
xf86ShowUnusedOptions(scrn->scrnIndex, scrn->options);
|
|
|
9ab42d |
|
|
|
9ab42d |
- intel_mode_init(intel);
|
|
|
9ab42d |
+ if (!intel->xwl_screen)
|
|
|
9ab42d |
+ intel_mode_init(intel);
|
|
|
9ab42d |
|
|
|
9ab42d |
intel->suspended = FALSE;
|
|
|
9ab42d |
|
|
|
9ab42d |
@@ -1182,7 +1250,8 @@ static Bool I830CloseScreen(CLOSE_SCREEN_ARGS_DECL)
|
|
|
9ab42d |
}
|
|
|
9ab42d |
|
|
|
9ab42d |
if (intel->front_buffer) {
|
|
|
9ab42d |
- intel_mode_remove_fb(intel);
|
|
|
9ab42d |
+ if (!intel->xwl_screen)
|
|
|
9ab42d |
+ intel_mode_remove_fb(intel);
|
|
|
9ab42d |
drm_intel_bo_unreference(intel->front_buffer);
|
|
|
9ab42d |
intel->front_buffer = NULL;
|
|
|
9ab42d |
}
|
|
|
9ab42d |
--
|
|
|
9ab42d |
1.8.3.1
|
|
|
9ab42d |
|