Merge remote-tracking branch 'origin/master' into glamor-next
I've done this merge manually to resolve the minor conflict in glamor.c. Signed-off-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
commit
6d49548849
|
@ -172,12 +172,38 @@ config_odev_find_or_add_attribute(struct OdevAttributes *attribs, int attrib)
|
|||
return oa;
|
||||
}
|
||||
|
||||
static int config_odev_get_attribute_type(int attrib)
|
||||
{
|
||||
switch (attrib) {
|
||||
case ODEV_ATTRIB_PATH:
|
||||
case ODEV_ATTRIB_SYSPATH:
|
||||
case ODEV_ATTRIB_BUSID:
|
||||
return ODEV_ATTRIB_STRING;
|
||||
case ODEV_ATTRIB_FD:
|
||||
case ODEV_ATTRIB_MAJOR:
|
||||
case ODEV_ATTRIB_MINOR:
|
||||
return ODEV_ATTRIB_INT;
|
||||
case ODEV_ATTRIB_DRIVER:
|
||||
return ODEV_ATTRIB_STRING;
|
||||
default:
|
||||
LogMessage(X_ERROR, "Error %s called for unknown attribute %d\n",
|
||||
__func__, attrib);
|
||||
return ODEV_ATTRIB_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
config_odev_add_attribute(struct OdevAttributes *attribs, int attrib,
|
||||
const char *attrib_name)
|
||||
{
|
||||
struct OdevAttribute *oa;
|
||||
|
||||
if (config_odev_get_attribute_type(attrib) != ODEV_ATTRIB_STRING) {
|
||||
LogMessage(X_ERROR, "Error %s called for non string attrib %d\n",
|
||||
__func__, attrib);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
oa = config_odev_find_or_add_attribute(attribs, attrib);
|
||||
free(oa->attrib_name);
|
||||
oa->attrib_name = XNFstrdup(attrib_name);
|
||||
|
@ -191,6 +217,12 @@ config_odev_add_int_attribute(struct OdevAttributes *attribs, int attrib,
|
|||
{
|
||||
struct OdevAttribute *oa;
|
||||
|
||||
if (config_odev_get_attribute_type(attrib) != ODEV_ATTRIB_INT) {
|
||||
LogMessage(X_ERROR, "Error %s called for non integer attrib %d\n",
|
||||
__func__, attrib);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
oa = config_odev_find_or_add_attribute(attribs, attrib);
|
||||
oa->attrib_value = attrib_value;
|
||||
oa->attrib_type = ODEV_ATTRIB_INT;
|
||||
|
|
14
configure.ac
14
configure.ac
|
@ -26,9 +26,9 @@ dnl
|
|||
dnl Process this file with autoconf to create configure.
|
||||
|
||||
AC_PREREQ(2.60)
|
||||
AC_INIT([xorg-server], 1.15.99.903, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
|
||||
RELEASE_DATE="2014-06-04"
|
||||
RELEASE_NAME="Strawberry Shortcake"
|
||||
AC_INIT([xorg-server], 1.16.99.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
|
||||
RELEASE_DATE="2014-07-17"
|
||||
RELEASE_NAME="Baba Ghanouj"
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AM_INIT_AUTOMAKE([foreign dist-bzip2])
|
||||
|
@ -810,7 +810,7 @@ LIBDMX="dmx >= 1.0.99.1"
|
|||
LIBDRI="dri >= 7.8.0"
|
||||
LIBDRM="libdrm >= 2.3.0"
|
||||
LIBEGL="egl"
|
||||
LIBGBM="gbm >= 9"
|
||||
LIBGBM="gbm >= 10.2.0"
|
||||
LIBGL="gl >= 7.1.0"
|
||||
LIBXEXT="xext >= 1.0.99.4"
|
||||
LIBXFONT="xfont >= 1.4.2"
|
||||
|
@ -1424,7 +1424,7 @@ AC_DEFINE(SHAPE, 1, [Support SHAPE extension])
|
|||
|
||||
AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
|
||||
AC_ARG_WITH(xkb-bin-directory,
|
||||
AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program]),
|
||||
AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program (default: ${bindir})]),
|
||||
[XKB_BIN_DIRECTORY="$withval"],
|
||||
[XKB_BIN_DIRECTORY="$bindir"])
|
||||
|
||||
|
@ -2459,6 +2459,10 @@ if test "x$XWAYLAND" = xyes; then
|
|||
XWAYLAND_SYS_LIBS="$XWAYLANDMODULES_LIBS $GLX_SYS_LIBS"
|
||||
AC_SUBST([XWAYLAND_LIBS])
|
||||
AC_SUBST([XWAYLAND_SYS_LIBS])
|
||||
|
||||
WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
|
||||
AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],,
|
||||
[${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -685,7 +685,7 @@ ExaCheckAddTraps(PicturePtr pPicture,
|
|||
|
||||
EXA_PRE_FALLBACK(pScreen);
|
||||
|
||||
EXA_FALLBACK(("to pict %p (%c)\n",
|
||||
EXA_FALLBACK(("to pict %p (%c)\n", pPicture,
|
||||
exaDrawableLocation(pPicture->pDrawable)));
|
||||
exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
|
||||
swap(pExaScr, ps, AddTraps);
|
||||
|
|
|
@ -37,7 +37,8 @@ fbCloseScreen(ScreenPtr pScreen)
|
|||
free(depths[d].vids);
|
||||
free(depths);
|
||||
free(pScreen->visuals);
|
||||
FreePixmap((PixmapPtr)pScreen->devPrivate);
|
||||
if (pScreen->devPrivate)
|
||||
FreePixmap((PixmapPtr)pScreen->devPrivate);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -310,6 +310,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
{
|
||||
glamor_screen_private *glamor_priv;
|
||||
int gl_version;
|
||||
int max_viewport_size[2];
|
||||
|
||||
#ifdef RENDER
|
||||
PictureScreenPtr ps = GetPictureScreenIfSet(screen);
|
||||
|
@ -409,7 +410,12 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
epoxy_has_gl_extension("GL_ARB_buffer_storage");
|
||||
glamor_priv->has_nv_texture_barrier =
|
||||
epoxy_has_gl_extension("GL_NV_texture_barrier");
|
||||
|
||||
glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size);
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glamor_priv->max_fbo_size);
|
||||
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, max_viewport_size);
|
||||
glamor_priv->max_fbo_size = MIN(glamor_priv->max_fbo_size, max_viewport_size[0]);
|
||||
glamor_priv->max_fbo_size = MIN(glamor_priv->max_fbo_size, max_viewport_size[1]);
|
||||
#ifdef MAX_FBO_SIZE
|
||||
glamor_priv->max_fbo_size = MAX_FBO_SIZE;
|
||||
#endif
|
||||
|
|
|
@ -347,6 +347,7 @@ _glamor_create_tex(glamor_screen_private *glamor_priv,
|
|||
glamor_make_current(glamor_priv);
|
||||
glGenTextures(1, &tex);
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0,
|
||||
|
|
|
@ -95,6 +95,7 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
|
|||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
|
|
|
@ -88,8 +88,7 @@ static void
|
|||
glamor_put_image_bail(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||
int w, int h, int leftPad, int format, char *bits)
|
||||
{
|
||||
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
|
||||
glamor_prepare_access_gc(gc))
|
||||
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW))
|
||||
fbPutImage(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
|
||||
glamor_finish_access(drawable);
|
||||
}
|
||||
|
|
|
@ -717,6 +717,7 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
|
|||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, *tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
|
|
|
@ -1446,8 +1446,8 @@ glamor_composite_clipped_region(CARD8 op,
|
|||
|| source_pixmap->drawable.height != height)))) {
|
||||
temp_src =
|
||||
glamor_convert_gradient_picture(screen, source,
|
||||
x_source,
|
||||
y_source,
|
||||
extent->x1 + x_source - x_dest - dest->pDrawable->x,
|
||||
extent->y1 + y_source - y_dest - dest->pDrawable->y,
|
||||
width, height);
|
||||
if (!temp_src) {
|
||||
temp_src = source;
|
||||
|
@ -1455,8 +1455,8 @@ glamor_composite_clipped_region(CARD8 op,
|
|||
}
|
||||
temp_src_priv =
|
||||
glamor_get_pixmap_private((PixmapPtr) (temp_src->pDrawable));
|
||||
x_temp_src = 0;
|
||||
y_temp_src = 0;
|
||||
x_temp_src = -extent->x1 + x_dest + dest->pDrawable->x;
|
||||
y_temp_src = -extent->y1 + y_dest + dest->pDrawable->y;
|
||||
}
|
||||
|
||||
if (mask
|
||||
|
@ -1470,8 +1470,8 @@ glamor_composite_clipped_region(CARD8 op,
|
|||
* to do reduce one convertion. */
|
||||
temp_mask =
|
||||
glamor_convert_gradient_picture(screen, mask,
|
||||
x_mask,
|
||||
y_mask,
|
||||
extent->x1 + x_mask - x_dest - dest->pDrawable->x,
|
||||
extent->y1 + y_mask - y_dest - dest->pDrawable->y,
|
||||
width, height);
|
||||
if (!temp_mask) {
|
||||
temp_mask = mask;
|
||||
|
@ -1479,8 +1479,8 @@ glamor_composite_clipped_region(CARD8 op,
|
|||
}
|
||||
temp_mask_priv =
|
||||
glamor_get_pixmap_private((PixmapPtr) (temp_mask->pDrawable));
|
||||
x_temp_mask = 0;
|
||||
y_temp_mask = 0;
|
||||
x_temp_mask = -extent->x1 + x_dest + dest->pDrawable->x;
|
||||
y_temp_mask = -extent->y1 + y_dest + dest->pDrawable->y;
|
||||
}
|
||||
/* Do two-pass PictOpOver componentAlpha, until we enable
|
||||
* dual source color blending.
|
||||
|
|
|
@ -119,7 +119,7 @@ glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset)
|
|||
if (glamor_priv->vbo_size < size) {
|
||||
glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size);
|
||||
free(glamor_priv->vb);
|
||||
glamor_priv->vb = XNFalloc(size);
|
||||
glamor_priv->vb = XNFalloc(glamor_priv->vbo_size);
|
||||
}
|
||||
*vbo_offset = NULL;
|
||||
/* We point to the start of glamor_priv->vb every time, and
|
||||
|
|
|
@ -758,6 +758,12 @@ ephyrScreenFini(KdScreenInfo * screen)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ephyrCloseScreen(ScreenPtr pScreen)
|
||||
{
|
||||
ephyrUnsetInternalDamage(pScreen);
|
||||
}
|
||||
|
||||
/*
|
||||
* Port of Mark McLoughlin's Xnest fix for focus in + modifier bug.
|
||||
* See https://bugs.freedesktop.org/show_bug.cgi?id=3030
|
||||
|
|
|
@ -130,6 +130,9 @@ void
|
|||
void
|
||||
ephyrScreenFini(KdScreenInfo * screen);
|
||||
|
||||
void
|
||||
ephyrCloseScreen(ScreenPtr pScreen);
|
||||
|
||||
void
|
||||
ephyrCardFini(KdCardInfo * card);
|
||||
|
||||
|
|
|
@ -440,4 +440,6 @@ KdCardFuncs ephyrFuncs = {
|
|||
|
||||
ephyrGetColors, /* getColors */
|
||||
ephyrPutColors, /* putColors */
|
||||
|
||||
ephyrCloseScreen, /* closeScreen */
|
||||
};
|
||||
|
|
|
@ -621,8 +621,12 @@ KdCloseScreen(ScreenPtr pScreen)
|
|||
KdCardInfo *card = pScreenPriv->card;
|
||||
Bool ret;
|
||||
|
||||
if (card->cfuncs->closeScreen)
|
||||
(*card->cfuncs->closeScreen)(pScreen);
|
||||
|
||||
pScreenPriv->closed = TRUE;
|
||||
pScreen->CloseScreen = pScreenPriv->CloseScreen;
|
||||
|
||||
if (pScreen->CloseScreen)
|
||||
ret = (*pScreen->CloseScreen) (pScreen);
|
||||
else
|
||||
|
|
|
@ -130,6 +130,7 @@ typedef struct _KdCardFuncs {
|
|||
void (*getColors) (ScreenPtr, int, xColorItem *);
|
||||
void (*putColors) (ScreenPtr, int, xColorItem *);
|
||||
|
||||
void (*closeScreen) (ScreenPtr); /* close ScreenRec */
|
||||
} KdCardFuncs;
|
||||
|
||||
#define KD_MAX_PSEUDO_DEPTH 8
|
||||
|
|
|
@ -265,7 +265,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
|
|||
#endif
|
||||
#ifdef XSERVER_LIBPCIACCESS
|
||||
if (i < (nmatches - 1))
|
||||
i = xf86PciMatchDriver(matches, nmatches);
|
||||
i += xf86PciMatchDriver(&matches[i], nmatches - i);
|
||||
#endif
|
||||
|
||||
#if defined(__linux__)
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;}
|
||||
|
|
|
@ -1320,8 +1320,9 @@ xchomp(char *line)
|
|||
* don't export their PCI ID's properly. If distros don't end up using this
|
||||
* feature it can and should be removed because the symbol-based resolution
|
||||
* scheme should be the primary one */
|
||||
void
|
||||
xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_chip)
|
||||
int
|
||||
xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
|
||||
char *matches[], int nmatches)
|
||||
{
|
||||
DIR *idsdir;
|
||||
FILE *fp;
|
||||
|
@ -1331,11 +1332,11 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
|
|||
ssize_t read;
|
||||
char path_name[256], vendor_str[5], chip_str[5];
|
||||
uint16_t vendor, chip;
|
||||
int i, j;
|
||||
int i = 0, j;
|
||||
|
||||
idsdir = opendir(PCI_TXT_IDS_PATH);
|
||||
if (!idsdir)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
xf86Msg(X_INFO,
|
||||
"Scanning %s directory for additional PCI ID's supported by the drivers\n",
|
||||
|
@ -1386,10 +1387,6 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
|
|||
}
|
||||
}
|
||||
if (vendor == match_vendor && chip == match_chip) {
|
||||
i = 0;
|
||||
while (matches[i]) {
|
||||
i++;
|
||||
}
|
||||
matches[i] =
|
||||
(char *) malloc(sizeof(char) *
|
||||
strlen(direntry->d_name) - 3);
|
||||
|
@ -1412,6 +1409,7 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
|
|||
}
|
||||
xf86Msg(X_INFO, "Matched %s from file name %s\n",
|
||||
matches[i], direntry->d_name);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1425,6 +1423,7 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
|
|||
end:
|
||||
free(line);
|
||||
closedir(idsdir);
|
||||
return i;
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
|
||||
|
@ -1435,7 +1434,7 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
|
|||
int
|
||||
xf86PciMatchDriver(char *matches[], int nmatches)
|
||||
{
|
||||
int i;
|
||||
int i = 0;
|
||||
struct pci_device *info = NULL;
|
||||
struct pci_device_iterator *iter;
|
||||
|
||||
|
@ -1450,13 +1449,10 @@ xf86PciMatchDriver(char *matches[], int nmatches)
|
|||
pci_iterator_destroy(iter);
|
||||
#ifdef __linux__
|
||||
if (info)
|
||||
xf86MatchDriverFromFiles(matches, info->vendor_id, info->device_id);
|
||||
i += xf86MatchDriverFromFiles(info->vendor_id, info->device_id,
|
||||
matches, nmatches);
|
||||
#endif
|
||||
|
||||
for (i = 0; (i < nmatches) && (matches[i]); i++) {
|
||||
/* find end of matches list */
|
||||
}
|
||||
|
||||
if ((info != NULL) && (i < nmatches)) {
|
||||
i += xf86VideoPtrToDriverList(info, &(matches[i]), nmatches - i);
|
||||
}
|
||||
|
|
|
@ -47,8 +47,9 @@ void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
|
|||
((x)->func == (y)->func) && \
|
||||
((x)->dev == (y)->dev))
|
||||
|
||||
void
|
||||
xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_chip);
|
||||
int
|
||||
xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
|
||||
char *matches[], int nmatches);
|
||||
int
|
||||
xf86VideoPtrToDriverList(struct pci_device *dev,
|
||||
char *returnList[], int returnListMax);
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "xf86Bus.h"
|
||||
#include "Pci.h"
|
||||
#include "xf86platformBus.h"
|
||||
#include "xf86Config.h"
|
||||
|
||||
#include "randrstr.h"
|
||||
int platformSlotClaimed;
|
||||
|
@ -199,6 +200,81 @@ xf86_check_platform_slot(const struct xf86_platform_device *pd)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
MatchToken(const char *value, struct xorg_list *patterns,
|
||||
int (*compare)(const char *, const char *))
|
||||
{
|
||||
const xf86MatchGroup *group;
|
||||
|
||||
/* If there are no patterns, accept the match */
|
||||
if (xorg_list_is_empty(patterns))
|
||||
return TRUE;
|
||||
|
||||
/* If there are patterns but no attribute, reject the match */
|
||||
if (!value)
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* Otherwise, iterate the list of patterns ensuring each entry has a
|
||||
* match. Each list entry is a separate Match line of the same type.
|
||||
*/
|
||||
xorg_list_for_each_entry(group, patterns, entry) {
|
||||
Bool match = FALSE;
|
||||
char *const *cur;
|
||||
|
||||
for (cur = group->values; *cur; cur++) {
|
||||
if ((*compare)(value, *cur) == 0) {
|
||||
match = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!match)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* All the entries in the list matched the attribute */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
OutputClassMatches(const XF86ConfOutputClassPtr oclass, int index)
|
||||
{
|
||||
char *driver = xf86_get_platform_attrib(index, ODEV_ATTRIB_DRIVER);
|
||||
|
||||
if (!MatchToken(driver, &oclass->match_driver, strcmp))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
xf86OutputClassDriverList(int index, char *matches[], int nmatches)
|
||||
{
|
||||
XF86ConfOutputClassPtr cl;
|
||||
int i = 0;
|
||||
|
||||
if (nmatches == 0)
|
||||
return 0;
|
||||
|
||||
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);
|
||||
|
||||
xf86Msg(X_INFO, "Applying OutputClass \"%s\" to %s\n",
|
||||
cl->identifier, path);
|
||||
xf86Msg(X_NONE, "\tloading driver: %s\n", cl->driver);
|
||||
|
||||
matches[i++] = xstrdup(cl->driver);
|
||||
}
|
||||
|
||||
if (i >= nmatches)
|
||||
break;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The numbers of found devices that match with the current system
|
||||
* drivers.
|
||||
|
@ -218,16 +294,15 @@ xf86PlatformMatchDriver(char *matches[], int nmatches)
|
|||
else if (!xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 0))
|
||||
continue;
|
||||
|
||||
j += xf86OutputClassDriverList(i, &matches[j], nmatches - j);
|
||||
|
||||
info = xf86_platform_devices[i].pdev;
|
||||
#ifdef __linux__
|
||||
if (info)
|
||||
xf86MatchDriverFromFiles(matches, info->vendor_id, info->device_id);
|
||||
j += xf86MatchDriverFromFiles(info->vendor_id, info->device_id,
|
||||
&matches[j], nmatches - j);
|
||||
#endif
|
||||
|
||||
for (j = 0; (j < nmatches) && (matches[j]); j++) {
|
||||
/* find end of matches list */
|
||||
}
|
||||
|
||||
if ((info != NULL) && (j < nmatches)) {
|
||||
j += xf86VideoPtrToDriverList(info, &(matches[j]), nmatches - j);
|
||||
}
|
||||
|
|
|
@ -130,6 +130,7 @@ typedef struct _DRI2Screen {
|
|||
HandleExposuresProcPtr HandleExposures;
|
||||
|
||||
ConfigNotifyProcPtr ConfigNotify;
|
||||
SetWindowPixmapProcPtr SetWindowPixmap;
|
||||
DRI2CreateBuffer2ProcPtr CreateBuffer2;
|
||||
DRI2DestroyBuffer2ProcPtr DestroyBuffer2;
|
||||
DRI2CopyRegion2ProcPtr CopyRegion2;
|
||||
|
@ -415,18 +416,14 @@ DRI2DrawableGone(void *p, XID id)
|
|||
}
|
||||
|
||||
static DRI2BufferPtr
|
||||
create_buffer(DrawablePtr pDraw,
|
||||
create_buffer(DRI2ScreenPtr ds, DrawablePtr pDraw,
|
||||
unsigned int attachment, unsigned int format)
|
||||
{
|
||||
ScreenPtr primeScreen;
|
||||
DRI2DrawablePtr pPriv;
|
||||
DRI2ScreenPtr ds;
|
||||
DRI2BufferPtr buffer;
|
||||
pPriv = DRI2GetDrawable(pDraw);
|
||||
primeScreen = GetScreenPrime(pDraw->pScreen, pPriv->prime_id);
|
||||
ds = DRI2GetScreenPrime(pDraw->pScreen, pPriv->prime_id);
|
||||
if (ds->CreateBuffer2)
|
||||
buffer = (*ds->CreateBuffer2)(primeScreen, pDraw, attachment, format);
|
||||
buffer = (*ds->CreateBuffer2)(GetScreenPrime(pDraw->pScreen,
|
||||
DRI2GetDrawable(pDraw)->prime_id),
|
||||
pDraw, attachment, format);
|
||||
else
|
||||
buffer = (*ds->CreateBuffer)(pDraw, attachment, format);
|
||||
return buffer;
|
||||
|
@ -475,7 +472,7 @@ allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds,
|
|||
if ((old_buf < 0)
|
||||
|| attachment == DRI2BufferFrontLeft
|
||||
|| !dimensions_match || (pPriv->buffers[old_buf]->format != format)) {
|
||||
*buffer = create_buffer (pDraw, attachment, format);
|
||||
*buffer = create_buffer(ds, pDraw, attachment, format);
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
@ -538,7 +535,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ds = DRI2GetScreen(pDraw->pScreen);
|
||||
ds = DRI2GetScreenPrime(pDraw->pScreen, pPriv->prime_id);
|
||||
|
||||
dimensions_match = (pDraw->width == pPriv->width)
|
||||
&& (pDraw->height == pPriv->height);
|
||||
|
@ -1382,6 +1379,21 @@ DRI2ConfigNotify(WindowPtr pWin, int x, int y, int w, int h, int bw,
|
|||
return Success;
|
||||
}
|
||||
|
||||
static void
|
||||
DRI2SetWindowPixmap(WindowPtr pWin, PixmapPtr pPix)
|
||||
{
|
||||
DrawablePtr pDraw = (DrawablePtr) pWin;
|
||||
ScreenPtr pScreen = pDraw->pScreen;
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||
|
||||
pScreen->SetWindowPixmap = ds->SetWindowPixmap;
|
||||
(*pScreen->SetWindowPixmap) (pWin, pPix);
|
||||
ds->SetWindowPixmap = pScreen->SetWindowPixmap;
|
||||
pScreen->SetWindowPixmap = DRI2SetWindowPixmap;
|
||||
|
||||
DRI2InvalidateDrawableAll(pDraw);
|
||||
}
|
||||
|
||||
#define MAX_PRIME DRI2DriverPrimeMask
|
||||
static int
|
||||
get_prime_id(void)
|
||||
|
@ -1528,6 +1540,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
|
|||
ds->ConfigNotify = pScreen->ConfigNotify;
|
||||
pScreen->ConfigNotify = DRI2ConfigNotify;
|
||||
|
||||
ds->SetWindowPixmap = pScreen->SetWindowPixmap;
|
||||
pScreen->SetWindowPixmap = DRI2SetWindowPixmap;
|
||||
|
||||
xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n");
|
||||
for (i = 0; i < sizeof(driverTypeNames) / sizeof(driverTypeNames[0]); i++) {
|
||||
if (i < ds->numDrivers && ds->driverNames[i]) {
|
||||
|
@ -1552,6 +1567,7 @@ DRI2CloseScreen(ScreenPtr pScreen)
|
|||
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||
|
||||
pScreen->ConfigNotify = ds->ConfigNotify;
|
||||
pScreen->SetWindowPixmap = ds->SetWindowPixmap;
|
||||
|
||||
if (ds->prime_id)
|
||||
prime_id_allocate_bitmask &= ~(1 << ds->prime_id);
|
||||
|
|
|
@ -171,6 +171,7 @@ The section names are:
|
|||
.BR "Extensions " "Extension enabling"
|
||||
.BR "InputDevice " "Input device description"
|
||||
.BR "InputClass " "Input class description"
|
||||
.BR "OutputClass " "Output class description"
|
||||
.BR "Device " "Graphics device description"
|
||||
.BR "VideoAdaptor " "Xv video adaptor description"
|
||||
.BR "Monitor " "Monitor description"
|
||||
|
@ -1190,6 +1191,82 @@ entries.
|
|||
This optional entry specifies that the device should be ignored entirely,
|
||||
and not added to the server. This can be useful when the device is handled
|
||||
by another program and no X events should be generated.
|
||||
.SH "OUTPUTCLASS SECTION"
|
||||
The config file may have multiple
|
||||
.B OutputClass
|
||||
sections.
|
||||
These sections are optional and are used to provide configuration for a
|
||||
class of output devices as they are automatically added.
|
||||
An output device can match more than one
|
||||
.B OutputClass
|
||||
section.
|
||||
Each class can override settings from a previous class, so it is best to
|
||||
arrange the sections with the most generic matches first.
|
||||
.PP
|
||||
.B OutputClass
|
||||
sections have the following format:
|
||||
.PP
|
||||
.RS 4
|
||||
.nf
|
||||
.B "Section \*qOutputClass\*q"
|
||||
.BI " Identifier \*q" name \*q
|
||||
.I " entries"
|
||||
.I " ..."
|
||||
.B "EndSection"
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The
|
||||
.B Identifier
|
||||
entry is required in all
|
||||
.B OutputClass
|
||||
sections.
|
||||
All other entries are optional.
|
||||
.PP
|
||||
The
|
||||
.B Identifier
|
||||
entry specifies the unique name for this output class.
|
||||
The
|
||||
.B Driver
|
||||
entry specifies the name of the driver to use for this output device.
|
||||
After all classes have been examined, the
|
||||
.RI \*q outputdriver \*q
|
||||
module from the first
|
||||
.B Driver
|
||||
entry will be enabled when using the loadable server.
|
||||
.PP
|
||||
When an output device is automatically added, its characteristics are
|
||||
checked against all
|
||||
.B OutputClass
|
||||
sections.
|
||||
Each section can contain optional entries to narrow the match of the class.
|
||||
If none of the optional entries appear, the
|
||||
.B OutputClass
|
||||
section is generic and will match any output device.
|
||||
If more than one of these entries appear, they all must match for the
|
||||
configuration to apply.
|
||||
.PP
|
||||
The following list of tokens can be matched against attributes of the device.
|
||||
An entry can be constructed to match attributes from different devices by
|
||||
separating arguments with a '|' character.
|
||||
.PP
|
||||
For example:
|
||||
.PP
|
||||
.RS 4
|
||||
.nf
|
||||
.B "Section \*qOutputClass\*q"
|
||||
.B " Identifier \*qMy Class\*q"
|
||||
.B " # kernel driver must be either foo or bar
|
||||
.B " MatchDriver \*qfoo|bar\*q
|
||||
.I " ..."
|
||||
.B "EndSection"
|
||||
.fi
|
||||
.RE
|
||||
.TP 7
|
||||
.BI "MatchDriver \*q" matchdriver \*q
|
||||
Check the case-sensitive string
|
||||
.RI \*q matchdriver \*q
|
||||
against the kernel driver of the device.
|
||||
.SH "DEVICE SECTION"
|
||||
The config file may have multiple
|
||||
.B Device
|
||||
|
|
|
@ -234,12 +234,22 @@ xf86RotateBlockHandler(ScreenPtr pScreen,
|
|||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
|
||||
xf86RotateRedisplay(pScreen);
|
||||
/* Unwrap before redisplay in case the software
|
||||
* cursor layer wants to add its block handler to the
|
||||
* chain
|
||||
*/
|
||||
pScreen->BlockHandler = xf86_config->BlockHandler;
|
||||
|
||||
xf86RotateRedisplay(pScreen);
|
||||
|
||||
(*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask);
|
||||
/* cannot avoid re-wrapping until all wrapping is audited */
|
||||
xf86_config->BlockHandler = pScreen->BlockHandler;
|
||||
pScreen->BlockHandler = xf86RotateBlockHandler;
|
||||
|
||||
/* Re-wrap if we still need this hook */
|
||||
if (xf86_config->rotation_damage != NULL) {
|
||||
xf86_config->BlockHandler = pScreen->BlockHandler;
|
||||
pScreen->BlockHandler = xf86RotateBlockHandler;
|
||||
} else
|
||||
xf86_config->BlockHandler = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -24,6 +24,7 @@ static Bool
|
|||
get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
|
||||
{
|
||||
drmSetVersion sv;
|
||||
drmVersionPtr v;
|
||||
char *buf;
|
||||
int major, minor, fd;
|
||||
int err = 0;
|
||||
|
@ -57,8 +58,9 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
|
|||
|
||||
err = drmSetInterfaceVersion(fd, &sv);
|
||||
if (err) {
|
||||
ErrorF("setversion 1.4 failed: %s\n", strerror(-err));
|
||||
goto out;
|
||||
xf86Msg(X_ERROR, "%s: failed to set DRM interface version 1.4: %s\n",
|
||||
path, strerror(-err));
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* for a delayed probe we've already added the device */
|
||||
|
@ -74,6 +76,17 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
|
|||
xf86_add_platform_device_attrib(delayed_index,
|
||||
ODEV_ATTRIB_BUSID, buf);
|
||||
drmFreeBusid(buf);
|
||||
|
||||
v = drmGetVersion(fd);
|
||||
if (!v) {
|
||||
xf86Msg(X_ERROR, "%s: failed to query DRM version\n", path);
|
||||
goto out;
|
||||
}
|
||||
|
||||
xf86_add_platform_device_attrib(delayed_index, ODEV_ATTRIB_DRIVER,
|
||||
v->name);
|
||||
drmFreeVersion(v);
|
||||
|
||||
out:
|
||||
if (!server_fd)
|
||||
close(fd);
|
||||
|
|
|
@ -14,6 +14,7 @@ INTERNAL_SOURCES= \
|
|||
Flags.c \
|
||||
Input.c \
|
||||
InputClass.c \
|
||||
OutputClass.c \
|
||||
Layout.c \
|
||||
Module.c \
|
||||
Video.c \
|
||||
|
|
167
hw/xfree86/parser/OutputClass.c
Normal file
167
hw/xfree86/parser/OutputClass.c
Normal file
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
* Copyright (c) 2014 NVIDIA Corporation. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#include "os.h"
|
||||
#include "xf86Parser.h"
|
||||
#include "xf86tokens.h"
|
||||
#include "Configint.h"
|
||||
|
||||
static
|
||||
xf86ConfigSymTabRec OutputClassTab[] = {
|
||||
{ENDSECTION, "endsection"},
|
||||
{IDENTIFIER, "identifier"},
|
||||
{DRIVER, "driver"},
|
||||
{MATCH_DRIVER, "matchdriver"},
|
||||
{-1, ""},
|
||||
};
|
||||
|
||||
#define CLEANUP xf86freeOutputClassList
|
||||
|
||||
#define TOKEN_SEP "|"
|
||||
|
||||
static void
|
||||
add_group_entry(struct xorg_list *head, char **values)
|
||||
{
|
||||
xf86MatchGroup *group;
|
||||
|
||||
group = malloc(sizeof(*group));
|
||||
if (group) {
|
||||
group->values = values;
|
||||
xorg_list_add(&group->entry, head);
|
||||
}
|
||||
}
|
||||
|
||||
XF86ConfOutputClassPtr
|
||||
xf86parseOutputClassSection(void)
|
||||
{
|
||||
int has_ident = FALSE;
|
||||
int token;
|
||||
|
||||
parsePrologue(XF86ConfOutputClassPtr, XF86ConfOutputClassRec)
|
||||
|
||||
/* Initialize MatchGroup lists */
|
||||
xorg_list_init(&ptr->match_driver);
|
||||
|
||||
while ((token = xf86getToken(OutputClassTab)) != ENDSECTION) {
|
||||
switch (token) {
|
||||
case COMMENT:
|
||||
ptr->comment = xf86addComment(ptr->comment, xf86_lex_val.str);
|
||||
break;
|
||||
case IDENTIFIER:
|
||||
if (xf86getSubToken(&(ptr->comment)) != STRING)
|
||||
Error(QUOTE_MSG, "Identifier");
|
||||
if (has_ident == TRUE)
|
||||
Error(MULTIPLE_MSG, "Identifier");
|
||||
ptr->identifier = xf86_lex_val.str;
|
||||
has_ident = TRUE;
|
||||
break;
|
||||
case DRIVER:
|
||||
if (xf86getSubToken(&(ptr->comment)) != STRING)
|
||||
Error(QUOTE_MSG, "Driver");
|
||||
else
|
||||
ptr->driver = xf86_lex_val.str;
|
||||
break;
|
||||
case MATCH_DRIVER:
|
||||
if (xf86getSubToken(&(ptr->comment)) != STRING)
|
||||
Error(QUOTE_MSG, "MatchDriver");
|
||||
add_group_entry(&ptr->match_driver,
|
||||
xstrtokenize(xf86_lex_val.str, TOKEN_SEP));
|
||||
free(xf86_lex_val.str);
|
||||
break;
|
||||
case EOF_TOKEN:
|
||||
Error(UNEXPECTED_EOF_MSG);
|
||||
break;
|
||||
default:
|
||||
Error(INVALID_KEYWORD_MSG, xf86tokenString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_ident)
|
||||
Error(NO_IDENT_MSG);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("OutputClass section parsed\n");
|
||||
#endif
|
||||
|
||||
return ptr;
|
||||
}
|
||||
void
|
||||
xf86printOutputClassSection(FILE * cf, XF86ConfOutputClassPtr ptr)
|
||||
{
|
||||
const xf86MatchGroup *group;
|
||||
char *const *cur;
|
||||
|
||||
while (ptr) {
|
||||
fprintf(cf, "Section \"OutputClass\"\n");
|
||||
if (ptr->comment)
|
||||
fprintf(cf, "%s", ptr->comment);
|
||||
if (ptr->identifier)
|
||||
fprintf(cf, "\tIdentifier \"%s\"\n", ptr->identifier);
|
||||
if (ptr->driver)
|
||||
fprintf(cf, "\tDriver \"%s\"\n", ptr->driver);
|
||||
|
||||
xorg_list_for_each_entry(group, &ptr->match_driver, entry) {
|
||||
fprintf(cf, "\tMatchDriver \"");
|
||||
for (cur = group->values; *cur; cur++)
|
||||
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
|
||||
*cur);
|
||||
fprintf(cf, "\"\n");
|
||||
}
|
||||
|
||||
fprintf(cf, "EndSection\n\n");
|
||||
ptr = ptr->list.next;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xf86freeOutputClassList(XF86ConfOutputClassPtr ptr)
|
||||
{
|
||||
XF86ConfOutputClassPtr prev;
|
||||
|
||||
while (ptr) {
|
||||
xf86MatchGroup *group, *next;
|
||||
char **list;
|
||||
|
||||
TestFree(ptr->identifier);
|
||||
TestFree(ptr->comment);
|
||||
TestFree(ptr->driver);
|
||||
|
||||
xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
|
||||
xorg_list_del(&group->entry);
|
||||
for (list = group->values; *list; list++)
|
||||
free(*list);
|
||||
free(group);
|
||||
}
|
||||
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
free(prev);
|
||||
}
|
||||
}
|
|
@ -57,6 +57,11 @@ XF86ConfInputClassPtr xf86parseInputClassSection(void);
|
|||
void xf86printInputClassSection(FILE * f, XF86ConfInputClassPtr ptr);
|
||||
void xf86freeInputClassList(XF86ConfInputClassPtr ptr);
|
||||
|
||||
/* OutputClass.c */
|
||||
XF86ConfOutputClassPtr xf86parseOutputClassSection(void);
|
||||
void xf86printOutputClassSection(FILE * f, XF86ConfOutputClassPtr ptr);
|
||||
void xf86freeOutputClassList(XF86ConfOutputClassPtr ptr);
|
||||
|
||||
/* Layout.c */
|
||||
XF86ConfLayoutPtr xf86parseLayoutSection(void);
|
||||
void xf86printLayoutSection(FILE * cf, XF86ConfLayoutPtr ptr);
|
||||
|
|
|
@ -165,6 +165,12 @@ xf86readConfigFile(void)
|
|||
HANDLE_LIST(conf_inputclass_lst,
|
||||
xf86parseInputClassSection, XF86ConfInputClassPtr);
|
||||
}
|
||||
else if (xf86nameCompare(xf86_lex_val.str, "outputclass") == 0) {
|
||||
free(xf86_lex_val.str);
|
||||
xf86_lex_val.str = NULL;
|
||||
HANDLE_LIST(conf_outputclass_lst, xf86parseOutputClassSection,
|
||||
XF86ConfOutputClassPtr);
|
||||
}
|
||||
else if (xf86nameCompare(xf86_lex_val.str, "module") == 0) {
|
||||
free(xf86_lex_val.str);
|
||||
xf86_lex_val.str = NULL;
|
||||
|
|
|
@ -114,6 +114,8 @@ doWriteConfigFile(const char *filename, XF86ConfigPtr cptr)
|
|||
|
||||
xf86printInputClassSection(cf, cptr->conf_inputclass_lst);
|
||||
|
||||
xf86printOutputClassSection(cf, cptr->conf_outputclass_lst);
|
||||
|
||||
xf86printVideoAdaptorSection(cf, cptr->conf_videoadaptor_lst);
|
||||
|
||||
xf86printModesSection(cf, cptr->conf_modes_lst);
|
||||
|
|
|
@ -327,6 +327,14 @@ typedef struct {
|
|||
char *comment;
|
||||
} XF86ConfInputClassRec, *XF86ConfInputClassPtr;
|
||||
|
||||
typedef struct {
|
||||
GenericListRec list;
|
||||
char *identifier;
|
||||
char *driver;
|
||||
struct xorg_list match_driver;
|
||||
char *comment;
|
||||
} XF86ConfOutputClassRec, *XF86ConfOutputClassPtr;
|
||||
|
||||
/* Values for adj_where */
|
||||
#define CONF_ADJ_OBSOLETE -1
|
||||
#define CONF_ADJ_ABSOLUTE 0
|
||||
|
@ -411,6 +419,7 @@ typedef struct {
|
|||
XF86ConfScreenPtr conf_screen_lst;
|
||||
XF86ConfInputPtr conf_input_lst;
|
||||
XF86ConfInputClassPtr conf_inputclass_lst;
|
||||
XF86ConfOutputClassPtr conf_outputclass_lst;
|
||||
XF86ConfLayoutPtr conf_layout_lst;
|
||||
XF86ConfVendorPtr conf_vendor_lst;
|
||||
XF86ConfDRIPtr conf_dri;
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
bin_PROGRAMS = Xwayland
|
||||
|
||||
Xwayland_CFLAGS = \
|
||||
-I$(top_srcdir)/glamor \
|
||||
-I$(top_srcdir)/dri3 \
|
||||
-DHAVE_DIX_CONFIG_H \
|
||||
$(XWAYLANDMODULES_CFLAGS) \
|
||||
$(DIX_CFLAGS)
|
||||
$(DIX_CFLAGS) \
|
||||
$(GLAMOR_CFLAGS) \
|
||||
$(GBM_CFLAGS)
|
||||
|
||||
Xwayland_SOURCES = \
|
||||
xwayland.c \
|
||||
|
@ -19,6 +22,7 @@ Xwayland_SOURCES = \
|
|||
$(top_srcdir)/mi/miinitext.c
|
||||
|
||||
Xwayland_LDADD = \
|
||||
$(glamor_lib) \
|
||||
$(XWAYLAND_LIBS) \
|
||||
$(XWAYLAND_SYS_LIBS) \
|
||||
$(XSERVER_SYS_LIBS)
|
||||
|
@ -26,5 +30,30 @@ Xwayland_DEPENDENCIES = $(XWAYLAND_LIBS)
|
|||
Xwayland_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
|
||||
|
||||
|
||||
if GLAMOR_EGL
|
||||
Xwayland_SOURCES += xwayland-glamor.c
|
||||
|
||||
nodist_Xwayland_SOURCES = \
|
||||
drm-client-protocol.h \
|
||||
drm-protocol.c
|
||||
|
||||
CLEANFILES = $(nodist_Xwayland_SOURCES)
|
||||
|
||||
EXTRA_DIST = drm.xml
|
||||
|
||||
xwayland-glamor.c : $(nodist_Xwayland_SOURCES)
|
||||
|
||||
glamor_lib = $(top_builddir)/glamor/libglamor.la
|
||||
|
||||
Xwayland_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL
|
||||
endif
|
||||
|
||||
|
||||
relink:
|
||||
$(AM_V_at)rm -f Xwayland$(EXEEXT) && $(MAKE) Xwayland$(EXEEXT)
|
||||
|
||||
%-protocol.c : %.xml
|
||||
$(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
|
||||
|
||||
%-client-protocol.h : %.xml
|
||||
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
|
||||
|
|
182
hw/xwayland/drm.xml
Normal file
182
hw/xwayland/drm.xml
Normal file
|
@ -0,0 +1,182 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="drm">
|
||||
|
||||
<copyright>
|
||||
Copyright © 2008-2011 Kristian Høgsberg
|
||||
Copyright © 2010-2011 Intel Corporation
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that\n the above copyright notice appear in
|
||||
all copies and that both that copyright notice and this permission
|
||||
notice appear in supporting documentation, and that the name of
|
||||
the copyright holders not be used in advertising or publicity
|
||||
pertaining to distribution of the software without specific,
|
||||
written prior permission. The copyright holders make no
|
||||
representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied
|
||||
warranty.
|
||||
|
||||
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<!-- drm support. This object is created by the server and published
|
||||
using the display's global event. -->
|
||||
<interface name="wl_drm" version="2">
|
||||
<enum name="error">
|
||||
<entry name="authenticate_fail" value="0"/>
|
||||
<entry name="invalid_format" value="1"/>
|
||||
<entry name="invalid_name" value="2"/>
|
||||
</enum>
|
||||
|
||||
<enum name="format">
|
||||
<!-- The drm format codes match the #defines in drm_fourcc.h.
|
||||
The formats actually supported by the compositor will be
|
||||
reported by the format event. -->
|
||||
<entry name="c8" value="0x20203843"/>
|
||||
<entry name="rgb332" value="0x38424752"/>
|
||||
<entry name="bgr233" value="0x38524742"/>
|
||||
<entry name="xrgb4444" value="0x32315258"/>
|
||||
<entry name="xbgr4444" value="0x32314258"/>
|
||||
<entry name="rgbx4444" value="0x32315852"/>
|
||||
<entry name="bgrx4444" value="0x32315842"/>
|
||||
<entry name="argb4444" value="0x32315241"/>
|
||||
<entry name="abgr4444" value="0x32314241"/>
|
||||
<entry name="rgba4444" value="0x32314152"/>
|
||||
<entry name="bgra4444" value="0x32314142"/>
|
||||
<entry name="xrgb1555" value="0x35315258"/>
|
||||
<entry name="xbgr1555" value="0x35314258"/>
|
||||
<entry name="rgbx5551" value="0x35315852"/>
|
||||
<entry name="bgrx5551" value="0x35315842"/>
|
||||
<entry name="argb1555" value="0x35315241"/>
|
||||
<entry name="abgr1555" value="0x35314241"/>
|
||||
<entry name="rgba5551" value="0x35314152"/>
|
||||
<entry name="bgra5551" value="0x35314142"/>
|
||||
<entry name="rgb565" value="0x36314752"/>
|
||||
<entry name="bgr565" value="0x36314742"/>
|
||||
<entry name="rgb888" value="0x34324752"/>
|
||||
<entry name="bgr888" value="0x34324742"/>
|
||||
<entry name="xrgb8888" value="0x34325258"/>
|
||||
<entry name="xbgr8888" value="0x34324258"/>
|
||||
<entry name="rgbx8888" value="0x34325852"/>
|
||||
<entry name="bgrx8888" value="0x34325842"/>
|
||||
<entry name="argb8888" value="0x34325241"/>
|
||||
<entry name="abgr8888" value="0x34324241"/>
|
||||
<entry name="rgba8888" value="0x34324152"/>
|
||||
<entry name="bgra8888" value="0x34324142"/>
|
||||
<entry name="xrgb2101010" value="0x30335258"/>
|
||||
<entry name="xbgr2101010" value="0x30334258"/>
|
||||
<entry name="rgbx1010102" value="0x30335852"/>
|
||||
<entry name="bgrx1010102" value="0x30335842"/>
|
||||
<entry name="argb2101010" value="0x30335241"/>
|
||||
<entry name="abgr2101010" value="0x30334241"/>
|
||||
<entry name="rgba1010102" value="0x30334152"/>
|
||||
<entry name="bgra1010102" value="0x30334142"/>
|
||||
<entry name="yuyv" value="0x56595559"/>
|
||||
<entry name="yvyu" value="0x55595659"/>
|
||||
<entry name="uyvy" value="0x59565955"/>
|
||||
<entry name="vyuy" value="0x59555956"/>
|
||||
<entry name="ayuv" value="0x56555941"/>
|
||||
<entry name="nv12" value="0x3231564e"/>
|
||||
<entry name="nv21" value="0x3132564e"/>
|
||||
<entry name="nv16" value="0x3631564e"/>
|
||||
<entry name="nv61" value="0x3136564e"/>
|
||||
<entry name="yuv410" value="0x39565559"/>
|
||||
<entry name="yvu410" value="0x39555659"/>
|
||||
<entry name="yuv411" value="0x31315559"/>
|
||||
<entry name="yvu411" value="0x31315659"/>
|
||||
<entry name="yuv420" value="0x32315559"/>
|
||||
<entry name="yvu420" value="0x32315659"/>
|
||||
<entry name="yuv422" value="0x36315559"/>
|
||||
<entry name="yvu422" value="0x36315659"/>
|
||||
<entry name="yuv444" value="0x34325559"/>
|
||||
<entry name="yvu444" value="0x34325659"/>
|
||||
</enum>
|
||||
|
||||
<!-- Call this request with the magic received from drmGetMagic().
|
||||
It will be passed on to the drmAuthMagic() or
|
||||
DRIAuthConnection() call. This authentication must be
|
||||
completed before create_buffer could be used. -->
|
||||
<request name="authenticate">
|
||||
<arg name="id" type="uint"/>
|
||||
</request>
|
||||
|
||||
<!-- Create a wayland buffer for the named DRM buffer. The DRM
|
||||
surface must have a name using the flink ioctl -->
|
||||
<request name="create_buffer">
|
||||
<arg name="id" type="new_id" interface="wl_buffer"/>
|
||||
<arg name="name" type="uint"/>
|
||||
<arg name="width" type="int"/>
|
||||
<arg name="height" type="int"/>
|
||||
<arg name="stride" type="uint"/>
|
||||
<arg name="format" type="uint"/>
|
||||
</request>
|
||||
|
||||
<!-- Create a wayland buffer for the named DRM buffer. The DRM
|
||||
surface must have a name using the flink ioctl -->
|
||||
<request name="create_planar_buffer">
|
||||
<arg name="id" type="new_id" interface="wl_buffer"/>
|
||||
<arg name="name" type="uint"/>
|
||||
<arg name="width" type="int"/>
|
||||
<arg name="height" type="int"/>
|
||||
<arg name="format" type="uint"/>
|
||||
<arg name="offset0" type="int"/>
|
||||
<arg name="stride0" type="int"/>
|
||||
<arg name="offset1" type="int"/>
|
||||
<arg name="stride1" type="int"/>
|
||||
<arg name="offset2" type="int"/>
|
||||
<arg name="stride2" type="int"/>
|
||||
</request>
|
||||
|
||||
<!-- Create a wayland buffer for the prime fd. Use for regular and planar
|
||||
buffers. Pass 0 for offset and stride for unused planes. -->
|
||||
<request name="create_prime_buffer" since="2">
|
||||
<arg name="id" type="new_id" interface="wl_buffer"/>
|
||||
<arg name="name" type="fd"/>
|
||||
<arg name="width" type="int"/>
|
||||
<arg name="height" type="int"/>
|
||||
<arg name="format" type="uint"/>
|
||||
<arg name="offset0" type="int"/>
|
||||
<arg name="stride0" type="int"/>
|
||||
<arg name="offset1" type="int"/>
|
||||
<arg name="stride1" type="int"/>
|
||||
<arg name="offset2" type="int"/>
|
||||
<arg name="stride2" type="int"/>
|
||||
</request>
|
||||
|
||||
<!-- Notification of the path of the drm device which is used by
|
||||
the server. The client should use this device for creating
|
||||
local buffers. Only buffers created from this device should
|
||||
be be passed to the server using this drm object's
|
||||
create_buffer request. -->
|
||||
<event name="device">
|
||||
<arg name="name" type="string"/>
|
||||
</event>
|
||||
|
||||
<event name="format">
|
||||
<arg name="format" type="uint"/>
|
||||
</event>
|
||||
|
||||
<!-- Raised if the authenticate request succeeded -->
|
||||
<event name="authenticated"/>
|
||||
|
||||
<enum name="capability" since="2">
|
||||
<description summary="wl_drm capability bitmask">
|
||||
Bitmask of capabilities.
|
||||
</description>
|
||||
<entry name="prime" value="1" summary="wl_drm prime available"/>
|
||||
</enum>
|
||||
|
||||
<event name="capabilities">
|
||||
<arg name="value" type="uint"/>
|
||||
</event>
|
||||
</interface>
|
||||
|
||||
</protocol>
|
570
hw/xwayland/xwayland-glamor.c
Normal file
570
hw/xwayland/xwayland-glamor.c
Normal file
|
@ -0,0 +1,570 @@
|
|||
/*
|
||||
* Copyright © 2011-2014 Intel Corporation
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of the
|
||||
* copyright holders not be used in advertising or publicity
|
||||
* pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "xwayland.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <xf86drm.h>
|
||||
|
||||
#define MESA_EGL_NO_X11_HEADERS
|
||||
#include <gbm.h>
|
||||
#include <epoxy/egl.h>
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
#include <glamor.h>
|
||||
#include <glamor_context.h>
|
||||
#include <dri3.h>
|
||||
#include "drm-client-protocol.h"
|
||||
|
||||
struct xwl_pixmap {
|
||||
struct wl_buffer *buffer;
|
||||
struct gbm_bo *bo;
|
||||
void *image;
|
||||
unsigned int texture;
|
||||
};
|
||||
|
||||
static void
|
||||
xwl_glamor_egl_make_current(struct glamor_context *glamor_ctx)
|
||||
{
|
||||
eglMakeCurrent(glamor_ctx->display, EGL_NO_SURFACE,
|
||||
EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (!eglMakeCurrent(glamor_ctx->display,
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
glamor_ctx->ctx))
|
||||
FatalError("Failed to make EGL context current\n");
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
drm_format_for_depth(int depth)
|
||||
{
|
||||
switch (depth) {
|
||||
case 15:
|
||||
return WL_DRM_FORMAT_XRGB1555;
|
||||
case 16:
|
||||
return WL_DRM_FORMAT_RGB565;
|
||||
case 24:
|
||||
return WL_DRM_FORMAT_XRGB8888;
|
||||
default:
|
||||
ErrorF("unexpected depth: %d\n", depth);
|
||||
case 32:
|
||||
return WL_DRM_FORMAT_ARGB8888;
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
gbm_format_for_depth(int depth)
|
||||
{
|
||||
switch (depth) {
|
||||
case 16:
|
||||
return GBM_FORMAT_RGB565;
|
||||
case 24:
|
||||
return GBM_FORMAT_XRGB8888;
|
||||
default:
|
||||
ErrorF("unexpected depth: %d\n", depth);
|
||||
case 32:
|
||||
return GBM_FORMAT_ARGB8888;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
|
||||
{
|
||||
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
|
||||
|
||||
glamor_ctx->ctx = xwl_screen->egl_context;
|
||||
glamor_ctx->display = xwl_screen->egl_display;
|
||||
|
||||
glamor_ctx->make_current = xwl_glamor_egl_make_current;
|
||||
|
||||
xwl_screen->glamor_ctx = glamor_ctx;
|
||||
}
|
||||
|
||||
static PixmapPtr
|
||||
xwl_glamor_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo, int depth)
|
||||
{
|
||||
PixmapPtr pixmap;
|
||||
struct xwl_pixmap *xwl_pixmap;
|
||||
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
|
||||
|
||||
xwl_pixmap = malloc(sizeof *xwl_pixmap);
|
||||
if (xwl_pixmap == NULL)
|
||||
return NULL;
|
||||
|
||||
pixmap = glamor_create_pixmap(screen,
|
||||
gbm_bo_get_width(bo),
|
||||
gbm_bo_get_height(bo),
|
||||
depth,
|
||||
GLAMOR_CREATE_PIXMAP_NO_TEXTURE);
|
||||
if (pixmap == NULL) {
|
||||
free(xwl_pixmap);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (lastGLContext != xwl_screen->glamor_ctx) {
|
||||
lastGLContext = xwl_screen->glamor_ctx;
|
||||
xwl_glamor_egl_make_current(xwl_screen->glamor_ctx);
|
||||
}
|
||||
|
||||
xwl_pixmap->bo = bo;
|
||||
xwl_pixmap->buffer = NULL;
|
||||
xwl_pixmap->image = eglCreateImageKHR(xwl_screen->egl_display,
|
||||
xwl_screen->egl_context,
|
||||
EGL_NATIVE_PIXMAP_KHR,
|
||||
xwl_pixmap->bo, NULL);
|
||||
|
||||
glGenTextures(1, &xwl_pixmap->texture);
|
||||
glBindTexture(GL_TEXTURE_2D, xwl_pixmap->texture);
|
||||
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, xwl_pixmap->image);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
xwl_pixmap_set_private(pixmap, xwl_pixmap);
|
||||
|
||||
glamor_set_pixmap_texture(pixmap, xwl_pixmap->texture);
|
||||
glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
struct wl_buffer *
|
||||
xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap)
|
||||
{
|
||||
struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen);
|
||||
struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
|
||||
int prime_fd;
|
||||
|
||||
if (xwl_pixmap->buffer)
|
||||
return xwl_pixmap->buffer;
|
||||
|
||||
prime_fd = gbm_bo_get_fd(xwl_pixmap->bo);
|
||||
if (prime_fd == -1)
|
||||
return NULL;
|
||||
|
||||
xwl_pixmap->buffer =
|
||||
wl_drm_create_prime_buffer(xwl_screen->drm, prime_fd,
|
||||
pixmap->drawable.width,
|
||||
pixmap->drawable.height,
|
||||
drm_format_for_depth(pixmap->drawable.depth),
|
||||
0, gbm_bo_get_stride(xwl_pixmap->bo),
|
||||
0, 0,
|
||||
0, 0);
|
||||
|
||||
close(prime_fd);
|
||||
|
||||
return xwl_pixmap->buffer;
|
||||
}
|
||||
|
||||
static PixmapPtr
|
||||
xwl_glamor_create_pixmap(ScreenPtr screen,
|
||||
int width, int height, int depth, unsigned int hint)
|
||||
{
|
||||
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
|
||||
struct gbm_bo *bo;
|
||||
|
||||
if (width > 0 && height > 0 && depth >= 15 &&
|
||||
(hint == 0 ||
|
||||
hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP ||
|
||||
hint == CREATE_PIXMAP_USAGE_SHARED)) {
|
||||
bo = gbm_bo_create(xwl_screen->gbm, width, height,
|
||||
gbm_format_for_depth(depth),
|
||||
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
|
||||
|
||||
if (bo)
|
||||
return xwl_glamor_create_pixmap_for_bo(screen, bo, depth);
|
||||
}
|
||||
|
||||
return glamor_create_pixmap(screen, width, height, depth, hint);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xwl_glamor_destroy_pixmap(PixmapPtr pixmap)
|
||||
{
|
||||
struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen);
|
||||
struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
|
||||
|
||||
if (xwl_pixmap && pixmap->refcnt == 1) {
|
||||
if (xwl_pixmap->buffer)
|
||||
wl_buffer_destroy(xwl_pixmap->buffer);
|
||||
|
||||
eglDestroyImageKHR(xwl_screen->egl_display, xwl_pixmap->image);
|
||||
gbm_bo_destroy(xwl_pixmap->bo);
|
||||
free(xwl_pixmap);
|
||||
}
|
||||
|
||||
return glamor_destroy_pixmap(pixmap);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xwl_glamor_create_screen_resources(ScreenPtr screen)
|
||||
{
|
||||
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
|
||||
int ret;
|
||||
|
||||
screen->CreateScreenResources = xwl_screen->CreateScreenResources;
|
||||
ret = (*screen->CreateScreenResources) (screen);
|
||||
xwl_screen->CreateScreenResources = screen->CreateScreenResources;
|
||||
screen->CreateScreenResources = xwl_glamor_create_screen_resources;
|
||||
|
||||
if (!ret)
|
||||
return ret;
|
||||
|
||||
if (xwl_screen->rootless)
|
||||
screen->devPrivate =
|
||||
fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0);
|
||||
else {
|
||||
screen->devPrivate =
|
||||
xwl_glamor_create_pixmap(screen, screen->width, screen->height,
|
||||
screen->rootDepth,
|
||||
CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
|
||||
if (screen->devPrivate)
|
||||
glamor_set_screen_pixmap(screen->devPrivate, NULL);
|
||||
}
|
||||
|
||||
return screen->devPrivate != NULL;
|
||||
}
|
||||
|
||||
static char
|
||||
is_fd_render_node(int fd)
|
||||
{
|
||||
struct stat render;
|
||||
|
||||
if (fstat(fd, &render))
|
||||
return 0;
|
||||
if (!S_ISCHR(render.st_mode))
|
||||
return 0;
|
||||
if (render.st_rdev & 0x80)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
xwl_drm_init_egl(struct xwl_screen *xwl_screen)
|
||||
{
|
||||
EGLint major, minor;
|
||||
const char *version;
|
||||
|
||||
if (xwl_screen->egl_display)
|
||||
return;
|
||||
|
||||
xwl_screen->expecting_event--;
|
||||
|
||||
xwl_screen->gbm = gbm_create_device(xwl_screen->drm_fd);
|
||||
if (xwl_screen->gbm == NULL) {
|
||||
ErrorF("couldn't get display device\n");
|
||||
return;
|
||||
}
|
||||
|
||||
xwl_screen->egl_display = eglGetDisplay(xwl_screen->gbm);
|
||||
if (xwl_screen->egl_display == EGL_NO_DISPLAY) {
|
||||
ErrorF("eglGetDisplay() failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
if (!eglInitialize(xwl_screen->egl_display, &major, &minor)) {
|
||||
ErrorF("eglInitialize() failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
version = eglQueryString(xwl_screen->egl_display, EGL_VERSION);
|
||||
ErrorF("glamor: EGL version %s:\n", version);
|
||||
|
||||
xwl_screen->egl_context = eglCreateContext(xwl_screen->egl_display,
|
||||
NULL, EGL_NO_CONTEXT, NULL);
|
||||
if (xwl_screen->egl_context == EGL_NO_CONTEXT) {
|
||||
ErrorF("Failed to create EGL context\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!eglMakeCurrent(xwl_screen->egl_display,
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
xwl_screen->egl_context)) {
|
||||
ErrorF("Failed to make EGL context current\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!epoxy_has_gl_extension("GL_OES_EGL_image")) {
|
||||
ErrorF("GL_OES_EGL_image no available");
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
xwl_drm_handle_device(void *data, struct wl_drm *drm, const char *device)
|
||||
{
|
||||
struct xwl_screen *xwl_screen = data;
|
||||
drm_magic_t magic;
|
||||
|
||||
xwl_screen->device_name = strdup(device);
|
||||
if (!xwl_screen->device_name)
|
||||
return;
|
||||
|
||||
xwl_screen->drm_fd = open(xwl_screen->device_name, O_RDWR | O_CLOEXEC);
|
||||
if (xwl_screen->drm_fd == -1) {
|
||||
ErrorF("wayland-egl: could not open %s (%s)",
|
||||
xwl_screen->device_name, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_fd_render_node(xwl_screen->drm_fd)) {
|
||||
xwl_screen->fd_render_node = 1;
|
||||
xwl_drm_init_egl(xwl_screen);
|
||||
} else {
|
||||
drmGetMagic(xwl_screen->drm_fd, &magic);
|
||||
wl_drm_authenticate(xwl_screen->drm, magic);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xwl_drm_handle_format(void *data, struct wl_drm *drm, uint32_t format)
|
||||
{
|
||||
struct xwl_screen *xwl_screen = data;
|
||||
|
||||
switch (format) {
|
||||
case WL_DRM_FORMAT_ARGB8888:
|
||||
xwl_screen->formats |= XWL_FORMAT_ARGB8888;
|
||||
break;
|
||||
case WL_DRM_FORMAT_XRGB8888:
|
||||
xwl_screen->formats |= XWL_FORMAT_XRGB8888;
|
||||
break;
|
||||
case WL_DRM_FORMAT_RGB565:
|
||||
xwl_screen->formats |= XWL_FORMAT_RGB565;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xwl_drm_handle_authenticated(void *data, struct wl_drm *drm)
|
||||
{
|
||||
struct xwl_screen *xwl_screen = data;
|
||||
|
||||
if (!xwl_screen->egl_display)
|
||||
xwl_drm_init_egl(xwl_screen);
|
||||
}
|
||||
|
||||
static void
|
||||
xwl_drm_handle_capabilities(void *data, struct wl_drm *drm, uint32_t value)
|
||||
{
|
||||
struct xwl_screen *xwl_screen = data;
|
||||
|
||||
xwl_screen->capabilities = value;
|
||||
}
|
||||
|
||||
static const struct wl_drm_listener xwl_drm_listener = {
|
||||
xwl_drm_handle_device,
|
||||
xwl_drm_handle_format,
|
||||
xwl_drm_handle_authenticated,
|
||||
xwl_drm_handle_capabilities
|
||||
};
|
||||
|
||||
Bool
|
||||
xwl_screen_init_glamor(struct xwl_screen *xwl_screen,
|
||||
uint32_t id, uint32_t version)
|
||||
{
|
||||
if (version < 2)
|
||||
return FALSE;
|
||||
|
||||
xwl_screen->drm =
|
||||
wl_registry_bind(xwl_screen->registry, id, &wl_drm_interface, 2);
|
||||
wl_drm_add_listener(xwl_screen->drm, &xwl_drm_listener, xwl_screen);
|
||||
xwl_screen->expecting_event++;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap)
|
||||
{
|
||||
glamor_destroy_textured_pixmap(pixmap);
|
||||
}
|
||||
|
||||
int
|
||||
glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
|
||||
PixmapPtr pixmap,
|
||||
unsigned int tex,
|
||||
Bool want_name, CARD16 *stride, CARD32 *size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct xwl_auth_state {
|
||||
int fd;
|
||||
ClientPtr client;
|
||||
};
|
||||
|
||||
static void
|
||||
sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
|
||||
{
|
||||
struct xwl_auth_state *state = data;
|
||||
|
||||
dri3_send_open_reply(state->client, state->fd);
|
||||
AttendClient(state->client);
|
||||
free(state);
|
||||
wl_callback_destroy(callback);
|
||||
}
|
||||
|
||||
static const struct wl_callback_listener sync_listener = {
|
||||
sync_callback
|
||||
};
|
||||
|
||||
static int
|
||||
xwl_dri3_open_client(ClientPtr client,
|
||||
ScreenPtr screen,
|
||||
RRProviderPtr provider,
|
||||
int *pfd)
|
||||
{
|
||||
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
|
||||
struct xwl_auth_state *state;
|
||||
struct wl_callback *callback;
|
||||
drm_magic_t magic;
|
||||
int fd;
|
||||
|
||||
fd = open(xwl_screen->device_name, O_RDWR | O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
return BadAlloc;
|
||||
if (xwl_screen->fd_render_node) {
|
||||
*pfd = fd;
|
||||
return Success;
|
||||
}
|
||||
|
||||
state = malloc(sizeof *state);
|
||||
if (state == NULL) {
|
||||
close(fd);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
state->client = client;
|
||||
state->fd = fd;
|
||||
|
||||
if (drmGetMagic(state->fd, &magic) < 0) {
|
||||
close(state->fd);
|
||||
free(state);
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
wl_drm_authenticate(xwl_screen->drm, magic);
|
||||
callback = wl_display_sync(xwl_screen->display);
|
||||
wl_callback_add_listener(callback, &sync_listener, state);
|
||||
|
||||
IgnoreClient(client);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static PixmapPtr
|
||||
xwl_dri3_pixmap_from_fd(ScreenPtr screen, int fd,
|
||||
CARD16 width, CARD16 height, CARD16 stride,
|
||||
CARD8 depth, CARD8 bpp)
|
||||
{
|
||||
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
|
||||
struct gbm_import_fd_data data;
|
||||
struct gbm_bo *bo;
|
||||
PixmapPtr pixmap;
|
||||
|
||||
if (width == 0 || height == 0 ||
|
||||
depth < 15 || bpp != BitsPerPixel(depth) || stride < width * bpp / 8)
|
||||
return NULL;
|
||||
|
||||
data.fd = fd;
|
||||
data.width = width;
|
||||
data.height = height;
|
||||
data.stride = stride;
|
||||
data.format = gbm_format_for_depth(depth);
|
||||
bo = gbm_bo_import(xwl_screen->gbm, GBM_BO_IMPORT_FD, &data,
|
||||
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
|
||||
if (bo == NULL)
|
||||
return NULL;
|
||||
|
||||
pixmap = xwl_glamor_create_pixmap_for_bo(screen, bo, depth);
|
||||
if (pixmap == NULL) {
|
||||
gbm_bo_destroy(bo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
static int
|
||||
xwl_dri3_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap,
|
||||
CARD16 *stride, CARD32 *size)
|
||||
{
|
||||
struct xwl_pixmap *xwl_pixmap;
|
||||
|
||||
xwl_pixmap = xwl_pixmap_get(pixmap);
|
||||
|
||||
*stride = gbm_bo_get_stride(xwl_pixmap->bo);
|
||||
*size = pixmap->drawable.width * *stride;
|
||||
|
||||
return gbm_bo_get_fd(xwl_pixmap->bo);
|
||||
}
|
||||
|
||||
static dri3_screen_info_rec xwl_dri3_info = {
|
||||
.version = 1,
|
||||
.open = NULL,
|
||||
.pixmap_from_fd = xwl_dri3_pixmap_from_fd,
|
||||
.fd_from_pixmap = xwl_dri3_fd_from_pixmap,
|
||||
.open_client = xwl_dri3_open_client,
|
||||
};
|
||||
|
||||
Bool
|
||||
xwl_glamor_init(struct xwl_screen *xwl_screen)
|
||||
{
|
||||
ScreenPtr screen = xwl_screen->screen;
|
||||
|
||||
if (xwl_screen->egl_context == EGL_NO_CONTEXT) {
|
||||
ErrorF("Disabling glamor and dri3, EGL setup failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!glamor_init(xwl_screen->screen,
|
||||
GLAMOR_INVERTED_Y_AXIS |
|
||||
GLAMOR_USE_EGL_SCREEN |
|
||||
GLAMOR_USE_SCREEN |
|
||||
GLAMOR_USE_PICTURE_SCREEN)) {
|
||||
ErrorF("Failed to initialize glamor\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!dri3_screen_init(xwl_screen->screen, &xwl_dri3_info)) {
|
||||
ErrorF("Failed to initialize dri3\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
xwl_screen->CreateScreenResources = screen->CreateScreenResources;
|
||||
screen->CreateScreenResources = xwl_glamor_create_screen_resources;
|
||||
screen->CreatePixmap = xwl_glamor_create_pixmap;
|
||||
screen->DestroyPixmap = xwl_glamor_destroy_pixmap;
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -337,7 +337,13 @@ xwl_screen_post_damage(struct xwl_screen *xwl_screen)
|
|||
|
||||
pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window);
|
||||
|
||||
buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
|
||||
#if GLAMOR_HAS_GBM
|
||||
if (xwl_screen->glamor)
|
||||
buffer = xwl_glamor_pixmap_get_wl_buffer(pixmap);
|
||||
#endif
|
||||
if (!xwl_screen->glamor)
|
||||
buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
|
||||
|
||||
wl_surface_attach(xwl_window->surface, buffer, 0, 0);
|
||||
for (i = 0; i < count; i++) {
|
||||
box = &RegionRects(region)[i];
|
||||
|
@ -373,6 +379,12 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id,
|
|||
xwl_output_create(xwl_screen, id);
|
||||
xwl_screen->expecting_event++;
|
||||
}
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
else if (xwl_screen->glamor &&
|
||||
strcmp(interface, "wl_drm") == 0 && version >= 2) {
|
||||
xwl_screen_init_glamor(xwl_screen, id, version);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -495,6 +507,10 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
|
|||
dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen);
|
||||
xwl_screen->screen = pScreen;
|
||||
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
xwl_screen->glamor = 1;
|
||||
#endif
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-rootless") == 0) {
|
||||
xwl_screen->rootless = 1;
|
||||
|
@ -514,6 +530,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
|
|||
atoi(argv[i + 1]);
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-shm") == 0) {
|
||||
xwl_screen->glamor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (xwl_screen->listen_fd_count > 0) {
|
||||
|
@ -591,10 +610,19 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
|
|||
if (!xwl_screen_init_cursor(xwl_screen))
|
||||
return FALSE;
|
||||
|
||||
xwl_screen->CreateScreenResources = pScreen->CreateScreenResources;
|
||||
pScreen->CreateScreenResources = xwl_shm_create_screen_resources;
|
||||
pScreen->CreatePixmap = xwl_shm_create_pixmap;
|
||||
pScreen->DestroyPixmap = xwl_shm_destroy_pixmap;
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
if (xwl_screen->glamor && !xwl_glamor_init(xwl_screen)) {
|
||||
ErrorF("Failed to initialize glamor, falling back to sw\n");
|
||||
xwl_screen->glamor = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!xwl_screen->glamor) {
|
||||
xwl_screen->CreateScreenResources = pScreen->CreateScreenResources;
|
||||
pScreen->CreateScreenResources = xwl_shm_create_screen_resources;
|
||||
pScreen->CreatePixmap = xwl_shm_create_pixmap;
|
||||
pScreen->DestroyPixmap = xwl_shm_destroy_pixmap;
|
||||
}
|
||||
|
||||
xwl_screen->RealizeWindow = pScreen->RealizeWindow;
|
||||
pScreen->RealizeWindow = xwl_realize_window;
|
||||
|
|
|
@ -55,6 +55,7 @@ struct xwl_screen {
|
|||
int listen_fds[5];
|
||||
int listen_fd_count;
|
||||
int rootless;
|
||||
int glamor;
|
||||
|
||||
CreateScreenResourcesProcPtr CreateScreenResources;
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
|
@ -83,6 +84,16 @@ struct xwl_screen {
|
|||
#define XWL_FORMAT_RGB565 (1 << 2)
|
||||
|
||||
int prepare_read;
|
||||
|
||||
char *device_name;
|
||||
int drm_fd;
|
||||
int fd_render_node;
|
||||
struct wl_drm *drm;
|
||||
uint32_t formats;
|
||||
uint32_t capabilities;
|
||||
void *egl_display, *egl_context;
|
||||
struct gbm_device *gbm;
|
||||
struct glamor_context *glamor_ctx;
|
||||
};
|
||||
|
||||
struct xwl_window {
|
||||
|
@ -161,4 +172,10 @@ Bool xwl_shm_destroy_pixmap(PixmapPtr pixmap);
|
|||
struct wl_buffer *xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap);
|
||||
|
||||
|
||||
Bool xwl_glamor_init(struct xwl_screen *xwl_screen);
|
||||
|
||||
Bool xwl_screen_init_glamor(struct xwl_screen *xwl_screen,
|
||||
uint32_t id, uint32_t version);
|
||||
struct wl_buffer *xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -155,7 +155,7 @@ XWIN_LIBS += $(top_builddir)/pseudoramiX/libPseudoramiX.la \
|
|||
$(top_builddir)/Xi/libXistubs.la
|
||||
XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(XSERVER_LIBS)
|
||||
XWin_LDADD = $(MULTIWINDOW_LIBS) $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
|
||||
XWin_LDFLAGS = -mwindows -static -Wl,--disable-stdcall-fixup
|
||||
XWin_LDFLAGS = -mwindows -Wl,--disable-stdcall-fixup $(LD_EXPORT_SYMBOLS_FLAG)
|
||||
|
||||
|
||||
.rc.o:
|
||||
|
|
|
@ -64,16 +64,16 @@ typedef struct _CallbackList *CallbackListPtr; /* also in misc.h */
|
|||
|
||||
typedef void (*CallbackProcPtr) (CallbackListPtr *, void *, void *);
|
||||
|
||||
extern _X_EXPORT Bool AddCallback(CallbackListPtr * /*pcbl */ ,
|
||||
CallbackProcPtr /*callback */ ,
|
||||
void */*data */ );
|
||||
extern _X_EXPORT Bool AddCallback(CallbackListPtr *pcbl,
|
||||
CallbackProcPtr callback,
|
||||
void *data);
|
||||
|
||||
extern _X_EXPORT Bool DeleteCallback(CallbackListPtr * /*pcbl */ ,
|
||||
CallbackProcPtr /*callback */ ,
|
||||
void */*data */ );
|
||||
extern _X_EXPORT Bool DeleteCallback(CallbackListPtr *pcbl,
|
||||
CallbackProcPtr callback,
|
||||
void *data);
|
||||
|
||||
extern _X_EXPORT void _CallCallbacks(CallbackListPtr * /*pcbl */ ,
|
||||
void */*call_data */ );
|
||||
extern _X_EXPORT void _CallCallbacks(CallbackListPtr *pcbl,
|
||||
void *call_data);
|
||||
|
||||
static inline void
|
||||
CallCallbacks(CallbackListPtr *pcbl, void *call_data)
|
||||
|
@ -83,7 +83,7 @@ CallCallbacks(CallbackListPtr *pcbl, void *call_data)
|
|||
_CallCallbacks(pcbl, call_data);
|
||||
}
|
||||
|
||||
extern _X_EXPORT void DeleteCallbackList(CallbackListPtr * /*pcbl */ );
|
||||
extern _X_EXPORT void DeleteCallbackList(CallbackListPtr *pcbl);
|
||||
|
||||
extern _X_EXPORT void InitCallbackManager(void);
|
||||
extern _X_EXPORT void DeleteCallbackManager(void);
|
||||
|
|
|
@ -82,14 +82,14 @@ extern _X_EXPORT int CreateColormap(Colormap /*mid */ ,
|
|||
int /*alloc */ ,
|
||||
int /*client */ );
|
||||
|
||||
extern _X_EXPORT int FreeColormap(void */*pmap */ ,
|
||||
XID /*mid */ );
|
||||
extern _X_EXPORT int FreeColormap(void *pmap,
|
||||
XID mid);
|
||||
|
||||
extern _X_EXPORT int TellLostMap(WindowPtr /*pwin */ ,
|
||||
void */* Colormap *pmid */ );
|
||||
extern _X_EXPORT int TellLostMap(WindowPtr pwin,
|
||||
void *value);
|
||||
|
||||
extern _X_EXPORT int TellGainedMap(WindowPtr /*pwin */ ,
|
||||
void */* Colormap *pmid */ );
|
||||
extern _X_EXPORT int TellGainedMap(WindowPtr pwin,
|
||||
void *value);
|
||||
|
||||
extern _X_EXPORT int CopyColormapAndFree(Colormap /*mid */ ,
|
||||
ColormapPtr /*pSrc */ ,
|
||||
|
@ -126,8 +126,8 @@ extern _X_EXPORT int QueryColors(ColormapPtr /*pmap */ ,
|
|||
xrgb * /*prgbList */ ,
|
||||
ClientPtr client);
|
||||
|
||||
extern _X_EXPORT int FreeClientPixels(void */*pcr */ ,
|
||||
XID /*fakeid */ );
|
||||
extern _X_EXPORT int FreeClientPixels(void *pcr,
|
||||
XID fakeid);
|
||||
|
||||
extern _X_EXPORT int AllocColorCells(int /*client */ ,
|
||||
ColormapPtr /*pmap */ ,
|
||||
|
|
|
@ -68,8 +68,8 @@ extern _X_EXPORT DevScreenPrivateKeyRec cursorScreenDevPriv;
|
|||
|
||||
extern _X_EXPORT CursorPtr rootCursor;
|
||||
|
||||
extern _X_EXPORT int FreeCursor(void */*pCurs */ ,
|
||||
XID /*cid */ );
|
||||
extern _X_EXPORT int FreeCursor(void *pCurs,
|
||||
XID cid);
|
||||
|
||||
extern _X_EXPORT CursorPtr RefCursor(CursorPtr /* cursor */);
|
||||
extern _X_EXPORT CursorPtr UnrefCursor(CursorPtr /* cursor */);
|
||||
|
|
|
@ -147,14 +147,14 @@ extern _X_EXPORT void UpdateCurrentTime(void);
|
|||
|
||||
extern _X_EXPORT void UpdateCurrentTimeIf(void);
|
||||
|
||||
extern _X_EXPORT int dixDestroyPixmap(void */*value */ ,
|
||||
XID /*pid */ );
|
||||
extern _X_EXPORT int dixDestroyPixmap(void *value,
|
||||
XID pid);
|
||||
|
||||
extern _X_EXPORT void InitClient(ClientPtr /*client */ ,
|
||||
int /*i */ ,
|
||||
void */*ospriv */ );
|
||||
extern _X_EXPORT void InitClient(ClientPtr client,
|
||||
int i,
|
||||
void *ospriv);
|
||||
|
||||
extern _X_EXPORT ClientPtr NextAvailableClient(void */*ospriv */ );
|
||||
extern _X_EXPORT ClientPtr NextAvailableClient(void *ospriv);
|
||||
|
||||
extern _X_EXPORT void SendErrorToClient(ClientPtr /*client */ ,
|
||||
unsigned int /*majorCode */ ,
|
||||
|
@ -203,11 +203,11 @@ extern _X_EXPORT int AlterSaveSetForClient(ClientPtr /*client */ ,
|
|||
|
||||
extern _X_EXPORT void DeleteWindowFromAnySaveSet(WindowPtr /*pWin */ );
|
||||
|
||||
extern _X_EXPORT void BlockHandler(void */*pTimeout */ ,
|
||||
void */*pReadmask */ );
|
||||
extern _X_EXPORT void BlockHandler(void *pTimeout,
|
||||
void *pReadmask);
|
||||
|
||||
extern _X_EXPORT void WakeupHandler(int /*result */ ,
|
||||
void */*pReadmask */ );
|
||||
extern _X_EXPORT void WakeupHandler(int result,
|
||||
void *pReadmask);
|
||||
|
||||
void
|
||||
EnableLimitedSchedulingLatency(void);
|
||||
|
@ -215,21 +215,17 @@ void
|
|||
void
|
||||
DisableLimitedSchedulingLatency(void);
|
||||
|
||||
typedef void (*WakeupHandlerProcPtr) (void */* blockData */ ,
|
||||
int /* result */ ,
|
||||
void */* pReadmask */ );
|
||||
typedef void (*WakeupHandlerProcPtr) (void *blockData,
|
||||
int result,
|
||||
void *pReadmask);
|
||||
|
||||
extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr
|
||||
/*blockHandler */ ,
|
||||
WakeupHandlerProcPtr
|
||||
/*wakeupHandler */ ,
|
||||
void */*blockData */ );
|
||||
extern _X_EXPORT Bool RegisterBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
|
||||
WakeupHandlerProcPtr wakeupHandler,
|
||||
void *blockData);
|
||||
|
||||
extern _X_EXPORT void RemoveBlockAndWakeupHandlers(BlockHandlerProcPtr
|
||||
/*blockHandler */ ,
|
||||
WakeupHandlerProcPtr
|
||||
/*wakeupHandler */ ,
|
||||
void */*blockData */ );
|
||||
extern _X_EXPORT void RemoveBlockAndWakeupHandlers(BlockHandlerProcPtr blockHandler,
|
||||
WakeupHandlerProcPtr wakeupHandler,
|
||||
void *blockData);
|
||||
|
||||
extern _X_EXPORT void InitBlockAndWakeupHandlers(void);
|
||||
|
||||
|
@ -237,22 +233,17 @@ extern _X_EXPORT void ProcessWorkQueue(void);
|
|||
|
||||
extern _X_EXPORT void ProcessWorkQueueZombies(void);
|
||||
|
||||
extern _X_EXPORT Bool QueueWorkProc(Bool (* /*function */ )(
|
||||
ClientPtr
|
||||
/*clientUnused */
|
||||
,
|
||||
void *
|
||||
/*closure */ ),
|
||||
ClientPtr /*client */ ,
|
||||
void */*closure */
|
||||
);
|
||||
extern _X_EXPORT Bool QueueWorkProc(Bool (*function)(ClientPtr clientUnused,
|
||||
void *closure),
|
||||
ClientPtr client,
|
||||
void *closure);
|
||||
|
||||
typedef Bool (*ClientSleepProcPtr) (ClientPtr /*client */ ,
|
||||
void */*closure */ );
|
||||
typedef Bool (*ClientSleepProcPtr) (ClientPtr client,
|
||||
void *closure);
|
||||
|
||||
extern _X_EXPORT Bool ClientSleep(ClientPtr /*client */ ,
|
||||
ClientSleepProcPtr /* function */ ,
|
||||
void */*closure */ );
|
||||
extern _X_EXPORT Bool ClientSleep(ClientPtr client,
|
||||
ClientSleepProcPtr function,
|
||||
void *closure);
|
||||
|
||||
#ifndef ___CLIENTSIGNAL_DEFINED___
|
||||
#define ___CLIENTSIGNAL_DEFINED___
|
||||
|
@ -444,8 +435,8 @@ extern void
|
|||
RecalculateDeliverableEvents(WindowPtr /* pWin */ );
|
||||
|
||||
extern _X_EXPORT int
|
||||
OtherClientGone(void */* value */ ,
|
||||
XID /* id */ );
|
||||
OtherClientGone(void *value,
|
||||
XID id);
|
||||
|
||||
extern void
|
||||
DoFocusEvents(DeviceIntPtr /* dev */ ,
|
||||
|
|
|
@ -40,9 +40,9 @@ extern _X_EXPORT void QueueFontWakeup(FontPathElementPtr /*fpe */ );
|
|||
|
||||
extern _X_EXPORT void RemoveFontWakeup(FontPathElementPtr /*fpe */ );
|
||||
|
||||
extern _X_EXPORT void FontWakeup(void */*data */ ,
|
||||
int /*count */ ,
|
||||
void */*LastSelectMask */ );
|
||||
extern _X_EXPORT void FontWakeup(void *data,
|
||||
int count,
|
||||
void *LastSelectMask);
|
||||
|
||||
extern _X_EXPORT int OpenFont(ClientPtr /*client */ ,
|
||||
XID /*fid */ ,
|
||||
|
@ -50,8 +50,8 @@ extern _X_EXPORT int OpenFont(ClientPtr /*client */ ,
|
|||
unsigned /*lenfname */ ,
|
||||
const char * /*pfontname */ );
|
||||
|
||||
extern _X_EXPORT int CloseFont(void */*pfont */ ,
|
||||
XID /*fid */ );
|
||||
extern _X_EXPORT int CloseFont(void *pfont,
|
||||
XID fid);
|
||||
|
||||
typedef struct _xQueryFontReply *xQueryFontReplyPtr;
|
||||
|
||||
|
|
|
@ -47,8 +47,8 @@ extern GrabPtr CreateGrab(int /* client */ ,
|
|||
WindowPtr /* confineTo */ ,
|
||||
CursorPtr /* cursor */ );
|
||||
|
||||
extern _X_EXPORT int DeletePassiveGrab(void */* value */ ,
|
||||
XID /* id */ );
|
||||
extern _X_EXPORT int DeletePassiveGrab(void *value,
|
||||
XID id);
|
||||
|
||||
extern _X_EXPORT Bool GrabMatchesSecond(GrabPtr /* pFirstGrab */ ,
|
||||
GrabPtr /* pSecondGrab */ ,
|
||||
|
|
|
@ -112,8 +112,8 @@ extern _X_EXPORT int CopyGC(GCPtr /*pgcSrc */ ,
|
|||
GCPtr /*pgcDst */ ,
|
||||
BITS32 /*mask */ );
|
||||
|
||||
extern _X_EXPORT int FreeGC(void */*pGC */ ,
|
||||
XID /*gid */ );
|
||||
extern _X_EXPORT int FreeGC(void *pGC,
|
||||
XID gid);
|
||||
|
||||
extern _X_EXPORT void FreeGCperDepth(int /*screenNum */ );
|
||||
|
||||
|
|
|
@ -76,10 +76,10 @@ typedef struct _GCFuncs {
|
|||
|
||||
void (*DestroyGC) (GCPtr /*pGC */ );
|
||||
|
||||
void (*ChangeClip) (GCPtr /*pGC */ ,
|
||||
int /*type */ ,
|
||||
void */*pvalue */ ,
|
||||
int /*nrects */ );
|
||||
void (*ChangeClip) (GCPtr pGC,
|
||||
int type,
|
||||
void *pvalue,
|
||||
int nrects);
|
||||
|
||||
void (*DestroyClip) (GCPtr /*pGC */ );
|
||||
|
||||
|
@ -210,21 +210,21 @@ typedef struct _GCOps {
|
|||
int /*count */ ,
|
||||
unsigned short * /*chars */ );
|
||||
|
||||
void (*ImageGlyphBlt) (DrawablePtr /*pDrawable */ ,
|
||||
GCPtr /*pGC */ ,
|
||||
int /*x */ ,
|
||||
int /*y */ ,
|
||||
unsigned int /*nglyph */ ,
|
||||
CharInfoPtr * /*ppci */ ,
|
||||
void */*pglyphBase */ );
|
||||
void (*ImageGlyphBlt) (DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int nglyph,
|
||||
CharInfoPtr *ppci,
|
||||
void *pglyphBase);
|
||||
|
||||
void (*PolyGlyphBlt) (DrawablePtr /*pDrawable */ ,
|
||||
GCPtr /*pGC */ ,
|
||||
int /*x */ ,
|
||||
int /*y */ ,
|
||||
unsigned int /*nglyph */ ,
|
||||
CharInfoPtr * /*ppci */ ,
|
||||
void */*pglyphBase */ );
|
||||
void (*PolyGlyphBlt) (DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int nglyph,
|
||||
CharInfoPtr *ppci,
|
||||
void *pglyphBase);
|
||||
|
||||
void (*PushPixels) (GCPtr /*pGC */ ,
|
||||
PixmapPtr /*pBitMap */ ,
|
||||
|
|
|
@ -32,7 +32,7 @@ extern _X_EXPORT void config_pre_init(void);
|
|||
extern _X_EXPORT void config_init(void);
|
||||
extern _X_EXPORT void config_fini(void);
|
||||
|
||||
enum { ODEV_ATTRIB_STRING, ODEV_ATTRIB_INT };
|
||||
enum { ODEV_ATTRIB_UNKNOWN = -1, ODEV_ATTRIB_STRING = 0, ODEV_ATTRIB_INT };
|
||||
|
||||
struct OdevAttribute {
|
||||
struct xorg_list member;
|
||||
|
@ -87,6 +87,8 @@ config_odev_free_attributes(struct OdevAttributes *attribs);
|
|||
#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
|
||||
|
||||
typedef void (*config_odev_probe_proc_ptr)(struct OdevAttributes *attribs);
|
||||
void config_odev_probe(config_odev_probe_proc_ptr probe_callback);
|
||||
|
|
|
@ -314,10 +314,10 @@ extern _X_EXPORT Bool InitTouchClassDeviceStruct(DeviceIntPtr /*device */ ,
|
|||
unsigned int /*mode */ ,
|
||||
unsigned int /*numAxes */ );
|
||||
|
||||
typedef void (*BellProcPtr) (int /*percent */ ,
|
||||
DeviceIntPtr /*device */ ,
|
||||
void */*ctrl */ ,
|
||||
int);
|
||||
typedef void (*BellProcPtr) (int percent,
|
||||
DeviceIntPtr device,
|
||||
void *ctrl,
|
||||
int feedbackClass);
|
||||
|
||||
typedef void (*KbdCtrlProcPtr) (DeviceIntPtr /*device */ ,
|
||||
KeybdCtrl * /*ctrl */ );
|
||||
|
|
52
include/os.h
52
include/os.h
|
@ -139,8 +139,8 @@ extern _X_EXPORT const char *ClientAuthorized(ClientPtr /*client */ ,
|
|||
unsigned int /*string_n */ ,
|
||||
char * /*auth_string */ );
|
||||
|
||||
extern _X_EXPORT Bool EstablishNewConnections(ClientPtr /*clientUnused */ ,
|
||||
void */*closure */ );
|
||||
extern _X_EXPORT Bool EstablishNewConnections(ClientPtr clientUnused,
|
||||
void *closure);
|
||||
|
||||
extern _X_EXPORT void CheckConnections(void);
|
||||
|
||||
|
@ -173,14 +173,14 @@ extern _X_EXPORT Bool AddClientOnOpenFD(int /* fd */ );
|
|||
extern _X_EXPORT CARD32 GetTimeInMillis(void);
|
||||
extern _X_EXPORT CARD64 GetTimeInMicros(void);
|
||||
|
||||
extern _X_EXPORT void AdjustWaitForDelay(void */*waitTime */ ,
|
||||
unsigned long /*newdelay */ );
|
||||
extern _X_EXPORT void AdjustWaitForDelay(void *waitTime,
|
||||
unsigned long newdelay);
|
||||
|
||||
typedef struct _OsTimerRec *OsTimerPtr;
|
||||
|
||||
typedef CARD32 (*OsTimerCallback) (OsTimerPtr /* timer */ ,
|
||||
CARD32 /* time */ ,
|
||||
void */* arg */ );
|
||||
typedef CARD32 (*OsTimerCallback) (OsTimerPtr timer,
|
||||
CARD32 time,
|
||||
void *arg);
|
||||
|
||||
extern _X_EXPORT void TimerInit(void);
|
||||
|
||||
|
@ -189,11 +189,11 @@ extern _X_EXPORT Bool TimerForce(OsTimerPtr /* timer */ );
|
|||
#define TimerAbsolute (1<<0)
|
||||
#define TimerForceOld (1<<1)
|
||||
|
||||
extern _X_EXPORT OsTimerPtr TimerSet(OsTimerPtr /* timer */ ,
|
||||
int /* flags */ ,
|
||||
CARD32 /* millis */ ,
|
||||
OsTimerCallback /* func */ ,
|
||||
void */* arg */ );
|
||||
extern _X_EXPORT OsTimerPtr TimerSet(OsTimerPtr timer,
|
||||
int flags,
|
||||
CARD32 millis,
|
||||
OsTimerCallback func,
|
||||
void *arg);
|
||||
|
||||
extern _X_EXPORT void TimerCheck(void);
|
||||
extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */ );
|
||||
|
@ -210,9 +210,9 @@ extern _X_EXPORT void UseMsg(void);
|
|||
|
||||
extern _X_EXPORT void ProcessCommandLine(int /*argc */ , char * /*argv */ []);
|
||||
|
||||
extern _X_EXPORT int set_font_authorizations(char ** /* authorizations */ ,
|
||||
int * /*authlen */ ,
|
||||
void */* client */ );
|
||||
extern _X_EXPORT int set_font_authorizations(char **authorizations,
|
||||
int *authlen,
|
||||
void *client);
|
||||
|
||||
#ifndef _HAVE_XALLOC_DECLS
|
||||
#define _HAVE_XALLOC_DECLS
|
||||
|
@ -391,18 +391,18 @@ AddHost(ClientPtr /*client */ ,
|
|||
const void * /*pAddr */ );
|
||||
|
||||
extern _X_EXPORT Bool
|
||||
ForEachHostInFamily(int /*family */ ,
|
||||
Bool (* /*func */ )(
|
||||
unsigned char * /* addr */ ,
|
||||
short /* len */ ,
|
||||
void */* closure */ ),
|
||||
void */*closure */ );
|
||||
ForEachHostInFamily(int family,
|
||||
Bool (*func)(
|
||||
unsigned char *addr,
|
||||
short len,
|
||||
void *closure),
|
||||
void *closure);
|
||||
|
||||
extern _X_EXPORT int
|
||||
RemoveHost(ClientPtr /*client */ ,
|
||||
int /*family */ ,
|
||||
unsigned /*length */ ,
|
||||
void */*pAddr */ );
|
||||
RemoveHost(ClientPtr client,
|
||||
int family,
|
||||
unsigned length,
|
||||
void *pAddr);
|
||||
|
||||
extern _X_EXPORT int
|
||||
GetHosts(void ** /*data */ ,
|
||||
|
@ -464,7 +464,7 @@ DefineSelf(int /*fd */ );
|
|||
|
||||
#if XDMCP
|
||||
extern _X_EXPORT void
|
||||
AugmentSelf(void */*from */ , int /*len */ );
|
||||
AugmentSelf(void *from, int len);
|
||||
|
||||
extern _X_EXPORT void
|
||||
RegisterAuthorizations(void);
|
||||
|
|
|
@ -93,13 +93,13 @@ typedef union _PixUnion {
|
|||
#define WindowDrawable(type) \
|
||||
((type == DRAWABLE_WINDOW) || (type == UNDRAWABLE_WINDOW))
|
||||
|
||||
extern _X_EXPORT PixmapPtr GetScratchPixmapHeader(ScreenPtr /*pScreen */ ,
|
||||
int /*width */ ,
|
||||
int /*height */ ,
|
||||
int /*depth */ ,
|
||||
int /*bitsPerPixel */ ,
|
||||
int /*devKind */ ,
|
||||
void */*pPixData */ );
|
||||
extern _X_EXPORT PixmapPtr GetScratchPixmapHeader(ScreenPtr pScreen,
|
||||
int width,
|
||||
int height,
|
||||
int depth,
|
||||
int bitsPerPixel,
|
||||
int devKind,
|
||||
void *pPixData);
|
||||
|
||||
extern _X_EXPORT void FreeScratchPixmapHeader(PixmapPtr /*pPixmap */ );
|
||||
|
||||
|
|
|
@ -57,24 +57,24 @@ extern _X_EXPORT int dixLookupProperty(PropertyPtr * /*result */ ,
|
|||
ClientPtr /*pClient */ ,
|
||||
Mask /*access_mode */ );
|
||||
|
||||
extern _X_EXPORT int dixChangeWindowProperty(ClientPtr /*pClient */ ,
|
||||
WindowPtr /*pWin */ ,
|
||||
Atom /*property */ ,
|
||||
Atom /*type */ ,
|
||||
int /*format */ ,
|
||||
int /*mode */ ,
|
||||
unsigned long /*len */ ,
|
||||
void */*value */ ,
|
||||
Bool /*sendevent */ );
|
||||
extern _X_EXPORT int dixChangeWindowProperty(ClientPtr pClient,
|
||||
WindowPtr pWin,
|
||||
Atom property,
|
||||
Atom type,
|
||||
int format,
|
||||
int mode,
|
||||
unsigned long len,
|
||||
void *value,
|
||||
Bool sendevent);
|
||||
|
||||
extern _X_EXPORT int ChangeWindowProperty(WindowPtr /*pWin */ ,
|
||||
Atom /*property */ ,
|
||||
Atom /*type */ ,
|
||||
int /*format */ ,
|
||||
int /*mode */ ,
|
||||
unsigned long /*len */ ,
|
||||
void */*value */ ,
|
||||
Bool /*sendevent */ );
|
||||
extern _X_EXPORT int ChangeWindowProperty(WindowPtr pWin,
|
||||
Atom property,
|
||||
Atom type,
|
||||
int format,
|
||||
int mode,
|
||||
unsigned long len,
|
||||
void *value,
|
||||
Bool sendevent);
|
||||
|
||||
extern _X_EXPORT int DeleteProperty(ClientPtr /*client */ ,
|
||||
WindowPtr /*pWin */ ,
|
||||
|
|
|
@ -136,21 +136,21 @@ typedef struct {
|
|||
void *value;
|
||||
} ResourceStateInfoRec;
|
||||
|
||||
typedef int (*DeleteType) (void */*value */ ,
|
||||
XID /*id */ );
|
||||
typedef int (*DeleteType) (void *value,
|
||||
XID id);
|
||||
|
||||
typedef void (*FindResType) (void */*value */ ,
|
||||
XID /*id */ ,
|
||||
void */*cdata */ );
|
||||
typedef void (*FindResType) (void *value,
|
||||
XID id,
|
||||
void *cdata);
|
||||
|
||||
typedef void (*FindAllRes) (void */*value */ ,
|
||||
XID /*id */ ,
|
||||
RESTYPE /*type */ ,
|
||||
void */*cdata */ );
|
||||
typedef void (*FindAllRes) (void *value,
|
||||
XID id,
|
||||
RESTYPE type,
|
||||
void *cdata);
|
||||
|
||||
typedef Bool (*FindComplexResType) (void */*value */ ,
|
||||
XID /*id */ ,
|
||||
void */*cdata */ );
|
||||
typedef Bool (*FindComplexResType) (void *value,
|
||||
XID id,
|
||||
void *cdata);
|
||||
|
||||
/* Structure for estimating resource memory usage. Memory usage
|
||||
* consists of space allocated for the resource itself and of
|
||||
|
@ -166,16 +166,16 @@ typedef struct {
|
|||
unsigned long refCnt;
|
||||
} ResourceSizeRec, *ResourceSizePtr;
|
||||
|
||||
typedef void (*SizeType)(void */*value*/,
|
||||
XID /*id*/,
|
||||
ResourceSizePtr /*size*/);
|
||||
typedef void (*SizeType)(void *value,
|
||||
XID id,
|
||||
ResourceSizePtr size);
|
||||
|
||||
extern _X_EXPORT RESTYPE CreateNewResourceType(DeleteType /*deleteFunc */ ,
|
||||
const char * /*name */ );
|
||||
extern _X_EXPORT RESTYPE CreateNewResourceType(DeleteType deleteFunc,
|
||||
const char *name);
|
||||
|
||||
typedef void (*FindTypeSubResources)(void */* value */,
|
||||
FindAllRes /* func */,
|
||||
void */* cdata */);
|
||||
typedef void (*FindTypeSubResources)(void *value,
|
||||
FindAllRes func,
|
||||
void *cdata);
|
||||
|
||||
extern _X_EXPORT SizeType GetResourceTypeSizeFunc(
|
||||
RESTYPE /*type*/);
|
||||
|
@ -200,9 +200,9 @@ extern _X_EXPORT XID FakeClientID(int /*client */ );
|
|||
#ifdef __APPLE__
|
||||
#define AddResource Darwin_X_AddResource
|
||||
#endif
|
||||
extern _X_EXPORT Bool AddResource(XID /*id */ ,
|
||||
RESTYPE /*type */ ,
|
||||
void */*value */ );
|
||||
extern _X_EXPORT Bool AddResource(XID id,
|
||||
RESTYPE type,
|
||||
void *value);
|
||||
|
||||
extern _X_EXPORT void FreeResource(XID /*id */ ,
|
||||
RESTYPE /*skipDeleteFuncType */ );
|
||||
|
@ -211,27 +211,27 @@ extern _X_EXPORT void FreeResourceByType(XID /*id */ ,
|
|||
RESTYPE /*type */ ,
|
||||
Bool /*skipFree */ );
|
||||
|
||||
extern _X_EXPORT Bool ChangeResourceValue(XID /*id */ ,
|
||||
RESTYPE /*rtype */ ,
|
||||
void */*value */ );
|
||||
extern _X_EXPORT Bool ChangeResourceValue(XID id,
|
||||
RESTYPE rtype,
|
||||
void *value);
|
||||
|
||||
extern _X_EXPORT void FindClientResourcesByType(ClientPtr /*client */ ,
|
||||
RESTYPE /*type */ ,
|
||||
FindResType /*func */ ,
|
||||
void */*cdata */ );
|
||||
extern _X_EXPORT void FindClientResourcesByType(ClientPtr client,
|
||||
RESTYPE type,
|
||||
FindResType func,
|
||||
void *cdata);
|
||||
|
||||
extern _X_EXPORT void FindAllClientResources(ClientPtr /*client */ ,
|
||||
FindAllRes /*func */ ,
|
||||
void */*cdata */ );
|
||||
extern _X_EXPORT void FindAllClientResources(ClientPtr client,
|
||||
FindAllRes func,
|
||||
void *cdata);
|
||||
|
||||
/** @brief Iterate through all subresources of a resource.
|
||||
|
||||
@note The XID argument provided to the FindAllRes function
|
||||
may be 0 for subresources that don't have an XID */
|
||||
extern _X_EXPORT void FindSubResources(void */*resource*/,
|
||||
RESTYPE /*type*/,
|
||||
FindAllRes /*func*/,
|
||||
void */*cdata*/);
|
||||
extern _X_EXPORT void FindSubResources(void *resource,
|
||||
RESTYPE type,
|
||||
FindAllRes func,
|
||||
void *cdata);
|
||||
|
||||
extern _X_EXPORT void FreeClientNeverRetainResources(ClientPtr /*client */ );
|
||||
|
||||
|
|
|
@ -259,23 +259,23 @@ typedef void (*SendGraphicsExposeProcPtr) (ClientPtr /*client */ ,
|
|||
int /*major */ ,
|
||||
int /*minor */ );
|
||||
|
||||
typedef void (*ScreenBlockHandlerProcPtr) (ScreenPtr /*pScreen*/ ,
|
||||
void */*pTimeout */ ,
|
||||
void */*pReadmask */ );
|
||||
typedef void (*ScreenBlockHandlerProcPtr) (ScreenPtr pScreen,
|
||||
void *pTimeout,
|
||||
void *pReadmask);
|
||||
|
||||
typedef void (*ScreenWakeupHandlerProcPtr) (ScreenPtr /*pScreen*/ ,
|
||||
unsigned long /*result */ ,
|
||||
void */*pReadMask */ );
|
||||
typedef void (*ScreenWakeupHandlerProcPtr) (ScreenPtr pScreen,
|
||||
unsigned long result,
|
||||
void *pReadMask);
|
||||
|
||||
typedef Bool (*CreateScreenResourcesProcPtr) (ScreenPtr /*pScreen */ );
|
||||
|
||||
typedef Bool (*ModifyPixmapHeaderProcPtr) (PixmapPtr /*pPixmap */ ,
|
||||
int /*width */ ,
|
||||
int /*height */ ,
|
||||
int /*depth */ ,
|
||||
int /*bitsPerPixel */ ,
|
||||
int /*devKind */ ,
|
||||
void */*pPixData */ );
|
||||
typedef Bool (*ModifyPixmapHeaderProcPtr) (PixmapPtr pPixmap,
|
||||
int width,
|
||||
int height,
|
||||
int depth,
|
||||
int bitsPerPixel,
|
||||
int devKind,
|
||||
void *pPixData);
|
||||
|
||||
typedef PixmapPtr (*GetWindowPixmapProcPtr) (WindowPtr /*pWin */ );
|
||||
|
||||
|
@ -358,6 +358,96 @@ typedef WindowPtr (*XYToWindowProcPtr)(ScreenPtr pScreen,
|
|||
|
||||
typedef int (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32);
|
||||
|
||||
/* Wrapping Screen procedures
|
||||
|
||||
There are a few modules in the X server which dynamically add and
|
||||
remove themselves from various screen procedure call chains.
|
||||
|
||||
For example, the BlockHandler is dynamically modified by:
|
||||
|
||||
* xf86Rotate
|
||||
* miSprite
|
||||
* composite
|
||||
* render (for animated cursors)
|
||||
|
||||
Correctly manipulating this chain is complicated by the fact that
|
||||
the chain is constructed through a sequence of screen private
|
||||
structures, each holding the next screen->proc pointer.
|
||||
|
||||
To add a module to a screen->proc chain is fairly simple; just save
|
||||
the current screen->proc value in the module screen private
|
||||
and store the module's function in the screen->proc location.
|
||||
|
||||
Removing a screen proc is a bit trickier. It seems like all you
|
||||
need to do is set the screen->proc pointer back to the value saved
|
||||
in your screen private. However, if some other module has come
|
||||
along and wrapped on top of you, then the right place to store the
|
||||
previous screen->proc value is actually in the wrapping module's
|
||||
screen private structure(!). Of course, you have no idea what
|
||||
other module may have wrapped on top, nor could you poke inside
|
||||
its screen private in any case.
|
||||
|
||||
To make this work, we restrict the unwrapping process to happen
|
||||
during the invocation of the screen proc itself, and then we
|
||||
require the screen proc to take some care when manipulating the
|
||||
screen proc functions pointers.
|
||||
|
||||
The requirements are:
|
||||
|
||||
1) The screen proc must set the screen->proc pointer back to the
|
||||
value saved in its screen private before calling outside its
|
||||
module.
|
||||
|
||||
2a) If the screen proc wants to be remove itself from the chain,
|
||||
it must not manipulate screen->proc pointer again before
|
||||
returning.
|
||||
|
||||
2b) If the screen proc wants to remain in the chain, it must:
|
||||
|
||||
2b.1) Re-fetch the screen->proc pointer and store that in
|
||||
its screen private. This ensures that any changes
|
||||
to the chain will be preserved.
|
||||
|
||||
2b.2) Set screen->proc back to itself
|
||||
|
||||
One key requirement here is that these steps must wrap not just
|
||||
any invocation of the nested screen->proc value, but must nest
|
||||
essentially any calls outside the current module. This ensures
|
||||
that other modules can reliably manipulate screen->proc wrapping
|
||||
using these same rules.
|
||||
|
||||
For example, the animated cursor code in render has two macros,
|
||||
Wrap and Unwrap.
|
||||
|
||||
#define Unwrap(as,s,elt) ((s)->elt = (as)->elt)
|
||||
|
||||
Unwrap takes the screen private (as), the screen (s) and the
|
||||
member name (elt), and restores screen->proc to that saved in the
|
||||
screen private.
|
||||
|
||||
#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
|
||||
|
||||
Wrap takes the screen private (as), the screen (s), the member
|
||||
name (elt) and the wrapping function (func). It saves the
|
||||
current screen->proc value in the screen private, and then sets the
|
||||
screen->proc to the local wrapping function.
|
||||
|
||||
Within each of these functions, there's a pretty simple pattern:
|
||||
|
||||
Unwrap(as, pScreen, UnrealizeCursor);
|
||||
|
||||
// Do local stuff, including possibly calling down through
|
||||
// pScreen->UnrealizeCursor
|
||||
|
||||
Wrap(as, pScreen, UnrealizeCursor, AnimCurUnrealizeCursor);
|
||||
|
||||
The wrapping block handler is a bit different; it does the Unwrap,
|
||||
the local operations and then only re-Wraps if the hook is still
|
||||
required. Unwrap occurrs at the top of each function, just after
|
||||
entry, and Wrap occurrs at the bottom of each function, just
|
||||
before returning.
|
||||
*/
|
||||
|
||||
typedef struct _Screen {
|
||||
int myNum; /* index of this instance in Screens[] */
|
||||
ATOM id;
|
||||
|
|
|
@ -114,8 +114,13 @@ SOFTWARE.
|
|||
|
||||
#if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__)
|
||||
|
||||
#define IMAGE_BYTE_ORDER MSBFirst
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#if defined(__LITTLE_ENDIAN__)
|
||||
#define IMAGE_BYTE_ORDER LSBFirst
|
||||
#define BITMAP_BIT_ORDER LSBFirst
|
||||
#else
|
||||
#define IMAGE_BYTE_ORDER MSBFirst
|
||||
#define BITMAP_BIT_ORDER MSBFirst
|
||||
#endif
|
||||
#define GLYPHPADBYTES 4
|
||||
|
||||
#endif /* PowerPC */
|
||||
|
|
|
@ -72,16 +72,16 @@ struct _Cursor;
|
|||
typedef struct _BackingStore *BackingStorePtr;
|
||||
typedef struct _Window *WindowPtr;
|
||||
|
||||
typedef int (*VisitWindowProcPtr) (WindowPtr /*pWin */ ,
|
||||
void */*data */ );
|
||||
typedef int (*VisitWindowProcPtr) (WindowPtr pWin,
|
||||
void *data);
|
||||
|
||||
extern _X_EXPORT int TraverseTree(WindowPtr /*pWin */ ,
|
||||
VisitWindowProcPtr /*func */ ,
|
||||
void */*data */ );
|
||||
extern _X_EXPORT int TraverseTree(WindowPtr pWin,
|
||||
VisitWindowProcPtr func,
|
||||
void *data);
|
||||
|
||||
extern _X_EXPORT int WalkTree(ScreenPtr /*pScreen */ ,
|
||||
VisitWindowProcPtr /*func */ ,
|
||||
void */*data */ );
|
||||
extern _X_EXPORT int WalkTree(ScreenPtr pScreen,
|
||||
VisitWindowProcPtr func,
|
||||
void *data);
|
||||
|
||||
extern _X_EXPORT Bool CreateRootWindow(ScreenPtr /*pScreen */ );
|
||||
|
||||
|
@ -108,8 +108,8 @@ extern _X_EXPORT WindowPtr CreateWindow(Window /*wid */ ,
|
|||
VisualID /*visual */ ,
|
||||
int * /*error */ );
|
||||
|
||||
extern _X_EXPORT int DeleteWindow(void */*pWin */ ,
|
||||
XID /*wid */ );
|
||||
extern _X_EXPORT int DeleteWindow(void *pWin,
|
||||
XID wid);
|
||||
|
||||
extern _X_EXPORT int DestroySubwindows(WindowPtr /*pWin */ ,
|
||||
ClientPtr /*client */ );
|
||||
|
|
|
@ -596,15 +596,15 @@ extern _X_EXPORT void XkbSendCompatMapNotify(DeviceIntPtr /* kbd */ ,
|
|||
xkbCompatMapNotify * /* ev */
|
||||
);
|
||||
|
||||
extern _X_EXPORT void XkbHandleBell(BOOL /* force */ ,
|
||||
BOOL /* eventOnly */ ,
|
||||
DeviceIntPtr /* kbd */ ,
|
||||
CARD8 /* percent */ ,
|
||||
void */* ctrl */ ,
|
||||
CARD8 /* class */ ,
|
||||
Atom /* name */ ,
|
||||
WindowPtr /* pWin */ ,
|
||||
ClientPtr /* pClient */
|
||||
extern _X_EXPORT void XkbHandleBell(BOOL force,
|
||||
BOOL eventOnly,
|
||||
DeviceIntPtr kbd,
|
||||
CARD8 percent,
|
||||
void *ctrl,
|
||||
CARD8 class,
|
||||
Atom name,
|
||||
WindowPtr pWin,
|
||||
ClientPtr pClient
|
||||
);
|
||||
|
||||
extern _X_EXPORT void XkbSendAccessXNotify(DeviceIntPtr /* kbd */ ,
|
||||
|
|
74
mi/mi.h
74
mi/mi.h
|
@ -270,22 +270,22 @@ extern _X_EXPORT void miPolyFillRect(DrawablePtr /*pDrawable */ ,
|
|||
|
||||
/* miglblt.c */
|
||||
|
||||
extern _X_EXPORT void miPolyGlyphBlt(DrawablePtr /*pDrawable */ ,
|
||||
GCPtr /*pGC */ ,
|
||||
int /*x */ ,
|
||||
int /*y */ ,
|
||||
unsigned int /*nglyph */ ,
|
||||
CharInfoPtr * /*ppci */ ,
|
||||
void */*pglyphBase */
|
||||
extern _X_EXPORT void miPolyGlyphBlt(DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int nglyph,
|
||||
CharInfoPtr *ppci,
|
||||
void *pglyphBase
|
||||
);
|
||||
|
||||
extern _X_EXPORT void miImageGlyphBlt(DrawablePtr /*pDrawable */ ,
|
||||
GCPtr /*pGC */ ,
|
||||
int /*x */ ,
|
||||
int /*y */ ,
|
||||
unsigned int /*nglyph */ ,
|
||||
CharInfoPtr * /*ppci */ ,
|
||||
void */*pglyphBase */
|
||||
extern _X_EXPORT void miImageGlyphBlt(DrawablePtr pDrawable,
|
||||
GCPtr pGC,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int nglyph,
|
||||
CharInfoPtr *ppci,
|
||||
void *pglyphBase
|
||||
);
|
||||
|
||||
/* mipoly.c */
|
||||
|
@ -386,36 +386,36 @@ extern _X_EXPORT void miPushPixels(GCPtr /*pGC */ ,
|
|||
|
||||
/* miscrinit.c */
|
||||
|
||||
extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr /*pPixmap */ ,
|
||||
int /*width */ ,
|
||||
int /*height */ ,
|
||||
int /*depth */ ,
|
||||
int /*bitsPerPixel */ ,
|
||||
int /*devKind */ ,
|
||||
void */*pPixData */
|
||||
extern _X_EXPORT Bool miModifyPixmapHeader(PixmapPtr pPixmap,
|
||||
int width,
|
||||
int height,
|
||||
int depth,
|
||||
int bitsPerPixel,
|
||||
int devKind,
|
||||
void *pPixData
|
||||
);
|
||||
|
||||
extern _X_EXPORT Bool miCreateScreenResources(ScreenPtr /*pScreen */
|
||||
);
|
||||
|
||||
extern _X_EXPORT Bool miScreenDevPrivateInit(ScreenPtr /*pScreen */ ,
|
||||
int /*width */ ,
|
||||
void */*pbits */
|
||||
extern _X_EXPORT Bool miScreenDevPrivateInit(ScreenPtr pScreen,
|
||||
int width,
|
||||
void *pbits
|
||||
);
|
||||
|
||||
extern _X_EXPORT Bool miScreenInit(ScreenPtr /*pScreen */ ,
|
||||
void */*pbits */ ,
|
||||
int /*xsize */ ,
|
||||
int /*ysize */ ,
|
||||
int /*dpix */ ,
|
||||
int /*dpiy */ ,
|
||||
int /*width */ ,
|
||||
int /*rootDepth */ ,
|
||||
int /*numDepths */ ,
|
||||
DepthPtr /*depths */ ,
|
||||
VisualID /*rootVisual */ ,
|
||||
int /*numVisuals */ ,
|
||||
VisualPtr /*visuals */
|
||||
extern _X_EXPORT Bool miScreenInit(ScreenPtr pScreen,
|
||||
void *pbits,
|
||||
int xsize,
|
||||
int ysize,
|
||||
int dpix,
|
||||
int dpiy,
|
||||
int width,
|
||||
int rootDepth,
|
||||
int numDepths,
|
||||
DepthPtr depths,
|
||||
VisualID rootVisual,
|
||||
int numVisuals,
|
||||
VisualPtr visuals
|
||||
);
|
||||
|
||||
/* mivaltree.c */
|
||||
|
|
|
@ -520,6 +520,8 @@ miSpriteBlockHandler(ScreenPtr pScreen, void *pTimeout,
|
|||
miCursorInfoPtr pCursorInfo;
|
||||
Bool WorkToDo = FALSE;
|
||||
|
||||
SCREEN_PROLOGUE(pPriv, pScreen, BlockHandler);
|
||||
|
||||
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
|
||||
if (DevHasCursor(pDev)) {
|
||||
pCursorInfo = MISPRITE(pDev);
|
||||
|
@ -543,8 +545,6 @@ miSpriteBlockHandler(ScreenPtr pScreen, void *pTimeout,
|
|||
}
|
||||
}
|
||||
|
||||
SCREEN_PROLOGUE(pPriv, pScreen, BlockHandler);
|
||||
|
||||
(*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask);
|
||||
|
||||
if (WorkToDo)
|
||||
|
|
|
@ -1217,9 +1217,9 @@ AddHost(ClientPtr client, int family, unsigned length, /* of bytes in pAddr */
|
|||
}
|
||||
|
||||
Bool
|
||||
ForEachHostInFamily(int family, Bool (*func) (unsigned char * /* addr */ ,
|
||||
short /* len */ ,
|
||||
void */* closure */ ),
|
||||
ForEachHostInFamily(int family, Bool (*func) (unsigned char *addr,
|
||||
short len,
|
||||
void *closure),
|
||||
void *closure)
|
||||
{
|
||||
HOST *host;
|
||||
|
|
2
os/log.c
2
os/log.c
|
@ -697,7 +697,7 @@ LogVMessageVerbSigSafe(MessageType type, int verb, const char *format, va_list a
|
|||
if (sizeof(buf) - len == 1)
|
||||
buf[len - 1] = '\n';
|
||||
|
||||
newline = (buf[len - 1] == '\n');
|
||||
newline = (len > 0 && buf[len - 1] == '\n');
|
||||
LogSWrite(verb, buf, len, newline);
|
||||
}
|
||||
|
||||
|
|
|
@ -382,6 +382,24 @@ present_set_tree_pixmap(WindowPtr window, PixmapPtr pixmap)
|
|||
TraverseTree(window, present_set_tree_pixmap_visit, &visit);
|
||||
}
|
||||
|
||||
static void
|
||||
present_set_abort_flip(ScreenPtr screen)
|
||||
{
|
||||
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
|
||||
|
||||
/* Switch back to using the screen pixmap now to avoid
|
||||
* 2D applications drawing to the wrong pixmap.
|
||||
*/
|
||||
|
||||
if (screen_priv->flip_window)
|
||||
present_set_tree_pixmap(screen_priv->flip_window,
|
||||
(*screen->GetScreenPixmap)(screen));
|
||||
|
||||
present_set_tree_pixmap(screen->root, (*screen->GetScreenPixmap)(screen));
|
||||
|
||||
screen_priv->flip_pending->abort_flip = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
present_unflip(ScreenPtr screen)
|
||||
{
|
||||
|
@ -511,7 +529,7 @@ present_check_flip_window (WindowPtr window)
|
|||
if (flip_pending->window == window) {
|
||||
if (!present_check_flip(flip_pending->crtc, window, flip_pending->pixmap,
|
||||
flip_pending->sync_flip, NULL, 0, 0))
|
||||
flip_pending->abort_flip = TRUE;
|
||||
present_set_abort_flip(screen);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
@ -578,6 +596,7 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
|
|||
}
|
||||
|
||||
xorg_list_del(&vblank->event_queue);
|
||||
xorg_list_del(&vblank->window_list);
|
||||
vblank->queued = FALSE;
|
||||
|
||||
if (vblank->pixmap && vblank->window) {
|
||||
|
@ -633,7 +652,7 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
|
|||
/* Check pending flip
|
||||
*/
|
||||
if (window == screen_priv->flip_pending->window)
|
||||
screen_priv->flip_pending->abort_flip = TRUE;
|
||||
present_set_abort_flip(screen);
|
||||
} else if (!screen_priv->unflip_event_id) {
|
||||
|
||||
/* Check current flip
|
||||
|
@ -752,7 +771,7 @@ present_pixmap(WindowPtr window,
|
|||
if (!vblank->queued)
|
||||
continue;
|
||||
|
||||
if (vblank->crtc != target_crtc || vblank->target_msc > target_msc)
|
||||
if (vblank->crtc != target_crtc || vblank->target_msc != target_msc)
|
||||
continue;
|
||||
|
||||
DebugPresent(("\tx %lld %p %8lld: %08lx -> %08lx (crtc %p)\n",
|
||||
|
@ -915,7 +934,7 @@ present_flip_destroy(ScreenPtr screen)
|
|||
|
||||
/* Do the actual cleanup once the flip has been performed by the hardware */
|
||||
if (screen_priv->flip_pending)
|
||||
screen_priv->flip_pending->abort_flip = TRUE;
|
||||
present_set_abort_flip(screen);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue
Block a user