Closed Bug 85527 Opened 23 years ago Closed 23 years ago

Turn xlibrgb into a shared library

Categories

(Core :: XUL, enhancement)

All
Linux
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla0.9.3

People

(Reporter: roland.mainz, Assigned: roland.mainz)

References

Details

(Keywords: memory-footprint)

Attachments

(4 files)

RFE: Turn xlibrgb code (mozilla/gfx/src/xlibrgb/) into a shared library that
both Xlib-toolkit and Xprint print system can share the same code.

This is non-trivial as much code relies on the static vars in xlibrgb which hold
|Display *|, |Screen *| and so on... these variables have to be moved into a 
xlibrgb-"handle" which can be created/destroyed multiple times - and the _same_
code must be able to handle multiple Display/Screen combinations using different
handles at the same time...
Advantages:
- Dramatically reduction of resulting module size in Xlib/Xprint modules
Disadvantages:
- patch will be horrible _big_ and therefore it will be rotten soon. Adding some
"depends on" bugs to avoid that someone starts this bug while
Xlib-toolkit/Xprint are still under heavy development...
- due the problem above r= and sr= must be fast as hell (less than 2 days if
possible)... ;-(

Setting milestone to Mozilla 1.1...
Depends on: 57820, 66082, 77060, 79228, 83242
Keywords: footprint
Target Milestone: --- → mozilla1.1
More thoughts:
This can be "done" more smoothly:
Step 1: Modify xlibrgb.c code to use handles but preseve compatibility to old
API via macros (#define XLIBRGB_USE_HANDLES to turn "handles" on). The
"compatibility mode" use one global handle during that time.
Step 2: Modify Xlib-toolkit and Xprint-toolkit to use the new handle API
Step 3: Turn "handles" on by default
Step 4: Turn xlibrgb.c into a shared library

I can do everything except step 4 myself. Step 1 is quite easy... steps 2/3 will
be hard... ;-(

Overtaking...
Assignee: trudelle → Roland.Mainz
Target Milestone: mozilla1.1 → mozilla1.0
Depends on: 87148
Depends on: 87582
Last blocker bug died few secs ago, this is now on my list for next week. 
CC:'ing pocemit.

Question to blizzard/tor:
Source compatibility to old xlibrgb API is not required, right ? I'd like to add
some #define's for the first patch in this bug to keep tinderbox machines
"green" but remove this compatibility hacks later after all code has been moved
over to the new API...
Target Milestone: mozilla1.0 → mozilla0.9.3
It would be best if xlibrgb was kept in sync with gdk-pixbuf-xlibrgb.[ch].
That way fixes could be shared and if moz-xlib ever went the gdkpixbuf-xlib
route there would only be one xlibrgb copy floating around in memory.
tor:
AFAIK gdkrgb does not support more than one |Display *| per application. 
But that's why I filed this bug - xlibrgb should be able to handle more than one
|Display *| at the same time (one per "handle" (which stores all |Display
*|-specific vars) - but multiple handles)...
Filed patch.

Changes:
- new API: same as old xlibrgb API but starts with xxlib_rgb_*. Each function
takes a "handle" argument to carry all "global vars" in this handle. There can
be any number of handles at the same time. Seperate "handle"s can be managed by
seperate threads. The old xlib_rgb* API is still available for some time until
all code has been moved over to use the new API...
- Bad XFlush() ifndef'ed - this is only "neccesary"[1] for MIT_SHMEM putimage
- No TABs in *.c anymore...

ToDO:
- Add API to create a xxlib_rgb handle with a given visual. May be usefull to
render the skin with a 8bit visual (for speed) but render the content area with
24bit...
[1]=Using the event API is the correct way and removes the need for XFlush()
here...

Requesting r=
Status: NEW → ASSIGNED
I have looked over the patch, and while I do not see anything strange in it I
don't feel I am qualified to give r= on such a large patch. I personally don't
see anything wrong with it - the old API is still available, the changes do not
introduce any weirdness, etc, but I would rather have more people take a look at
this.
 -pocemit
Filed new patch to match r=timeless as discussed in IRC #mozilla

Additional changes:
- disabled alpha image support in Xprint module. It does not work ith 8bit alpha
images and sometimes spamms the users with X error messages. BAD. Fix is on the
way - I just do not like to make users nuts with these error messages...
-- snip --
+/* gisburn: alpha image code disabled. 
+ * it fails for 8bit alpha stuff and spamms the user with X errors sometimes
BAD.
+ */
+#ifdef XPRINT_NOT_NOW  
   // Create gc clip-mask on demand
   if( alphaBits != nsnull )
   {
@@ -829,6 +833,7 @@
     x_image->data = nsnull; /* Don't free the IL_Pixmap's bits. */
     XDestroyImage(x_image);
   }
+#endif /* XPRINT_NOT_NOW */
-- snip --

Requesting r=timeless...
whoops i wasn't clear, you need to fix _all_ else after return instances. fix
that for r=timeless.  let's see what the sr's have to say :)
Keywords: approval, patch
timeless: thanks !

Code to fix is
-- snip --
Colormap
xxlib_rgb_get_cmap (XlibRgbHandle *handle)
{
  /* xxlib_rgb_init (); */
  if (handle)
    return handle->cmap;
  else
    return 0;
}
-- snip --

I'll wait for the sr= comments and file a final catch-all/fix-all patch...

----

requesting sr= ... blizzard, tor ?
Attach the final version of the patch you want reviewed (plus a -w version).
Seperate the unrelated xprint change into a new bug.
#ifdef XPRINT_NOT_NOW /* alpha code */ #endif ... that are _two_ lines... is
this really worth a complete new bug ??
Yes.

Keeping patches contained to fixing a particular bug's problem will speed
up r/sr.
I looked through it.  Most of it is busy work.  rs=blizzard

Please try to touch less whitespace in the future.  It screws up cvsblame.

blizzard:
thanks !

> Please try to touch less whitespace in the future.  It screws up cvsblame.

I know. But I removed - once and forever - all xx!!@@-TABs from xlibrgb.[ch] ...
there should be no need for such a massive whitespace change in these files
anymore... :-)
CC:'ing mkaply for checkin, please...
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
May God have mercy on us all. The 212 bug spam-o-rama is Now!
QA Contact: aegis → jrgm
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: