aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-07-19 15:12:53 +0200
committermarha <marha@users.sourceforge.net>2014-07-19 15:12:53 +0200
commit61c36feba19d918885022042ea62d068a698c83d (patch)
treefd351953eb2193fe548e7d0e2dca06b34b7c4f4d /xorg-server/hw/xfree86/common
parent3865d60ef607cbb00c819e905e40d3628b8eca29 (diff)
parentd0c30e7945e76ac119f6d867e27137c8a76f7e15 (diff)
downloadvcxsrv-61c36feba19d918885022042ea62d068a698c83d.tar.gz
vcxsrv-61c36feba19d918885022042ea62d068a698c83d.tar.bz2
vcxsrv-61c36feba19d918885022042ea62d068a698c83d.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/glsl/ir.cpp xorg-server/config/config.c xorg-server/include/callback.h xorg-server/include/colormap.h xorg-server/include/cursor.h xorg-server/include/dix.h xorg-server/include/dixfont.h xorg-server/include/dixgrabs.h xorg-server/include/gc.h xorg-server/include/gcstruct.h xorg-server/include/input.h xorg-server/include/os.h xorg-server/include/pixmap.h xorg-server/include/property.h xorg-server/include/resource.h xorg-server/include/scrnintstr.h xorg-server/include/window.h xorg-server/include/xkbsrv.h xorg-server/mi/mi.h
Diffstat (limited to 'xorg-server/hw/xfree86/common')
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86DPMS.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h10
-rw-r--r--xorg-server/hw/xfree86/common/xf86platformBus.c58
-rw-r--r--xorg-server/hw/xfree86/common/xf86platformBus.h104
-rw-r--r--xorg-server/hw/xfree86/common/xf86xv.c53
-rw-r--r--xorg-server/hw/xfree86/common/xf86xv.h36
7 files changed, 124 insertions, 141 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index 481674de2..779ba6f7c 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -103,7 +103,7 @@
"/etc/X11/%X," "%C/X11/%X"
#endif
#ifndef SYS_CONFIGDIRPATH
-#define SYS_CONFIGDIRPATH "/usr/share/X11/%X," "%D/X11/%X"
+#define SYS_CONFIGDIRPATH "%D/X11/%X"
#endif
#ifndef PROJECTROOT
#define PROJECTROOT "/usr/X11R6"
diff --git a/xorg-server/hw/xfree86/common/xf86DPMS.c b/xorg-server/hw/xfree86/common/xf86DPMS.c
index 14d1f4545..2b5a3ed1e 100644
--- a/xorg-server/hw/xfree86/common/xf86DPMS.c
+++ b/xorg-server/hw/xfree86/common/xf86DPMS.c
@@ -166,7 +166,7 @@ DPMSSet(ClientPtr client, int level)
return rc;
}
} else if (!xf86IsUnblank(screenIsSaved)) {
- rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverReset);
+ rc = dixSaveScreens(client, SCREEN_SAVER_OFF, ScreenSaverReset);
if (rc != Success)
return rc;
}
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
index ec21bc2f2..b832c9a5f 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -49,10 +49,14 @@
#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x
-#define SCREEN_PROLOG(x) pScreen->x = ((VGAarbiterScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))->x
+#define SCREEN_PRIV() ((VGAarbiterScreenPtr) dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))
-#define SCREEN_EPILOG(x,y) pScreen->x = y;
+#define SCREEN_PROLOG(x) (pScreen->x = SCREEN_PRIV()->x)
+
+#define SCREEN_EPILOG(x,y) do { \
+ SCREEN_PRIV()->x = pScreen->x; \
+ pScreen->x = y; \
+ } while (0)
#define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\
ps->x = y;}
diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.c b/xorg-server/hw/xfree86/common/xf86platformBus.c
index eb1a3fb5d..22e4603e6 100644
--- a/xorg-server/hw/xfree86/common/xf86platformBus.c
+++ b/xorg-server/hw/xfree86/common/xf86platformBus.c
@@ -77,7 +77,7 @@ xf86_remove_platform_device(int dev_index)
{
int j;
- config_odev_free_attribute_list(xf86_platform_devices[dev_index].attribs);
+ config_odev_free_attributes(xf86_platform_devices[dev_index].attribs);
for (j = dev_index; j < xf86_num_platform_devices - 1; j++)
memcpy(&xf86_platform_devices[j], &xf86_platform_devices[j + 1], sizeof(struct xf86_platform_device));
@@ -86,44 +86,6 @@ xf86_remove_platform_device(int dev_index)
}
Bool
-xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_name)
-{
- struct xf86_platform_device *device = &xf86_platform_devices[index];
-
- return config_odev_add_attribute(device->attribs, attrib_id, attrib_name);
-}
-
-Bool
-xf86_add_platform_device_int_attrib(int index, int attrib_id, int attrib_value)
-{
- return config_odev_add_int_attribute(xf86_platform_devices[index].attribs, attrib_id, attrib_value);
-}
-
-char *
-xf86_get_platform_attrib(int index, int attrib_id)
-{
- return config_odev_get_attribute(xf86_platform_devices[index].attribs, attrib_id);
-}
-
-char *
-xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_id)
-{
- return config_odev_get_attribute(device->attribs, attrib_id);
-}
-
-int
-xf86_get_platform_int_attrib(int index, int attrib_id, int def)
-{
- return config_odev_get_int_attribute(xf86_platform_devices[index].attribs, attrib_id, def);
-}
-
-int
-xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib_id, int def)
-{
- return config_odev_get_int_attribute(device->attribs, attrib_id, def);
-}
-
-Bool
xf86_get_platform_device_unowned(int index)
{
return (xf86_platform_devices[index].flags & XF86_PDEV_UNOWNED) ?
@@ -136,8 +98,8 @@ xf86_find_platform_device_by_devnum(int major, int minor)
int i, attr_major, attr_minor;
for (i = 0; i < xf86_num_platform_devices; i++) {
- attr_major = xf86_get_platform_int_attrib(i, ODEV_ATTRIB_MAJOR, 0);
- attr_minor = xf86_get_platform_int_attrib(i, ODEV_ATTRIB_MINOR, 0);
+ attr_major = xf86_platform_odev_attributes(i)->major;
+ attr_minor = xf86_platform_odev_attributes(i)->minor;
if (attr_major == major && attr_minor == minor)
return &xf86_platform_devices[i];
}
@@ -240,7 +202,7 @@ MatchToken(const char *value, struct xorg_list *patterns,
static Bool
OutputClassMatches(const XF86ConfOutputClassPtr oclass, int index)
{
- char *driver = xf86_get_platform_attrib(index, ODEV_ATTRIB_DRIVER);
+ char *driver = xf86_platform_odev_attributes(index)->driver;
if (!MatchToken(driver, &oclass->match_driver, strcmp))
return FALSE;
@@ -259,7 +221,7 @@ xf86OutputClassDriverList(int index, char *matches[], int nmatches)
for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
if (OutputClassMatches(cl, index)) {
- char *path = xf86_get_platform_attrib(index, ODEV_ATTRIB_PATH);
+ char *path = xf86_platform_odev_attributes(index)->path;
xf86Msg(X_INFO, "Applying OutputClass \"%s\" to %s\n",
cl->identifier, path);
@@ -324,7 +286,7 @@ xf86platformProbe(void)
}
for (i = 0; i < xf86_num_platform_devices; i++) {
- char *busid = xf86_get_platform_attrib(i, ODEV_ATTRIB_BUSID);
+ char *busid = xf86_platform_odev_attributes(i)->busid;
if (pci && (strncmp(busid, "pci:", 4) == 0)) {
platform_find_pci_info(&xf86_platform_devices[i], busid);
@@ -412,11 +374,11 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
if (entity != -1) {
if ((dev->flags & XF86_PDEV_SERVER_FD) && (!drvp->driverFunc ||
!drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL))) {
- fd = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_FD, -1);
- major = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MAJOR, 0);
- minor = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MINOR, 0);
+ fd = dev->attribs->fd;
+ major = dev->attribs->major;
+ minor = dev->attribs->minor;
systemd_logind_release_fd(major, minor, fd);
- config_odev_add_int_attribute(dev->attribs, ODEV_ATTRIB_FD, -1);
+ dev->attribs->fd = -1;
dev->flags &= ~XF86_PDEV_SERVER_FD;
}
diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.h b/xorg-server/hw/xfree86/common/xf86platformBus.h
index 5dee4e0e0..317dd24d5 100644
--- a/xorg-server/hw/xfree86/common/xf86platformBus.h
+++ b/xorg-server/hw/xfree86/common/xf86platformBus.h
@@ -45,31 +45,109 @@ int xf86platformProbeDev(DriverPtr drvp);
extern int xf86_num_platform_devices;
extern struct xf86_platform_device *xf86_platform_devices;
-extern char *
-xf86_get_platform_attrib(int index, int attrib_id);
-extern int
-xf86_get_platform_int_attrib(int index, int attrib_id, int def);
extern int
xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned);
extern int
xf86_remove_platform_device(int dev_index);
extern Bool
xf86_get_platform_device_unowned(int index);
-/* Note starting with xserver 1.16 these 2 functions never fail */
-extern Bool
-xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_str);
-extern Bool
-xf86_add_platform_device_int_attrib(int index, int attrib_id, int attrib_value);
extern int
xf86platformAddDevice(int index);
extern void
xf86platformRemoveDevice(int index);
-extern _X_EXPORT char *
-xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_id);
-extern _X_EXPORT int
-xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib_id, int def);
+static inline struct OdevAttributes *
+xf86_platform_device_odev_attributes(struct xf86_platform_device *device)
+{
+ return device->attribs;
+}
+
+static inline struct OdevAttributes *
+xf86_platform_odev_attributes(int index)
+{
+ struct xf86_platform_device *device = &xf86_platform_devices[index];
+
+ return device->attribs;
+}
+
+#ifndef _XORG_CONFIG_H_
+/*
+ * Define the legacy API only for external builds
+ */
+
+/* path to kernel device node - Linux e.g. /dev/dri/card0 */
+#define ODEV_ATTRIB_PATH 1
+/* system device path - Linux e.g. /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 */
+#define ODEV_ATTRIB_SYSPATH 2
+/* DRI-style bus id */
+#define ODEV_ATTRIB_BUSID 3
+/* Server managed FD */
+#define ODEV_ATTRIB_FD 4
+/* Major number of the device node pointed to by ODEV_ATTRIB_PATH */
+#define ODEV_ATTRIB_MAJOR 5
+/* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */
+#define ODEV_ATTRIB_MINOR 6
+/* kernel driver name */
+#define ODEV_ATTRIB_DRIVER 7
+
+/* Protect against a mismatch attribute type by generating a compiler
+ * error using a negative array size when an incorrect attribute is
+ * passed
+ */
+
+#define _ODEV_ATTRIB_IS_STRING(x) ((x) == ODEV_ATTRIB_PATH || \
+ (x) == ODEV_ATTRIB_SYSPATH || \
+ (x) == ODEV_ATTRIB_BUSID || \
+ (x) == ODEV_ATTRIB_DRIVER)
+
+#define _ODEV_ATTRIB_STRING_CHECK(x) ((int (*)[_ODEV_ATTRIB_IS_STRING(x)-1]) 0)
+
+static inline char *
+_xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0])
+{
+ switch (attrib) {
+ case ODEV_ATTRIB_PATH:
+ return xf86_platform_device_odev_attributes(device)->path;
+ case ODEV_ATTRIB_SYSPATH:
+ return xf86_platform_device_odev_attributes(device)->syspath;
+ case ODEV_ATTRIB_BUSID:
+ return xf86_platform_device_odev_attributes(device)->busid;
+ case ODEV_ATTRIB_DRIVER:
+ return xf86_platform_device_odev_attributes(device)->driver;
+ default:
+ assert(FALSE);
+ return NULL;
+ }
+}
+
+#define xf86_get_platform_device_attrib(device, attrib) _xf86_get_platform_device_attrib(device,attrib,_ODEV_ATTRIB_STRING_CHECK(attrib))
+
+#define _ODEV_ATTRIB_IS_INT(x) ((x) == ODEV_ATTRIB_FD || (x) == ODEV_ATTRIB_MAJOR || (x) == ODEV_ATTRIB_MINOR)
+#define _ODEV_ATTRIB_INT_DEFAULT(x) ((x) == ODEV_ATTRIB_FD ? -1 : 0)
+#define _ODEV_ATTRIB_DEFAULT_CHECK(x,def) (_ODEV_ATTRIB_INT_DEFAULT(x) == (def))
+#define _ODEV_ATTRIB_INT_CHECK(x,def) ((int (*)[_ODEV_ATTRIB_IS_INT(x)*_ODEV_ATTRIB_DEFAULT_CHECK(x,def)-1]) 0)
+
+static inline int
+_xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0])
+{
+ switch (attrib) {
+ case ODEV_ATTRIB_FD:
+ return xf86_platform_device_odev_attributes(device)->fd;
+ case ODEV_ATTRIB_MAJOR:
+ return xf86_platform_device_odev_attributes(device)->major;
+ case ODEV_ATTRIB_MINOR:
+ return xf86_platform_device_odev_attributes(device)->minor;
+ default:
+ assert(FALSE);
+ return 0;
+ }
+}
+
+#define xf86_get_platform_device_int_attrib(device, attrib, def) _xf86_get_platform_device_int_attrib(device,attrib,_ODEV_ATTRIB_INT_CHECK(attrib,def))
+
+#endif
+
extern _X_EXPORT Bool
xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid);
diff --git a/xorg-server/hw/xfree86/common/xf86xv.c b/xorg-server/hw/xfree86/common/xf86xv.c
index b16cb5df3..e212a7387 100644
--- a/xorg-server/hw/xfree86/common/xf86xv.c
+++ b/xorg-server/hw/xfree86/common/xf86xv.c
@@ -359,15 +359,11 @@ xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number)
XvPortRecPrivatePtr portPriv;
XvPortPtr pPort, pp;
int numPort;
- XF86AttributePtr attributePtr;
- XvAttributePtr pAttribute, pat;
XF86VideoFormatPtr formatPtr;
XvFormatPtr pFormat, pf;
int numFormat, totFormat;
XF86VideoEncodingPtr encodingPtr;
XvEncodingPtr pEncode, pe;
- XF86ImagePtr imagePtr;
- XvImagePtr pImage, pi;
int numVisuals;
VisualPtr pVisual;
int i;
@@ -445,49 +441,24 @@ xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number)
}
if (adaptorPtr->nImages &&
- (pImage = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
-
- for (i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
- i < adaptorPtr->nImages; i++, pi++, imagePtr++) {
- pi->id = imagePtr->id;
- pi->type = imagePtr->type;
- pi->byte_order = imagePtr->byte_order;
- memcpy(pi->guid, imagePtr->guid, 16);
- pi->bits_per_pixel = imagePtr->bits_per_pixel;
- pi->format = imagePtr->format;
- pi->num_planes = imagePtr->num_planes;
- pi->depth = imagePtr->depth;
- pi->red_mask = imagePtr->red_mask;
- pi->green_mask = imagePtr->green_mask;
- pi->blue_mask = imagePtr->blue_mask;
- pi->y_sample_bits = imagePtr->y_sample_bits;
- pi->u_sample_bits = imagePtr->u_sample_bits;
- pi->v_sample_bits = imagePtr->v_sample_bits;
- pi->horz_y_period = imagePtr->horz_y_period;
- pi->horz_u_period = imagePtr->horz_u_period;
- pi->horz_v_period = imagePtr->horz_v_period;
- pi->vert_y_period = imagePtr->vert_y_period;
- pi->vert_u_period = imagePtr->vert_u_period;
- pi->vert_v_period = imagePtr->vert_v_period;
- memcpy(pi->component_order, imagePtr->component_order, 32);
- pi->scanline_order = imagePtr->scanline_order;
- }
+ (pa->pImages = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
+ memcpy(pa->pImages, adaptorPtr->pImages,
+ adaptorPtr->nImages * sizeof(XvImageRec));
pa->nImages = adaptorPtr->nImages;
- pa->pImages = pImage;
}
if (adaptorPtr->nAttributes &&
- (pAttribute =
- calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) {
- for (pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i =
- 0; i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) {
- pat->flags = attributePtr->flags;
- pat->min_value = attributePtr->min_value;
- pat->max_value = attributePtr->max_value;
- pat->name = strdup(attributePtr->name);
+ (pa->pAttributes = calloc(adaptorPtr->nAttributes,
+ sizeof(XvAttributeRec)))) {
+ memcpy(pa->pAttributes, adaptorPtr->pAttributes,
+ adaptorPtr->nAttributes * sizeof(XvAttributeRec));
+
+ for (i = 0; i < adaptorPtr->nAttributes; i++) {
+ pa->pAttributes[i].name =
+ strdup(adaptorPtr->pAttributes[i].name);
}
+
pa->nAttributes = adaptorPtr->nAttributes;
- pa->pAttributes = pAttribute;
}
totFormat = adaptorPtr->nFormats;
diff --git a/xorg-server/hw/xfree86/common/xf86xv.h b/xorg-server/hw/xfree86/common/xf86xv.h
index 8986e2e57..de17eb133 100644
--- a/xorg-server/hw/xfree86/common/xf86xv.h
+++ b/xorg-server/hw/xfree86/common/xf86xv.h
@@ -42,34 +42,7 @@
*/
#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
-typedef struct {
- int id;
- int type;
- int byte_order;
- unsigned char guid[16];
- int bits_per_pixel;
- int format;
- int num_planes;
-
- /* for RGB formats only */
- int depth;
- unsigned int red_mask;
- unsigned int green_mask;
- unsigned int blue_mask;
-
- /* for YUV formats only */
- unsigned int y_sample_bits;
- unsigned int u_sample_bits;
- unsigned int v_sample_bits;
- unsigned int horz_y_period;
- unsigned int horz_u_period;
- unsigned int horz_v_period;
- unsigned int vert_y_period;
- unsigned int vert_u_period;
- unsigned int vert_v_period;
- char component_order[32];
- int scanline_order;
-} XF86ImageRec, *XF86ImagePtr;
+typedef XvImageRec XF86ImageRec, *XF86ImagePtr;
typedef struct {
ScrnInfoPtr pScrn;
@@ -147,12 +120,7 @@ typedef struct {
short class;
} XF86VideoFormatRec, *XF86VideoFormatPtr;
-typedef struct {
- int flags;
- int min_value;
- int max_value;
- const char *name;
-} XF86AttributeRec, *XF86AttributePtr;
+typedef XvAttributeRec XF86AttributeRec, *XF86AttributePtr;
typedef struct {
unsigned int type;