Closed Bug 309571 Opened 19 years ago Closed 18 years ago

create accelerated cairo backend for Mac OS X

Categories

(Core Graveyard :: GFX: Mac, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: jaas, Assigned: jaas)

References

Details

Attachments

(3 files)

This bug is for coordinating development of an accelerated cairo backend for Mac
OS X. I'll be posting my test apps, cairo backend work and whatnot. This should
make it easier for people to start helping out if they can.
I use this to create png reference images so I can compare what I'm getting
with my in-development backend to a more correct backend. Its simple, but I
figure it might be useful to others, so here it is.

Read the file for instructions on how to use it.
This is a cocoa test app for drawing with cairo into an NSView. Unpack it, and
the rest should be self explanatory.
(In reply to comment #1)
> pngout - a utility for creating png reference images (read file for
> instructions)

Out of curiousity, what's wrong with cairo's "make check"?
I don't really know what that is. I just use pngout when I have some code in my
cocoa test app and I want to see what it would render as a png. I just copy the
code out, paste it into pngout, source a file to compile pngout and execute it.
Then I can see what the quartz backend *should* be drawing for any given piece
of code.
This is a cleaned-up reference backend that only accelerates rects, with no
fallback. I'm working on cleaning up trapezoids now, but I figured I'd throw
this up now for reference.
Comment on attachment 197067 [details]
reference backend that only accelerates rects, no fallback

>static cairo_int_status_t
>_cairo_quartz_surface_fill_rect (void                 *abstract_surface,
>                                 cairo_operator_t      operator,
>                                 const cairo_color_t  *color,
>                                 cairo_rectangle_t    *rects,
>                                 int                   num_rects) {
>  cairo_quartz_surface_t *surface = abstract_surface;
>  int i;
>  
>  // Don't draw with XOR operator since on CG it works only for
>  // black and white images. Just say we did it and move on.
>  if (operator == CAIRO_OPERATOR_XOR)
>    return CAIRO_STATUS_SUCCESS;

You can't just silently fail operations in the backend.  You either need to
handle every possible case cairo can throw at you, or return
CAIRO_INT_STATUS_UNSUPPORTED and let the fallbacks happen, which means
implementing _cairo_quartz_surface_acquire/release_dest_image.
I'm very encouraged to see interest in fixing up cairo's quartz backend.

We've got "mark Quartz backend as supported" on the cairo roadmap already:

        http://cairographics.org/ROADMAP

I put that on the 1.4.0 schedule instead of 1.2.0 only because I didn't know
of anyone actively working on it. We could move that up if there was some good
momentum.

As for cairo's "make check", you will notice this is sub-item #1 on the cairo
roadmap. What this is is a test suite within cairo/test in the cairo source
tree. It executes several tests against multiple backends, comparing the
.png image resulting from each backend against a reference image.

The order I'd like to see this development happen in is:

1) Add quartz backend support to cairo's "make check". (See stub functions
   in cairo/test/cairo-test.c)

2) Get it to pass all tests, (using fallbacks whenever necessary to get
   correct results).

3) Add optimization and acceleration incrementally, always preserving correct
   results.

I would also love to have all of this work happen within cairo's CVS tree.
The quartz backend was marked "experimental" in the cairo 1.0.0 release,
so we don't really have any regressions to worry about as far as what code
is committed to the HEAD of cairo's CVS tree.

See the following instructions for how to get CVS commit access to cairo:

    http://freedesktop.org/wiki/AccountRequests

I find it very easy to give commit access out when people have any code in
hand.

Also, it would be nice if this development would be discussed on cairo's
mailing list (cairo@cairographics.org). Subscription details are available here:

    http://cairographics.org/lists

I don't really see anything mozilla-specific in this bug report.

-Carl
"You can't just silently fail operations in the backend."

You *can*, but we shouldn't, however, I'm not seeing too many better options if
we can't find a way to get dest pixels from a CGContextRef. I like the theory,
but I like a working practical backend even more.

"which means implementing _cairo_quartz_surface_acquire/release_dest_image."

Exactly. See what I said above about not having a way to do that if we're going
to accelerate. Of course I tried doing that first.

That file is not code I'm suggesting we check in or anything. It is simply a
reference - use what is there, don't use it as a reference for what is not there.

"I don't really see anything mozilla-specific in this bug report."

This bug is just a place for me to throw my files so they are preserved in a
clean state and people (including me when I move from machine to machine) can
reference them.
This bug isn't really useful any more. The work is being or has been done elsewhere.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → INVALID
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: