[OpenJDK 2D-Dev] Optimizing pixmap reads and write

Roman Kennke roman.kennke at aicas.com
Tue Nov 4 09:16:09 UTC 2008

I'm currently implementing a SurfaceData for VxWorks/WindML.
Unfortunately, this graphics library (WindML) doesn't provide me direct
framebuffer access. Therefore I have to perform read and write
operations for rendering operations (at least, for images and likewise
non-primitives). I was thinking that in many cases I can avoid reading
the surface data (i.e. for rendering opaque images) or in some cases
writing (when transferring the surface data to another incompatible
surface). So I implemented my GetRasInfo like this (pseudocode):

malloc(pixels, size);
if (lockFlags & SD_LOCK_READ) {

and the Release function:

if (lockFlags & SD_LOCK_WRITE) {

Unfortunately, this doesn't work well. When rendering translucent or
bitmask images, it does NOT set the the SD_LOCK_READ flag, and therefore
I don't read the surface pixels here, resulting in uninitialized
background for these images. This means, it only renders correctly if I
ignore the SD_LOCK_READ flag and read every time, even if I wouldn't
need to.

My question is, did I get something wrong in my understanding of the
flags? Or is this a bug? Or just something that hasn't been
implemented/optimized yet, because it isn't needed on OpenJDKs primary
platforms? (Although, I would think, that at least for non-DGA surfaces
it would be a nice little optimization at least on X11).


Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-48
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt

More information about the 2d-dev mailing list