Discussion:
Ximage's byte_order field
McDonald, Michael-p7438c
2009-02-19 17:54:41 UTC
Permalink
Am I allowed to change the value of the XImage byte_order field? And if
I do, will subsequent XPutImage() calls do the "right thing"? Does the
value of byte_order default to the client's byte order?

I have a memory based frame buffer from another app that I'd like to
use XCreateImage() and XPutImage() to display in a repeating display
loop. Unfortunately, the source frame buffer is in big endian and I'm
running on a little endian machine.

Thanks,

Mike McDonald
GDC4S/FCS/PVM/SDC
Adam Jackson
2009-02-23 16:01:30 UTC
Permalink
Post by McDonald, Michael-p7438c
Am I allowed to change the value of the XImage byte_order field? And if
I do, will subsequent XPutImage() calls do the "right thing"? Does the
value of byte_order default to the client's byte order?
The default byte order is the server's byte order. You _can_ change the
image's byte_order field, and xlib will do the right thing with that (in
the sense of transmitting the bits as you pass them in). But the server
will only do the right thing with it if it was built with
MATCH_CLIENT_ENDIAN defined, which I don't think is ever the case.

Swapping client-side is the Done Thing. We could argue whether that's
philosophically correct, and it's probably not, but I think it's what
you're stuck with, sorry.

- ajax
Peter Harris
2009-02-23 17:37:16 UTC
Permalink
Post by McDonald, Michael-p7438c
Am I allowed to change the value of the XImage byte_order field? And if
I do, will subsequent XPutImage() calls do the "right thing"?
Yes, you can change the byte_order field to match the byte order of your
image. XPutImage will take care of swapping your bits around to match
what the server expects.

See:
http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/PutImage.c
particularly the function "SendZImage", if you want the gory details.

Peter Harris
--
Open Text Connectivity Solutions Group
Peter Harris http://www.opentext.com/connectivity
Research and Development Phone: +1 905 762 6001
***@opentext.com Toll Free: 1 877 359 4866
McDonald, Michael-p7438c
2009-02-25 18:11:35 UTC
Permalink
-----Original Message-----
Sent: Friday, February 20, 2009 1:02 PM
To: McDonald, Michael-p7438c
Subject: Re: Ximage's byte_order field
Mike,
How is your frame buffer connected to your little endian machine?
It's a shared memory area generated by a COTS software package. As
such, we can't modify its byte-order. There may be multiple copies of
this package running at the same time, each with its own "virtual
framebuffer". We want to display all of these vfbs on a real display
that's running X with the Intel driver.

Brute force copying the vfbs using XPutImage() is the only method we've
come up with for displaying the vfbs. But that required us to make a
copy of the source vfbs with the byte-order fixed. By setting the
byte_order field of the _Ximage structure, we hope we can eliminate the
intermediate copy of the vfbs.

Mike McDonald
GDC4S/FCS/PVM/SDC
Jim Gettys
2009-02-25 18:46:35 UTC
Permalink
You should be able to specify your byte order of the local image, and
Xlib worry about swapping for you, as I remember; but there will still
be a copy/swap taking someplace.

Sorry the API is so horrid: I got interrupted in the middle of designing
it for a meeting 2500 miles away, and the XImage interfaces never got
repaired....
Your dinosaur.
- Jim
Post by McDonald, Michael-p7438c
-----Original Message-----
Sent: Friday, February 20, 2009 1:02 PM
To: McDonald, Michael-p7438c
Subject: Re: Ximage's byte_order field
Mike,
How is your frame buffer connected to your little endian machine?
It's a shared memory area generated by a COTS software package. As
such, we can't modify its byte-order. There may be multiple copies of
this package running at the same time, each with its own "virtual
framebuffer". We want to display all of these vfbs on a real display
that's running X with the Intel driver.
Brute force copying the vfbs using XPutImage() is the only method we've
come up with for displaying the vfbs. But that required us to make a
copy of the source vfbs with the byte-order fixed. By setting the
byte_order field of the _Ximage structure, we hope we can eliminate the
intermediate copy of the vfbs.
Mike McDonald
GDC4S/FCS/PVM/SDC
_______________________________________________
xorg mailing list
http://lists.freedesktop.org/mailman/listinfo/xorg
--
Jim Gettys <***@freedesktop.org>
McDonald, Michael-p7438c
2009-02-25 18:54:44 UTC
Permalink
-----Original Message-----
Sent: Wednesday, February 25, 2009 11:47 AM
To: McDonald, Michael-p7438c
Subject: RE: Ximage's byte_order field
You should be able to specify your byte order of the local image, and
Xlib worry about swapping for you, as I remember; but there will still
be a copy/swap taking someplace.
Right, we agree that at least one copy and one swap has to be done.
We're just trying to avoid extra, unneeded copies.
Sorry the API is so horrid: I got interrupted in the middle
of designing
it for a meeting 2500 miles away, and the XImage interfaces never got
repaired....
Your dinosaur.
- Jim
No problem. I was just trying to make sure you had intended the
byte_order field to be user accessable. Since the Ximage structure was
defined, I had assumed yes.

Even older dinosaur who froze his backside off every January attending
all of the X conferences.

Mike McDonald
GDC4S/FCS/PVM/SDC
Jim Gettys
2009-02-25 19:12:19 UTC
Permalink
Post by McDonald, Michael-p7438c
No problem. I was just trying to make sure you had intended the
byte_order field to be user accessable. Since the Ximage structure was
defined, I had assumed yes.
Yes, though that was not really the original intent; the problem is, I
didn't get finished with hiding things, so it escaped into the wild and
by the time I recognized the disaster, I judged it too late to fix.
- Jim
Post by McDonald, Michael-p7438c
Even older dinosaur who froze his backside off every January attending
all of the X conferences.
Mike McDonald
GDC4S/FCS/PVM/SDC
--
Jim Gettys <***@freedesktop.org>
Loading...