Re: [PATCH 17/17] drm/cirrus: Use VGA macro constants to unblank

2023-02-20 Thread Gerd Hoffmann
On Mon, Feb 20, 2023 at 03:22:03PM +0100, Thomas Zimmermann wrote:
> Hi
> 
> Am 16.02.23 um 12:33 schrieb Gerd Hoffmann:
> > On Wed, Feb 15, 2023 at 05:15:17PM +0100, Thomas Zimmermann wrote:
> > > Set the VGA bit for unblanking with macro constants instead of magic
> > > values. No functional changes.
> > 
> > blank/unblank should work simliar to bochs (see commit 250e743915d4),
> > that is maybe a nice thing to add of you modernize the driver anyway.
> > 
> > take care,
> >Gerd
> > 
> 
> Do you have comments on the other patches?

Checked briefly only, looked sane overall.  Seems the blit and format
conversions helpers improved alot since I've added them initially (don't
follow drm that closely any more, busy with other stuff), nice to see
cirrus being updated to that and getting dirty tracking support.

Acked-by: Gerd Hoffmann 

take care,
  Gerd



Re: [PATCH 17/17] drm/cirrus: Use VGA macro constants to unblank

2023-02-20 Thread Thomas Zimmermann

Hi

Am 16.02.23 um 12:33 schrieb Gerd Hoffmann:

On Wed, Feb 15, 2023 at 05:15:17PM +0100, Thomas Zimmermann wrote:

Set the VGA bit for unblanking with macro constants instead of magic
values. No functional changes.


blank/unblank should work simliar to bochs (see commit 250e743915d4),
that is maybe a nice thing to add of you modernize the driver anyway.

take care,
   Gerd



Do you have comments on the other patches?

Best regards
Thomas

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 17/17] drm/cirrus: Use VGA macro constants to unblank

2023-02-17 Thread Thomas Zimmermann

Hi

Am 16.02.23 um 18:20 schrieb Ville Syrjälä:

On Thu, Feb 16, 2023 at 02:21:43PM +0100, Thomas Zimmermann wrote:

Hi

Am 16.02.23 um 13:52 schrieb Ville Syrjälä:

On Thu, Feb 16, 2023 at 01:03:02PM +0100, Thomas Zimmermann wrote:

Hi,

thanks for taking a look at the patches.

Am 16.02.23 um 12:33 schrieb Gerd Hoffmann:

On Wed, Feb 15, 2023 at 05:15:17PM +0100, Thomas Zimmermann wrote:

Set the VGA bit for unblanking with macro constants instead of magic
values. No functional changes.


blank/unblank should work simliar to bochs (see commit 250e743915d4),
that is maybe a nice thing to add of you modernize the driver anyway.

Yeah, it's the VGA PAS field. [1] But is it really called blanking? PAS
controls palette access, but blanking is sounds more like DPMS.


Why aren't people just using the normal way of flipping the
screen off bit in sequencer register 01?


Setting the SD bit in SR01 isn't a bad idea. We can do this as part of
enabling/disabling the plane.

But for PAS, we don't have a choice. It's one of the bazillion obscure
VGA settings and (according to a comment in the source code) we need to
update it for compatibility.


Well, you do need to enable the palette to see something
other that border color. Not sure tha't a very obscure thing :P


Pun intended? :D



On a related note, the code looks pretty sketchy. It just
blindly writes to 0x3c0 assuming it is the attribute controller
index register. But unless you explicitly reset the flip-flop
it could actually be the data write register instead. That could
easily happen if the previous access to the attribute controller
was a read since reads do not toggle the register role.


Yeah, the attribute controller is *fun* to work with. In the next 
iteration, I'll probably add a helper to do all this; similar to bochs.


Best regards
Thomas





--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 17/17] drm/cirrus: Use VGA macro constants to unblank

2023-02-16 Thread Ville Syrjälä
On Thu, Feb 16, 2023 at 02:21:43PM +0100, Thomas Zimmermann wrote:
> Hi
> 
> Am 16.02.23 um 13:52 schrieb Ville Syrjälä:
> > On Thu, Feb 16, 2023 at 01:03:02PM +0100, Thomas Zimmermann wrote:
> >> Hi,
> >>
> >> thanks for taking a look at the patches.
> >>
> >> Am 16.02.23 um 12:33 schrieb Gerd Hoffmann:
> >>> On Wed, Feb 15, 2023 at 05:15:17PM +0100, Thomas Zimmermann wrote:
>  Set the VGA bit for unblanking with macro constants instead of magic
>  values. No functional changes.
> >>>
> >>> blank/unblank should work simliar to bochs (see commit 250e743915d4),
> >>> that is maybe a nice thing to add of you modernize the driver anyway.
> >> Yeah, it's the VGA PAS field. [1] But is it really called blanking? PAS
> >> controls palette access, but blanking is sounds more like DPMS.
> > 
> > Why aren't people just using the normal way of flipping the
> > screen off bit in sequencer register 01?
> 
> Setting the SD bit in SR01 isn't a bad idea. We can do this as part of 
> enabling/disabling the plane.
> 
> But for PAS, we don't have a choice. It's one of the bazillion obscure 
> VGA settings and (according to a comment in the source code) we need to 
> update it for compatibility.

Well, you do need to enable the palette to see something
other that border color. Not sure tha't a very obscure thing :P

On a related note, the code looks pretty sketchy. It just
blindly writes to 0x3c0 assuming it is the attribute controller
index register. But unless you explicitly reset the flip-flop
it could actually be the data write register instead. That could
easily happen if the previous access to the attribute controller
was a read since reads do not toggle the register role.

-- 
Ville Syrjälä
Intel


Re: [PATCH 17/17] drm/cirrus: Use VGA macro constants to unblank

2023-02-16 Thread Thomas Zimmermann

Hi

Am 16.02.23 um 13:52 schrieb Ville Syrjälä:

On Thu, Feb 16, 2023 at 01:03:02PM +0100, Thomas Zimmermann wrote:

Hi,

thanks for taking a look at the patches.

Am 16.02.23 um 12:33 schrieb Gerd Hoffmann:

On Wed, Feb 15, 2023 at 05:15:17PM +0100, Thomas Zimmermann wrote:

Set the VGA bit for unblanking with macro constants instead of magic
values. No functional changes.


blank/unblank should work simliar to bochs (see commit 250e743915d4),
that is maybe a nice thing to add of you modernize the driver anyway.

Yeah, it's the VGA PAS field. [1] But is it really called blanking? PAS
controls palette access, but blanking is sounds more like DPMS.


Why aren't people just using the normal way of flipping the
screen off bit in sequencer register 01?


Setting the SD bit in SR01 isn't a bad idea. We can do this as part of 
enabling/disabling the plane.


But for PAS, we don't have a choice. It's one of the bazillion obscure 
VGA settings and (according to a comment in the source code) we need to 
update it for compatibility.


Best regards
Thomas






The PAS setting is actually part of the primary plane, so it's current
location in the CRTC code is misleading. I didn't want to change the
driver logic too much, but I guess I'll fix that in the next iteration.

Best regards
Thomas

[1]
https://web.stanford.edu/class/cs140/projects/pintos/specs/freevga/vga/attrreg.htm#3C0



take care,
Gerd



--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev







--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 17/17] drm/cirrus: Use VGA macro constants to unblank

2023-02-16 Thread Gerd Hoffmann
On Thu, Feb 16, 2023 at 02:52:51PM +0200, Ville Syrjälä wrote:
> On Thu, Feb 16, 2023 at 01:03:02PM +0100, Thomas Zimmermann wrote:
> > Hi,
> > 
> > thanks for taking a look at the patches.
> > 
> > Am 16.02.23 um 12:33 schrieb Gerd Hoffmann:
> > > On Wed, Feb 15, 2023 at 05:15:17PM +0100, Thomas Zimmermann wrote:
> > >> Set the VGA bit for unblanking with macro constants instead of magic
> > >> values. No functional changes.
> > > 
> > > blank/unblank should work simliar to bochs (see commit 250e743915d4),
> > > that is maybe a nice thing to add of you modernize the driver anyway.
> > Yeah, it's the VGA PAS field. [1] But is it really called blanking? PAS 
> > controls palette access, but blanking is sounds more like DPMS.
> 
> Why aren't people just using the normal way of flipping the
> screen off bit in sequencer register 01?

qemu vga emulation doesn't check that bit ...

take care,
  Gerd



Re: [PATCH 17/17] drm/cirrus: Use VGA macro constants to unblank

2023-02-16 Thread Ville Syrjälä
On Thu, Feb 16, 2023 at 01:03:02PM +0100, Thomas Zimmermann wrote:
> Hi,
> 
> thanks for taking a look at the patches.
> 
> Am 16.02.23 um 12:33 schrieb Gerd Hoffmann:
> > On Wed, Feb 15, 2023 at 05:15:17PM +0100, Thomas Zimmermann wrote:
> >> Set the VGA bit for unblanking with macro constants instead of magic
> >> values. No functional changes.
> > 
> > blank/unblank should work simliar to bochs (see commit 250e743915d4),
> > that is maybe a nice thing to add of you modernize the driver anyway.
> Yeah, it's the VGA PAS field. [1] But is it really called blanking? PAS 
> controls palette access, but blanking is sounds more like DPMS.

Why aren't people just using the normal way of flipping the
screen off bit in sequencer register 01?


> 
> The PAS setting is actually part of the primary plane, so it's current 
> location in the CRTC code is misleading. I didn't want to change the 
> driver logic too much, but I guess I'll fix that in the next iteration.
> 
> Best regards
> Thomas
> 
> [1] 
> https://web.stanford.edu/class/cs140/projects/pintos/specs/freevga/vga/attrreg.htm#3C0
> 
> > 
> > take care,
> >Gerd
> > 
> 
> -- 
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Ivo Totev




-- 
Ville Syrjälä
Intel


Re: [PATCH 17/17] drm/cirrus: Use VGA macro constants to unblank

2023-02-16 Thread Gerd Hoffmann
On Thu, Feb 16, 2023 at 01:03:02PM +0100, Thomas Zimmermann wrote:
> Hi,
> 
> thanks for taking a look at the patches.
> 
> Am 16.02.23 um 12:33 schrieb Gerd Hoffmann:
> > On Wed, Feb 15, 2023 at 05:15:17PM +0100, Thomas Zimmermann wrote:
> > > Set the VGA bit for unblanking with macro constants instead of magic
> > > values. No functional changes.
> > 
> > blank/unblank should work simliar to bochs (see commit 250e743915d4),
> > that is maybe a nice thing to add of you modernize the driver anyway.
> Yeah, it's the VGA PAS field. [1] But is it really called blanking? PAS
> controls palette access, but blanking is sounds more like DPMS.

Yes, strictly speaking it is not the same thing. DPMS blank will send
the monitor into suspend mode which this does not.  On virtual hardware
there isn't much of a difference though ;)

take care,
  Gerd



Re: [PATCH 17/17] drm/cirrus: Use VGA macro constants to unblank

2023-02-16 Thread Thomas Zimmermann

Hi,

thanks for taking a look at the patches.

Am 16.02.23 um 12:33 schrieb Gerd Hoffmann:

On Wed, Feb 15, 2023 at 05:15:17PM +0100, Thomas Zimmermann wrote:

Set the VGA bit for unblanking with macro constants instead of magic
values. No functional changes.


blank/unblank should work simliar to bochs (see commit 250e743915d4),
that is maybe a nice thing to add of you modernize the driver anyway.
Yeah, it's the VGA PAS field. [1] But is it really called blanking? PAS 
controls palette access, but blanking is sounds more like DPMS.


The PAS setting is actually part of the primary plane, so it's current 
location in the CRTC code is misleading. I didn't want to change the 
driver logic too much, but I guess I'll fix that in the next iteration.


Best regards
Thomas

[1] 
https://web.stanford.edu/class/cs140/projects/pintos/specs/freevga/vga/attrreg.htm#3C0




take care,
   Gerd



--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 17/17] drm/cirrus: Use VGA macro constants to unblank

2023-02-16 Thread Gerd Hoffmann
On Wed, Feb 15, 2023 at 05:15:17PM +0100, Thomas Zimmermann wrote:
> Set the VGA bit for unblanking with macro constants instead of magic
> values. No functional changes.

blank/unblank should work simliar to bochs (see commit 250e743915d4),
that is maybe a nice thing to add of you modernize the driver anyway.

take care,
  Gerd



[PATCH 17/17] drm/cirrus: Use VGA macro constants to unblank

2023-02-15 Thread Thomas Zimmermann
Set the VGA bit for unblanking with macro constants instead of magic
values. No functional changes.

Signed-off-by: Thomas Zimmermann 
---
 drivers/gpu/drm/tiny/cirrus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c
index ad67fb895213..594bc472862f 100644
--- a/drivers/gpu/drm/tiny/cirrus.c
+++ b/drivers/gpu/drm/tiny/cirrus.c
@@ -509,7 +509,7 @@ static void cirrus_crtc_helper_atomic_enable(struct 
drm_crtc *crtc,
cirrus_mode_set(cirrus, _state->mode);
 
/* Unblank (needed on S3 resume, vgabios doesn't do it then) */
-   outb(0x20, 0x3c0);
+   outb(VGA_AR_ENABLE_DISPLAY, VGA_ATT_W);
 
drm_dev_exit(idx);
 }
-- 
2.39.1