From: John Sledge Subject: Re: DRM Inquiry Date: Thu, 24 May 2018 04:19:54 +0000 (UTC) Message-ID: <910225270.614010.1527135594944@mail.yahoo.com> References: <471791572.2287221.1526561265798.ref@mail.yahoo.com> <471791572.2287221.1526561265798@mail.yahoo.com> <87fu2pxph0.fsf@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1266042506==" Return-path: In-Reply-To: <87fu2pxph0.fsf@intel.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 --===============1266042506== Content-Type: multipart/alternative; boundary="----=_Part_614009_1699550502.1527135594941" ------=_Part_614009_1699550502.1527135594941 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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_614009_1699550502.1527135594941 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
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 f= or the late reply, your first reply went to my spam inbox, not sure what ha= ppen and I was waiting for replies for days.

I'm still new to Li= nux and to DRM. I also need to investigate and learn more about it.

Here's what= I have done so far. I was able to work on the modeprint test application f= rom the libdrm package found in the website github.com/grate-dri= ver/libdrm. I need to understand how user space and kernel works and modepr= int provided me a simple understanding how it works.
The modeprint requires a module name to open and I = provided the i915 module. It followed opening 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 display device's information successf= ully.

So from here I got stuck and got confused. I only not= ice that in the 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.

Okay, back to your adv= ice. Correct, 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 giv= e 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 expec= t /dev/drm_dp_auxN node in the system.=

config DRM_DP_AUX_CHARDEV
=09bool "DRM DP AUX Interface"
=09depends on DRM=3Dy
=09help
=09  Choose this option to enable a /dev/dr= m_dp_auxN node that allows to
=09  read and write values to arbitrary DPCD registers on t= he 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 applicati= on modeprint result.

Regards,
<= div>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 b= een doing some PTN3460 programming under Linux using C/C++ and I
> have some questions regarding on setting the brightness leve= l to my
> display device.
>
> The display device with PTN3460 is connected in DP (displ= ay port) to
> my computer. Only needs a DisplayPort na= tive AUX command to access
> DPCD address from PTN3460= .  I=E2=80=99m currently looking into the DRM (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 sugge= stions 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 imp= lement
> it. Biggest concern is I don't have sufficien= t knowledge where to
> start what to code using the DR= M module.


Let me double check, y= ou'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 ca= n use e.g. dd to debug
read DPCD.

Of course, it would be better to have a generic backlight int= erface for
DPCD based backlight in kernel. We have the ba= sics for that for Intel
GPU in i915/intel_dp_aux_backligh= t.c. Granted, it should be moved to
common DRM code, but = it also doesn't work for you if you have the chip
connect= ed to regular DP. It expects eDP, and somewhat spec compliant eDP
DPCD backlight support.

HTH,=
Jani.


--
Jani Nikula, Intel Open Source Graphics Center<= /div>
------=_Part_614009_1699550502.1527135594941-- --===============1266042506== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============1266042506==--