xserver-xorg-video-intel: Changes to 'debian-unstable'
configure.ac | 59 ++++++
debian/changelog | 19 ++
debian/patches/0002-Update-manpage-for-new-accelmethod-option.patch | 15 +
debian/patches/series | 1
debian/rules | 2
src/Makefile.am | 1
src/common.h | 2
src/intel_display.c | 21 ++
src/intel_driver.c | 86 ---------
src/intel_driver.h | 2
src/intel_glamor.c | 15 +
src/intel_module.c | 90 ++++++----
src/intel_options.h | 75 ++++++++
src/legacy/i810/i810_driver.c | 3
src/legacy/legacy.h | 2
src/sna/sna.h | 15 -
src/sna/sna_display.c | 2
src/sna/sna_dri.c | 6
src/sna/sna_driver.c | 32 +--
src/sna/sna_module.h | 4
src/sna/sna_video.c | 2
src/sna/sna_video_overlay.c | 2
src/sna/sna_video_sprite.c | 2
23 files changed, 297 insertions(+), 161 deletions(-)
New commits:
commit d76d28952241dd22f7252fbf28f3f0049965f201
Author: Cyril Brulebois <kibi@debian.org>
Date: Mon Jun 11 22:22:04 2012 +0000
Upload to unstable.
diff --git a/debian/changelog b/debian/changelog
index e203e41..3b45678 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-xserver-xorg-video-intel (2:2.19.0-2) UNRELEASED; urgency=low
+xserver-xorg-video-intel (2:2.19.0-2) unstable; urgency=low
* Cherry-pick the following commits to make it possible to build both
uxa (legacy acceleration method) and sna (experimental acceleration
@@ -15,7 +15,7 @@ xserver-xorg-video-intel (2:2.19.0-2) UNRELEASED; urgency=low
* Add patch to document the new AccelMethod option accordingly:
- 0002-Update-manpage-for-new-accelmethod-option.patch
- -- Cyril Brulebois <kibi@debian.org> Mon, 11 Jun 2012 21:55:45 +0000
+ -- Cyril Brulebois <kibi@debian.org> Mon, 11 Jun 2012 22:22:00 +0000
xserver-xorg-video-intel (2:2.19.0-1) unstable; urgency=low
commit 28febcb6451e8cc9eb4fd5b05c6176529b54aef3
Author: Cyril Brulebois <kibi@debian.org>
Date: Mon Jun 11 22:21:38 2012 +0000
Add patch to document the new AccelMethod option accordingly: 0002-Update-manpage-for-new-accelmethod-option.patch
diff --git a/debian/changelog b/debian/changelog
index 22ced2a..e203e41 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,8 @@ xserver-xorg-video-intel (2:2.19.0-2) UNRELEASED; urgency=low
* rules: Enable sna and uxa accel methods, default to uxa. The switch
to sna can be achieved through a minimal xorg.conf (look for “AccelMethod”
in: man intel).
+ * Add patch to document the new AccelMethod option accordingly:
+ - 0002-Update-manpage-for-new-accelmethod-option.patch
-- Cyril Brulebois <kibi@debian.org> Mon, 11 Jun 2012 21:55:45 +0000
diff --git a/debian/patches/0002-Update-manpage-for-new-accelmethod-option.patch b/debian/patches/0002-Update-manpage-for-new-accelmethod-option.patch
new file mode 100644
index 0000000..11fd542
--- /dev/null
+++ b/debian/patches/0002-Update-manpage-for-new-accelmethod-option.patch
@@ -0,0 +1,15 @@
+--- a/man/intel.man
++++ b/man/intel.man
+@@ -57,6 +57,12 @@ The following driver
+ .B Options
+ are supported
+ .TP
++.BI "Option \*qAccelMethod\*q \*q" string \*q
++This sets the acceleration method. The legacy method is uxa, the experimental
++one is sna.
++.IP
++Default: uxa.
++.TP
+ .BI "Option \*qColorKey\*q \*q" integer \*q
+ This sets the default pixel value for the YUV video overlay key.
+ .IP
diff --git a/debian/patches/series b/debian/patches/series
index 3569ab4..340efc7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
0001-Fix-build-failure-when-passing-with-builderstring.patch
+0002-Update-manpage-for-new-accelmethod-option.patch
commit 63bc77e1c5906e7ccc1820e560cbd080299de64e
Author: Cyril Brulebois <kibi@debian.org>
Date: Mon Jun 11 22:01:37 2012 +0000
rules: Enable sna and uxa accel methods, default to uxa.
diff --git a/debian/changelog b/debian/changelog
index 996b253..22ced2a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,9 @@ xserver-xorg-video-intel (2:2.19.0-2) UNRELEASED; urgency=low
- 318982566b sna/dri: Disable experimental code by default
- 7614a54188 configure: Harden --with-default-accel against simple mistakes
- 4e984b79cc configure: Correct the help string for --with-default-accel
+ * rules: Enable sna and uxa accel methods, default to uxa. The switch
+ to sna can be achieved through a minimal xorg.conf (look for “AccelMethod”
+ in: man intel).
-- Cyril Brulebois <kibi@debian.org> Mon, 11 Jun 2012 21:55:45 +0000
diff --git a/debian/rules b/debian/rules
index 493cd9c..451de4d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,7 +6,7 @@ BUILDER := $(shell dpkg-parsechangelog | awk -F': ' '/^Maintainer: / {pri
# Enable SNA, pass builderstring:
override_dh_auto_configure:
- dh_auto_configure -- --disable-sna --with-builderstring="$(SOURCE_NAME) $(SOURCE_VERSION) ($(BUILDER))"
+ dh_auto_configure -- --enable-sna --enable-uxa --with-default-accel=uxa --with-builderstring="$(SOURCE_NAME) $(SOURCE_VERSION) ($(BUILDER))"
# Install in debian/tmp to retain control through dh_install:
override_dh_auto_install:
commit a0366c845df384d9ba3a2501025764ec4bdcc289
Author: Cyril Brulebois <kibi@debian.org>
Date: Mon Jun 11 21:57:24 2012 +0000
Document the cherry-picks.
diff --git a/debian/changelog b/debian/changelog
index 884957b..996b253 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+xserver-xorg-video-intel (2:2.19.0-2) UNRELEASED; urgency=low
+
+ * Cherry-pick the following commits to make it possible to build both
+ uxa (legacy acceleration method) and sna (experimental acceleration
+ method):
+ - 3f3bde4f0c uxa: Only consider an output valid if the kernel reports it attached
+ - df6ab02c36 Unify options handling between UXA and SNA
+ - e456291350 Allow runtime switching of AccelMethod between uxa/sna and even glamor
+ - 318982566b sna/dri: Disable experimental code by default
+ - 7614a54188 configure: Harden --with-default-accel against simple mistakes
+ - 4e984b79cc configure: Correct the help string for --with-default-accel
+
+ -- Cyril Brulebois <kibi@debian.org> Mon, 11 Jun 2012 21:55:45 +0000
+
xserver-xorg-video-intel (2:2.19.0-1) unstable; urgency=low
* New upstream release.
commit fd9a6d4f787572d1ebaeec3f80bc9ffffd03f2ae
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Mon Jun 11 09:02:03 2012 +0100
configure: Correct the help string for --with-default-accel
Prior to finalizing the defaults I changed my mind and realised that the
default had to reflect the current behaviour of someone enabling SNA for
the first time, and not the previous behaviour of --enable-sna to
override UXA. This is so that distro's could offer an SNA enabled DDX
for the brave whilst not affecting their typical no-xorg.conf users.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit 4e984b79cce038ba5026d8bdd93dec9b5a6ced8a)
diff --git a/configure.ac b/configure.ac
index 8969c51..cc498a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -160,7 +160,7 @@ fi
AC_ARG_WITH(default-accel,
AS_HELP_STRING([--with-default-accel],
- [Select the default acceleration method [default=sna if enabled, otherwise uxa]]),
+ [Select the default acceleration method [default=uxa if enabled, otherwise sna]]),
[accel="$withval"],
[accel=auto])
if test "x$accel" = xyes; then
commit f67f7ab109bb610b071a3700595dd50f148cd8e4
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Sun Jun 10 09:36:38 2012 +0100
configure: Harden --with-default-accel against simple mistakes
If the user specifies no options, assume automatic selection. Then
double check we found a valid backend and so avoid later breaking the
build.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit 7614a541886dd9eb5c9d441e2618785e9cc53a65)
diff --git a/configure.ac b/configure.ac
index e4da047..8969c51 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,6 +163,10 @@ AC_ARG_WITH(default-accel,
[Select the default acceleration method [default=sna if enabled, otherwise uxa]]),
[accel="$withval"],
[accel=auto])
+if test "x$accel" = xyes; then
+ AC_MSG_WARN([No default acceleration specified, choosing automatic selection])
+ accel="auto"
+fi
AC_MSG_CHECKING([which acceleration method to use by default])
if test "x$accel" = xauto; then
@@ -178,9 +182,11 @@ if test "x$accel" = xauto; then
fi
fi
+have_accel=no
if test "x$accel" = xsna; then
if test "x$SNA" != "xno"; then
AC_DEFINE(DEFAULT_ACCEL_METHOD, SNA, [Default acceleration method])
+ have_accel=yes
else
AC_MSG_ERROR([SNA requested as default, but is not enabled])
fi
@@ -189,11 +195,15 @@ fi
if test "x$accel" = xuxa; then
if test "x$UXA" != "xno"; then
AC_DEFINE(DEFAULT_ACCEL_METHOD, UXA, [Default acceleration method])
+ have_accel=yes
else
AC_MSG_ERROR([UXA requested as default, but is not enabled])
fi
fi
AC_MSG_RESULT($accel)
+if test "x$accel" = xno; then
+ AC_MSG_ERROR([No default acceleration option])
+fi
AC_ARG_ENABLE(vmap,
AS_HELP_STRING([--enable-vmap],
commit 16181d27d13d87dfef92f78af5e80e89cf085b90
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Thu Jun 7 21:56:04 2012 +0100
sna/dri: Disable experimental code by default
Since these require non-upstream patches to other components, we don't
want it enabled by default and randomly breaking builds.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit 318982566bbc7145847bd03601087150eef7a8d8)
Conflicts:
src/sna/sna_dri.c
The diff was applied manually for that file, the context changed a lot.
diff --git a/configure.ac b/configure.ac
index 2d860b8..e4da047 100644
--- a/configure.ac
+++ b/configure.ac
@@ -197,7 +197,7 @@ AC_MSG_RESULT($accel)
AC_ARG_ENABLE(vmap,
AS_HELP_STRING([--enable-vmap],
- [Enable use of vmap [default=no]]),
+ [Enable use of vmap (experimental) [default=no]]),
[VMAP="$enableval"],
[VMAP=no])
AM_CONDITIONAL(USE_VMAP, test x$VMAP = xyes)
@@ -205,6 +205,15 @@ if test "x$VMAP" = xyes; then
AC_DEFINE(USE_VMAP,1,[Assume VMAP support])
fi
+AC_ARG_ENABLE(async-swap,
+ AS_HELP_STRING([--enable-async-swap],
+ [Enable use of asynchronous swaps (experimental) [default=no]]),
+ [ASYNC_SWAP="$enableval"],
+ [ASYNC_SWAP=no])
+AM_CONDITIONAL(USE_ASYNC_SWAP, test x$ASYNC_SWAP = xyes)
+if test "x$ASYNC_SWAP" = xyes; then
+ AC_DEFINE(USE_ASYNC_SWAP,1,[Assume asynchronous swap support])
+fi
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 1a7b6bd..f8d057a 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -1210,7 +1210,7 @@ static void sna_dri_flip_event(struct sna *sna,
}
break;
-#if DRI2INFOREC_VERSION >= 7
+#if USE_ASYNC_SWAP && DRI2INFOREC_VERSION >= 7
case DRI2_ASYNC_FLIP:
DBG(("%s: async swap flip completed on pipe %d, pending? %d, new? %d\n",
__FUNCTION__, flip->pipe,
@@ -1698,7 +1698,7 @@ blit_fallback:
return TRUE;
}
-#if DRI2INFOREC_VERSION >= 7
+#if USE_ASYNC_SWAP && DRI2INFOREC_VERSION >= 7
static Bool
sna_dri_async_swap(ClientPtr client, DrawablePtr draw,
DRI2BufferPtr front, DRI2BufferPtr back,
@@ -2078,7 +2078,7 @@ Bool sna_dri_open(struct sna *sna, ScreenPtr screen)
info.ReuseBufferNotify = NULL;
#endif
-#if DRI2INFOREC_VERSION >= 7
+#if USE_ASYNC_SWAP && DRI2INFOREC_VERSION >= 7
info.version = 7;
info.AsyncSwap = sna_dri_async_swap;
#endif
commit 88bf278f12110154e917b8e5a850e79f4aae86da
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Thu May 24 18:22:45 2012 +0100
Allow runtime switching of AccelMethod between uxa/sna and even glamor
Section "Device"
Option "AccelMethod" "uxa/glamor/sna"
EndSection
The appropriate backend must also be enabled at compile time for the
runtime option to be available (i.e. --enable-uxa (default) --enable-sna
--enable-glamor)
Demanded-by: Adam Jackson <ajax@redhat.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50290
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit e45629135065d0cc73c285f8df35ab4e1d07c6dc)
diff --git a/configure.ac b/configure.ac
index 3770983..2d860b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,6 +158,43 @@ if test "x$GLAMOR" != "xno"; then
AC_DEFINE(USE_GLAMOR, 1, [Enable glamor acceleration])
fi
+AC_ARG_WITH(default-accel,
+ AS_HELP_STRING([--with-default-accel],
+ [Select the default acceleration method [default=sna if enabled, otherwise uxa]]),
+ [accel="$withval"],
+ [accel=auto])
+
+AC_MSG_CHECKING([which acceleration method to use by default])
+if test "x$accel" = xauto; then
+ if test "x$UXA" != "xno"; then
+ accel=uxa
+ else
+ if test "x$SNA" != "xno"; then
+ accel=sna
+ fi
+ fi
+ if test "x$accel" = xauto; then
+ AC_MSG_ERROR([No default acceleration option])
+ fi
+fi
+
+if test "x$accel" = xsna; then
+ if test "x$SNA" != "xno"; then
+ AC_DEFINE(DEFAULT_ACCEL_METHOD, SNA, [Default acceleration method])
+ else
+ AC_MSG_ERROR([SNA requested as default, but is not enabled])
+ fi
+fi
+
+if test "x$accel" = xuxa; then
+ if test "x$UXA" != "xno"; then
+ AC_DEFINE(DEFAULT_ACCEL_METHOD, UXA, [Default acceleration method])
+ else
+ AC_MSG_ERROR([UXA requested as default, but is not enabled])
+ fi
+fi
+AC_MSG_RESULT($accel)
+
AC_ARG_ENABLE(vmap,
AS_HELP_STRING([--enable-vmap],
[Enable use of vmap [default=no]]),
@@ -174,7 +211,6 @@ AC_ARG_ENABLE(debug,
[Enables internal debugging [default=no]]),
[DEBUG="$enableval"],
[DEBUG=no])
-
# Store the list of server defined optional extensions in REQUIRED_MODULES
XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
diff --git a/src/common.h b/src/common.h
index 06b2192..e3ab1f2 100644
--- a/src/common.h
+++ b/src/common.h
@@ -63,7 +63,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/* I830 hooks for the I810 driver setup/probe. */
extern const OptionInfoRec *I830AvailableOptions(int chipid, int busid);
-extern void intel_init_scrn(ScrnInfoPtr scrn);
+extern Bool intel_init_scrn(ScrnInfoPtr scrn);
/* Symbol lists shared by the i810 and i830 parts. */
extern int I830EntityIndex;
diff --git a/src/intel_driver.c b/src/intel_driver.c
index 5a8a953..261e7a5 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -1236,7 +1236,7 @@ static Bool I830PMEvent(int scrnIndex, pmEvent event, Bool undo)
return TRUE;
}
-void intel_init_scrn(ScrnInfoPtr scrn)
+Bool intel_init_scrn(ScrnInfoPtr scrn)
{
scrn->PreInit = I830PreInit;
scrn->ScreenInit = I830ScreenInit;
@@ -1247,4 +1247,5 @@ void intel_init_scrn(ScrnInfoPtr scrn)
scrn->FreeScreen = I830FreeScreen;
scrn->ValidMode = I830ValidMode;
scrn->PMEvent = I830PMEvent;
+ return TRUE;
}
diff --git a/src/intel_glamor.c b/src/intel_glamor.c
index a868157..f318b17 100644
--- a/src/intel_glamor.c
+++ b/src/intel_glamor.c
@@ -172,6 +172,18 @@ intel_glamor_finish_access(PixmapPtr pixmap, uxa_access_t access)
return;
}
+static Bool
+intel_glamor_enabled(intel_screen_private *intel)
+{
+ const char *s;
+
+ s = xf86GetOptString(intel->Options, ACCEL_METHOD);
+ if (s == NULL)
+ return FALSE;
+
+ return strcasecmp(s, "glamor") == 0;
+}
+
Bool
intel_glamor_init(ScreenPtr screen)
{
@@ -181,6 +193,9 @@ intel_glamor_init(ScreenPtr screen)
if ((intel->uxa_flags & UXA_GLAMOR_EGL_INITIALIZED) == 0)
goto fail;
+ if (!intel_glamor_enabled(intel))
+ goto fail;
+
if (!glamor_init(screen, GLAMOR_INVERTED_Y_AXIS | GLAMOR_USE_EGL_SCREEN)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Failed to initialize glamor.\n");
diff --git a/src/intel_module.c b/src/intel_module.c
index ac6dae1..4430ac6 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -31,6 +31,7 @@
#include <xf86.h>
#include <xf86_OSproc.h>
#include <xf86cmap.h>
+#include <xf86Parser.h>
#include <xf86drmMode.h>
#include <xorgVersion.h>
@@ -292,6 +293,43 @@ static Bool has_kernel_mode_setting(struct pci_device *dev)
return ret == 0;
}
+extern XF86ConfigPtr xf86configptr;
+
+static XF86ConfDevicePtr
+_xf86findDriver(const char *ident, XF86ConfDevicePtr p)
+{
+ while (p) {
+ if (xf86nameCompare(ident, p->dev_driver) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
+}
+
+static enum accel_method { UXA, SNA } get_accel_method(void)
+{
+ enum accel_method accel_method = DEFAULT_ACCEL_METHOD;
+ XF86ConfDevicePtr dev;
+
+ dev = _xf86findDriver("intel", xf86configptr->conf_device_lst);
+ if (dev && dev->dev_option_lst) {
+ const char *s;
+
+ s = xf86FindOptionValue(dev->dev_option_lst, "AccelMethod");
+ if (s ) {
+ if (strcasecmp(s, "sna") == 0)
+ accel_method = SNA;
+ else if (strcasecmp(s, "uxa") == 0)
+ accel_method = UXA;
+ else if (strcasecmp(s, "glamor") == 0)
+ accel_method = UXA;
+ }
+ }
+
+ return accel_method;
+}
+
/*
* intel_pci_probe --
*
@@ -338,34 +376,35 @@ static Bool intel_pci_probe(DriverPtr driver,
scrn = xf86ConfigPciEntity(NULL, 0, entity_num, intel_pci_chipsets,
NULL, NULL, NULL, NULL, NULL);
- if (scrn != NULL) {
- scrn->driverVersion = INTEL_VERSION;
- scrn->driverName = INTEL_DRIVER_NAME;
- scrn->name = INTEL_NAME;
- scrn->Probe = NULL;
+ if (scrn == NULL)
+ return FALSE;
+
+ scrn->driverVersion = INTEL_VERSION;
+ scrn->driverName = INTEL_DRIVER_NAME;
+ scrn->name = INTEL_NAME;
+ scrn->Probe = NULL;
- switch (DEVICE_ID(device)) {
#if !KMS_ONLY
- case PCI_CHIP_I810:
- case PCI_CHIP_I810_DC100:
- case PCI_CHIP_I810_E:
- case PCI_CHIP_I815:
- lg_i810_init(scrn);
- break;
+ switch (DEVICE_ID(device)) {
+ case PCI_CHIP_I810:
+ case PCI_CHIP_I810_DC100:
+ case PCI_CHIP_I810_E:
+ case PCI_CHIP_I815:
+ return lg_i810_init(scrn);
+ }
#endif
- default:
+ switch (get_accel_method()) {
#if USE_SNA
- sna_init_scrn(scrn, entity_num);
-#elif USE_UXA
- intel_init_scrn(scrn);
-#else
- scrn = NULL;
+ case SNA: return sna_init_scrn(scrn, entity_num);
#endif
- break;
- }
+
+#if USE_UXA
+ case UXA: return intel_init_scrn(scrn);
+#endif
+
+ default: return FALSE;
}
- return scrn != NULL;
}
#ifdef XFree86LOADER
diff --git a/src/intel_options.h b/src/intel_options.h
index 9367751..8863878 100644
--- a/src/intel_options.h
+++ b/src/intel_options.h
@@ -8,6 +8,7 @@
*/
enum intel_options {
+ OPTION_ACCEL_METHOD,
OPTION_DRI,
OPTION_VIDEO_KEY,
OPTION_COLOR_KEY,
@@ -40,6 +41,7 @@ enum intel_options {
};
static OptionInfoRec intel_options[] = {
+ {OPTION_ACCEL_METHOD, "AccelMethod", OPTV_STRING, {0}, 0},
{OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, TRUE},
{OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE},
{OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE},
diff --git a/src/legacy/i810/i810_driver.c b/src/legacy/i810/i810_driver.c
index 02da574..59700fb 100644
--- a/src/legacy/i810/i810_driver.c
+++ b/src/legacy/i810/i810_driver.c
@@ -2102,7 +2102,7 @@ lg_i810_available_options(int chipid, int busid)
}
-void lg_i810_init(ScrnInfoPtr scrn)
+Bool lg_i810_init(ScrnInfoPtr scrn)
{
scrn->PreInit = I810PreInit;
scrn->ScreenInit = I810ScreenInit;
@@ -2112,4 +2112,5 @@ void lg_i810_init(ScrnInfoPtr scrn)
scrn->LeaveVT = I810LeaveVT;
scrn->FreeScreen = I810FreeScreen;
scrn->ValidMode = I810ValidMode;
+ return TRUE;
}
diff --git a/src/legacy/legacy.h b/src/legacy/legacy.h
index 7bdd172..0ff3299 100644
--- a/src/legacy/legacy.h
+++ b/src/legacy/legacy.h
@@ -1,3 +1,3 @@
/* The old i810 (only) driver. */
const OptionInfoRec *lg_i810_available_options(int chipid, int busid);
-void lg_i810_init(ScrnInfoPtr scrn);
+Bool lg_i810_init(ScrnInfoPtr scrn);
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index e63665e..41b42da 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -1049,7 +1049,7 @@ static Bool sna_pm_event(int scrnIndex, pmEvent event, Bool undo)
return TRUE;
}
-void sna_init_scrn(ScrnInfoPtr scrn, int entity_num)
+Bool sna_init_scrn(ScrnInfoPtr scrn, int entity_num)
{
EntityInfoPtr entity;
@@ -1083,8 +1083,13 @@ void sna_init_scrn(ScrnInfoPtr scrn, int entity_num)
xf86SetEntitySharable(scrn->entityList[0]);
entity = xf86GetEntityInfo(entity_num);
+ if (!entity)
+ return FALSE;
+
xf86SetEntityInstanceForScreen(scrn,
entity->index,
xf86GetNumEntityInstances(entity->index)-1);
free(entity);
+
+ return TRUE;
}
diff --git a/src/sna/sna_module.h b/src/sna/sna_module.h
index aa1ae0d..1b46cb7 100644
--- a/src/sna/sna_module.h
+++ b/src/sna/sna_module.h
@@ -1 +1 @@
-void sna_init_scrn(ScrnInfoPtr scrn, int entity_num);
+Bool sna_init_scrn(ScrnInfoPtr scrn, int entity_num);
commit 1e6fdd07aec0b4744e06127d42fd7785f73127fb
Author: Eugeni Dodonov <eugeni.dodonov@intel.com>
Date: Mon Oct 31 14:43:22 2011 -0200
Unify options handling between UXA and SNA
Unifies available options for both UXA and SNA drivers, and
moves them into a common header file, intel_opts.h.
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
(cherry picked from commit df6ab02c3690eea8393ecc8c113e2f2891856cc6)
diff --git a/src/Makefile.am b/src/Makefile.am
index 448a354..de97018 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -42,6 +42,7 @@ NULL:=#
intel_drv_la_SOURCES = \
intel_list.h \
+ intel_options.h \
intel_module.c \
$(NULL)
diff --git a/src/intel_display.c b/src/intel_display.c
index 77a1cce..89f7259 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -1702,7 +1702,6 @@ int intel_crtc_to_pipe(xf86CrtcPtr crtc)
Bool intel_crtc_on(xf86CrtcPtr crtc)
{
- ScrnInfoPtr scrn = crtc->scrn;
struct intel_crtc *intel_crtc = crtc->driver_private;
drmModeCrtcPtr drm_crtc;
Bool ret;
diff --git a/src/intel_driver.c b/src/intel_driver.c
index 3a27a14..5a8a953 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -78,59 +78,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <xf86drmMode.h>
#include "intel_glamor.h"
-
-/* *INDENT-OFF* */
-/*
- * Note: "ColorKey" is provided for compatibility with the i810 driver.
- * However, the correct option name is "VideoKey". "ColorKey" usually
- * refers to the tranparency key for 8+24 overlays, not for video overlays.
- */
-
-typedef enum {
- OPTION_DRI,
- OPTION_VIDEO_KEY,
- OPTION_COLOR_KEY,
- OPTION_FALLBACKDEBUG,
- OPTION_TILING_FB,
- OPTION_TILING_2D,
- OPTION_SHADOW,
- OPTION_SWAPBUFFERS_WAIT,
- OPTION_TRIPLE_BUFFER,
-#ifdef INTEL_XVMC
- OPTION_XVMC,
-#endif
- OPTION_PREFER_OVERLAY,
- OPTION_DEBUG_FLUSH_BATCHES,
- OPTION_DEBUG_FLUSH_CACHES,
- OPTION_DEBUG_WAIT,
- OPTION_HOTPLUG,
- OPTION_RELAXED_FENCING,
- OPTION_BUFFER_CACHE,
-} I830Opts;
-
-static OptionInfoRec I830Options[] = {
- {OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, TRUE},
- {OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE},
- {OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE},
- {OPTION_FALLBACKDEBUG, "FallbackDebug", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_TILING_2D, "Tiling", OPTV_BOOLEAN, {0}, TRUE},
- {OPTION_TILING_FB, "LinearFramebuffer", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_SHADOW, "Shadow", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_SWAPBUFFERS_WAIT, "SwapbuffersWait", OPTV_BOOLEAN, {0}, TRUE},
- {OPTION_TRIPLE_BUFFER, "TripleBuffer", OPTV_BOOLEAN, {0}, TRUE},
-#ifdef INTEL_XVMC
- {OPTION_XVMC, "XvMC", OPTV_BOOLEAN, {0}, TRUE},
-#endif
- {OPTION_PREFER_OVERLAY, "XvPreferOverlay", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_DEBUG_FLUSH_BATCHES, "DebugFlushBatches", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_DEBUG_FLUSH_CACHES, "DebugFlushCaches", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_DEBUG_WAIT, "DebugWait", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_HOTPLUG, "HotPlug", OPTV_BOOLEAN, {0}, TRUE},
- {OPTION_RELAXED_FENCING, "RelaxedFencing", OPTV_BOOLEAN, {0}, TRUE},
- {OPTION_BUFFER_CACHE, "BufferCache", OPTV_BOOLEAN, {0}, TRUE},
- {-1, NULL, OPTV_NONE, {0}, FALSE}
-};
-/* *INDENT-ON* */
+#include "intel_options.h"
static void i830AdjustFrame(int scrnIndex, int x, int y, int flags);
static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen);
@@ -140,11 +88,6 @@ static Bool I830EnterVT(int scrnIndex, int flags);
extern void xf86SetCursor(ScreenPtr screen, CursorPtr pCurs, int x, int y);
/* Export I830 options to i830 driver where necessary */
-const OptionInfoRec *intel_uxa_available_options(int chipid, int busid)
-{
- return I830Options;
-}
-
static void
I830LoadPalette(ScrnInfoPtr scrn, int numColors, int *indices,
LOCO * colors, VisualPtr pVisual)
@@ -278,9 +221,9 @@ static Bool I830GetEarlyOptions(ScrnInfoPtr scrn)
/* Process the options */
xf86CollectOptions(scrn, NULL);
- if (!(intel->Options = malloc(sizeof(I830Options))))
+ if (!(intel->Options = malloc(sizeof(intel_options))))
return FALSE;
- memcpy(intel->Options, I830Options, sizeof(I830Options));
+ memcpy(intel->Options, intel_options, sizeof(intel_options));
xf86ProcessOptions(scrn->scrnIndex, scrn->options, intel->Options);
intel->fallback_debug = xf86ReturnOptValBool(intel->Options,
diff --git a/src/intel_driver.h b/src/intel_driver.h
index 98973e5..f33d135 100644
--- a/src/intel_driver.h
+++ b/src/intel_driver.h
@@ -247,7 +247,5 @@ void intel_detect_chipset(ScrnInfoPtr scrn,
struct pci_device *pci,
struct intel_chipset *chipset);
-const OptionInfoRec *intel_uxa_available_options(int chipid, int busid);
-
#endif /* INTEL_DRIVER_H */
diff --git a/src/intel_module.c b/src/intel_module.c
index c6f94f5..ac6dae1 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -41,6 +41,7 @@
#include "common.h"
#include "intel_driver.h"
+#include "intel_options.h"
#include "legacy/legacy.h"
#include "sna/sna_module.h"
@@ -397,13 +398,7 @@ intel_available_options(int chipid, int busid)
#endif
default:
-#if USE_SNA
- return sna_available_options(chipid, busid);
-#elif USE_UXA
- return intel_uxa_available_options(chipid, busid);
-#else
- return NULL;
-#endif
+ return intel_options;
}
}
diff --git a/src/intel_options.h b/src/intel_options.h
new file mode 100644
index 0000000..9367751
--- /dev/null
+++ b/src/intel_options.h
@@ -0,0 +1,73 @@
+#ifndef INTEL_OPTIONS_H
+#define INTEL_OPTIONS_H
+
+/*
+ * Note: "ColorKey" is provided for compatibility with the i810 driver.
+ * However, the correct option name is "VideoKey". "ColorKey" usually
+ * refers to the tranparency key for 8+24 overlays, not for video overlays.
+ */
+
+enum intel_options {
+ OPTION_DRI,
+ OPTION_VIDEO_KEY,
+ OPTION_COLOR_KEY,
+ OPTION_TILING_FB,
+ OPTION_TILING_2D,
+ OPTION_SHADOW,
+ OPTION_SWAPBUFFERS_WAIT,
+ OPTION_TRIPLE_BUFFER,
+#ifdef INTEL_XVMC
+ OPTION_XVMC,
+#endif
+ OPTION_PREFER_OVERLAY,
+ OPTION_DEBUG_FLUSH_BATCHES,
+ OPTION_DEBUG_FLUSH_CACHES,
+ OPTION_DEBUG_WAIT,
+ OPTION_HOTPLUG,
+ OPTION_RELAXED_FENCING,
+ OPTION_USE_SNA,
+#ifdef USE_SNA
+ OPTION_THROTTLE,
+ OPTION_VMAP,
+ OPTION_ZAPHOD,
+ OPTION_DELAYED_FLUSH,
+#endif
+#ifdef USE_UXA
+ OPTION_FALLBACKDEBUG,
+ OPTION_BUFFER_CACHE,
+#endif
+ NUM_OPTIONS,
+};
+
+static OptionInfoRec intel_options[] = {
+ {OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, TRUE},
+ {OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE},
+ {OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE},
+ {OPTION_TILING_2D, "Tiling", OPTV_BOOLEAN, {0}, TRUE},
+ {OPTION_TILING_FB, "LinearFramebuffer", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_SHADOW, "Shadow", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_SWAPBUFFERS_WAIT, "SwapbuffersWait", OPTV_BOOLEAN, {0}, TRUE},
+ {OPTION_TRIPLE_BUFFER, "TripleBuffer", OPTV_BOOLEAN, {0}, TRUE},
+#ifdef INTEL_XVMC
+ {OPTION_XVMC, "XvMC", OPTV_BOOLEAN, {0}, TRUE},
+#endif
+ {OPTION_PREFER_OVERLAY, "XvPreferOverlay", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_DEBUG_FLUSH_BATCHES, "DebugFlushBatches", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_DEBUG_FLUSH_CACHES, "DebugFlushCaches", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_DEBUG_WAIT, "DebugWait", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_HOTPLUG, "HotPlug", OPTV_BOOLEAN, {0}, TRUE},
+ {OPTION_RELAXED_FENCING, "RelaxedFencing", OPTV_BOOLEAN, {0}, TRUE},
+#ifdef USE_SNA
+ {OPTION_THROTTLE, "Throttle", OPTV_BOOLEAN, {0}, TRUE},
+ {OPTION_VMAP, "UseVmap", OPTV_BOOLEAN, {0}, TRUE},
+ {OPTION_ZAPHOD, "ZaphodHeads", OPTV_STRING, {0}, FALSE},
+ {OPTION_DELAYED_FLUSH, "DelayedFlush", OPTV_BOOLEAN, {0}, TRUE},
+#endif
+#ifdef USE_UXA
+ {OPTION_FALLBACKDEBUG, "FallbackDebug", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_BUFFER_CACHE, "BufferCache", OPTV_BOOLEAN, {0}, TRUE},
+#endif
+ {-1, NULL, OPTV_NONE, {0}, FALSE}
+};
+
+#endif /* INTEL_OPTIONS_H */
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 308e329..96b0335 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -192,21 +192,6 @@ static inline struct sna_gc *sna_gc(GCPtr gc)
}
enum {
- OPTION_TILING_FB,
- OPTION_TILING_2D,
- OPTION_PREFER_OVERLAY,
- OPTION_COLOR_KEY,
- OPTION_VIDEO_KEY,
- OPTION_HOTPLUG,
- OPTION_THROTTLE,
- OPTION_RELAXED_FENCING,
- OPTION_VMAP,
- OPTION_ZAPHOD,
- OPTION_DELAYED_FLUSH,
- NUM_OPTIONS
-};
-
-enum {
FLUSH_TIMER = 0,
EXPIRE_TIMER,
INACTIVE_TIMER,
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 5275d4a..092eeb3 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -45,6 +45,8 @@
#include "sna.h"
#include "sna_reg.h"
+#include "intel_options.h"
+
#if DEBUG_DISPLAY
#undef DBG
#define DBG(x) ErrorF x
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 7b3cfce..e63665e 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -55,6 +55,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "sna_video.h"
#include "intel_driver.h"
+#include "intel_options.h"
#include <sys/ioctl.h>
#include <sys/fcntl.h>
@@ -76,31 +77,11 @@ DevPrivateKeyRec sna_gc_index;
DevPrivateKeyRec sna_glyph_key;
DevPrivateKeyRec sna_glyph_image_key;
-static OptionInfoRec sna_options[] = {
- {OPTION_TILING_FB, "LinearFramebuffer", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_TILING_2D, "Tiling", OPTV_BOOLEAN, {0}, TRUE},
- {OPTION_PREFER_OVERLAY, "XvPreferOverlay", OPTV_BOOLEAN, {0}, FALSE},
- {OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE},
- {OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE},
- {OPTION_HOTPLUG, "HotPlug", OPTV_BOOLEAN, {0}, TRUE},
- {OPTION_THROTTLE, "Throttle", OPTV_BOOLEAN, {0}, TRUE},
- {OPTION_RELAXED_FENCING, "UseRelaxedFencing", OPTV_BOOLEAN, {0}, TRUE},
- {OPTION_VMAP, "UseVmap", OPTV_BOOLEAN, {0}, TRUE},
- {OPTION_ZAPHOD, "ZaphodHeads", OPTV_STRING, {0}, FALSE},
- {OPTION_DELAYED_FLUSH, "DelayedFlush", OPTV_BOOLEAN, {0}, TRUE},
- {-1, NULL, OPTV_NONE, {0}, FALSE}
-};
-
static Bool sna_enter_vt(int scrnIndex, int flags);
/* temporary */
extern void xf86SetCursor(ScreenPtr screen, CursorPtr pCurs, int x, int y);
-const OptionInfoRec *sna_available_options(int chipid, int busid)
-{
- return sna_options;
-}
-
static void
sna_load_palette(ScrnInfoPtr scrn, int numColors, int *indices,
LOCO * colors, VisualPtr pVisual)
@@ -280,10 +261,10 @@ static Bool sna_get_early_options(ScrnInfoPtr scrn)
/* Process the options */
xf86CollectOptions(scrn, NULL);
- if (!(sna->Options = malloc(sizeof(sna_options))))
+ if (!(sna->Options = malloc(sizeof(intel_options))))
return FALSE;
- memcpy(sna->Options, sna_options, sizeof(sna_options));
+ memcpy(sna->Options, intel_options, sizeof(intel_options));
Reply to: