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>
This commit is contained in:
parent
df6ab02c36
commit
e456291350
38
configure.ac
38
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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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},
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1047,7 +1047,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;
|
||||
|
||||
|
|
@ -1081,8 +1081,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
void sna_init_scrn(ScrnInfoPtr scrn, int entity_num);
|
||||
Bool sna_init_scrn(ScrnInfoPtr scrn, int entity_num);
|
||||
|
|
|
|||
Loading…
Reference in New Issue