[Nouveau] [PATCH v3] drm/nouveau: Add support to control backlight using bl_power for nva3.

2022-11-04 Thread Antonio Gomes
From: antoniospg 

Summary:

* Add support to turn on/off backlight when changing values in bl_power
  file. This is achieved by using function backlight_get_brightness()
  in nva3_set_intensity to get current brightness.

Test plan:

* Turn off:
echo 1 > /sys/class/backlight/nv_backlight/bl_power

* Turn on:
echo 0 > /sys/class/backlight/nv_backlight/bl_power

Signed-off-by: antoniospg 
---
 drivers/gpu/drm/nouveau/nouveau_backlight.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c 
b/drivers/gpu/drm/nouveau/nouveau_backlight.c
index a2141d3d9b1d..5c82f5189b79 100644
--- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
+++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
@@ -263,7 +263,11 @@ nva3_set_intensity(struct backlight_device *bd)
u32 div, val;
 
div = nvif_rd32(device, NV50_PDISP_SOR_PWM_DIV(or));
-   val = (bd->props.brightness * div) / 100;
+
+   val = backlight_get_brightness(bd);
+   if (val)
+   val = (val * div) / 100;
+
if (div) {
nvif_wr32(device, NV50_PDISP_SOR_PWM_CTL(or),
  val |
-- 
2.25.1



[Nouveau] [PATCH v3] drm/nouveau: Add support to control backlight using bl_power for nva3.

2022-11-04 Thread Antonio Gomes
From: antoniospg 

Summary:

* Add support to turn on/off backlight when changing values in bl_power
  file. This is achieved by using function backlight_get_brightness()
  in nva3_set_intensity to get current brightness.

Test plan:

* Turn off:
echo 1 > /sys/class/backlight/nv_backlight/bl_power

* Turn on:
echo 0 > /sys/class/backlight/nv_backlight/bl_power

Signed-off-by: antoniospg 
---
 drivers/gpu/drm/nouveau/nouveau_backlight.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c 
b/drivers/gpu/drm/nouveau/nouveau_backlight.c
index a2141d3d9b1d..5c82f5189b79 100644
--- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
+++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
@@ -263,7 +263,11 @@ nva3_set_intensity(struct backlight_device *bd)
u32 div, val;
 
div = nvif_rd32(device, NV50_PDISP_SOR_PWM_DIV(or));
-   val = (bd->props.brightness * div) / 100;
+
+   val = backlight_get_brightness(bd);
+   if (val)
+   val = (val * div) / 100;
+
if (div) {
nvif_wr32(device, NV50_PDISP_SOR_PWM_CTL(or),
  val |
-- 
2.25.1



Re: [Nouveau] TV Out question

2022-11-04 Thread Lukas Satin
Switch to 360x240 works, but it is only scaled to 640x480.

I read that it should be possible to set particular TV chipset registers
and there's nvtv utility for that:
https://manpages.ubuntu.com/manpages/focal/man1/nvtv.1x.html

I guess it will work only with nvidia driver, which in NV40 case is legacy
304 series, which means compiling custom kernel and patching it on Ubuntu
18:
http://blog.schmorp.de/2019-08-03-nvidia-legacy-304-patch-for-post-50-linux-kernels.html

It would be great if your nuvo can set these tv chipset registers as well.

I collect retro hardware and I'm retrogamer (born 1987). There are
significant costs, most retrogamers buy 500 Eur video converter because
they want to output 240p TV resolution.

Currently only Calamity's CRT EmuDriver works and that one is for AMD
GPU's only.

For NVIDIA you need Linux kernel with 15Khz fix (which I have):
https://github.com/D0023R/linux_kernel_15khz and then you can output 15khz
240P over VGA, DVI-I or even HDMI. Then you apply some kind of adapter, for
example HDMI to VGA or DVI to VGA. Then you can use VGA to BNC cable and
use BNC directly in TV or you can buy RCA BNC connector and go from HDMI to
RCA and it will output directly 240p using custom made modelines and
enabling either custom unsigned AMD driver or having Linux kernel with
15khz patch.

Controlling TV out chipset directly would be the next level and it would be
great if it could be achieved.

On Fri, Nov 4, 2022 at 6:29 PM Lukas Satin  wrote:

> Yes, switching to 360x240 works! Interesting...it is definitely a step
> forward while still not satisfying result.
>
> On Fri, Nov 4, 2022 at 6:13 PM Lukas Satin  wrote:
>
>> 1) Some people here say: " Scrap everything already stated. The old
>> Nvidia cards with the mini DIN analog video out can ONLY do 480i output.
>> 240p is not an option."
>>
>> Source:
>> https://www.reddit.com/r/crtgaming/comments/a9k85n/old_nvidia_geforce_output_240p/
>>
>> But I guess that is due to using Windows and NVIDIA driver.
>>
>> 2) Here:
>> https://www.reddit.com/r/retrogaming/comments/40dv00/240p_signal_from_svideo_port_on_old_video_card/
>> someone says: "240p doesn't actually exist, it's really a trick that
>> uses a non-standard 480i signal to cause the alternating fields line up the
>> scanlines instead of offsetting them. "
>>
>> So I guess it could be done by sending non-standard 480i signal.
>>
>> On Fri, Nov 4, 2022 at 6:06 PM Ilia Mirkin  wrote:
>>
>>> On Fri, Nov 4, 2022 at 12:56 PM Lukas Satin 
>>> wrote:
>>> >
>>> > Hello, sorry fo the typos. Wanted to catch you before the weekend, to
>>> get some hints for upcoming work.
>>> >
>>> > I'm back at PC.
>>> >
>>> > Does your driver support switching to 240p in NTSC and 288p in PAL on
>>> the go via xrandr, for example?
>>> >
>>> > If not, can I find some relevant part of code in your repository where
>>> to implement that?
>>>
>>>
>>> https://cgit.freedesktop.org/drm/drm/tree/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
>>> + tvmodesnv17.c
>>>
>>> There's definitely a lot of hard-coding going on. A lot of the
>>> pre-nv50 display code is from This code is (likely) originally from
>>> https://cgit.freedesktop.org/xorg/driver/xf86-video-nv/tree/src but I
>>> can't immediately find the TV code in there. But perhaps it's there
>>> anyways, I only spent about 30s looking for it.
>>>
>>> I don't remember by now, but there _might_ be a kms property (which
>>> should get piped through to xrandr properties) which allows you to
>>> change this live?
>>>
>>> > Some info I found regarding 240p and that it is a part of NTSC:
>>> https://en.wikipedia.org/wiki/Low-definition_television
>>> >
>>> > TV with S-Video mostly supports 480i and 240p as well. So the current
>>> issue is outputting that via TV out.
>>> >
>>> > My current configuration looks like this:
>>> > TV-1 connected 240x224+0+0 (normal left inverted right x axis y axis)
>>> 0mm x 0mm
>>> >720x480   59.94 +
>>> >1024x768  59.94
>>> >800x600   59.94
>>> >720x576   59.94
>>> >640x480   59.94
>>> >400x300   59.94
>>> >320x240   59.93
>>> >320x200   59.94
>>> >768x576   50.00
>>> >360x200   60.00
>>> >360x240   60.00
>>> >640x240   60.00
>>> >SR-1_240x224@60.10  60.10*
>>> >
>>> > I see I have created 240x224 (I need to fix that), but even 320x240
>>> does not work. It always stays at 480i.
>>>
>>> Did you try 360x240? I have no idea though, sorry. I was just happy
>>> when the S-Video worked at all. It could require further modifications
>>> to how we configure those registers.
>>>
>>


Re: [Nouveau] TV Out question

2022-11-04 Thread Lukas Satin
Yes, switching to 360x240 works! Interesting...it is definitely a step
forward while still not satisfying result.

On Fri, Nov 4, 2022 at 6:13 PM Lukas Satin  wrote:

> 1) Some people here say: " Scrap everything already stated. The old
> Nvidia cards with the mini DIN analog video out can ONLY do 480i output.
> 240p is not an option."
>
> Source:
> https://www.reddit.com/r/crtgaming/comments/a9k85n/old_nvidia_geforce_output_240p/
>
> But I guess that is due to using Windows and NVIDIA driver.
>
> 2) Here:
> https://www.reddit.com/r/retrogaming/comments/40dv00/240p_signal_from_svideo_port_on_old_video_card/
> someone says: "240p doesn't actually exist, it's really a trick that uses
> a non-standard 480i signal to cause the alternating fields line up the
> scanlines instead of offsetting them. "
>
> So I guess it could be done by sending non-standard 480i signal.
>
> On Fri, Nov 4, 2022 at 6:06 PM Ilia Mirkin  wrote:
>
>> On Fri, Nov 4, 2022 at 12:56 PM Lukas Satin  wrote:
>> >
>> > Hello, sorry fo the typos. Wanted to catch you before the weekend, to
>> get some hints for upcoming work.
>> >
>> > I'm back at PC.
>> >
>> > Does your driver support switching to 240p in NTSC and 288p in PAL on
>> the go via xrandr, for example?
>> >
>> > If not, can I find some relevant part of code in your repository where
>> to implement that?
>>
>>
>> https://cgit.freedesktop.org/drm/drm/tree/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
>> + tvmodesnv17.c
>>
>> There's definitely a lot of hard-coding going on. A lot of the
>> pre-nv50 display code is from This code is (likely) originally from
>> https://cgit.freedesktop.org/xorg/driver/xf86-video-nv/tree/src but I
>> can't immediately find the TV code in there. But perhaps it's there
>> anyways, I only spent about 30s looking for it.
>>
>> I don't remember by now, but there _might_ be a kms property (which
>> should get piped through to xrandr properties) which allows you to
>> change this live?
>>
>> > Some info I found regarding 240p and that it is a part of NTSC:
>> https://en.wikipedia.org/wiki/Low-definition_television
>> >
>> > TV with S-Video mostly supports 480i and 240p as well. So the current
>> issue is outputting that via TV out.
>> >
>> > My current configuration looks like this:
>> > TV-1 connected 240x224+0+0 (normal left inverted right x axis y axis)
>> 0mm x 0mm
>> >720x480   59.94 +
>> >1024x768  59.94
>> >800x600   59.94
>> >720x576   59.94
>> >640x480   59.94
>> >400x300   59.94
>> >320x240   59.93
>> >320x200   59.94
>> >768x576   50.00
>> >360x200   60.00
>> >360x240   60.00
>> >640x240   60.00
>> >SR-1_240x224@60.10  60.10*
>> >
>> > I see I have created 240x224 (I need to fix that), but even 320x240
>> does not work. It always stays at 480i.
>>
>> Did you try 360x240? I have no idea though, sorry. I was just happy
>> when the S-Video worked at all. It could require further modifications
>> to how we configure those registers.
>>
>


