xfree86: Add options support for OutputClass Options
Add support for setting options in OutputClass Sections and having these applied to any matching output devices. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
08b84d7287
commit
9cd3cc7526
|
@ -44,6 +44,7 @@
|
||||||
#include "xf86Xinput.h"
|
#include "xf86Xinput.h"
|
||||||
#include "xf86Optrec.h"
|
#include "xf86Optrec.h"
|
||||||
#include "xf86Parser.h"
|
#include "xf86Parser.h"
|
||||||
|
#include "xf86platformBus.h" /* For OutputClass functions */
|
||||||
#include "optionstr.h"
|
#include "optionstr.h"
|
||||||
|
|
||||||
static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options,
|
static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options,
|
||||||
|
@ -64,7 +65,7 @@ static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options,
|
||||||
*
|
*
|
||||||
* The order of precedence for options is:
|
* The order of precedence for options is:
|
||||||
*
|
*
|
||||||
* extraOpts, display, confScreen, monitor, device
|
* extraOpts, display, confScreen, monitor, device, outputClassOptions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -79,6 +80,8 @@ xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts)
|
||||||
pScrn->options = NULL;
|
pScrn->options = NULL;
|
||||||
|
|
||||||
for (i = pScrn->numEntities - 1; i >= 0; i--) {
|
for (i = pScrn->numEntities - 1; i >= 0; i--) {
|
||||||
|
xf86MergeOutputClassOptions(pScrn->entityList[i], &pScrn->options);
|
||||||
|
|
||||||
device = xf86GetDevFromEntity(pScrn->entityList[i],
|
device = xf86GetDevFromEntity(pScrn->entityList[i],
|
||||||
pScrn->entityInstanceList[i]);
|
pScrn->entityInstanceList[i]);
|
||||||
if (device && device->options) {
|
if (device && device->options) {
|
||||||
|
|
|
@ -310,6 +310,48 @@ xf86platformProbe(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
xf86MergeOutputClassOptions(int entityIndex, void **options)
|
||||||
|
{
|
||||||
|
const EntityPtr entity = xf86Entities[entityIndex];
|
||||||
|
struct xf86_platform_device *dev = NULL;
|
||||||
|
XF86ConfOutputClassPtr cl;
|
||||||
|
XF86OptionPtr classopts;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
switch (entity->bus.type) {
|
||||||
|
case BUS_PLATFORM:
|
||||||
|
dev = entity->bus.id.plat;
|
||||||
|
break;
|
||||||
|
case BUS_PCI:
|
||||||
|
for (i = 0; i < xf86_num_platform_devices; i++) {
|
||||||
|
if (MATCH_PCI_DEVICES(xf86_platform_devices[i].pdev,
|
||||||
|
entity->bus.id.pci)) {
|
||||||
|
dev = &xf86_platform_devices[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
xf86Msg(X_DEBUG, "xf86MergeOutputClassOptions unsupported bus type %d\n",
|
||||||
|
entity->bus.type);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
|
||||||
|
if (!OutputClassMatches(cl, dev) || !cl->option_lst)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
xf86Msg(X_INFO, "Applying OutputClass \"%s\" options to %s\n",
|
||||||
|
cl->identifier, dev->attribs->path);
|
||||||
|
|
||||||
|
classopts = xf86optionListDup(cl->option_lst);
|
||||||
|
*options = xf86optionListMerge(*options, classopts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xf86ClaimPlatformSlot(struct xf86_platform_device * d, DriverPtr drvp,
|
xf86ClaimPlatformSlot(struct xf86_platform_device * d, DriverPtr drvp,
|
||||||
int chipset, GDevPtr dev, Bool active)
|
int chipset, GDevPtr dev, Bool active)
|
||||||
|
|
|
@ -42,6 +42,7 @@ struct xf86_platform_device {
|
||||||
int xf86platformProbe(void);
|
int xf86platformProbe(void);
|
||||||
int xf86platformProbeDev(DriverPtr drvp);
|
int xf86platformProbeDev(DriverPtr drvp);
|
||||||
int xf86platformAddGPUDevices(DriverPtr drvp);
|
int xf86platformAddGPUDevices(DriverPtr drvp);
|
||||||
|
void xf86MergeOutputClassOptions(int entityIndex, void **options);
|
||||||
|
|
||||||
extern int xf86_num_platform_devices;
|
extern int xf86_num_platform_devices;
|
||||||
extern struct xf86_platform_device *xf86_platform_devices;
|
extern struct xf86_platform_device *xf86_platform_devices;
|
||||||
|
@ -161,6 +162,7 @@ extern void xf86platformPrimary(void);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static inline int xf86platformAddGPUDevices(DriverPtr drvp) { return FALSE; }
|
static inline int xf86platformAddGPUDevices(DriverPtr drvp) { return FALSE; }
|
||||||
|
static inline void xf86MergeOutputClassOptions(int index, void **options) {}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1280,6 +1280,16 @@ For example:
|
||||||
Check the case-sensitive string
|
Check the case-sensitive string
|
||||||
.RI \*q matchdriver \*q
|
.RI \*q matchdriver \*q
|
||||||
against the kernel driver of the device.
|
against the kernel driver of the device.
|
||||||
|
.PP
|
||||||
|
When an output device has been matched to the
|
||||||
|
.B OutputClass
|
||||||
|
section, any
|
||||||
|
.B Option
|
||||||
|
entries are applied to the device. See the
|
||||||
|
.B Device
|
||||||
|
section below for a description of the remaining
|
||||||
|
.B Option
|
||||||
|
entries.
|
||||||
.SH "DEVICE SECTION"
|
.SH "DEVICE SECTION"
|
||||||
The config file may have multiple
|
The config file may have multiple
|
||||||
.B Device
|
.B Device
|
||||||
|
|
|
@ -36,6 +36,7 @@ static const xf86ConfigSymTabRec OutputClassTab[] = {
|
||||||
{ENDSECTION, "endsection"},
|
{ENDSECTION, "endsection"},
|
||||||
{IDENTIFIER, "identifier"},
|
{IDENTIFIER, "identifier"},
|
||||||
{DRIVER, "driver"},
|
{DRIVER, "driver"},
|
||||||
|
{OPTION, "option"},
|
||||||
{MATCH_DRIVER, "matchdriver"},
|
{MATCH_DRIVER, "matchdriver"},
|
||||||
{-1, ""},
|
{-1, ""},
|
||||||
};
|
};
|
||||||
|
@ -60,6 +61,8 @@ xf86freeOutputClassList(XF86ConfOutputClassPtr ptr)
|
||||||
free(group);
|
free(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xf86optionListFree(ptr->option_lst);
|
||||||
|
|
||||||
prev = ptr;
|
prev = ptr;
|
||||||
ptr = ptr->list.next;
|
ptr = ptr->list.next;
|
||||||
free(prev);
|
free(prev);
|
||||||
|
@ -112,6 +115,9 @@ xf86parseOutputClassSection(void)
|
||||||
else
|
else
|
||||||
ptr->driver = xf86_lex_val.str;
|
ptr->driver = xf86_lex_val.str;
|
||||||
break;
|
break;
|
||||||
|
case OPTION:
|
||||||
|
ptr->option_lst = xf86parseOption(ptr->option_lst);
|
||||||
|
break;
|
||||||
case MATCH_DRIVER:
|
case MATCH_DRIVER:
|
||||||
if (xf86getSubToken(&(ptr->comment)) != STRING)
|
if (xf86getSubToken(&(ptr->comment)) != STRING)
|
||||||
Error(QUOTE_MSG, "MatchDriver");
|
Error(QUOTE_MSG, "MatchDriver");
|
||||||
|
|
|
@ -338,6 +338,7 @@ typedef struct {
|
||||||
char *identifier;
|
char *identifier;
|
||||||
char *driver;
|
char *driver;
|
||||||
struct xorg_list match_driver;
|
struct xorg_list match_driver;
|
||||||
|
XF86OptionPtr option_lst;
|
||||||
char *comment;
|
char *comment;
|
||||||
} XF86ConfOutputClassRec, *XF86ConfOutputClassPtr;
|
} XF86ConfOutputClassRec, *XF86ConfOutputClassPtr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue