9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] 'page' bottom-top turning troubles
@ 2000-06-26 16:32 Russ Cox
  2000-06-27  8:31 ` Wladimir Mutel
  0 siblings, 1 reply; 5+ messages in thread
From: Russ Cox @ 2000-06-26 16:32 UTC (permalink / raw)
  To: 9fans

Typing 'u' in page causes the whole system
to freeze while it does the rotation; it will
come back once the rotation has happened.

There are a number of problems here, most of
them my fault.  First, page is using the
draw(3) driver to do the actual rotation.
It uses O(log Dx+log Dy) draw operations
to make the driver rotate the image in
memory, rather than sucking down all the
bits, performing the operation itself, and
sending them back.  This was a big win for
previewing bitmaps over remote lines when
I wrote that code, and it still is, usually.

The draw driver is single-threaded, mainly
to avoid deadlock when trying to acquire
exclusive access to the images in question,
or the underlying data structures.  Combine
this with the fact that calls to the draw
driver are buffered by libdraw, so that page
queues up its entire list of commands and
sends them in one big swoop to the driver.
Now the driver sits and rotates the image,
doing nothing else until it is done.

This would not be a problem except that
the draw operator is very hard to implement
efficiently for the general case.  The strategy
then was to get a decent general case and
have code that handles most of the common
cases very efficiently.  Copying >= 8-bit
images around via boolean masks was special
cased, but copying < 8-bit images via boolean
masks was not, so you're getting hit by the
general case code for what is quite a lot
of computation.  If you view an 8-bit image
or a true color image, u is much much faster.

When someone else noticed this problem a
while ago, I started to write the special
code for exactly the case you are running
into, and I got disgusted by the fact that
we constantly had to do this.  That's why
I started the on-the-fly x86 compiler to
see how much of a win there was to be had
in getting reasonable code without the hugeness
of all the special cases.  I had also hoped
that the second pass through implementing
the draw operator might lend some insights
toward doing a portable one in a more efficient
manner.  As I said a couple weeks ago, I
stopped working on the code generator version
at some point and never got back to it.
So typing u is still embarrassingly slow
on < 8-bit images.

So that's the cause; the only quick solution
at present is to view a higher-depth image.

Russ


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] 'page' bottom-top turning troubles
  2000-06-26 16:32 [9fans] 'page' bottom-top turning troubles Russ Cox
@ 2000-06-27  8:31 ` Wladimir Mutel
  2000-06-28  3:45   ` Eric Dorman
  0 siblings, 1 reply; 5+ messages in thread
From: Wladimir Mutel @ 2000-06-27  8:31 UTC (permalink / raw)
  To: 9fans

Russ Cox <rsc@plan9.bell-labs.com> wrote:

> cases very efficiently.  Copying >= 8-bit
> images around via boolean masks was special
> cased, but copying < 8-bit images via boolean
> masks was not, so you're getting hit by the
> general case code for what is quite a lot
> of computation.  If you view an 8-bit image
> or a true color image, u is much much faster.

	Yes I view in 800x600x8bits mode,
	my videocard is a kind of S3Trio64 (Trio64V2).

> So typing u is still embarrassingly slow
> on < 8-bit images.

	I have exactly 8 bits per pixel. It is 'gs' output viewed by
	'page', hope its depth is not less than 8 ?

> So that's the cause; the only quick solution
> at present is to view a higher-depth image.

	Unfortunately my videocard does not seem to work in 16 or more
	bpps, as 'supported hardware' reads.

--
mwg@alkar.net


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] 'page' bottom-top turning troubles
  2000-06-27  8:31 ` Wladimir Mutel
@ 2000-06-28  3:45   ` Eric Dorman
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Dorman @ 2000-06-28  3:45 UTC (permalink / raw)
  To: 9fans

----- Original Message -----
From: "Wladimir Mutel" <mwg@alkar.net>
To: <9fans@cse.psu.edu>
Sent: Tuesday, June 27, 2000 1:31 AM
Subject: Re: [9fans] 'page' bottom-top turning troubles


> Russ Cox <rsc@plan9.bell-labs.com> wrote:
[stuff]
> Unfortunately my videocard does not seem to work in 16 or more
> bpps, as 'supported hardware' reads.

the Trio64V2 should do 1280x1024x8, 1024x768x16 and 800x600x24
(according to the doc); aux/vga just doesn't support the higher depth modes.
i hope to tackle that one soon.. if you're interested in working on that i
have the S3 docs (open disclosure) or you can get them from S3.

> mwg@alkar.net

regards,

Eric Dorman
edorman@san.rr.com




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] 'page' bottom-top turning troubles
@ 2000-06-28 19:14 rsc
  0 siblings, 0 replies; 5+ messages in thread
From: rsc @ 2000-06-28 19:14 UTC (permalink / raw)
  To: 9fans

	I have exactly 8 bits per pixel. It is 'gs' output viewed by
	'page', hope its depth is not less than 8 ?

I wasn't talking about the depth of
the screen but the depth of the actual
image, which can be (and often is)
different.

Gs produces a depth as small as possible.
If you like, you could edit /sys/src/cmd/gs/src/gdevifno.c
to always produce 8-bit images; change
	idev->ldepth = 0
to
	idev->ldepth = 3
in inferno_open().

I haven't done that because the right fix is
to get draw correct instead, and because the
driver needs to be updated for the new color
scheme anyway.

Russ



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [9fans] 'page' bottom-top turning troubles
@ 2000-06-26  9:00 Wladimir Mutel
  0 siblings, 0 replies; 5+ messages in thread
From: Wladimir Mutel @ 2000-06-26  9:00 UTC (permalink / raw)
  To: 9fans

	Greetings,

	At last I read 'man page' and started to see how it works.
	I noticed that whe I press 'u' to turn page bottom-top, rest
	windows get freezed, i.e. by left-clicking on any other window it does
	not become active and topmost. Whole window system except mouse
	cursor gets freezed ! May be I missed something about time-sharing
	in Plan9 ? Please explain the cause and may be give some help .

	Thanks.

--
mwg@alkar.net


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2000-06-28 19:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-26 16:32 [9fans] 'page' bottom-top turning troubles Russ Cox
2000-06-27  8:31 ` Wladimir Mutel
2000-06-28  3:45   ` Eric Dorman
  -- strict thread matches above, loose matches on Subject: below --
2000-06-28 19:14 rsc
2000-06-26  9:00 Wladimir Mutel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).