Re: [Nouveau] TV Out question

2022-11-04 Thread Lukas Satin
1) Some people here say: " Scrap everything already stated. The old Nvidia
cards with the mini DIN analog video out can ONLY do 480i output. 240p is
not an option."

Source:
https://www.reddit.com/r/crtgaming/comments/a9k85n/old_nvidia_geforce_output_240p/

But I guess that is due to using Windows and NVIDIA driver.

2) Here:
https://www.reddit.com/r/retrogaming/comments/40dv00/240p_signal_from_svideo_port_on_old_video_card/
someone says: "240p doesn't actually exist, it's really a trick that uses a
non-standard 480i signal to cause the alternating fields line up the
scanlines instead of offsetting them. "

So I guess it could be done by sending non-standard 480i signal.

On Fri, Nov 4, 2022 at 6:06 PM Ilia Mirkin  wrote:

> On Fri, Nov 4, 2022 at 12:56 PM Lukas Satin  wrote:
> >
> > Hello, sorry fo the typos. Wanted to catch you before the weekend, to
> get some hints for upcoming work.
> >
> > I'm back at PC.
> >
> > Does your driver support switching to 240p in NTSC and 288p in PAL on
> the go via xrandr, for example?
> >
> > If not, can I find some relevant part of code in your repository where
> to implement that?
>
>
> https://cgit.freedesktop.org/drm/drm/tree/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
> + tvmodesnv17.c
>
> There's definitely a lot of hard-coding going on. A lot of the
> pre-nv50 display code is from This code is (likely) originally from
> https://cgit.freedesktop.org/xorg/driver/xf86-video-nv/tree/src but I
> can't immediately find the TV code in there. But perhaps it's there
> anyways, I only spent about 30s looking for it.
>
> I don't remember by now, but there _might_ be a kms property (which
> should get piped through to xrandr properties) which allows you to
> change this live?
>
> > Some info I found regarding 240p and that it is a part of NTSC:
> https://en.wikipedia.org/wiki/Low-definition_television
> >
> > TV with S-Video mostly supports 480i and 240p as well. So the current
> issue is outputting that via TV out.
> >
> > My current configuration looks like this:
> > TV-1 connected 240x224+0+0 (normal left inverted right x axis y axis)
> 0mm x 0mm
> >720x480   59.94 +
> >1024x768  59.94
> >800x600   59.94
> >720x576   59.94
> >640x480   59.94
> >400x300   59.94
> >320x240   59.93
> >320x200   59.94
> >768x576   50.00
> >360x200   60.00
> >360x240   60.00
> >640x240   60.00
> >SR-1_240x224@60.10  60.10*
> >
> > I see I have created 240x224 (I need to fix that), but even 320x240 does
> not work. It always stays at 480i.
>
> Did you try 360x240? I have no idea though, sorry. I was just happy
> when the S-Video worked at all. It could require further modifications
> to how we configure those registers.
>


Re: [Nouveau] TV Out question

2022-11-04 Thread Ilia Mirkin
On Fri, Nov 4, 2022 at 12:56 PM Lukas Satin  wrote:
>
> Hello, sorry fo the typos. Wanted to catch you before the weekend, to get 
> some hints for upcoming work.
>
> I'm back at PC.
>
> Does your driver support switching to 240p in NTSC and 288p in PAL on the go 
> via xrandr, for example?
>
> If not, can I find some relevant part of code in your repository where to 
> implement that?

https://cgit.freedesktop.org/drm/drm/tree/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
+ tvmodesnv17.c

There's definitely a lot of hard-coding going on. A lot of the
pre-nv50 display code is from This code is (likely) originally from
https://cgit.freedesktop.org/xorg/driver/xf86-video-nv/tree/src but I
can't immediately find the TV code in there. But perhaps it's there
anyways, I only spent about 30s looking for it.

I don't remember by now, but there _might_ be a kms property (which
should get piped through to xrandr properties) which allows you to
change this live?

> Some info I found regarding 240p and that it is a part of NTSC: 
> https://en.wikipedia.org/wiki/Low-definition_television
>
> TV with S-Video mostly supports 480i and 240p as well. So the current issue 
> is outputting that via TV out.
>
> My current configuration looks like this:
> TV-1 connected 240x224+0+0 (normal left inverted right x axis y axis) 0mm x 
> 0mm
>720x480   59.94 +
>1024x768  59.94
>800x600   59.94
>720x576   59.94
>640x480   59.94
>400x300   59.94
>320x240   59.93
>320x200   59.94
>768x576   50.00
>360x200   60.00
>360x240   60.00
>640x240   60.00
>SR-1_240x224@60.10  60.10*
>
> I see I have created 240x224 (I need to fix that), but even 320x240 does not 
> work. It always stays at 480i.

Did you try 360x240? I have no idea though, sorry. I was just happy
when the S-Video worked at all. It could require further modifications
to how we configure those registers.


Re: [Nouveau] TV Out question

2022-11-04 Thread Lukas Satin
240p compatibility list of TVs:
https://static1.squarespace.com/static/51f517f0e4b01da70d01ca2a/t/5a2f36e953450aa1429361d9/1513043690556/240p-TVs_20171211.pdf

Source: https://www.hdretrovision.com/240p

On Fri, Nov 4, 2022 at 5:55 PM Lukas Satin  wrote:

> Hello, sorry fo the typos. Wanted to catch you before the weekend, to get
> some hints for upcoming work.
>
> I'm back at PC.
>
> Does your driver support switching to 240p in NTSC and 288p in PAL on the
> go via xrandr, for example?
>
> If not, can I find some relevant part of code in your repository where to
> implement that?
>
> Some info I found regarding 240p and that it is a part of NTSC:
> https://en.wikipedia.org/wiki/Low-definition_television
>
> TV with S-Video mostly supports 480i and 240p as well. So the current
> issue is outputting that via TV out.
>
> My current configuration looks like this:
> TV-1 connected 240x224+0+0 (normal left inverted right x axis y axis) 0mm
> x 0mm
>720x480   59.94 +
>1024x768  59.94
>800x600   59.94
>720x576   59.94
>640x480   59.94
>400x300   59.94
>320x240   59.93
>320x200   59.94
>768x576   50.00
>360x200   60.00
>360x240   60.00
>640x240   60.00
>SR-1_240x224@60.10  60.10*
>
> I see I have created 240x224 (I need to fix that), but even 320x240 does
> not work. It always stays at 480i.
>
> I read somewhere that older GPU with TV out can do it. Only newer cards in
> Windows cannot do it.
>
> Thank you a lot,
> Lukas
>
>
>
> On Fri, Nov 4, 2022 at 5:43 PM Lukas Satin  wrote:
>
>> Yes I just figured it out an hour ago. It works same as hd480i.
>>
>> Win7 can switch pal and ntsc just by changing desktop tesolution. Wht
>> about here?
>>
>> TV with svideo or component rca supporr 480i and 240p by the spec.
>>
>> I hve added modelines for that. It works via dvi to vga to bnc to rca
>> wity 15khz kernel.
>>
>> How to modify ut driver to outtput 240p via tv out?
>>
>> Imvon phone sorry fot ttyoos
>>
>> On Fri 4. 11. 2022 at 17:35, Ilia Mirkin  wrote:
>>
>>> https://nouveau.freedesktop.org/KernelModuleParameters.html
>>>
>>> Perhaps nouveau.tv_norm=NTSC-M will help get you the 60hz modes? I
>>> haven't played with these options much at all, it has always sorta
>>> Just Worked for me.
>>>
>>> This should have the validation of new modes, make sure you don't run
>>> afoul of this:
>>>
>>>
>>> https://cgit.freedesktop.org/drm/drm/tree/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c#n303
>>>
>>> Cheers,
>>>
>>>   -ilia
>>>
>>> On Thu, Nov 3, 2022 at 10:56 PM Lukas Satin 
>>> wrote:
>>> >
>>> > Hi, I am currently testing Batocera Linux for retrogaming with 15KHz
>>> output on CRT / TV.
>>> >
>>> > The machine I discovered is a certified Windows Media Center / Intel
>>> ViiV machine: Acer iDEA 510
>>> >
>>> > It features:
>>> > RCA component output
>>> > S-Video CVBS output
>>> > S-Video DIN output
>>> > Scart IN / Scart OUT (two DVB-T tuners for realtime playback and
>>> recording)
>>> > DVI-I out
>>> > HDMI out
>>> >
>>> > Laptop style components, MXM module Geforce 7 Go 7600 (NVIDIA Curie).
>>> >
>>> > Now, BIOS default output via RCA component is 640x480 NTSC (480i,
>>> 60Hz). In Windows I can switch between NTSC and PAL (480i or 576i).
>>> >
>>> > As this is EU machine, after BIOS it often defaults to 576i PAL,
>>> unless set otherwise.
>>> >
>>> > Now your nouveau driver therefore defaults to 576i.
>>> >
>>> > Xrandr looks like this:
>>> > TV-1 connected 640x480+0+0 (normal left inverted right x axis y axis)
>>> 0mm x 0mm
>>> >720x576   50.00 +
>>> >1024x768  50.00
>>> >800x600   50.00
>>> >720x480   50.00
>>> >640x480   50.00*
>>> >400x300   50.00
>>> >320x240   50.00
>>> >320x200   50.00
>>> >768x576   50.00
>>> >360x200   60.00
>>> >360x240   60.00
>>> >640x240   60.00
>>> >
>>> > I tried to add some additional modelines. But look at 640x480. It
>>> forces 50Hz and I am unable to remove it, create new or change it to 60Hz.
>>> Therefore the TV is always set to 576i and screen output is 640x480,
>>> therefore it looks like GPU scaled. First I read your troubleshooting which
>>> mentions scaling, so I tried to disable scaling. Did not help.
>>> >
>>> > Now I read about this:
>>> >
>>> https://nvidia.custhelp.com/app/answers/detail/a_id/177/~/linux---configuring-tv-out
>>> >
>>> > And this might be the solution and issue. It would correspond with
>>> what can be observed in Windows 7.
>>> >
>>> > Does your driver have some options for configuring TV Out and name
>>> switching from PAL to NTSC or HD480i mode? It should be automatic based on
>>> 480i or 576i or 240p or 288p, but it is not.
>>> >
>>> > Thanks,
>>> > Lukas
>>>
>>


