Bug 692369 - Regression: x11alpha display was corrupted sometime in the last week
Summary: Regression: x11alpha display was corrupted sometime in the last week
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: X Display Driver (show other bugs)
Version: master
Hardware: PC Linux
: P4 normal
Assignee: Henry Stiles
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-22 19:13 UTC by James Cloos
Modified: 2011-08-04 22:01 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
xwd|xwdtopnm|pnmtopng of x11alpha display window (98.09 KB, image/png)
2011-07-22 19:13 UTC, James Cloos
Details
xwd|xwdtopnm|pnmtopng of x11alpha display window from debug build (44.14 KB, image/png)
2011-07-22 19:23 UTC, James Cloos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Cloos 2011-07-22 19:13:24 UTC
Created attachment 7701 [details]
xwd|xwdtopnm|pnmtopng of x11alpha display window

The x11alpha device’s background has obtained some black boxes this week.

I suspect the clipping changes; I will bisect to be sure.

The command line I used for the example screen dump attached below is:

 ./language_switch/obj/pspcl6 -r72 -sDEVICE=x11alpha gs/examples/colorcir.ps

(-r72 just to keep it small enough to send over my tiny link.)
Comment 1 James Cloos 2011-07-22 19:17:30 UTC
I see that a debug build produces gray instead of black anomalies.  I’ll attach an example of that, too.

alphabet.ps, chess.ps, doretree.ps also show the bug.

None of the other x11 devices do, w/ or w/o -d{Text,Graphics}AlphaBits=4.
Comment 2 James Cloos 2011-07-22 19:23:53 UTC
Created attachment 7702 [details]
xwd|xwdtopnm|pnmtopng of x11alpha display window from debug build

./language_switch/debugobj/pspcl6 -r36 -sDEVICE=x11alpha gs/examples/colorcir.ps

(Even the 100K png from -r72 was an iffy upload.)
Comment 3 James Cloos 2011-07-22 23:18:15 UTC
[SIGH]

It was not the clipping, but rather the fix for bug #692234:

:; git bisect bad
a46123967e919fdd557411d2b0d177e6be2722e3 is the first bad commit
commit a46123967e919fdd557411d2b0d177e6be2722e3
Author: Henry Stiles <henry.stiles@artifex.com>
Date:   Tue Jul 19 21:57:11 2011 -0600

    Fixes 692234 premature erasepage.
    
    The page was being erased before the postscript interpreter was
    properly initialized.  In particular for the crash in this bug a
    default halftone has to be installed before erasepage.

:040000 040000 bc3f8c80274a95ed0f422cbb14f1b33689856ac9 d039777c7ff2af7c4bd11bfb6f5089a016cf8f9c M	psi

And revering that does fix this bug.

Something must be left unititialized w/o the erasepage???
Comment 4 Henry Stiles 2011-07-27 23:08:49 UTC
(In reply to comment #3)
> [SIGH]
> 
> It was not the clipping, but rather the fix for bug #692234:
> 
> :; git bisect bad
> a46123967e919fdd557411d2b0d177e6be2722e3 is the first bad commit
> commit a46123967e919fdd557411d2b0d177e6be2722e3
> Author: Henry Stiles <henry.stiles@artifex.com>
> Date:   Tue Jul 19 21:57:11 2011 -0600
> 
>     Fixes 692234 premature erasepage.
> 
>     The page was being erased before the postscript interpreter was
>     properly initialized.  In particular for the crash in this bug a
>     default halftone has to be installed before erasepage.
> 
> :040000 040000 bc3f8c80274a95ed0f422cbb14f1b33689856ac9
> d039777c7ff2af7c4bd11bfb6f5089a016cf8f9c M    psi
> 
> And revering that does fix this bug.
> 
> Something must be left unititialized w/o the erasepage???


Yes right I thought the postscript setup code would do this but apparently it isn't.  This is a patch I'm playing with, it basically moves the erasepage after the screen setup which should address the uninitialized value associated with the halftone you identified and erase the background so alpha works properly.

git diff
diff --git a/psi/psitop.c b/psi/psitop.c
index e46c182..d146534 100644
--- a/psi/psitop.c
+++ b/psi/psitop.c
@@ -301,11 +301,12 @@ ps_impl_set_device(
     code = gsicc_init_device_profile_struct(device, NULL, 0);
     if (code < 0)
         return code;
+
     /* Set the device into the gstate */
     code = gs_setdevice_no_erase(pgs, device);
-
     if (code < 0)
         return code;
+
     /* install a screen appropriate for the device */
     {
         const char *screen_str = ".setdefaultscreen\n";
@@ -319,6 +320,12 @@ ps_impl_set_device(
         if (code < 0)
             return code;
     }
+
+    /* this shouldn't fail */
+    code = gs_erasepage(pgs);
+    if (code < 0)
+        return code;
+
     return exit_code;
 }
Comment 5 James Cloos 2011-08-01 17:30:30 UTC
The rendering looks OK with that patch.

I tested a range of ps, pdf and pcl file and have not been able to break it.
Comment 6 Henry Stiles 2011-08-04 22:01:47 UTC
Fixed in

http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=7e4051f