public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] omission in video driver
@ 2002-04-01 18:41 Andries.Brouwer
  2002-04-03 13:27 ` Paul Gortmaker
  0 siblings, 1 reply; 4+ messages in thread
From: Andries.Brouwer @ 2002-04-01 18:41 UTC (permalink / raw)
  To: linux-kernel

Documenting the video ioctls, I noticed to my dismay
that the ioctl to set the border color of the console
screen is lacking.

Here part of the fix for 2.4.19:

--- /linux/2.4/linux-2.4.19pre4/linux/drivers/video/vgacon.c	Fri Mar 29 01:02:00 2002
+++ ./vgacon.c	Tue Apr  1 20:14:14 2002
@@ -244,6 +244,14 @@
 				outb_p (6, 0x3ce) ;
 				outb_p (6, 0x3cf) ;
 #endif
+				/*
+				 * Load overscan register red.
+				 */
+				inb_p(0x3da);        /* clear flipflop */
+				outb_p(0x11, 0x3c0); /* index overscan color */
+				outb_p(0x0c, 0x3c0); /* load value */
+				outb_p(0x20, 0x3c0); /* allow display memory
+							to access palette */
 
 				/*
 				 * Normalise the palette registers, to point

Andries

[this is the nontrivial part; the rest is left as an exercise]

^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: [PATCH] omission in video driver
@ 2002-04-03 22:51 Andries.Brouwer
  0 siblings, 0 replies; 4+ messages in thread
From: Andries.Brouwer @ 2002-04-03 22:51 UTC (permalink / raw)
  To: Andries.Brouwer, p_gortmaker; +Cc: linux-kernel

: Heh, you mean "here is the hardware information, please make a patch".
: But your choice of red makes it truly a "bleeding edge" kernel :)

: The fact that we have been using linux for ~ 10 yrs and nobody has
: complained about the lack of this function yet says something...

: Anyway, have a look at this and see if it is what you had in mind.
: I figured it would be sensible to have a per VC colour

Yes, bleeding edge it was.

Adding something like this is allowed only on April 1st.

[But other systems have it. I find that both FreeBSD and UnixWare
have a KDSBORDER ioctl.]

Yes, your patch sounds more or less OK, but more less than more,
since I think that this should be treated completely parallel
to the palette stuff. And that works as follows:
There are ioctls and escape sequences. Escape sequences set
the palette per-VC. Upon reset the palette is reset to a default.
The default is set by ioctl. (And at the moment the ioctl sets
the default, it is also applied to the actual screen.)

[Not that I like this construction so much, but for uniformity..]
[In fact the author of the palette patch did not know the standard
for escape sequences, but nobody stopped him.]

Andries

^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: [PATCH] omission in video driver
@ 2002-04-04 13:13 Andries.Brouwer
  0 siblings, 0 replies; 4+ messages in thread
From: Andries.Brouwer @ 2002-04-04 13:13 UTC (permalink / raw)
  To: linux-kernel

> if you think a linux KDSBORDER is worthwhile

Maybe mostly fun.

> Ok, so if we feed the above four lines through s/palette/border/g
> then we have an acceptable API?

Yes.

>> [In fact the author of the palette patch did not know the standard
>> for escape sequences, but nobody stopped him.]

> Alas, I too don't know what would be the standard/ANSI escape
> sequences for setting border colours

I meant it differently.

Escape sequences have a certain structure described
in various standards, like ISO 6429 (ECMA 48).
That is useful, it enables applications to parse input
into text and escape sequences without knowing of all
escape sequences precisely what they are supposed to do.

For example, for security one might want to have a filter
that removes the escape sequences (or maybe only the
unrecognized escape sequences) from text written to the
terminal.

Attempt to summarize very briefly:
One has
- single byte codes in 0x00-0x1f, like CR, LF, FF, ESC, BEL, etc.
- single byte codes in 0x80-0x9f, also representable as
  ESC followed by a single byte code in 0x40-0x5f.
  For example, CSI can be 0x9b or ESC [.
- two byte sequences of the form ESC followed by a byte in 0x60-0x7e.
- sequences that start with CSI, then zero or more parameter bytes
  in 0x30-0x3f, then zero or more intermediate bytes in 0x20-0x2f,
  then one final byte in 0x40-0x7e.
  For example, a typical sequence might be ESC [ rr ; cc H
  where rr and cc are sequences of decimal digits, and this
  sequence moves the cursor to row rr and column cc.
- finally there sequences that start with an opening delimiter
  (e.g. ESC _ or ESC P or ESC ] or ESC ^ or ESC X) and end
  with a string terminator (0x9c or ESC \).

The palette setting sequence that Linux uses is
ESC ] P nrrggbb. There is no string terminator here.

So, the structure of the sequence is wrong.
The choice of sequence, probably random, with P for palette,
is also wrong, SGR (set graphics rendition) or DCS (device
control string) would have been more logical choices.

Andries

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

end of thread, other threads:[~2002-04-04 13:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-01 18:41 [PATCH] omission in video driver Andries.Brouwer
2002-04-03 13:27 ` Paul Gortmaker
  -- strict thread matches above, loose matches on Subject: below --
2002-04-03 22:51 Andries.Brouwer
2002-04-04 13:13 Andries.Brouwer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox