aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-07-19 15:00:38 +0200
committermarha <marha@users.sourceforge.net>2014-07-19 15:00:38 +0200
commitd0c30e7945e76ac119f6d867e27137c8a76f7e15 (patch)
tree1bfb3148a6f43bdd32746c5b882f9f083076cf91 /xorg-server/hw
parente708bebcc029873004ade4241f347ce8c58896af (diff)
downloadvcxsrv-d0c30e7945e76ac119f6d867e27137c8a76f7e15.tar.gz
vcxsrv-d0c30e7945e76ac119f6d867e27137c8a76f7e15.tar.bz2
vcxsrv-d0c30e7945e76ac119f6d867e27137c8a76f7e15.zip
fontconfig plink libX11 libxcb mesa git update 19 July 2014
plink revision 10207 xserver commit cfa302d6224d10860e60491333950544c4fb9b04 libxcb commit 49a61c8b459ab19c7f39e653bbb0d0339ea8f00f libX11 commit 5525e8433f93bce464412f27cffa203ea628f368 fontconfig commit 6781c6baef062eeea5b5b68e4a9c31ea6cd7539b mesa commit f6fc80734533140a69b30361fe0d4773a03515db
Diffstat (limited to 'xorg-server/hw')
-rw-r--r--xorg-server/hw/kdrive/ephyr/Makefile.am5
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr.c10
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr.h13
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c24
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr_glamor_xv.c161
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrinit.c14
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrvideo.c34
-rw-r--r--xorg-server/hw/kdrive/ephyr/hostx.c34
-rw-r--r--xorg-server/hw/kdrive/src/kdrive.c4
-rw-r--r--xorg-server/hw/kdrive/src/kdrive.h1
-rw-r--r--xorg-server/hw/kdrive/src/kxv.c81
-rw-r--r--xorg-server/hw/kdrive/src/kxv.h23
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86DPMS.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h10
-rw-r--r--xorg-server/hw/xfree86/common/xf86platformBus.c58
-rw-r--r--xorg-server/hw/xfree86/common/xf86platformBus.h104
-rw-r--r--xorg-server/hw/xfree86/common/xf86xv.c53
-rw-r--r--xorg-server/hw/xfree86/common/xf86xv.h36
-rw-r--r--xorg-server/hw/xfree86/glamor_egl/Makefile.am3
-rw-r--r--xorg-server/hw/xfree86/glamor_egl/glamor_xf86_xv.c185
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Rotate.c18
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_platform.c52
23 files changed, 621 insertions, 306 deletions
diff --git a/xorg-server/hw/kdrive/ephyr/Makefile.am b/xorg-server/hw/kdrive/ephyr/Makefile.am
index 00a53d0df..10c59174f 100644
--- a/xorg-server/hw/kdrive/ephyr/Makefile.am
+++ b/xorg-server/hw/kdrive/ephyr/Makefile.am
@@ -35,9 +35,14 @@ XV_SRCS = ephyrvideo.c
endif
if GLAMOR
+if XV
+GLAMOR_XV_SRCS = ephyr_glamor_xv.c
+endif
+
GLAMOR_SRCS = \
ephyr_glamor_glx.c \
ephyr_glamor_glx.h \
+ $(GLAMOR_XV_SRCS) \
$()
endif
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c
index def50d8d8..d57e9f33c 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.c
@@ -650,7 +650,9 @@ ephyrInitScreen(ScreenPtr pScreen)
#ifdef XV
if (!ephyrNoXV) {
- if (!ephyrInitVideo(pScreen)) {
+ if (ephyr_glamor)
+ ephyr_glamor_xv_init(pScreen);
+ else if (!ephyrInitVideo(pScreen)) {
EPHYR_LOG_ERROR("failed to initialize xvideo\n");
}
else {
@@ -756,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
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.h b/xorg-server/hw/kdrive/ephyr/ephyr.h
index 34ce4601b..dfd93c9bc 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr.h
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.h
@@ -131,6 +131,9 @@ void
ephyrScreenFini(KdScreenInfo * screen);
void
+ephyrCloseScreen(ScreenPtr pScreen);
+
+void
ephyrCardFini(KdCardInfo * card);
void
@@ -221,4 +224,14 @@ void ephyr_glamor_host_paint_rect(ScreenPtr pScreen);
Bool ephyrInitVideo(ScreenPtr pScreen);
+/* ephyr_glamor_xv.c */
+#ifdef GLAMOR
+void ephyr_glamor_xv_init(ScreenPtr screen);
+#else /* !GLAMOR */
+static inline void
+ephyr_glamor_xv_init(ScreenPtr screen)
+{
+}
+#endif /* !GLAMOR */
+
#endif
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c b/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c
index eaf565496..8fe751693 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c
@@ -52,6 +52,7 @@
static Display *dpy;
static XVisualInfo *visual_info;
static GLXFBConfig fb_config;
+Bool ephyr_glamor_gles2;
/** @} */
/**
@@ -145,6 +146,10 @@ ephyr_glamor_setup_texturing_shader(struct ephyr_glamor *glamor)
"}\n";
const char *fs_source =
+ "#ifdef GL_ES\n"
+ "precision mediump float;\n"
+ "#endif\n"
+ "\n"
"varying vec2 t;\n"
"uniform sampler2D s; /* initially 0 */\n"
"\n"
@@ -276,7 +281,24 @@ ephyr_glamor_glx_screen_init(xcb_window_t win)
glx_win = glXCreateWindow(dpy, fb_config, win, NULL);
- ctx = glXCreateContext(dpy, visual_info, NULL, True);
+ if (ephyr_glamor_gles2) {
+ static const int context_attribs[] = {
+ GLX_CONTEXT_MAJOR_VERSION_ARB, 2,
+ GLX_CONTEXT_MINOR_VERSION_ARB, 0,
+ GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES_PROFILE_BIT_EXT,
+ 0,
+ };
+ if (epoxy_has_glx_extension(dpy, DefaultScreen(dpy),
+ "GLX_EXT_create_context_es2_profile")) {
+ ctx = glXCreateContextAttribsARB(dpy, fb_config, NULL, True,
+ context_attribs);
+ } else {
+ FatalError("Xephyr -glamor_gles2 rquires "
+ "GLX_EXT_create_context_es2_profile\n");
+ }
+ } else {
+ ctx = glXCreateContext(dpy, visual_info, NULL, True);
+ }
if (ctx == NULL)
FatalError("glXCreateContext failed\n");
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr_glamor_xv.c b/xorg-server/hw/kdrive/ephyr/ephyr_glamor_xv.c
new file mode 100644
index 000000000..b9c3464d8
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyr_glamor_xv.c
@@ -0,0 +1,161 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * 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 (including the next
+ * paragraph) 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_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+#include "kdrive.h"
+#include "kxv.h"
+#include "ephyr.h"
+#include "glamor_priv.h"
+
+#include <X11/extensions/Xv.h>
+#include "fourcc.h"
+
+#define NUM_FORMATS 3
+
+static KdVideoFormatRec Formats[NUM_FORMATS] = {
+ {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
+};
+
+static void
+ephyr_glamor_xv_stop_video(KdScreenInfo *screen, void *data, Bool cleanup)
+{
+ if (!cleanup)
+ return;
+
+ glamor_xv_stop_video(data);
+}
+
+static int
+ephyr_glamor_xv_set_port_attribute(KdScreenInfo *screen,
+ Atom attribute, INT32 value, void *data)
+{
+ return glamor_xv_set_port_attribute(data, attribute, value);
+}
+
+static int
+ephyr_glamor_xv_get_port_attribute(KdScreenInfo *screen,
+ Atom attribute, INT32 *value, void *data)
+{
+ return glamor_xv_get_port_attribute(data, attribute, value);
+}
+
+static void
+ephyr_glamor_xv_query_best_size(KdScreenInfo *screen,
+ Bool motion,
+ short vid_w, short vid_h,
+ short drw_w, short drw_h,
+ unsigned int *p_w, unsigned int *p_h,
+ void *data)
+{
+ *p_w = drw_w;
+ *p_h = drw_h;
+}
+
+static int
+ephyr_glamor_xv_query_image_attributes(KdScreenInfo *screen,
+ int id,
+ unsigned short *w, unsigned short *h,
+ int *pitches, int *offsets)
+{
+ return glamor_xv_query_image_attributes(id, w, h, pitches, offsets);
+}
+
+static int
+ephyr_glamor_xv_put_image(KdScreenInfo *screen,
+ DrawablePtr pDrawable,
+ short src_x, short src_y,
+ short drw_x, short drw_y,
+ short src_w, short src_h,
+ short drw_w, short drw_h,
+ int id,
+ unsigned char *buf,
+ short width,
+ short height,
+ Bool sync,
+ RegionPtr clipBoxes, void *data)
+{
+ return glamor_xv_put_image(data, pDrawable,
+ src_x, src_y,
+ drw_x, drw_y,
+ src_w, src_h,
+ drw_w, drw_h,
+ id, buf, width, height, sync, clipBoxes);
+}
+
+void
+ephyr_glamor_xv_init(ScreenPtr screen)
+{
+ KdVideoAdaptorRec *adaptor;
+ glamor_port_private *port_privates;
+ KdVideoEncodingRec encoding = {
+ 0,
+ "XV_IMAGE",
+ /* These sizes should probably be GL_MAX_TEXTURE_SIZE instead
+ * of 2048, but our context isn't set up yet.
+ */
+ 2048, 2048,
+ {1, 1}
+ };
+ int i;
+
+ glamor_xv_core_init(screen);
+
+ adaptor = xnfcalloc(1, sizeof(*adaptor));
+
+ adaptor->name = "glamor textured video";
+ adaptor->type = XvWindowMask | XvInputMask | XvImageMask;
+ adaptor->flags = 0;
+ adaptor->nEncodings = 1;
+ adaptor->pEncodings = &encoding;
+
+ adaptor->pFormats = Formats;
+ adaptor->nFormats = NUM_FORMATS;
+
+ adaptor->nPorts = 16; /* Some absurd number */
+ port_privates = xnfcalloc(adaptor->nPorts,
+ sizeof(glamor_port_private));
+ adaptor->pPortPrivates = xnfcalloc(adaptor->nPorts,
+ sizeof(glamor_port_private *));
+ for (i = 0; i < adaptor->nPorts; i++) {
+ adaptor->pPortPrivates[i].ptr = &port_privates[i];
+ glamor_xv_init_port(&port_privates[i]);
+ }
+
+ adaptor->pAttributes = glamor_xv_attributes;
+ adaptor->nAttributes = glamor_xv_num_attributes;
+
+ adaptor->pImages = glamor_xv_images;
+ adaptor->nImages = glamor_xv_num_images;
+
+ adaptor->StopVideo = ephyr_glamor_xv_stop_video;
+ adaptor->SetPortAttribute = ephyr_glamor_xv_set_port_attribute;
+ adaptor->GetPortAttribute = ephyr_glamor_xv_get_port_attribute;
+ adaptor->QueryBestSize = ephyr_glamor_xv_query_best_size;
+ adaptor->PutImage = ephyr_glamor_xv_put_image;
+ adaptor->QueryImageAttributes = ephyr_glamor_xv_query_image_attributes;
+
+ KdXVScreenInit(screen, adaptor, 1);
+}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrinit.c b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
index fac84cd13..fc0001012 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrinit.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
@@ -35,7 +35,7 @@ extern Bool EphyrWantGrayScale;
extern Bool EphyrWantResize;
extern Bool kdHasPointer;
extern Bool kdHasKbd;
-extern Bool ephyr_glamor;
+extern Bool ephyr_glamor, ephyr_glamor_gles2;
#ifdef GLXEXT
extern Bool ephyrNoDRI;
@@ -138,6 +138,7 @@ ddxUseMsg(void)
ErrorF("-resizeable Make Xephyr windows resizeable\n");
#ifdef GLAMOR
ErrorF("-glamor Enable 2D acceleration using glamor\n");
+ ErrorF("-glamor_gles2 Enable 2D acceleration using glamor (with GLES2 only)\n");
#endif
ErrorF
("-fakexa Simulate acceleration using software rendering\n");
@@ -251,6 +252,15 @@ ddxProcessArgument(int argc, char **argv, int i)
ephyrFuncs.finiAccel = ephyr_glamor_fini;
return 1;
}
+ else if (!strcmp (argv[i], "-glamor_gles2")) {
+ ephyr_glamor = TRUE;
+ ephyr_glamor_gles2 = TRUE;
+ ephyrFuncs.initAccel = ephyr_glamor_init;
+ ephyrFuncs.enableAccel = ephyr_glamor_enable;
+ ephyrFuncs.disableAccel = ephyr_glamor_disable;
+ ephyrFuncs.finiAccel = ephyr_glamor_fini;
+ return 1;
+ }
#endif
else if (!strcmp(argv[i], "-fakexa")) {
ephyrFuncs.initAccel = ephyrDrawInit;
@@ -430,4 +440,6 @@ KdCardFuncs ephyrFuncs = {
ephyrGetColors, /* getColors */
ephyrPutColors, /* putColors */
+
+ ephyrCloseScreen, /* closeScreen */
};
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrvideo.c b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
index c6728351f..ab18c7afa 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
@@ -69,7 +69,7 @@ static Bool ephyrXVPrivSetAdaptorsHooks(EphyrXVPriv * a_this);
static Bool ephyrXVPrivRegisterAdaptors(EphyrXVPriv * a_this,
ScreenPtr a_screen);
-static Bool ephyrXVPrivIsAttrValueValid(KdAttributePtr a_attrs,
+static Bool ephyrXVPrivIsAttrValueValid(XvAttributePtr a_attrs,
int a_attrs_len,
const char *a_attr_name,
int a_attr_value, Bool *a_is_valid);
@@ -363,7 +363,7 @@ translate_xv_attributes(KdVideoAdaptorPtr adaptor,
it = xcb_xv_query_port_attributes_attributes_iterator(reply);
for (i = 0; i < reply->num_attributes; i++) {
- KdAttributePtr attribute = &adaptor->pAttributes[i];
+ XvAttributePtr attribute = &adaptor->pAttributes[i];
attribute->flags = it.data->flags;
attribute->min_value = it.data->min;
@@ -397,7 +397,7 @@ translate_xv_image_formats(KdVideoAdaptorPtr adaptor,
return FALSE;
adaptor->nImages = reply->num_formats;
- adaptor->pImages = calloc(reply->num_formats, sizeof(KdImageRec));
+ adaptor->pImages = calloc(reply->num_formats, sizeof(XvImageRec));
if (!adaptor->pImages) {
free(reply);
return FALSE;
@@ -405,7 +405,7 @@ translate_xv_image_formats(KdVideoAdaptorPtr adaptor,
formats = xcb_xv_list_image_formats_format(reply);
for (i = 0; i < reply->num_formats; i++) {
- KdImagePtr image = &adaptor->pImages[i];
+ XvImagePtr image = &adaptor->pImages[i];
image->id = formats[i].id;
image->type = formats[i].type;
@@ -612,11 +612,7 @@ ephyrXVPrivSetAdaptorsHooks(EphyrXVPriv * a_this)
static Bool
ephyrXVPrivRegisterAdaptors(EphyrXVPriv * a_this, ScreenPtr a_screen)
{
- KdScreenPriv(a_screen);
- KdScreenInfo *screen = pScreenPriv->screen;
Bool is_ok = FALSE;
- KdVideoAdaptorPtr *adaptors = NULL, *registered_adaptors = NULL;
- int num_registered_adaptors = 0, i = 0, num_adaptors = 0;
EPHYR_RETURN_VAL_IF_FAIL(a_this && a_screen, FALSE);
@@ -624,38 +620,22 @@ ephyrXVPrivRegisterAdaptors(EphyrXVPriv * a_this, ScreenPtr a_screen)
if (!a_this->num_adaptors)
goto out;
- num_registered_adaptors =
- KdXVListGenericAdaptors(screen, &registered_adaptors);
- num_adaptors = num_registered_adaptors + a_this->num_adaptors;
- adaptors = calloc(num_adaptors, sizeof(KdVideoAdaptorPtr));
- if (!adaptors) {
- EPHYR_LOG_ERROR("failed to allocate adaptors tab\n");
- goto out;
- }
- memmove(adaptors, registered_adaptors, num_registered_adaptors);
- for (i = 0; i < a_this->num_adaptors; i++) {
- *(adaptors + num_registered_adaptors + i) = &a_this->adaptors[i];
- }
- if (!KdXVScreenInit(a_screen, adaptors, num_adaptors)) {
+ if (!KdXVScreenInit(a_screen, a_this->adaptors, a_this->num_adaptors)) {
EPHYR_LOG_ERROR("failed to register adaptors\n");
goto out;
}
- EPHYR_LOG("there are %d registered adaptors\n", num_adaptors);
+ EPHYR_LOG("there are %d registered adaptors\n", a_this->num_adaptors);
is_ok = TRUE;
out:
- free(registered_adaptors);
- registered_adaptors = NULL;
- free(adaptors);
- adaptors = NULL;
EPHYR_LOG("leave\n");
return is_ok;
}
static Bool
-ephyrXVPrivIsAttrValueValid(KdAttributePtr a_attrs,
+ephyrXVPrivIsAttrValueValid(XvAttributePtr a_attrs,
int a_attrs_len,
const char *a_attr_name,
int a_attr_value, Bool *a_is_valid)
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.c b/xorg-server/hw/kdrive/ephyr/hostx.c
index 435919e0a..1c759743d 100644
--- a/xorg-server/hw/kdrive/ephyr/hostx.c
+++ b/xorg-server/hw/kdrive/ephyr/hostx.c
@@ -287,7 +287,8 @@ hostx_set_title(char *title)
int
hostx_init(void)
{
- uint32_t attr;
+ uint32_t attrs[2];
+ uint32_t attr_mask = 0;
xcb_cursor_t empty_cursor;
xcb_pixmap_t cursor_pxm;
uint16_t red, green, blue;
@@ -299,7 +300,7 @@ hostx_init(void)
const xcb_query_extension_reply_t *shm_rep;
xcb_screen_t *xscreen;
- attr =
+ attrs[0] =
XCB_EVENT_MASK_BUTTON_PRESS
| XCB_EVENT_MASK_BUTTON_RELEASE
| XCB_EVENT_MASK_POINTER_MOTION
@@ -307,6 +308,7 @@ hostx_init(void)
| XCB_EVENT_MASK_KEY_RELEASE
| XCB_EVENT_MASK_EXPOSURE
| XCB_EVENT_MASK_STRUCTURE_NOTIFY;
+ attr_mask |= XCB_CW_EVENT_MASK;
EPHYR_DBG("mark");
#ifdef GLAMOR
@@ -325,9 +327,18 @@ hostx_init(void)
HostX.gc = xcb_generate_id(HostX.conn);
HostX.depth = xscreen->root_depth;
#ifdef GLAMOR
- if (ephyr_glamor)
+ if (ephyr_glamor) {
HostX.visual = ephyr_glamor_get_visual();
- else
+ if (HostX.visual->visual_id != xscreen->root_visual) {
+ attrs[1] = xcb_generate_id(HostX.conn);
+ attr_mask |= XCB_CW_COLORMAP;
+ xcb_create_colormap(HostX.conn,
+ XCB_COLORMAP_ALLOC_NONE,
+ attrs[1],
+ HostX.winroot,
+ HostX.visual->visual_id);
+ }
+ } else
#endif
HostX.visual = xcb_aux_find_visual_by_id(xscreen,xscreen->root_visual);
@@ -379,9 +390,9 @@ hostx_init(void)
scrpriv->win_height,
0,
XCB_WINDOW_CLASS_COPY_FROM_PARENT,
- XCB_COPY_FROM_PARENT,
- XCB_CW_EVENT_MASK,
- &attr);
+ HostX.visual->visual_id,
+ attr_mask,
+ attrs);
}
else {
xcb_create_window(HostX.conn,
@@ -391,9 +402,9 @@ hostx_init(void)
0,0,100,100, /* will resize */
0,
XCB_WINDOW_CLASS_COPY_FROM_PARENT,
- XCB_COPY_FROM_PARENT,
- XCB_CW_EVENT_MASK,
- &attr);
+ HostX.visual->visual_id,
+ attr_mask,
+ attrs);
hostx_set_win_title(screen,
"(ctrl+shift grabs mouse and keyboard)");
@@ -1234,8 +1245,7 @@ ephyr_glamor_init(ScreenPtr screen)
glamor_init(screen,
GLAMOR_USE_SCREEN |
- GLAMOR_USE_PICTURE_SCREEN |
- GLAMOR_INVERTED_Y_AXIS);
+ GLAMOR_USE_PICTURE_SCREEN);
return TRUE;
}
diff --git a/xorg-server/hw/kdrive/src/kdrive.c b/xorg-server/hw/kdrive/src/kdrive.c
index 9814fc66a..b5b91c0dd 100644
--- a/xorg-server/hw/kdrive/src/kdrive.c
+++ b/xorg-server/hw/kdrive/src/kdrive.c
@@ -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
diff --git a/xorg-server/hw/kdrive/src/kdrive.h b/xorg-server/hw/kdrive/src/kdrive.h
index bec75cb6f..08b1681ce 100644
--- a/xorg-server/hw/kdrive/src/kdrive.h
+++ b/xorg-server/hw/kdrive/src/kdrive.h
@@ -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
diff --git a/xorg-server/hw/kdrive/src/kxv.c b/xorg-server/hw/kdrive/src/kxv.c
index 9cc0edd8a..60a83458c 100644
--- a/xorg-server/hw/kdrive/src/kxv.c
+++ b/xorg-server/hw/kdrive/src/kxv.c
@@ -98,7 +98,7 @@ static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
/* misc */
-static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr *, int);
+static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr, int);
static DevPrivateKeyRec KdXVWindowKeyRec;
@@ -116,49 +116,6 @@ static unsigned long PortResource = 0;
#define GET_KDXV_WINDOW(pWin) ((KdXVWindowPtr) \
dixLookupPrivate(&(pWin)->devPrivates, KdXVWindowKey))
-static KdXVInitGenericAdaptorPtr *GenDrivers = NULL;
-static int NumGenDrivers = 0;
-
-int
-KdXVRegisterGenericAdaptorDriver(KdXVInitGenericAdaptorPtr InitFunc)
-{
- KdXVInitGenericAdaptorPtr *newdrivers;
-
-/* fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */
-
- newdrivers = realloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) *
- (1 + NumGenDrivers));
- if (!newdrivers)
- return 0;
- GenDrivers = newdrivers;
-
- GenDrivers[NumGenDrivers++] = InitFunc;
-
- return 1;
-}
-
-int
-KdXVListGenericAdaptors(KdScreenInfo * screen, KdVideoAdaptorPtr ** adaptors)
-{
- int i, j, n, num;
- KdVideoAdaptorPtr *DrivAdap, *new;
-
- num = 0;
- *adaptors = NULL;
- for (i = 0; i < NumGenDrivers; i++) {
- n = GenDrivers[i] (screen, &DrivAdap);
- if (0 == n)
- continue;
- new = realloc(*adaptors, sizeof(KdVideoAdaptorPtr) * (num + n));
- if (NULL == new)
- continue;
- *adaptors = new;
- for (j = 0; j < n; j++, num++)
- (*adaptors)[num] = DrivAdap[j];
- }
- return num;
-}
-
KdVideoAdaptorPtr
KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen)
{
@@ -172,7 +129,7 @@ KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr)
}
Bool
-KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr * adaptors, int num)
+KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
{
KdXVScreenPtr ScreenPriv;
XvScreenPtr pxvs;
@@ -282,7 +239,7 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
}
static Bool
-KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
+KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr infoPtr, int number)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
@@ -295,15 +252,11 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
XvPortRecPrivatePtr portPriv;
XvPortPtr pPort, pp;
int numPort;
- KdAttributePtr attributePtr;
- XvAttributePtr pAttribute, pat;
KdVideoFormatPtr formatPtr;
XvFormatPtr pFormat, pf;
int numFormat, totFormat;
KdVideoEncodingPtr encodingPtr;
XvEncodingPtr pEncode, pe;
- KdImagePtr imagePtr;
- XvImagePtr pImage, pi;
int numVisuals;
VisualPtr pVisual;
int i;
@@ -315,7 +268,7 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
return FALSE;
for (pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
- adaptorPtr = infoPtr[na];
+ adaptorPtr = &infoPtr[na];
if (!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
!adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize)
@@ -381,26 +334,24 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
}
if (adaptorPtr->nImages &&
- (pImage = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
-
- for (i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
- i < adaptorPtr->nImages; i++, pi++, imagePtr++) {
- memcpy(pi, imagePtr, sizeof(*pi));
- }
+ (pa->pImages = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
+ memcpy(pa->pImages, adaptorPtr->pImages,
+ adaptorPtr->nImages * sizeof(XvImageRec));
pa->nImages = adaptorPtr->nImages;
- pa->pImages = pImage;
}
if (adaptorPtr->nAttributes &&
- (pAttribute =
- calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) {
- for (pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i =
- 0; i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) {
- memcpy(pat, attributePtr, sizeof(*pat));
- pat->name = strdup(attributePtr->name);
+ (pa->pAttributes = calloc(adaptorPtr->nAttributes,
+ sizeof(XvAttributeRec)))) {
+ memcpy(pa->pAttributes, adaptorPtr->pAttributes,
+ adaptorPtr->nAttributes * sizeof(XvAttributeRec));
+
+ for (i = 0; i < adaptorPtr->nAttributes; i++) {
+ pa->pAttributes[i].name =
+ strdup(adaptorPtr->pAttributes[i].name);
}
+
pa->nAttributes = adaptorPtr->nAttributes;
- pa->pAttributes = pAttribute;
}
totFormat = adaptorPtr->nFormats;
diff --git a/xorg-server/hw/kdrive/src/kxv.h b/xorg-server/hw/kdrive/src/kxv.h
index 85a030ee9..3a49a659f 100644
--- a/xorg-server/hw/kdrive/src/kxv.h
+++ b/xorg-server/hw/kdrive/src/kxv.h
@@ -56,8 +56,6 @@ of the copyright holder.
#define VIDEO_OVERLAID_STILLS 0x00000008
#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
-typedef XvImageRec KdImageRec, *KdImagePtr;
-
typedef struct {
KdScreenInfo *screen;
int id;
@@ -121,7 +119,7 @@ typedef enum {
typedef struct {
int id;
- char *name;
+ const char *name;
unsigned short width, height;
XvRationalRec rate;
} KdVideoEncodingRec, *KdVideoEncodingPtr;
@@ -131,12 +129,10 @@ typedef struct {
short class;
} KdVideoFormatRec, *KdVideoFormatPtr;
-typedef XvAttributeRec KdAttributeRec, *KdAttributePtr;
-
typedef struct {
unsigned int type;
int flags;
- char *name;
+ const char *name;
int nEncodings;
KdVideoEncodingPtr pEncodings;
int nFormats;
@@ -144,9 +140,9 @@ typedef struct {
int nPorts;
DevUnion *pPortPrivates;
int nAttributes;
- KdAttributePtr pAttributes;
+ XvAttributePtr pAttributes;
int nImages;
- KdImagePtr pImages;
+ XvImagePtr pImages;
PutVideoFuncPtr PutVideo;
PutStillFuncPtr PutStill;
GetVideoFuncPtr GetVideo;
@@ -161,16 +157,7 @@ typedef struct {
} KdVideoAdaptorRec, *KdVideoAdaptorPtr;
Bool
- KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr * Adaptors, int num);
-
-typedef int (*KdXVInitGenericAdaptorPtr) (KdScreenInfo * screen,
- KdVideoAdaptorPtr ** Adaptors);
-
-int
- KdXVRegisterGenericAdaptorDriver(KdXVInitGenericAdaptorPtr InitFunc);
-
-int
- KdXVListGenericAdaptors(KdScreenInfo * screen, KdVideoAdaptorPtr ** Adaptors);
+ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr Adaptors, int num);
void
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index 481674de2..779ba6f7c 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -103,7 +103,7 @@
"/etc/X11/%X," "%C/X11/%X"
#endif
#ifndef SYS_CONFIGDIRPATH
-#define SYS_CONFIGDIRPATH "/usr/share/X11/%X," "%D/X11/%X"
+#define SYS_CONFIGDIRPATH "%D/X11/%X"
#endif
#ifndef PROJECTROOT
#define PROJECTROOT "/usr/X11R6"
diff --git a/xorg-server/hw/xfree86/common/xf86DPMS.c b/xorg-server/hw/xfree86/common/xf86DPMS.c
index 14d1f4545..2b5a3ed1e 100644
--- a/xorg-server/hw/xfree86/common/xf86DPMS.c
+++ b/xorg-server/hw/xfree86/common/xf86DPMS.c
@@ -166,7 +166,7 @@ DPMSSet(ClientPtr client, int level)
return rc;
}
} else if (!xf86IsUnblank(screenIsSaved)) {
- rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverReset);
+ rc = dixSaveScreens(client, SCREEN_SAVER_OFF, ScreenSaverReset);
if (rc != Success)
return rc;
}
diff --git a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
index ec21bc2f2..b832c9a5f 100644
--- a/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/xorg-server/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -49,10 +49,14 @@
#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x
-#define SCREEN_PROLOG(x) pScreen->x = ((VGAarbiterScreenPtr) \
- dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))->x
+#define SCREEN_PRIV() ((VGAarbiterScreenPtr) dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))
-#define SCREEN_EPILOG(x,y) pScreen->x = y;
+#define SCREEN_PROLOG(x) (pScreen->x = SCREEN_PRIV()->x)
+
+#define SCREEN_EPILOG(x,y) do { \
+ SCREEN_PRIV()->x = pScreen->x; \
+ pScreen->x = y; \
+ } while (0)
#define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\
ps->x = y;}
diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.c b/xorg-server/hw/xfree86/common/xf86platformBus.c
index eb1a3fb5d..22e4603e6 100644
--- a/xorg-server/hw/xfree86/common/xf86platformBus.c
+++ b/xorg-server/hw/xfree86/common/xf86platformBus.c
@@ -77,7 +77,7 @@ xf86_remove_platform_device(int dev_index)
{
int j;
- config_odev_free_attribute_list(xf86_platform_devices[dev_index].attribs);
+ config_odev_free_attributes(xf86_platform_devices[dev_index].attribs);
for (j = dev_index; j < xf86_num_platform_devices - 1; j++)
memcpy(&xf86_platform_devices[j], &xf86_platform_devices[j + 1], sizeof(struct xf86_platform_device));
@@ -86,44 +86,6 @@ xf86_remove_platform_device(int dev_index)
}
Bool
-xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_name)
-{
- struct xf86_platform_device *device = &xf86_platform_devices[index];
-
- return config_odev_add_attribute(device->attribs, attrib_id, attrib_name);
-}
-
-Bool
-xf86_add_platform_device_int_attrib(int index, int attrib_id, int attrib_value)
-{
- return config_odev_add_int_attribute(xf86_platform_devices[index].attribs, attrib_id, attrib_value);
-}
-
-char *
-xf86_get_platform_attrib(int index, int attrib_id)
-{
- return config_odev_get_attribute(xf86_platform_devices[index].attribs, attrib_id);
-}
-
-char *
-xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_id)
-{
- return config_odev_get_attribute(device->attribs, attrib_id);
-}
-
-int
-xf86_get_platform_int_attrib(int index, int attrib_id, int def)
-{
- return config_odev_get_int_attribute(xf86_platform_devices[index].attribs, attrib_id, def);
-}
-
-int
-xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib_id, int def)
-{
- return config_odev_get_int_attribute(device->attribs, attrib_id, def);
-}
-
-Bool
xf86_get_platform_device_unowned(int index)
{
return (xf86_platform_devices[index].flags & XF86_PDEV_UNOWNED) ?
@@ -136,8 +98,8 @@ xf86_find_platform_device_by_devnum(int major, int minor)
int i, attr_major, attr_minor;
for (i = 0; i < xf86_num_platform_devices; i++) {
- attr_major = xf86_get_platform_int_attrib(i, ODEV_ATTRIB_MAJOR, 0);
- attr_minor = xf86_get_platform_int_attrib(i, ODEV_ATTRIB_MINOR, 0);
+ attr_major = xf86_platform_odev_attributes(i)->major;
+ attr_minor = xf86_platform_odev_attributes(i)->minor;
if (attr_major == major && attr_minor == minor)
return &xf86_platform_devices[i];
}
@@ -240,7 +202,7 @@ MatchToken(const char *value, struct xorg_list *patterns,
static Bool
OutputClassMatches(const XF86ConfOutputClassPtr oclass, int index)
{
- char *driver = xf86_get_platform_attrib(index, ODEV_ATTRIB_DRIVER);
+ char *driver = xf86_platform_odev_attributes(index)->driver;
if (!MatchToken(driver, &oclass->match_driver, strcmp))
return FALSE;
@@ -259,7 +221,7 @@ xf86OutputClassDriverList(int index, char *matches[], int nmatches)
for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
if (OutputClassMatches(cl, index)) {
- char *path = xf86_get_platform_attrib(index, ODEV_ATTRIB_PATH);
+ char *path = xf86_platform_odev_attributes(index)->path;
xf86Msg(X_INFO, "Applying OutputClass \"%s\" to %s\n",
cl->identifier, path);
@@ -324,7 +286,7 @@ xf86platformProbe(void)
}
for (i = 0; i < xf86_num_platform_devices; i++) {
- char *busid = xf86_get_platform_attrib(i, ODEV_ATTRIB_BUSID);
+ char *busid = xf86_platform_odev_attributes(i)->busid;
if (pci && (strncmp(busid, "pci:", 4) == 0)) {
platform_find_pci_info(&xf86_platform_devices[i], busid);
@@ -412,11 +374,11 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
if (entity != -1) {
if ((dev->flags & XF86_PDEV_SERVER_FD) && (!drvp->driverFunc ||
!drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL))) {
- fd = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_FD, -1);
- major = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MAJOR, 0);
- minor = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MINOR, 0);
+ fd = dev->attribs->fd;
+ major = dev->attribs->major;
+ minor = dev->attribs->minor;
systemd_logind_release_fd(major, minor, fd);
- config_odev_add_int_attribute(dev->attribs, ODEV_ATTRIB_FD, -1);
+ dev->attribs->fd = -1;
dev->flags &= ~XF86_PDEV_SERVER_FD;
}
diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.h b/xorg-server/hw/xfree86/common/xf86platformBus.h
index 5dee4e0e0..317dd24d5 100644
--- a/xorg-server/hw/xfree86/common/xf86platformBus.h
+++ b/xorg-server/hw/xfree86/common/xf86platformBus.h
@@ -45,31 +45,109 @@ int xf86platformProbeDev(DriverPtr drvp);
extern int xf86_num_platform_devices;
extern struct xf86_platform_device *xf86_platform_devices;
-extern char *
-xf86_get_platform_attrib(int index, int attrib_id);
-extern int
-xf86_get_platform_int_attrib(int index, int attrib_id, int def);
extern int
xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned);
extern int
xf86_remove_platform_device(int dev_index);
extern Bool
xf86_get_platform_device_unowned(int index);
-/* Note starting with xserver 1.16 these 2 functions never fail */
-extern Bool
-xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_str);
-extern Bool
-xf86_add_platform_device_int_attrib(int index, int attrib_id, int attrib_value);
extern int
xf86platformAddDevice(int index);
extern void
xf86platformRemoveDevice(int index);
-extern _X_EXPORT char *
-xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_id);
-extern _X_EXPORT int
-xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib_id, int def);
+static inline struct OdevAttributes *
+xf86_platform_device_odev_attributes(struct xf86_platform_device *device)
+{
+ return device->attribs;
+}
+
+static inline struct OdevAttributes *
+xf86_platform_odev_attributes(int index)
+{
+ struct xf86_platform_device *device = &xf86_platform_devices[index];
+
+ return device->attribs;
+}
+
+#ifndef _XORG_CONFIG_H_
+/*
+ * Define the legacy API only for external builds
+ */
+
+/* path to kernel device node - Linux e.g. /dev/dri/card0 */
+#define ODEV_ATTRIB_PATH 1
+/* system device path - Linux e.g. /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 */
+#define ODEV_ATTRIB_SYSPATH 2
+/* DRI-style bus id */
+#define ODEV_ATTRIB_BUSID 3
+/* Server managed FD */
+#define ODEV_ATTRIB_FD 4
+/* Major number of the device node pointed to by ODEV_ATTRIB_PATH */
+#define ODEV_ATTRIB_MAJOR 5
+/* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */
+#define ODEV_ATTRIB_MINOR 6
+/* kernel driver name */
+#define ODEV_ATTRIB_DRIVER 7
+
+/* Protect against a mismatch attribute type by generating a compiler
+ * error using a negative array size when an incorrect attribute is
+ * passed
+ */
+
+#define _ODEV_ATTRIB_IS_STRING(x) ((x) == ODEV_ATTRIB_PATH || \
+ (x) == ODEV_ATTRIB_SYSPATH || \
+ (x) == ODEV_ATTRIB_BUSID || \
+ (x) == ODEV_ATTRIB_DRIVER)
+
+#define _ODEV_ATTRIB_STRING_CHECK(x) ((int (*)[_ODEV_ATTRIB_IS_STRING(x)-1]) 0)
+
+static inline char *
+_xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0])
+{
+ switch (attrib) {
+ case ODEV_ATTRIB_PATH:
+ return xf86_platform_device_odev_attributes(device)->path;
+ case ODEV_ATTRIB_SYSPATH:
+ return xf86_platform_device_odev_attributes(device)->syspath;
+ case ODEV_ATTRIB_BUSID:
+ return xf86_platform_device_odev_attributes(device)->busid;
+ case ODEV_ATTRIB_DRIVER:
+ return xf86_platform_device_odev_attributes(device)->driver;
+ default:
+ assert(FALSE);
+ return NULL;
+ }
+}
+
+#define xf86_get_platform_device_attrib(device, attrib) _xf86_get_platform_device_attrib(device,attrib,_ODEV_ATTRIB_STRING_CHECK(attrib))
+
+#define _ODEV_ATTRIB_IS_INT(x) ((x) == ODEV_ATTRIB_FD || (x) == ODEV_ATTRIB_MAJOR || (x) == ODEV_ATTRIB_MINOR)
+#define _ODEV_ATTRIB_INT_DEFAULT(x) ((x) == ODEV_ATTRIB_FD ? -1 : 0)
+#define _ODEV_ATTRIB_DEFAULT_CHECK(x,def) (_ODEV_ATTRIB_INT_DEFAULT(x) == (def))
+#define _ODEV_ATTRIB_INT_CHECK(x,def) ((int (*)[_ODEV_ATTRIB_IS_INT(x)*_ODEV_ATTRIB_DEFAULT_CHECK(x,def)-1]) 0)
+
+static inline int
+_xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0])
+{
+ switch (attrib) {
+ case ODEV_ATTRIB_FD:
+ return xf86_platform_device_odev_attributes(device)->fd;
+ case ODEV_ATTRIB_MAJOR:
+ return xf86_platform_device_odev_attributes(device)->major;
+ case ODEV_ATTRIB_MINOR:
+ return xf86_platform_device_odev_attributes(device)->minor;
+ default:
+ assert(FALSE);
+ return 0;
+ }
+}
+
+#define xf86_get_platform_device_int_attrib(device, attrib, def) _xf86_get_platform_device_int_attrib(device,attrib,_ODEV_ATTRIB_INT_CHECK(attrib,def))
+
+#endif
+
extern _X_EXPORT Bool
xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid);
diff --git a/xorg-server/hw/xfree86/common/xf86xv.c b/xorg-server/hw/xfree86/common/xf86xv.c
index b16cb5df3..e212a7387 100644
--- a/xorg-server/hw/xfree86/common/xf86xv.c
+++ b/xorg-server/hw/xfree86/common/xf86xv.c
@@ -359,15 +359,11 @@ xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number)
XvPortRecPrivatePtr portPriv;
XvPortPtr pPort, pp;
int numPort;
- XF86AttributePtr attributePtr;
- XvAttributePtr pAttribute, pat;
XF86VideoFormatPtr formatPtr;
XvFormatPtr pFormat, pf;
int numFormat, totFormat;
XF86VideoEncodingPtr encodingPtr;
XvEncodingPtr pEncode, pe;
- XF86ImagePtr imagePtr;
- XvImagePtr pImage, pi;
int numVisuals;
VisualPtr pVisual;
int i;
@@ -445,49 +441,24 @@ xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number)
}
if (adaptorPtr->nImages &&
- (pImage = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
-
- for (i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
- i < adaptorPtr->nImages; i++, pi++, imagePtr++) {
- pi->id = imagePtr->id;
- pi->type = imagePtr->type;
- pi->byte_order = imagePtr->byte_order;
- memcpy(pi->guid, imagePtr->guid, 16);
- pi->bits_per_pixel = imagePtr->bits_per_pixel;
- pi->format = imagePtr->format;
- pi->num_planes = imagePtr->num_planes;
- pi->depth = imagePtr->depth;
- pi->red_mask = imagePtr->red_mask;
- pi->green_mask = imagePtr->green_mask;
- pi->blue_mask = imagePtr->blue_mask;
- pi->y_sample_bits = imagePtr->y_sample_bits;
- pi->u_sample_bits = imagePtr->u_sample_bits;
- pi->v_sample_bits = imagePtr->v_sample_bits;
- pi->horz_y_period = imagePtr->horz_y_period;
- pi->horz_u_period = imagePtr->horz_u_period;
- pi->horz_v_period = imagePtr->horz_v_period;
- pi->vert_y_period = imagePtr->vert_y_period;
- pi->vert_u_period = imagePtr->vert_u_period;
- pi->vert_v_period = imagePtr->vert_v_period;
- memcpy(pi->component_order, imagePtr->component_order, 32);
- pi->scanline_order = imagePtr->scanline_order;
- }
+ (pa->pImages = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
+ memcpy(pa->pImages, adaptorPtr->pImages,
+ adaptorPtr->nImages * sizeof(XvImageRec));
pa->nImages = adaptorPtr->nImages;
- pa->pImages = pImage;
}
if (adaptorPtr->nAttributes &&
- (pAttribute =
- calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) {
- for (pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i =
- 0; i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) {
- pat->flags = attributePtr->flags;
- pat->min_value = attributePtr->min_value;
- pat->max_value = attributePtr->max_value;
- pat->name = strdup(attributePtr->name);
+ (pa->pAttributes = calloc(adaptorPtr->nAttributes,
+ sizeof(XvAttributeRec)))) {
+ memcpy(pa->pAttributes, adaptorPtr->pAttributes,
+ adaptorPtr->nAttributes * sizeof(XvAttributeRec));
+
+ for (i = 0; i < adaptorPtr->nAttributes; i++) {
+ pa->pAttributes[i].name =
+ strdup(adaptorPtr->pAttributes[i].name);
}
+
pa->nAttributes = adaptorPtr->nAttributes;
- pa->pAttributes = pAttribute;
}
totFormat = adaptorPtr->nFormats;
diff --git a/xorg-server/hw/xfree86/common/xf86xv.h b/xorg-server/hw/xfree86/common/xf86xv.h
index 8986e2e57..de17eb133 100644
--- a/xorg-server/hw/xfree86/common/xf86xv.h
+++ b/xorg-server/hw/xfree86/common/xf86xv.h
@@ -42,34 +42,7 @@
*/
#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
-typedef struct {
- int id;
- int type;
- int byte_order;
- unsigned char guid[16];
- int bits_per_pixel;
- int format;
- int num_planes;
-
- /* for RGB formats only */
- int depth;
- unsigned int red_mask;
- unsigned int green_mask;
- unsigned int blue_mask;
-
- /* for YUV formats only */
- unsigned int y_sample_bits;
- unsigned int u_sample_bits;
- unsigned int v_sample_bits;
- unsigned int horz_y_period;
- unsigned int horz_u_period;
- unsigned int horz_v_period;
- unsigned int vert_y_period;
- unsigned int vert_u_period;
- unsigned int vert_v_period;
- char component_order[32];
- int scanline_order;
-} XF86ImageRec, *XF86ImagePtr;
+typedef XvImageRec XF86ImageRec, *XF86ImagePtr;
typedef struct {
ScrnInfoPtr pScrn;
@@ -147,12 +120,7 @@ typedef struct {
short class;
} XF86VideoFormatRec, *XF86VideoFormatPtr;
-typedef struct {
- int flags;
- int min_value;
- int max_value;
- const char *name;
-} XF86AttributeRec, *XF86AttributePtr;
+typedef XvAttributeRec XF86AttributeRec, *XF86AttributePtr;
typedef struct {
unsigned int type;
diff --git a/xorg-server/hw/xfree86/glamor_egl/Makefile.am b/xorg-server/hw/xfree86/glamor_egl/Makefile.am
index 85e1c0c06..e697c8296 100644
--- a/xorg-server/hw/xfree86/glamor_egl/Makefile.am
+++ b/xorg-server/hw/xfree86/glamor_egl/Makefile.am
@@ -24,7 +24,7 @@ module_LTLIBRARIES = libglamoregl.la
libglamoregl_la_SOURCES = \
$(top_srcdir)/glamor/glamor_egl.c \
$(top_srcdir)/glamor/glamor_eglmodule.c \
- $(top_srcdir)/glamor/glamor_xv.c \
+ glamor_xf86_xv.c \
$()
libglamoregl_la_LDFLAGS = \
@@ -38,6 +38,7 @@ libglamoregl_la_LIBADD = \
AM_CPPFLAGS = $(XORG_INCS) \
-I$(top_srcdir)/dri3 \
+ -I$(top_srcdir)/glamor \
$()
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(GLAMOR_CFLAGS) $(GBM_CFLAGS)
diff --git a/xorg-server/hw/xfree86/glamor_egl/glamor_xf86_xv.c b/xorg-server/hw/xfree86/glamor_egl/glamor_xf86_xv.c
new file mode 100644
index 000000000..8535fa0c9
--- /dev/null
+++ b/xorg-server/hw/xfree86/glamor_egl/glamor_xf86_xv.c
@@ -0,0 +1,185 @@
+/*
+ * Copyright © 2013 Red Hat
+ *
+ * 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 (including the next
+ * paragraph) 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.
+ *
+ * Authors:
+ * Dave Airlie <airlied@redhat.com>
+ *
+ * some code is derived from the xf86-video-ati radeon driver, mainly
+ * the calculations.
+ */
+
+/** @file glamor_xf86_xv.c
+ *
+ * This implements the XF86 XV interface, and calls into glamor core
+ * for its support of the suspiciously similar XF86 and Kdrive
+ * device-dependent XV interfaces.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#define GLAMOR_FOR_XORG
+#include "glamor_priv.h"
+
+#include <X11/extensions/Xv.h>
+#include "fourcc.h"
+
+#define NUM_FORMATS 3
+
+static XF86VideoFormatRec Formats[NUM_FORMATS] = {
+ {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
+};
+
+static void
+glamor_xf86_xv_stop_video(ScrnInfoPtr pScrn, void *data, Bool cleanup)
+{
+ if (!cleanup)
+ return;
+
+ glamor_xv_stop_video(data);
+}
+
+static int
+glamor_xf86_xv_set_port_attribute(ScrnInfoPtr pScrn,
+ Atom attribute, INT32 value, void *data)
+{
+ return glamor_xv_set_port_attribute(data, attribute, value);
+}
+
+static int
+glamor_xf86_xv_get_port_attribute(ScrnInfoPtr pScrn,
+ Atom attribute, INT32 *value, void *data)
+{
+ return glamor_xv_get_port_attribute(data, attribute, value);
+}
+
+static void
+glamor_xf86_xv_query_best_size(ScrnInfoPtr pScrn,
+ Bool motion,
+ short vid_w, short vid_h,
+ short drw_w, short drw_h,
+ unsigned int *p_w, unsigned int *p_h, void *data)
+{
+ *p_w = drw_w;
+ *p_h = drw_h;
+}
+
+static int
+glamor_xf86_xv_query_image_attributes(ScrnInfoPtr pScrn,
+ int id,
+ unsigned short *w, unsigned short *h,
+ int *pitches, int *offsets)
+{
+ return glamor_xv_query_image_attributes(id, w, h, pitches, offsets);
+}
+
+static int
+glamor_xf86_xv_put_image(ScrnInfoPtr pScrn,
+ short src_x, short src_y,
+ short drw_x, short drw_y,
+ short src_w, short src_h,
+ short drw_w, short drw_h,
+ int id,
+ unsigned char *buf,
+ short width,
+ short height,
+ Bool sync,
+ RegionPtr clipBoxes, void *data, DrawablePtr pDrawable)
+{
+ return glamor_xv_put_image(data, pDrawable,
+ src_x, src_y,
+ drw_x, drw_y,
+ src_w, src_h,
+ drw_w, drw_h,
+ id, buf, width, height, sync, clipBoxes);
+}
+
+static XF86VideoEncodingRec DummyEncodingGLAMOR[1] = {
+ {
+ 0,
+ "XV_IMAGE",
+ 8192, 8192,
+ {1, 1}
+ }
+};
+
+XF86VideoAdaptorPtr
+glamor_xv_init(ScreenPtr screen, int num_texture_ports)
+{
+ glamor_port_private *port_priv;
+ XF86VideoAdaptorPtr adapt;
+ int i;
+
+ glamor_xv_core_init(screen);
+
+ adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + num_texture_ports *
+ (sizeof(glamor_port_private) + sizeof(DevUnion)));
+ if (adapt == NULL)
+ return NULL;
+
+ adapt->type = XvWindowMask | XvInputMask | XvImageMask;
+ adapt->flags = 0;
+ adapt->name = "GLAMOR Textured Video";
+ adapt->nEncodings = 1;
+ adapt->pEncodings = DummyEncodingGLAMOR;
+
+ adapt->nFormats = NUM_FORMATS;
+ adapt->pFormats = Formats;
+ adapt->nPorts = num_texture_ports;
+ adapt->pPortPrivates = (DevUnion *) (&adapt[1]);
+
+ adapt->pAttributes = glamor_xv_attributes;
+ adapt->nAttributes = glamor_xv_num_attributes;
+
+ port_priv =
+ (glamor_port_private *) (&adapt->pPortPrivates[num_texture_ports]);
+ adapt->pImages = glamor_xv_images;
+ adapt->nImages = glamor_xv_num_images;
+ adapt->PutVideo = NULL;
+ adapt->PutStill = NULL;
+ adapt->GetVideo = NULL;
+ adapt->GetStill = NULL;
+ adapt->StopVideo = glamor_xf86_xv_stop_video;
+ adapt->SetPortAttribute = glamor_xf86_xv_set_port_attribute;
+ adapt->GetPortAttribute = glamor_xf86_xv_get_port_attribute;
+ adapt->QueryBestSize = glamor_xf86_xv_query_best_size;
+ adapt->PutImage = glamor_xf86_xv_put_image;
+ adapt->ReputImage = NULL;
+ adapt->QueryImageAttributes = glamor_xf86_xv_query_image_attributes;
+
+ for (i = 0; i < num_texture_ports; i++) {
+ glamor_port_private *pPriv = &port_priv[i];
+
+ pPriv->brightness = 0;
+ pPriv->contrast = 0;
+ pPriv->saturation = 0;
+ pPriv->hue = 0;
+ pPriv->gamma = 1000;
+ pPriv->transform_index = 0;
+
+ REGION_NULL(pScreen, &pPriv->clip);
+
+ adapt->pPortPrivates[i].ptr = (void *) (pPriv);
+ }
+ return adapt;
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86Rotate.c b/xorg-server/hw/xfree86/modes/xf86Rotate.c
index 0ddd8408e..1627e61dd 100644
--- a/xorg-server/hw/xfree86/modes/xf86Rotate.c
+++ b/xorg-server/hw/xfree86/modes/xf86Rotate.c
@@ -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
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_platform.c b/xorg-server/hw/xfree86/os-support/linux/lnx_platform.c
index d660761c5..1d145b362 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_platform.c
@@ -30,8 +30,8 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
int err = 0;
Bool paused, server_fd = FALSE;
- major = config_odev_get_int_attribute(attribs, ODEV_ATTRIB_MAJOR, 0);
- minor = config_odev_get_int_attribute(attribs, ODEV_ATTRIB_MINOR, 0);
+ major = attribs->major;
+ minor = attribs->minor;
fd = systemd_logind_take_fd(major, minor, path, &paused);
if (fd != -1) {
@@ -41,7 +41,7 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
systemd_logind_release_fd(major, minor, -1);
return FALSE;
}
- config_odev_add_int_attribute(attribs, ODEV_ATTRIB_FD, fd);
+ attribs->fd = fd;
server_fd = TRUE;
}
@@ -73,8 +73,7 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
xf86_platform_devices[delayed_index].flags |= XF86_PDEV_SERVER_FD;
buf = drmGetBusid(fd);
- xf86_add_platform_device_attrib(delayed_index,
- ODEV_ATTRIB_BUSID, buf);
+ xf86_platform_odev_attributes(delayed_index)->busid = XNFstrdup(buf);
drmFreeBusid(buf);
v = drmGetVersion(fd);
@@ -83,8 +82,7 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
goto out;
}
- xf86_add_platform_device_attrib(delayed_index, ODEV_ATTRIB_DRIVER,
- v->name);
+ xf86_platform_odev_attributes(delayed_index)->driver = XNFstrdup(v->name);
drmFreeVersion(v);
out:
@@ -96,16 +94,9 @@ out:
Bool
xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid)
{
- struct OdevAttribute *attrib;
- const char *syspath = NULL;
+ const char *syspath = device->attribs->syspath;
BusType bustype;
const char *id;
- xorg_list_for_each_entry(attrib, &device->attribs->list, member) {
- if (attrib->attrib_id == ODEV_ATTRIB_SYSPATH) {
- syspath = attrib->attrib_name;
- break;
- }
- }
if (!syspath)
return FALSE;
@@ -138,8 +129,7 @@ void
xf86PlatformReprobeDevice(int index, struct OdevAttributes *attribs)
{
Bool ret;
- char *dpath;
- dpath = xf86_get_platform_attrib(index, ODEV_ATTRIB_PATH);
+ char *dpath = attribs->path;
ret = get_drm_info(attribs, dpath, index);
if (ret == FALSE) {
@@ -155,18 +145,16 @@ void
xf86PlatformDeviceProbe(struct OdevAttributes *attribs)
{
int i;
- char *path = NULL;
+ char *path = attribs->path;
Bool ret;
- path = config_odev_get_attribute(attribs, ODEV_ATTRIB_PATH);
if (!path)
goto out_free;
for (i = 0; i < xf86_num_platform_devices; i++) {
- char *dpath;
- dpath = xf86_get_platform_attrib(i, ODEV_ATTRIB_PATH);
+ char *dpath = xf86_platform_odev_attributes(i)->path;
- if (!strcmp(path, dpath))
+ if (dpath && !strcmp(path, dpath))
break;
}
@@ -189,7 +177,7 @@ xf86PlatformDeviceProbe(struct OdevAttributes *attribs)
return;
out_free:
- config_odev_free_attribute_list(attribs);
+ config_odev_free_attributes(attribs);
}
void NewGPUDeviceRequest(struct OdevAttributes *attribs)
@@ -214,21 +202,15 @@ void NewGPUDeviceRequest(struct OdevAttributes *attribs)
void DeleteGPUDeviceRequest(struct OdevAttributes *attribs)
{
- struct OdevAttribute *attrib;
int index;
- char *syspath = NULL;
+ char *syspath = attribs->syspath;
- xorg_list_for_each_entry(attrib, &attribs->list, member) {
- if (attrib->attrib_id == ODEV_ATTRIB_SYSPATH) {
- syspath = attrib->attrib_name;
- break;
- }
- }
+ if (!syspath)
+ goto out;
for (index = 0; index < xf86_num_platform_devices; index++) {
- char *dspath;
- dspath = xf86_get_platform_attrib(index, ODEV_ATTRIB_SYSPATH);
- if (!strcmp(syspath, dspath))
+ char *dspath = xf86_platform_odev_attributes(index)->syspath;
+ if (dspath && !strcmp(syspath, dspath))
break;
}
@@ -242,7 +224,7 @@ void DeleteGPUDeviceRequest(struct OdevAttributes *attribs)
else
xf86platformRemoveDevice(index);
out:
- config_odev_free_attribute_list(attribs);
+ config_odev_free_attributes(attribs);
}
#endif