Re: [Nouveau] TV Out question

2022-11-04 Thread Lukas Satin
Hello, sorry fo the typos. Wanted to catch you before the weekend, to get
some hints for upcoming work.

I'm back at PC.

Does your driver support switching to 240p in NTSC and 288p in PAL on the
go via xrandr, for example?

If not, can I find some relevant part of code in your repository where to
implement that?

Some info I found regarding 240p and that it is a part of NTSC:
https://en.wikipedia.org/wiki/Low-definition_television

TV with S-Video mostly supports 480i and 240p as well. So the current issue
is outputting that via TV out.

My current configuration looks like this:
TV-1 connected 240x224+0+0 (normal left inverted right x axis y axis) 0mm x
0mm
   720x480   59.94 +
   1024x768  59.94
   800x600   59.94
   720x576   59.94
   640x480   59.94
   400x300   59.94
   320x240   59.93
   320x200   59.94
   768x576   50.00
   360x200   60.00
   360x240   60.00
   640x240   60.00
   SR-1_240x224@60.10  60.10*

I see I have created 240x224 (I need to fix that), but even 320x240 does
not work. It always stays at 480i.

I read somewhere that older GPU with TV out can do it. Only newer cards in
Windows cannot do it.

Thank you a lot,
Lukas



On Fri, Nov 4, 2022 at 5:43 PM Lukas Satin  wrote:

> Yes I just figured it out an hour ago. It works same as hd480i.
>
> Win7 can switch pal and ntsc just by changing desktop tesolution. Wht
> about here?
>
> TV with svideo or component rca supporr 480i and 240p by the spec.
>
> I hve added modelines for that. It works via dvi to vga to bnc to rca wity
> 15khz kernel.
>
> How to modify ut driver to outtput 240p via tv out?
>
> Imvon phone sorry fot ttyoos
>
> On Fri 4. 11. 2022 at 17:35, Ilia Mirkin  wrote:
>
>> https://nouveau.freedesktop.org/KernelModuleParameters.html
>>
>> Perhaps nouveau.tv_norm=NTSC-M will help get you the 60hz modes? I
>> haven't played with these options much at all, it has always sorta
>> Just Worked for me.
>>
>> This should have the validation of new modes, make sure you don't run
>> afoul of this:
>>
>>
>> https://cgit.freedesktop.org/drm/drm/tree/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c#n303
>>
>> Cheers,
>>
>>   -ilia
>>
>> On Thu, Nov 3, 2022 at 10:56 PM Lukas Satin  wrote:
>> >
>> > Hi, I am currently testing Batocera Linux for retrogaming with 15KHz
>> output on CRT / TV.
>> >
>> > The machine I discovered is a certified Windows Media Center / Intel
>> ViiV machine: Acer iDEA 510
>> >
>> > It features:
>> > RCA component output
>> > S-Video CVBS output
>> > S-Video DIN output
>> > Scart IN / Scart OUT (two DVB-T tuners for realtime playback and
>> recording)
>> > DVI-I out
>> > HDMI out
>> >
>> > Laptop style components, MXM module Geforce 7 Go 7600 (NVIDIA Curie).
>> >
>> > Now, BIOS default output via RCA component is 640x480 NTSC (480i,
>> 60Hz). In Windows I can switch between NTSC and PAL (480i or 576i).
>> >
>> > As this is EU machine, after BIOS it often defaults to 576i PAL, unless
>> set otherwise.
>> >
>> > Now your nouveau driver therefore defaults to 576i.
>> >
>> > Xrandr looks like this:
>> > TV-1 connected 640x480+0+0 (normal left inverted right x axis y axis)
>> 0mm x 0mm
>> >720x576   50.00 +
>> >1024x768  50.00
>> >800x600   50.00
>> >720x480   50.00
>> >640x480   50.00*
>> >400x300   50.00
>> >320x240   50.00
>> >320x200   50.00
>> >768x576   50.00
>> >360x200   60.00
>> >360x240   60.00
>> >640x240   60.00
>> >
>> > I tried to add some additional modelines. But look at 640x480. It
>> forces 50Hz and I am unable to remove it, create new or change it to 60Hz.
>> Therefore the TV is always set to 576i and screen output is 640x480,
>> therefore it looks like GPU scaled. First I read your troubleshooting which
>> mentions scaling, so I tried to disable scaling. Did not help.
>> >
>> > Now I read about this:
>> >
>> https://nvidia.custhelp.com/app/answers/detail/a_id/177/~/linux---configuring-tv-out
>> >
>> > And this might be the solution and issue. It would correspond with what
>> can be observed in Windows 7.
>> >
>> > Does your driver have some options for configuring TV Out and name
>> switching from PAL to NTSC or HD480i mode? It should be automatic based on
>> 480i or 576i or 240p or 288p, but it is not.
>> >
>> > Thanks,
>> > Lukas
>>
>


Re: [Nouveau] TV Out question

2022-11-04 Thread Lukas Satin
Yes I just figured it out an hour ago. It works same as hd480i.

Win7 can switch pal and ntsc just by changing desktop tesolution. Wht about
here?

TV with svideo or component rca supporr 480i and 240p by the spec.

I hve added modelines for that. It works via dvi to vga to bnc to rca wity
15khz kernel.

How to modify ut driver to outtput 240p via tv out?

Imvon phone sorry fot ttyoos

On Fri 4. 11. 2022 at 17:35, Ilia Mirkin  wrote:

> https://nouveau.freedesktop.org/KernelModuleParameters.html
>
> Perhaps nouveau.tv_norm=NTSC-M will help get you the 60hz modes? I
> haven't played with these options much at all, it has always sorta
> Just Worked for me.
>
> This should have the validation of new modes, make sure you don't run
> afoul of this:
>
>
> https://cgit.freedesktop.org/drm/drm/tree/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c#n303
>
> Cheers,
>
>   -ilia
>
> On Thu, Nov 3, 2022 at 10:56 PM Lukas Satin  wrote:
> >
> > Hi, I am currently testing Batocera Linux for retrogaming with 15KHz
> output on CRT / TV.
> >
> > The machine I discovered is a certified Windows Media Center / Intel
> ViiV machine: Acer iDEA 510
> >
> > It features:
> > RCA component output
> > S-Video CVBS output
> > S-Video DIN output
> > Scart IN / Scart OUT (two DVB-T tuners for realtime playback and
> recording)
> > DVI-I out
> > HDMI out
> >
> > Laptop style components, MXM module Geforce 7 Go 7600 (NVIDIA Curie).
> >
> > Now, BIOS default output via RCA component is 640x480 NTSC (480i, 60Hz).
> In Windows I can switch between NTSC and PAL (480i or 576i).
> >
> > As this is EU machine, after BIOS it often defaults to 576i PAL, unless
> set otherwise.
> >
> > Now your nouveau driver therefore defaults to 576i.
> >
> > Xrandr looks like this:
> > TV-1 connected 640x480+0+0 (normal left inverted right x axis y axis)
> 0mm x 0mm
> >720x576   50.00 +
> >1024x768  50.00
> >800x600   50.00
> >720x480   50.00
> >640x480   50.00*
> >400x300   50.00
> >320x240   50.00
> >320x200   50.00
> >768x576   50.00
> >360x200   60.00
> >360x240   60.00
> >640x240   60.00
> >
> > I tried to add some additional modelines. But look at 640x480. It forces
> 50Hz and I am unable to remove it, create new or change it to 60Hz.
> Therefore the TV is always set to 576i and screen output is 640x480,
> therefore it looks like GPU scaled. First I read your troubleshooting which
> mentions scaling, so I tried to disable scaling. Did not help.
> >
> > Now I read about this:
> >
> https://nvidia.custhelp.com/app/answers/detail/a_id/177/~/linux---configuring-tv-out
> >
> > And this might be the solution and issue. It would correspond with what
> can be observed in Windows 7.
> >
> > Does your driver have some options for configuring TV Out and name
> switching from PAL to NTSC or HD480i mode? It should be automatic based on
> 480i or 576i or 240p or 288p, but it is not.
> >
> > Thanks,
> > Lukas
>


