[PATCH] xwayland: Adjust screen size with rotation

2015-09-23 Thread Olivier Fourdan
bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92076
Signed-off-by: Olivier Fourdan 
---
 hw/xwayland/xwayland-output.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 7e5484c..7d7420b 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -101,8 +101,13 @@ output_handle_mode(void *data, struct wl_output 
*wl_output, uint32_t flags,
 if (!(flags & WL_OUTPUT_MODE_CURRENT))
 return;
 
-xwl_output->width = width;
-xwl_output->height = height;
+if (xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180)) {
+xwl_output->width = width;
+xwl_output->height = height;
+} else {
+xwl_output->width = height;
+xwl_output->height = width;
+}
 
 randr_mode = xwayland_cvt(width, height, refresh / 1000.0, 0, 0);
 
-- 
2.4.3

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

Re: [PATCH:twm] Add some const.

2015-09-23 Thread Jasper St. Pierre
Should also mention that it also adds a strdup -- I feel that the code
calling this might conditionally free. Would be nice to double-check
callers.

On Wed, Sep 23, 2015 at 1:58 AM, Thomas Klausner  wrote:
> From: Christos Zoulas 
>
> Signed-off-by: Thomas Klausner 
> ---
>  src/util.c | 4 ++--
>  src/util.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/util.c b/src/util.c
> index 4b94051..5e8f0db 100644
> --- a/src/util.c
> +++ b/src/util.c
> @@ -256,11 +256,11 @@ Zoom(Window wf, Window wt)
>   *  \param name  the filename to expand
>   */
>  char *
> -ExpandFilename(char *name)
> +ExpandFilename(const char *name)
>  {
>  char *newname;
>
> -if (name[0] != '~') return name;
> +if (name[0] != '~') return strdup(name);
>
>  newname = malloc (HomeLen + strlen(name) + 2);
>  if (!newname) {
> diff --git a/src/util.h b/src/util.h
> index 7f4527c..4b2d3a8 100644
> --- a/src/util.h
> +++ b/src/util.h
> @@ -64,7 +64,7 @@ in this Software without prior written authorization from 
> The Open Group.
>  extern void MoveOutline ( Window root, int x, int y, int width, int height,
>   int bw, int th );
>  extern void Zoom ( Window wf, Window wt );
> -extern char * ExpandFilename ( char *name );
> +extern char * ExpandFilename ( const char *name );
>  extern void GetUnknownIcon ( const char *name );
>  extern Pixmap FindBitmap ( const char *name, unsigned int *widthp,
>unsigned int *heightp );
> --
> 2.5.2
>
> ___
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel



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

Re: [PATCH:twm] Add some const.

2015-09-23 Thread Thomas Klausner
Well, yes, but for context, here is the full function after the change:

char *
ExpandFilename(const char *name)
{
char *newname;

if (name[0] != '~') return strdup(name);

newname = malloc (HomeLen + strlen(name) + 2);
if (!newname) {
fprintf (stderr,
 "%s:  unable to allocate %ld bytes to expand filename %s/%s\n",
 ProgramName, HomeLen + (unsigned long)strlen(name) + 2,
 Home, [1]);
} else {
(void) sprintf (newname, "%s/%s", Home, [1]);
}

return newname;
}

So in other words, now the function is consistent in returning a
malloc()ed string when it succeeds.
 Thomas

On Wed, Sep 23, 2015 at 08:59:22AM -0700, Jasper St. Pierre wrote:
> Should also mention that it also adds a strdup -- I feel that the code
> calling this might conditionally free. Would be nice to double-check
> callers.
> 
> On Wed, Sep 23, 2015 at 1:58 AM, Thomas Klausner  wrote:
> > From: Christos Zoulas 
> >
> > Signed-off-by: Thomas Klausner 
> > ---
> >  src/util.c | 4 ++--
> >  src/util.h | 2 +-
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/util.c b/src/util.c
> > index 4b94051..5e8f0db 100644
> > --- a/src/util.c
> > +++ b/src/util.c
> > @@ -256,11 +256,11 @@ Zoom(Window wf, Window wt)
> >   *  \param name  the filename to expand
> >   */
> >  char *
> > -ExpandFilename(char *name)
> > +ExpandFilename(const char *name)
> >  {
> >  char *newname;
> >
> > -if (name[0] != '~') return name;
> > +if (name[0] != '~') return strdup(name);
> >
> >  newname = malloc (HomeLen + strlen(name) + 2);
> >  if (!newname) {
> > diff --git a/src/util.h b/src/util.h
> > index 7f4527c..4b2d3a8 100644
> > --- a/src/util.h
> > +++ b/src/util.h
> > @@ -64,7 +64,7 @@ in this Software without prior written authorization from 
> > The Open Group.
> >  extern void MoveOutline ( Window root, int x, int y, int width, int height,
> >   int bw, int th );
> >  extern void Zoom ( Window wf, Window wt );
> > -extern char * ExpandFilename ( char *name );
> > +extern char * ExpandFilename ( const char *name );
> >  extern void GetUnknownIcon ( const char *name );
> >  extern Pixmap FindBitmap ( const char *name, unsigned int *widthp,
> >unsigned int *heightp );
> > --
> > 2.5.2
> >
> > ___
> > xorg-devel@lists.x.org: X.Org development
> > Archives: http://lists.x.org/archives/xorg-devel
> > Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 
> 
> 
> -- 
>   Jasper
> 
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Is that possible easy vga passthrough without i915 patch?

2015-09-23 Thread Cong Zhang
Hi all,

  I try to do VGA Passthrough in kvm, I face the trouble as my host is
intel IGD+Nvidia.

  I face the vga arbiter problem when I need my vm boot into legecy mode,
 my question is *why I must apply the patch
from https://lkml.org/lkml/2014/5/9/517
* ?

   I read the vga arbiter article in http://www.x.org/wiki/VgaArbiter/ , as
my understand *that should be possible to do some api level call to tell
the vga arbiter that there are some more vga device(lie to vga arbiter is
enough?)? or I must do that before x driver was loaded? if that's true,
 boot to the text mode directly fix the problem?*

   Any help was very appreciate.

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

Re: [PATCH:twm] Add some const.

2015-09-23 Thread Jasper St. Pierre
I was imagining that it might be used like:

char *foo = ExpandFilename(name);
...
if (foo != name)
free(foo);

... which would still work, but the != is now dead code. If callers
were unconditionally freeing before, I heavily suspect something more
serious here.

On Wed, Sep 23, 2015 at 9:30 AM, Thomas Klausner  wrote:
> Well, yes, but for context, here is the full function after the change:
>
> char *
> ExpandFilename(const char *name)
> {
> char *newname;
>
> if (name[0] != '~') return strdup(name);
>
> newname = malloc (HomeLen + strlen(name) + 2);
> if (!newname) {
> fprintf (stderr,
>  "%s:  unable to allocate %ld bytes to expand filename 
> %s/%s\n",
>  ProgramName, HomeLen + (unsigned long)strlen(name) + 2,
>  Home, [1]);
> } else {
> (void) sprintf (newname, "%s/%s", Home, [1]);
> }
>
> return newname;
> }
>
> So in other words, now the function is consistent in returning a
> malloc()ed string when it succeeds.
>  Thomas
>
> On Wed, Sep 23, 2015 at 08:59:22AM -0700, Jasper St. Pierre wrote:
>> Should also mention that it also adds a strdup -- I feel that the code
>> calling this might conditionally free. Would be nice to double-check
>> callers.
>>
>> On Wed, Sep 23, 2015 at 1:58 AM, Thomas Klausner  wrote:
>> > From: Christos Zoulas 
>> >
>> > Signed-off-by: Thomas Klausner 
>> > ---
>> >  src/util.c | 4 ++--
>> >  src/util.h | 2 +-
>> >  2 files changed, 3 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/src/util.c b/src/util.c
>> > index 4b94051..5e8f0db 100644
>> > --- a/src/util.c
>> > +++ b/src/util.c
>> > @@ -256,11 +256,11 @@ Zoom(Window wf, Window wt)
>> >   *  \param name  the filename to expand
>> >   */
>> >  char *
>> > -ExpandFilename(char *name)
>> > +ExpandFilename(const char *name)
>> >  {
>> >  char *newname;
>> >
>> > -if (name[0] != '~') return name;
>> > +if (name[0] != '~') return strdup(name);
>> >
>> >  newname = malloc (HomeLen + strlen(name) + 2);
>> >  if (!newname) {
>> > diff --git a/src/util.h b/src/util.h
>> > index 7f4527c..4b2d3a8 100644
>> > --- a/src/util.h
>> > +++ b/src/util.h
>> > @@ -64,7 +64,7 @@ in this Software without prior written authorization 
>> > from The Open Group.
>> >  extern void MoveOutline ( Window root, int x, int y, int width, int 
>> > height,
>> >   int bw, int th );
>> >  extern void Zoom ( Window wf, Window wt );
>> > -extern char * ExpandFilename ( char *name );
>> > +extern char * ExpandFilename ( const char *name );
>> >  extern void GetUnknownIcon ( const char *name );
>> >  extern Pixmap FindBitmap ( const char *name, unsigned int *widthp,
>> >unsigned int *heightp );
>> > --
>> > 2.5.2
>> >
>> > ___
>> > xorg-devel@lists.x.org: X.Org development
>> > Archives: http://lists.x.org/archives/xorg-devel
>> > Info: http://lists.x.org/mailman/listinfo/xorg-devel
>>
>>
>>
>> --
>>   Jasper
>>



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

Re: [PATCH:twm] Add some const.

2015-09-23 Thread Thomas Klausner
Ah, good catch. I've attached a cleanup patch for that.
 Thomas


On Wed, Sep 23, 2015 at 11:38:02AM -0700, Jasper St. Pierre wrote:
> I was imagining that it might be used like:
> 
> char *foo = ExpandFilename(name);
> ...
> if (foo != name)
> free(foo);
> 
> ... which would still work, but the != is now dead code. If callers
> were unconditionally freeing before, I heavily suspect something more
> serious here.
> 
> On Wed, Sep 23, 2015 at 9:30 AM, Thomas Klausner  wrote:
> > Well, yes, but for context, here is the full function after the change:
> >
> > char *
> > ExpandFilename(const char *name)
> > {
> > char *newname;
> >
> > if (name[0] != '~') return strdup(name);
> >
> > newname = malloc (HomeLen + strlen(name) + 2);
> > if (!newname) {
> > fprintf (stderr,
> >  "%s:  unable to allocate %ld bytes to expand filename 
> > %s/%s\n",
> >  ProgramName, HomeLen + (unsigned long)strlen(name) + 2,
> >  Home, [1]);
> > } else {
> > (void) sprintf (newname, "%s/%s", Home, [1]);
> > }
> >
> > return newname;
> > }
> >
> > So in other words, now the function is consistent in returning a
> > malloc()ed string when it succeeds.
> >  Thomas
> >
> > On Wed, Sep 23, 2015 at 08:59:22AM -0700, Jasper St. Pierre wrote:
> >> Should also mention that it also adds a strdup -- I feel that the code
> >> calling this might conditionally free. Would be nice to double-check
> >> callers.
> >>
> >> On Wed, Sep 23, 2015 at 1:58 AM, Thomas Klausner  wrote:
> >> > From: Christos Zoulas 
> >> >
> >> > Signed-off-by: Thomas Klausner 
> >> > ---
> >> >  src/util.c | 4 ++--
> >> >  src/util.h | 2 +-
> >> >  2 files changed, 3 insertions(+), 3 deletions(-)
> >> >
> >> > diff --git a/src/util.c b/src/util.c
> >> > index 4b94051..5e8f0db 100644
> >> > --- a/src/util.c
> >> > +++ b/src/util.c
> >> > @@ -256,11 +256,11 @@ Zoom(Window wf, Window wt)
> >> >   *  \param name  the filename to expand
> >> >   */
> >> >  char *
> >> > -ExpandFilename(char *name)
> >> > +ExpandFilename(const char *name)
> >> >  {
> >> >  char *newname;
> >> >
> >> > -if (name[0] != '~') return name;
> >> > +if (name[0] != '~') return strdup(name);
> >> >
> >> >  newname = malloc (HomeLen + strlen(name) + 2);
> >> >  if (!newname) {
> >> > diff --git a/src/util.h b/src/util.h
> >> > index 7f4527c..4b2d3a8 100644
> >> > --- a/src/util.h
> >> > +++ b/src/util.h
> >> > @@ -64,7 +64,7 @@ in this Software without prior written authorization 
> >> > from The Open Group.
> >> >  extern void MoveOutline ( Window root, int x, int y, int width, int 
> >> > height,
> >> >   int bw, int th );
> >> >  extern void Zoom ( Window wf, Window wt );
> >> > -extern char * ExpandFilename ( char *name );
> >> > +extern char * ExpandFilename ( const char *name );
> >> >  extern void GetUnknownIcon ( const char *name );
> >> >  extern Pixmap FindBitmap ( const char *name, unsigned int *widthp,
> >> >unsigned int *heightp );
> >> > --
> >> > 2.5.2
> >> >
> >> > ___
> >> > xorg-devel@lists.x.org: X.Org development
> >> > Archives: http://lists.x.org/archives/xorg-devel
> >> > Info: http://lists.x.org/mailman/listinfo/xorg-devel
> >>
> >>
> >>
> >> --
> >>   Jasper
> >>
> 
> 
> 
> -- 
>   Jasper
> 
>From e8cd9fe47d1458d6a5ea17addb5cef7026742c82 Mon Sep 17 00:00:00 2001
From: Thomas Klausner 
Date: Wed, 23 Sep 2015 20:53:24 +0200
Subject: [PATCH:twm 2/2] Adapt callers to ExpandFilename change.

It now always allocates memory, so remove some unnecessary checks.
While here, improve handling of an error case.
---
 src/menus.c | 32 ++--
 src/util.c  |  4 ++--
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/menus.c b/src/menus.c
index e23b5ff..ada9c41 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -2020,7 +2020,7 @@ ExecuteFunction(int func, const char *action, Window w, 
TwmWindow *tmp_win,
 "%s:  unable to open cut file \"%s\"\n",
 ProgramName, tmp);
}
-   if (ptr != tmp) free (ptr);
+   free (ptr);
}
} else {
XFree(ptr);
@@ -2171,21 +2171,25 @@ ExecuteFunction(int func, const char *action, Window w, 
TwmWindow *tmp_win,
 
 case F_FILE:
ptr = ExpandFilename(action);
-   fd = open(ptr, O_RDONLY);
-   if (fd >= 0)
-   {
-   count = read(fd, buff, MAX_FILE_SIZE - 1);
-   if (count > 0)
-   XStoreBytes(dpy, buff, count);
+   if (ptr) {
+   fd = open(ptr, O_RDONLY);
+   if (fd >= 0)
+   {
+   count = read(fd, buff, MAX_FILE_SIZE - 1);
+   if (count > 0)
+   

[PATCH:twm] Add some const.

2015-09-23 Thread Thomas Klausner
From: Christos Zoulas 

Signed-off-by: Thomas Klausner 
---
 src/util.c | 4 ++--
 src/util.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/util.c b/src/util.c
index 4b94051..5e8f0db 100644
--- a/src/util.c
+++ b/src/util.c
@@ -256,11 +256,11 @@ Zoom(Window wf, Window wt)
  *  \param name  the filename to expand
  */
 char *
-ExpandFilename(char *name)
+ExpandFilename(const char *name)
 {
 char *newname;
 
-if (name[0] != '~') return name;
+if (name[0] != '~') return strdup(name);
 
 newname = malloc (HomeLen + strlen(name) + 2);
 if (!newname) {
diff --git a/src/util.h b/src/util.h
index 7f4527c..4b2d3a8 100644
--- a/src/util.h
+++ b/src/util.h
@@ -64,7 +64,7 @@ in this Software without prior written authorization from The 
Open Group.
 extern void MoveOutline ( Window root, int x, int y, int width, int height,
  int bw, int th );
 extern void Zoom ( Window wf, Window wt );
-extern char * ExpandFilename ( char *name );
+extern char * ExpandFilename ( const char *name );
 extern void GetUnknownIcon ( const char *name );
 extern Pixmap FindBitmap ( const char *name, unsigned int *widthp,
   unsigned int *heightp );
-- 
2.5.2

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

Re: [PATCH] glx: fix regression with copy sub buffer disappearing

2015-09-23 Thread Adam Jackson
On Wed, 2015-09-23 at 11:19 +1000, Dave Airlie wrote:
> From: Fedora X Ninjas 
> 
> So copy sub buffer isn't a core extensions it's a driver extension
> which means we are using totally the wrong interface to query for it
> here, which means bad things happen when you roll out this code,
> for instance MESA_copy_sub_buffer stops working.

I have vague memories of trying to find the extension in the driver ext
list and not seeing it, but that might have been a function of using a
stale Mesa version?

Whatever though.  This patch is fine, drisw doesn't generate GLX
protocol for this request so the server can go ahead and claim to
support it in all cases, the client will issue the appropriate blit.  I
agree it's not pretty, but that's true of drisw in general, a vgem
design would make this all properly moot.

Merged:

remote: I: patch #60153 updated using rev 
6da3f5d04f6a1cda0c858280f9561f9fbc323275.
remote: I: 1 patch(es) updated to state Accepted.
To ssh://git.freedesktop.org/git/xorg/xserver
   5e9457c..6da3f5d  master -> master

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

Re: [PATCH:twm] Add some const.

2015-09-23 Thread Christos Zoulas
On Sep 23, 11:38am, jstpie...@mecheye.net ("Jasper St. Pierre") wrote:
-- Subject: Re: [PATCH:twm] Add some const.

| I was imagining that it might be used like:
| 
| char *foo = ExpandFilename(name);
| ...
| if (foo != name)
| free(foo);

Yes, that's how it is currently done.

| ... which would still work, but the != is now dead code. If callers
| were unconditionally freeing before, I heavily suspect something more
| serious here.

I am trying to fix:

http://cgit.freedesktop.org/xorg/app/twm/tree/src/menus.c#n1291

"action" is "const char *"

http://cgit.freedesktop.org/xorg/app/twm/tree/src/menus.c#n2173

ExpandFilename(action);

I wanted the minimal diffs; the code could use a lot more cleanup.

Please feel free to make it better!

christos

| 
| On Wed, Sep 23, 2015 at 9:30 AM, Thomas Klausner  wrote:
| > Well, yes, but for context, here is the full function after the change:
| >
| > char *
| > ExpandFilename(const char *name)
| > {
| > char *newname;
| >
| > if (name[0] != '~') return strdup(name);
| >
| > newname = malloc (HomeLen + strlen(name) + 2);
| > if (!newname) {
| > fprintf (stderr,
| >  "%s:  unable to allocate %ld bytes to expand filename 
%s/%s\n",
| >  ProgramName, HomeLen + (unsigned long)strlen(name) + 2,
| >  Home, [1]);
| > } else {
| > (void) sprintf (newname, "%s/%s", Home, [1]);
| > }
| >
| > return newname;
| > }
| >
| > So in other words, now the function is consistent in returning a
| > malloc()ed string when it succeeds.
| >  Thomas
| >
| > On Wed, Sep 23, 2015 at 08:59:22AM -0700, Jasper St. Pierre wrote:
| >> Should also mention that it also adds a strdup -- I feel that the code
| >> calling this might conditionally free. Would be nice to double-check
| >> callers.
| >>
| >> On Wed, Sep 23, 2015 at 1:58 AM, Thomas Klausner  wrote:
| >> > From: Christos Zoulas 
| >> >
| >> > Signed-off-by: Thomas Klausner 
| >> > ---
| >> >  src/util.c | 4 ++--
| >> >  src/util.h | 2 +-
| >> >  2 files changed, 3 insertions(+), 3 deletions(-)
| >> >
| >> > diff --git a/src/util.c b/src/util.c
| >> > index 4b94051..5e8f0db 100644
| >> > --- a/src/util.c
| >> > +++ b/src/util.c
| >> > @@ -256,11 +256,11 @@ Zoom(Window wf, Window wt)
| >> >   *  \param name  the filename to expand
| >> >   */
| >> >  char *
| >> > -ExpandFilename(char *name)
| >> > +ExpandFilename(const char *name)
| >> >  {
| >> >  char *newname;
| >> >
| >> > -if (name[0] != '~') return name;
| >> > +if (name[0] != '~') return strdup(name);
| >> >
| >> >  newname = malloc (HomeLen + strlen(name) + 2);
| >> >  if (!newname) {
| >> > diff --git a/src/util.h b/src/util.h
| >> > index 7f4527c..4b2d3a8 100644
| >> > --- a/src/util.h
| >> > +++ b/src/util.h
| >> > @@ -64,7 +64,7 @@ in this Software without prior written authorization 
from The Open Group.
| >> >  extern void MoveOutline ( Window root, int x, int y, int width, int 
height,
| >> >   int bw, int th );
| >> >  extern void Zoom ( Window wf, Window wt );
| >> > -extern char * ExpandFilename ( char *name );
| >> > +extern char * ExpandFilename ( const char *name );
| >> >  extern void GetUnknownIcon ( const char *name );
| >> >  extern Pixmap FindBitmap ( const char *name, unsigned int *widthp,
| >> >unsigned int *heightp );
| >> > --
| >> > 2.5.2
| >> >
| >> > ___
| >> > xorg-devel@lists.x.org: X.Org development
| >> > Archives: http://lists.x.org/archives/xorg-devel
| >> > Info: http://lists.x.org/mailman/listinfo/xorg-devel
| >>
| >>
| >>
| >> --
| >>   Jasper
| >>
| 
| 
| 
| -- 
|   Jasper
-- End of excerpt from "Jasper St. Pierre"


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