From: John Sledge Subject: Re: DRM Inquiry Date: Thu, 24 May 2018 10:57:01 +0000 (UTC) Message-ID: <524712366.665006.1527159421984@mail.yahoo.com> References: <471791572.2287221.1526561265798.ref@mail.yahoo.com> <471791572.2287221.1526561265798@mail.yahoo.com> <87fu2pxph0.fsf@intel.com> <910225270.614010.1527135594944@mail.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0102738164==" Return-path: In-Reply-To: <910225270.614010.1527135594944@mail.yahoo.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: "dri-devel@lists.freedesktop.org" , Jani Nikula Cc: intel-gfx@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0102738164== Content-Type: multipart/alternative; boundary="----=_Part_665005_353402469.1527159421979" ------=_Part_665005_353402469.1527159421979 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Jani, I was able to update my kernel to 4.6 which has the DRM_DP_AUX_CHARDEV in t= he=C2=A0Kconfig file=C2=A0linux-4.6\drivers\gpu\drm. Though I also add=C2= =A0DRM_DP_AUX_CHARDEV=3Dy in=C2=A0=C2=A0kernel config. When invoke uname -r= , I could see that the kernel is now 4.6. How can I verify the DRM_DP_AUX_CHARDEV takes effect or got configure it co= rrectly? It still unclear to me how to follow what you mean by using DRM DP AUX inte= rface and getting /dev/drm_dp_auxN node(s) that allows me to read and write= arbitrary DPCD offsets.=C2=A0 Please have comments and advice. Regards,John On Thursday, May 24, 2018, 12:19:55 PM GMT+8, John Sledge wrote: =20 =20 Hi Jani, Good day! Thank you for taking the time to point out those information. It=E2=80=99s = a great help to me. Also apologies for the late reply, your first reply went to my spam inbox, = not sure what happen and I was waiting for replies for days. I'm still new to Linux and to DRM. I also need to investigate and learn mor= e about it. Here's what I have done so far. I was able to work on the modeprint test ap= plication from the libdrm package found in the website=C2=A0github.com/grat= e-driver/libdrm. I need to understand how user space and kernel works and m= odeprint provided me a simple understanding how it works.The modeprint requ= ires a module name to open and I provided the i915 module. It followed open= ing the device name then calling ioctl commands to get resources, drm mode = get connectors, encoders and crtc. From here, i was able to detect the disp= lay device's information successfully. So from here I got stuck and got confused. I only notice that in the drm.h = it has limited IOCTL commands which it doesn't reach what i needed like to = reach scope in=C2=A0drm_dp_helper.c or=C2=A0intel_dp.c where the dp aux rea= d/write functions. Okay, back to your advice. Correct, I'm trying to access DPCD from the user= space. I haven't tried it and I'm not sure how it will goes out. I will try= it now and I will give feedback on this.From what I understand, I need to = rebuild the entire kernel with modification to Kconfig file (depends on DRM= =3Dy) in=C2=A0linux-4.16\drivers\gpu\drm directory. Then expect=C2=A0/dev/d= rm_dp_auxN node in the system. config DRM_DP_AUX_CHARDEV bool "DRM DP AUX Interface" depends on DRM=3Dy he= lp =C2=A0 Choose this option to enable a /dev/drm_dp_auxN node that allows = to =C2=A0 read and write values to arbitrary DPCD registers on the DP aux = =C2=A0 channel. The second advice, I guess your correct since the display device i needed t= o communicate is under Connector: DP-1 and not in=C2=A0Connector: eDP-1. Th= is is based on the application modeprint result. Regards,John On Friday, May 18, 2018, 5:48:31 PM GMT+8, Jani Nikula wrote: =20 =20 On Thu, 17 May 2018, John Sledge wrote: > I=E2=80=99ve been doing some PTN3460 programming under Linux using C/C++ = and I > have some questions regarding on setting the brightness level to my > display device. > > The display device with PTN3460 is connected in DP (display port) to > my computer. Only needs a DisplayPort native AUX command to access > DPCD address from PTN3460.=C2=A0 I=E2=80=99m currently looking into the D= RM (Direct > Rendering Manager) a subsystem of the Linux kernel. It has a methods > drm_dp_dpcd_readb, drm_dp_dpcd_read and drm_dp_dpcd_write. > > Do you have any suggestions or advice how to use the kernel driver in > DRM in regards to how to implement the method drm_dp_dpcd_readb for > example? I couldn't not find any test tool examples that implement > it. Biggest concern is I don't have sufficient knowledge where to > start what to code using the DRM module. Let me double check, you're talking about doing DPCD access from userspace? The *only* interface that can be recommended for that is the DRM DP AUX interface. If you have kernel config DRM_DP_AUX_CHARDEV=3Dy, you'll get /dev/drm_dp_auxN node(s) that allows you to read and write arbitrary DPCD offsets. It's a chardev; you can use e.g. dd to debug read DPCD. Of course, it would be better to have a generic backlight interface for DPCD based backlight in kernel. We have the basics for that for Intel GPU in i915/intel_dp_aux_backlight.c. Granted, it should be moved to common DRM code, but it also doesn't work for you if you have the chip connected to regular DP. It expects eDP, and somewhat spec compliant eDP DPCD backlight support. HTH, Jani. --=20 Jani Nikula, Intel Open Source Graphics Center =20 ------=_Part_665005_353402469.1527159421979 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Jani,

I was able to update my = kernel to 4.6 which has the DRM_DP_AUX_CHARDEV in the Kconfig file lin= ux-4.6\drivers\gpu\drm. Though I also add DRM_DP_AUX= _CHARDEV=3Dy in 
<= /span>
How can I verif= y the DRM_DP_AUX_CHARDEV takes effect or got configure it correctly?=

It still unclear to me ho= w to follow what you mean by using DRM DP AUX interface and getting /dev/dr= m_dp_auxN node(s) that allows me to read and write arbitrary DPCD offsets.&= nbsp;

Please have comments and advice.

Regards,=
John

=20
=20
On Thursday, May 24, 2018, 12:19:55 PM GMT+8, John = Sledge <john_sledget@yahoo.com> wrote:


<= /div>
Hi Jani,

Good day!
Thank you for taking the time to poi= nt out those information. It=E2=80=99s a great help to me.
Also apologies for the late reply, your first reply= went to my spam inbox, not sure what happen and I was waiting for replies = for days.

I'm= still new to Linux and to DRM. I also need to investigate and learn more a= bout it.

Here= 's what I have done so far. I was able to work on the modeprint test applic= ation from the libdrm package found in the website github.com/gr= ate-driver/libdrm. I need to understand how user space and kernel works and= modeprint provided me a simple understanding how it works.
The modeprint requires a module name to open and I provi= ded the i915 module. It followed opening the device name then calling ioctl= commands to get resources, drm mode get connectors, encoders and crtc. Fro= m here, i was able to detect the display device's information successfully.=

So from here I got stuck and got confused. I only notice that in th= e drm.h it has limited IOCTL commands which it doesn't reach what i needed = like to reach scope in drm_dp_helper.c or intel_dp.c = where the dp aux read/write functions.
<= span>

Okay, back to your advice. Correc= t, I'm trying to access DPCD from the userspace. I haven't tried it and I'm= not sure how it will goes out. I will try it now and I will give feedback = on this.
From what I understand, I need to rebuild the= entire kernel with modification to Kconfig file (depends on DRM=3Dy) in linux-4.16= \drivers\gpu\drm directory. Then expect /dev/dr= m_dp_auxN node in the system.
config DRM_DP_AUX_C= HARDEV
=09bool "DRM = DP AUX Interface"
=09depends on DRM=3Dy
=09help
=09  Ch= oose this option to enable a /dev/drm_dp_auxN node that allows to
=09  read and write valu= es to arbitrary DPCD registers on the DP aux
=09  channel.

The second advice, I guess your correct since the display device i= needed to communicate is under Connector: DP-1 and not in Connector: eDP-1. This is based on the application modeprint result.

Regards,
John




=20
=20
On Friday, May 18, 2018, 5:48:31 PM GMT+8, Jani Nik= ula <jani.nikula@linux.intel.com> wrote:


On Thu, 17 May 2018, John Sledge = <john_sledget= @yahoo.com> wrote:

> I=E2=80=99ve been doing some= PTN3460 programming under Linux using C/C++ and I
> h= ave some questions regarding on setting the brightness level to my
> display device.
>
>= ; The display device with PTN3460 is connected in DP (display port) to
> my computer. Only needs a DisplayPort native AUX command= to access
> DPCD address from PTN3460.  I=E2=80= =99m currently looking into the DRM (Direct
> Renderin= g Manager) a subsystem of the Linux kernel. It has a methods
> drm_dp_dpcd_readb, drm_dp_dpcd_read and drm_dp_dpcd_write.
>
> Do you have any suggestions or advic= e how to use the kernel driver in
> DRM in regards to = how to implement the method drm_dp_dpcd_readb for
> ex= ample? I couldn't not find any test tool examples that implement
> it. Biggest concern is I don't have sufficient knowledge whe= re to
> start what to code using the DRM module.
=

Let me double check, you're talking a= bout doing DPCD access from
userspace? The *only* interfa= ce that can be recommended for that is the
DRM DP AUX int= erface. If you have kernel config DRM_DP_AUX_CHARDEV=3Dy,
you'll get /dev/drm_dp_auxN node(s) that allows you to read and write
arbitrary DPCD offsets. It's a chardev; you can use e.g. dd t= o debug
read DPCD.

O= f course, it would be better to have a generic backlight interface for
DPCD based backlight in kernel. We have the basics for that f= or Intel
GPU in i915/intel_dp_aux_backlight.c. Granted, i= t should be moved to
common DRM code, but it also doesn't= work for you if you have the chip
connected to regular D= P. It expects eDP, and somewhat spec compliant eDP
DPCD b= acklight support.

HTH,
Jani.


--
Jani Nikula, Intel Open Source Graphics Center
------=_Part_665005_353402469.1527159421979-- --===============0102738164== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============0102738164==--