Re: [Nouveau] TV Out question

2022-11-04 Thread Ilia Mirkin
https://nouveau.freedesktop.org/KernelModuleParameters.html

Perhaps nouveau.tv_norm=NTSC-M will help get you the 60hz modes? I
haven't played with these options much at all, it has always sorta
Just Worked for me.

This should have the validation of new modes, make sure you don't run
afoul of this:

https://cgit.freedesktop.org/drm/drm/tree/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c#n303

Cheers,

  -ilia

On Thu, Nov 3, 2022 at 10:56 PM Lukas Satin  wrote:
>
> Hi, I am currently testing Batocera Linux for retrogaming with 15KHz output 
> on CRT / TV.
>
> The machine I discovered is a certified Windows Media Center / Intel ViiV 
> machine: Acer iDEA 510
>
> It features:
> RCA component output
> S-Video CVBS output
> S-Video DIN output
> Scart IN / Scart OUT (two DVB-T tuners for realtime playback and recording)
> DVI-I out
> HDMI out
>
> Laptop style components, MXM module Geforce 7 Go 7600 (NVIDIA Curie).
>
> Now, BIOS default output via RCA component is 640x480 NTSC (480i, 60Hz). In 
> Windows I can switch between NTSC and PAL (480i or 576i).
>
> As this is EU machine, after BIOS it often defaults to 576i PAL, unless set 
> otherwise.
>
> Now your nouveau driver therefore defaults to 576i.
>
> Xrandr looks like this:
> TV-1 connected 640x480+0+0 (normal left inverted right x axis y axis) 0mm x 
> 0mm
>720x576   50.00 +
>1024x768  50.00
>800x600   50.00
>720x480   50.00
>640x480   50.00*
>400x300   50.00
>320x240   50.00
>320x200   50.00
>768x576   50.00
>360x200   60.00
>360x240   60.00
>640x240   60.00
>
> I tried to add some additional modelines. But look at 640x480. It forces 50Hz 
> and I am unable to remove it, create new or change it to 60Hz. Therefore the 
> TV is always set to 576i and screen output is 640x480, therefore it looks 
> like GPU scaled. First I read your troubleshooting which mentions scaling, so 
> I tried to disable scaling. Did not help.
>
> Now I read about this:
> https://nvidia.custhelp.com/app/answers/detail/a_id/177/~/linux---configuring-tv-out
>
> And this might be the solution and issue. It would correspond with what can 
> be observed in Windows 7.
>
> Does your driver have some options for configuring TV Out and name switching 
> from PAL to NTSC or HD480i mode? It should be automatic based on 480i or 576i 
> or 240p or 288p, but it is not.
>
> Thanks,
> Lukas


Re: [Nouveau] [PATCH v5 02/31] drm/i915: Don't register backlight when another backlight should be used (v2)

2022-11-04 Thread Hans de Goede
Hi Matthew, Rafael,

On 10/27/22 14:09, Rafael J. Wysocki wrote:
> On Thu, Oct 27, 2022 at 12:37 PM Hans de Goede  wrote:
>>
>> Hi,
>>
>> On 10/27/22 11:52, Matthew Garrett wrote:
>>> On Thu, Oct 27, 2022 at 11:39:38AM +0200, Hans de Goede wrote:
>>>
 The *only* behavior which actually is new in 6.1 is the native GPU
 drivers now doing the equivalent of:

  if (acpi_video_get_backlight_type() != acpi_backlight_native)
  return;

 In their backlight register paths (i), which is causing the native
 backlight to disappear on your custom laptop setup and on Chromebooks
 (with the Chromebooks case being already solved I hope.).
>>>
>>> It's causing the backlight control to vanish on any machine that isn't
>>> ((acpi_video || vendor interface) || !acpi). Most machines that fall
>>> into that are either weird or Chromebooks or old, but there are machines
>>> that fall into that.
>>
>> I acknowledge that their are machines that fall into this category,
>> but I expect / hope there to be so few of them that we can just DMI
>> quirk our way out if this.
>>
>> I believe the old group to be small because:
>>
>> 1. Generally speaking the "native" control method is usually not
>> present on the really old (pre ACPI video spec) mobile GPUs.
>>
>> 2. On most old laptops I would still expect there to be a vendor
>> interface too, and if both get registered standard desktop environments
>> will prefer the vendor one, so then we need a native DMI quirk to
>> disable the vendor interface anyways and we already have a bunch of
>> those, so some laptops in this group are already covered by DMI quirks.
>>
>> And a fix for the Chromebook case is already in Linus' tree, which
>> just leaves the weird case, of which there will hopefully be only
>> a few.
>>
>> I do share your worry that this might break some machines, but
>> the only way to really find out is to get this code out there
>> I'm afraid.
>>
>> I have just written a blog post asking for people to check if
>> their laptop might be affected; and to report various details
>> to me of their laptop is affected:
>>
>> https://hansdegoede.dreamwidth.org/26548.html
>>
>> Lets wait and see how this goes. If I get (too) many reports then
>> I will send a revert of the addition of the:
>>
>> if (acpi_video_get_backlight_type() != acpi_backlight_native)
>> return;
>>
>> check to the i915 / radeon / amd / nouveau drivers.
>>
>> (And if I only get a couple of reports I will probably just submit
>> DMI quirks for the affected models).
> 
> Sounds reasonable to me, FWIW.

I have received quite a few test reports as a result of my blogpost
(and of the blogpost's mention in an arstechnica article).

Long story short, Matthew, you are right. Quite a few laptop models
will end up with an empty /sys/class/backlight because of the native
backlight class devices no longer registering when
acpi_video_backlight_use_native() returns false.

I will submit a patch-set later today to fix this (by making 
cpi_video_backlight_use_native() always return true for now).

More detailed summary/analysis of the received test reports:

-30 unaffected models

-The following laptop models:
 Acer Aspire 1640
 Apple MacBook 2.1
 Apple MacBook 4.1
 Apple MacBook Pro 7.1 (uses nv_backligh instead of intel_backlight!)
 HP Compaq nc6120
 IBM ThinkPad X40
 System76 Starling Star1

 All only have a native intel_backlight interface and the heuristics from
 acpi_video_get_backlight_type() return acpi_backlight_vendor there causing
 the changes in 6.1 to not register native backlights when
 acpi_video_backlight_use_native() returns false resulting in an empty
 /sys/class/backlight, breaking users ability to control their laptop
 panel's brightness.

 I will submit a patch to always make acpi_video_backlight_use_native()
 return true for now to work around this for 6.1.

 I do plan to try to re-introduce that change again later. First I need to
 change the heuristics to still native on more models so that on models
 where the native backlight is the only (working) entry they will
 return native.

-The Dell N1410 has acpi_video support and acpi_osi_is_win8() returns false
 so acpi_video_get_backlight_type() returns acpi_video, but acpi_video
 fails to register a backlight device due to a_BCM eval error.
 The intel_backlight interface works fine, but this model is going to need
 a DMI-use-native-quirk to avoid intel_backlight disappearing when
 acpi_video_backlight_use_native() is changed back.

-The following laptop models actually use a vendor backlight control method,
 while also having a native backlight entry under /sys/class/backlight:

 Asus EeePC 901   -> native backlight confirmed to also work
 Dell Latitude D610   -> native backlight confirmed to work better then vendor
 Sony Vaio PCG-FRV3   -> native backlight not tested

 Note these will keep working the same as before in 6.1, independent of
 the revert. I've tracked these 

Re: [Nouveau] [PATCH v3 23/23] drm/fb-helper: Clarify use of last_close and output_poll_changed

2022-11-04 Thread Javier Martinez Canillas
On 11/3/22 16:14, Thomas Zimmermann wrote:
> Clarify documentation in the use of struct drm_driver.last_close and
> struct drm_mode_config_funcs.output_poll_changed. Those callbacks should
> not be said for fbdev implementations on top of struct drm_client_funcs.
> 
> Signed-off-by: Thomas Zimmermann 
> ---

Reviewed-by: Javier Martinez Canillas 

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat



Re: [Nouveau] [PATCH v3 20/23] drm/fb-helper: Set flag in struct drm_fb_helper for leaking physical addresses

2022-11-04 Thread Javier Martinez Canillas
On 11/3/22 16:14, Thomas Zimmermann wrote:
> Uncouple the parameter drm_leak_fbdev_smem from the implementation by
> setting a flag in struct drm_fb_helper. This will help to move the
> generic fbdev emulation into its own source file, while keeping the
> parameter in drm_fb_helper.c. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann 
> ---

Reviewed-by: Javier Martinez Canillas 

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat