patch for Bug 103722

2017-11-14 Thread John Lumby

--- xserver/hw/xfree86/modes/xf86EdidModes.c.orig   2017-09-24 
18:29:54.582068856 -0400
+++ xserver/hw/xfree86/modes/xf86EdidModes.c2017-11-13 12:06:11.843310650 
-0500
@@ -1203,7 +1203,10 @@ xf86EdidMonitorSet(int scrnIndex, MonPtr
 Monitor->Modes = Modes;
 }
 
-xf86PruneDuplicateModes(Monitor->Modes);
+/* xf86PruneDuplicateModes may delete any item in the list including 
the first,
+ * but always returns pointer to new start of list
+ */
+Monitor->Modes = xf86PruneDuplicateModes(Monitor->Modes);
 
 /* Update pointer to last mode */
 for (Mode = Monitor->Modes; Mode && Mode->next; Mode = Mode->next) {}
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] glamor: Drop the non-VAO rendering path

2017-11-14 Thread Eric Anholt
Adam Jackson  writes:

> GLES spells this extension as GL_OES_vertex_array_object, but it is
> functionally equivalent to the GL_ARB version. Mesa has supported both
> since 9.0, let's go ahead and require it.

Excellent.  Now to just start using VAOs as they're actually
intended

Reviewed-by: Eric Anholt 


signature.asc
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] glx: Only flush indirect contexts in MakeCurrent (v2)

2017-11-14 Thread Adam Jackson
If the context is direct none of the GL commands were issued by this
process, the server couldn't flush them even if it wanted to.

v2: Fix embarassingly obvious boolean inversion (Michel Dänzer)

Signed-off-by: Adam Jackson 
---
 glx/glxcmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 241abc6a58..061acb7930 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -626,7 +626,7 @@ DoMakeCurrent(__GLXclientState * cl,
 /*
  ** Flush the previous context if needed.
  */
-Bool need_flush = GL_TRUE;
+Bool need_flush = !prevglxc->isDirect;
 #ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB
 if (prevglxc->releaseBehavior == GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB)
 need_flush = GL_FALSE;
-- 
2.14.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver] edid: fix off-by-one error in CEA mode numbering

2017-11-14 Thread Adam Jackson
On Wed, 2017-11-15 at 03:12 +0900, Hector Martin wrote:
> The CEA extension short video descriptors contain the VIC, which starts
> at 1, not 0.
> 
> Signed-off-by: Hector Martin 

Matches Linux's drm_edid.c, nice catch. Merged, thanks:

remote: I: patch #188251 updated using rev 
68556d74b49e99d3490166c446079f7d5de26ca4.
remote: I: 1 patch(es) updated to state Accepted.
To ssh://git.freedesktop.org/git/xorg/xserver
   9bd5a198dc..68556d74b4  master -> master

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 3/4] animcur: Run the timer from the device, not the screen

2017-11-14 Thread Adam Jackson
On Tue, 2017-11-14 at 10:42 -0800, Keith Packard wrote:
> Adam Jackson  writes:
> 
> > You added that comment when you added XFIXES to XFree86, presumably you
> > know what it means better than I do.
> 
> Never mind -- the original version of the code had the assignment to the
> local DisplayCursor variable below the comment while you've moved it up
> to the declaration. I had thought that 'DisplayCursor' was a global
> function somehow.
> 
> I'm just confused.

Yeah, sorry about that, my reformatting instinct is a little too strong
sometimes. I actually had the same confusion when I went back to look
where that code originated, thinking that local assignment had been
deleted somewhere.

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 0/3] Implement GLX_EXT_no_config_context

2017-11-14 Thread Adam Jackson
The big change from last time is actually handling MakeCurrent requests
sanely: if the context has no config and we make a bare Window current,
we look up the appropriate fbconfig and remember it in the GLX drawable
state. Otherwise this is all the same as before.

- ajax

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 2/3] glx: Prepare __glXGetDrawable for no-config contexts

2017-11-14 Thread Adam Jackson
Any proper (GLX 1.3) drawable will already have a bound config, but if
we're doing the GLX 1.2 thing of making a Window current, we need to
infer the config from the window's Visual.

Signed-off-by: Adam Jackson 
---
 glx/glxcmds.c | 46 +++---
 1 file changed, 39 insertions(+), 7 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 8681ef13f..2f011889c 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -474,6 +474,18 @@ StartUsingContext(__GLXclientState * cl, __GLXcontext * 
glxc)
 glxc->currentClient = cl->client;
 }
 
+static __GLXconfig *
+inferConfigForWindow(__GLXscreen *pGlxScreen, WindowPtr pWin)
+{
+int i, vid = wVisual(pWin);
+
+for (i = 0; i < pGlxScreen->numVisuals; i++)
+if (pGlxScreen->visuals[i]->visualID == vid)
+return pGlxScreen->visuals[i];
+
+return NULL;
+}
+
 /**
  * This is a helper function to handle the legacy (pre GLX 1.3) cases
  * where passing an X window to glXMakeCurrent is valid.  Given a
@@ -486,11 +498,15 @@ __glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, 
ClientPtr client,
 {
 DrawablePtr pDraw;
 __GLXdrawable *pGlxDraw;
+__GLXconfig *config;
+__GLXscreen *pGlxScreen;
 int rc;
 
 if (validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
  DixWriteAccess, , )) {
-if (glxc != NULL && pGlxDraw->config != glxc->config) {
+if (glxc != NULL &&
+glxc->config != NULL &&
+glxc->config != pGlxDraw->config) {
 client->errorValue = drawId;
 *error = BadMatch;
 return NULL;
@@ -518,19 +534,35 @@ __glXGetDrawable(__GLXcontext * glxc, GLXDrawable drawId, 
ClientPtr client,
 return NULL;
 }
 
-if (pDraw->pScreen != glxc->pGlxScreen->pScreen) {
+pGlxScreen = glxc->pGlxScreen;
+if (pDraw->pScreen != pGlxScreen->pScreen) {
 client->errorValue = pDraw->pScreen->myNum;
 *error = BadMatch;
 return NULL;
 }
 
-if (!validGlxFBConfigForWindow(client, glxc->config, pDraw, error))
+config = glxc->config;
+if (!config)
+config = inferConfigForWindow(pGlxScreen, (WindowPtr)pDraw);
+if (!config) {
+/*
+ * If we get here, we've tried to bind a no-config context to a
+ * window without a corresponding fbconfig, presumably because
+ * we don't support GL on it (PseudoColor perhaps). From GLX Section
+ * 3.3.7 "Rendering Contexts":
+ *
+ * "If draw or read are not compatible with ctx a BadMatch error
+ * is generated."
+ */
+*error = BadMatch;
 return NULL;
+}
 
-pGlxDraw = glxc->pGlxScreen->createDrawable(client, glxc->pGlxScreen,
-pDraw, drawId,
-GLX_DRAWABLE_WINDOW,
-drawId, glxc->config);
+if (!validGlxFBConfigForWindow(client, config, pDraw, error))
+return NULL;
+
+pGlxDraw = pGlxScreen->createDrawable(client, pGlxScreen, pDraw, drawId,
+  GLX_DRAWABLE_WINDOW, drawId, config);
 if (!pGlxDraw) {
*error = BadAlloc;
return NULL;
-- 
2.14.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 1/3] glx: Fix glXQueryContext for GLX_FBCONFIG_ID and GLX_RENDER_TYPE (v2)

2017-11-14 Thread Adam Jackson
Just never filled in, oops. Seems to have gone unnoticed because
normally glXQueryContext simply returns the values filled in by the
client library when the context was created. The only path by which you
normally get to a GLXQueryContext request is glXImportContext, and then
only if the context is already indirect.

However, that's a statement about Mesa's libGL (and anything else that
inherited that bit of the SGI SI more or less intact). Nothing prevents
a mischeivous client from issuing that request of a direct context, and
if they did we'd be in trouble because we never bothered to preserve the
associated fbconfig in the context state, so we'd crash looking up
GLX_VISUAL_ID_EXT. So let's fix that too.

v2: Fixed missing preservation of the config in DRI2 (Eric Anholt)

Signed-off-by: Adam Jackson 
---
 glx/glxcmds.c| 7 ++-
 glx/glxdri2.c| 1 +
 glx/glxdriswrast.c   | 1 +
 hw/xquartz/GL/indirect.c | 2 +-
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 241abc6a5..8681ef13f 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -215,6 +215,7 @@ __glXdirectContextCreate(__GLXscreen * screen,
 if (context == NULL)
 return NULL;
 
+context->config = modes;
 context->destroy = __glXdirectContextDestroy;
 context->loseCurrent = __glXdirectContextLoseCurrent;
 
@@ -1718,7 +1719,7 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
 ClientPtr client = cl->client;
 __GLXcontext *ctx;
 xGLXQueryContextInfoEXTReply reply;
-int nProps = 3;
+int nProps = 5;
 int sendBuf[nProps * 2];
 int nReplyBytes;
 int err;
@@ -1740,6 +1741,10 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
 sendBuf[3] = (int) (ctx->config->visualID);
 sendBuf[4] = GLX_SCREEN_EXT;
 sendBuf[5] = (int) (ctx->pGlxScreen->pScreen->myNum);
+sendBuf[6] = GLX_FBCONFIG_ID;
+sendBuf[7] = (int) (ctx->config->fbconfigID);
+sendBuf[8] = GLX_RENDER_TYPE;
+sendBuf[9] = (int) (ctx->config->renderType);
 
 if (client->swapped) {
 int length = reply.length;
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 8f5aab0c2..2c542bfdf 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -552,6 +552,7 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
 return NULL;
 }
 
+context->base.config = glxConfig;
 context->base.destroy = __glXDRIcontextDestroy;
 context->base.makeCurrent = __glXDRIcontextMakeCurrent;
 context->base.loseCurrent = __glXDRIcontextLoseCurrent;
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 5b1f3d1fc..c000d6cfb 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -231,6 +231,7 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
 if (context == NULL)
 return NULL;
 
+context->base.config = glxConfig;
 context->base.destroy = __glXDRIcontextDestroy;
 context->base.makeCurrent = __glXDRIcontextMakeCurrent;
 context->base.loseCurrent = __glXDRIcontextLoseCurrent;
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 2d88ef284..6738946ff 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -156,7 +156,7 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
 memset(context, 0, sizeof *context);
 
 context->base.pGlxScreen = screen;
-
+context->base.config = conf;
 context->base.destroy = __glXAquaContextDestroy;
 context->base.makeCurrent = __glXAquaContextMakeCurrent;
 context->base.loseCurrent = __glXAquaContextLoseCurrent;
-- 
2.14.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 3/4] animcur: Run the timer from the device, not the screen

2017-11-14 Thread Keith Packard
Adam Jackson  writes:

> You added that comment when you added XFIXES to XFree86, presumably you
> know what it means better than I do.

Never mind -- the original version of the code had the assignment to the
local DisplayCursor variable below the comment while you've moved it up
to the declaration. I had thought that 'DisplayCursor' was a global
function somehow.

I'm just confused.

-- 
-keith


signature.asc
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver] edid: fix off-by-one error in CEA mode numbering

2017-11-14 Thread Hector Martin
The CEA extension short video descriptors contain the VIC, which starts
at 1, not 0.

Signed-off-by: Hector Martin 
---
 hw/xfree86/modes/xf86EdidModes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 908c5a4cf..ff04eca03 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -970,8 +970,8 @@ handle_cea_svd(struct cea_video_block *video, void *data)
 int vid;
 
 vid = video->video_code & 0x7f;
-if (vid < CEA_VIDEO_MODES_NUM) {
-Mode = xf86DuplicateMode(CEAVideoModes + vid);
+if (vid >= 1 && vid <= CEA_VIDEO_MODES_NUM) {
+Mode = xf86DuplicateMode(CEAVideoModes + (vid - 1));
 *Modes = xf86ModesAdd(*Modes, Mode);
 }
 }
-- 
2.14.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 3/4] animcur: Run the timer from the device, not the screen

2017-11-14 Thread Adam Jackson
On Sun, 2017-11-12 at 17:02 -0800, Keith Packard wrote:
> Adam Jackson  writes:
> 
> > +/*
> > + * Not a simple Unwrap/Wrap as this isn't called along the 
> > DisplayCursor
> > + * wrapper chain.
> > + */
> > +pScreen->DisplayCursor = as->DisplayCursor;
> > +(void) (*pScreen->DisplayCursor) (dev, pScreen, ac->elts[elt].pCursor);
> > +as->DisplayCursor = pScreen->DisplayCursor;
> > +pScreen->DisplayCursor = DisplayCursor;
> 
> I'm probably reading this out of context, but if this isn't called along
> the usual DisplayCursor wrapper chain, then it's presumptuous to smash
> in our DisplayCursor pointer; shouldn't it preserve the previous value
> and restore that instead?

You added that comment when you added XFIXES to XFree86, presumably you
know what it means better than I do.

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel