Re: [Freedreno] [PATCH 2/2] drm/msm/dpu: add HDMI output support

2023-04-16 Thread Arnaud Vrac

On Apr 15 20:19, Dmitry Baryshkov  wrote:


MSM8998 and the older Qualcomm platforms support HDMI outputs. Now as
DPU encoder is ready, add support for using INTF_HDMI.

Signed-off-by: Dmitry Baryshkov 
---
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 45 +
1 file changed, 45 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index e85e3721d2c7..65cce59163a4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -617,6 +617,45 @@ static int _dpu_kms_initialize_displayport(struct 
drm_device *dev,
return 0;
}

+static int _dpu_kms_initialize_hdmi(struct drm_device *dev,
+   struct msm_drm_private *priv,
+   struct dpu_kms *dpu_kms)
+{
+   struct drm_encoder *encoder = NULL;
+   struct msm_display_info info;
+   int rc;
+   int i;
+
+   if (!priv->hdmi)
+   return 0;
+
+   encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS);
+   if (IS_ERR(encoder)) {
+   DPU_ERROR("encoder init failed for HDMI display\n");
+   return PTR_ERR(encoder);
+   }
+
+   memset(, 0, sizeof(info));


Move this where fields are initialized ?


+   rc = msm_hdmi_modeset_init(priv->hdmi, dev, encoder);
+   if (rc) {
+   DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
+   drm_encoder_cleanup(encoder);
+   return rc;
+   }
+
+   info.num_of_h_tiles = 1;
+   info.h_tile_instance[0] = i;


i is uninitialized here, the line can be removed.

With the above changes:

Reviewed-by: Arnaud Vrac 
Tested-by: Arnaud Vrac  # on msm8998

-Arnaud


+   info.intf_type = INTF_HDMI;
+   rc = dpu_encoder_setup(dev, encoder, );
+   if (rc) {
+   DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
+ encoder->base.id, rc);
+   return rc;
+   }
+
+   return 0;
+}
+
static int _dpu_kms_initialize_writeback(struct drm_device *dev,
struct msm_drm_private *priv, struct dpu_kms *dpu_kms,
const u32 *wb_formats, int n_formats)
@@ -683,6 +722,12 @@ static int _dpu_kms_setup_displays(struct drm_device *dev,
return rc;
}

+   rc = _dpu_kms_initialize_hdmi(dev, priv, dpu_kms);
+   if (rc) {
+   DPU_ERROR("initialize HDMI failed, rc = %d\n", rc);
+   return rc;
+   }
+
/* Since WB isn't a driver check the catalog before initializing */
if (dpu_kms->catalog->wb_count) {
for (i = 0; i < dpu_kms->catalog->wb_count; i++) {
--
2.30.2



Re: [Freedreno] [PATCH 1/2] drm/msm/dpu: simplify intf allocation code

2023-04-16 Thread Arnaud Vrac

On Apr 15 20:19, Dmitry Baryshkov  wrote:


Rather than passing DRM_MODE_ENCODER_* and letting dpu_encoder to guess,
which intf type we mean, pass INTF_DSI/INTF_DP directly. This is
required to support HDMI output in DPU, as both DP and HDMI encoders are
DRM_MODE_ENCODER_TMDS. Thus dpu_encoder code can not make a difference
between HDMI and DP outputs.

Reviewed-by: Bjorn Andersson 
Signed-off-by: Dmitry Baryshkov 


Reviewed-by: Arnaud Vrac 
Tested-by: Arnaud Vrac 


---
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 39 +++--
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h |  4 +--
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |  6 ++--
3 files changed, 18 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 1dc5dbe58572..b34416cbd0f5 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -495,7 +495,7 @@ void dpu_encoder_helper_split_config(
hw_mdptop = phys_enc->hw_mdptop;
disp_info = _enc->disp_info;

-   if (disp_info->intf_type != DRM_MODE_ENCODER_DSI)
+   if (disp_info->intf_type != INTF_DSI)
return;

/**
@@ -1127,7 +1127,7 @@ static void _dpu_encoder_virt_enable_helper(struct 
drm_encoder *drm_enc)
}


-   if (dpu_enc->disp_info.intf_type == DRM_MODE_ENCODER_TMDS &&
+   if (dpu_enc->disp_info.intf_type == INTF_DP &&
dpu_enc->cur_master->hw_mdptop &&
dpu_enc->cur_master->hw_mdptop->ops.intf_audio_select)
dpu_enc->cur_master->hw_mdptop->ops.intf_audio_select(
@@ -1135,7 +1135,7 @@ static void _dpu_encoder_virt_enable_helper(struct 
drm_encoder *drm_enc)

_dpu_encoder_update_vsync_source(dpu_enc, _enc->disp_info);

-   if (dpu_enc->disp_info.intf_type == DRM_MODE_ENCODER_DSI &&
+   if (dpu_enc->disp_info.intf_type == INTF_DSI &&
!WARN_ON(dpu_enc->num_phys_encs == 0)) {
unsigned bpc = dpu_enc->connector->display_info.bpc;
for (i = 0; i < MAX_CHANNELS_PER_ENC; i++) {
@@ -1977,7 +1977,7 @@ void dpu_encoder_kickoff(struct drm_encoder *drm_enc)
phys->ops.handle_post_kickoff(phys);
}

-   if (dpu_enc->disp_info.intf_type == DRM_MODE_ENCODER_DSI &&
+   if (dpu_enc->disp_info.intf_type == INTF_DSI &&
!dpu_encoder_vsync_time(drm_enc, _time)) {
trace_dpu_enc_early_kickoff(DRMID(drm_enc),
ktime_to_ms(wakeup_time));
@@ -2182,7 +2182,7 @@ static int dpu_encoder_virt_add_phys_encs(
}


-   if (disp_info->intf_type == DRM_MODE_ENCODER_VIRTUAL) {
+   if (disp_info->intf_type == INTF_WB) {
enc = dpu_encoder_phys_wb_init(params);

if (IS_ERR(enc)) {
@@ -2231,7 +2231,6 @@ static int dpu_encoder_setup_display(struct 
dpu_encoder_virt *dpu_enc,
{
int ret = 0;
int i = 0;
-   enum dpu_intf_type intf_type = INTF_NONE;
struct dpu_enc_phys_init_params phys_params;

if (!dpu_enc) {
@@ -2246,23 +2245,11 @@ static int dpu_encoder_setup_display(struct 
dpu_encoder_virt *dpu_enc,
phys_params.parent = _enc->base;
phys_params.enc_spinlock = _enc->enc_spinlock;

-   switch (disp_info->intf_type) {
-   case DRM_MODE_ENCODER_DSI:
-   intf_type = INTF_DSI;
-   break;
-   case DRM_MODE_ENCODER_TMDS:
-   intf_type = INTF_DP;
-   break;
-   case DRM_MODE_ENCODER_VIRTUAL:
-   intf_type = INTF_WB;
-   break;
-   }
-
WARN_ON(disp_info->num_of_h_tiles < 1);

DPU_DEBUG("dsi_info->num_of_h_tiles %d\n", disp_info->num_of_h_tiles);

-   if (disp_info->intf_type != DRM_MODE_ENCODER_VIRTUAL)
+   if (disp_info->intf_type != INTF_WB)
dpu_enc->idle_pc_supported =
dpu_kms->catalog->caps->has_idle_pc;

@@ -2290,11 +2277,11 @@ static int dpu_encoder_setup_display(struct 
dpu_encoder_virt *dpu_enc,
i, controller_id, phys_params.split_role);

phys_params.intf_idx = dpu_encoder_get_intf(dpu_kms->catalog,
-   
intf_type,
-   
controller_id);
+   
disp_info->intf_type,
+   controller_id);

phys_params.wb_idx = dpu_encoder_get_wb(dpu_kms->catalog,
-   intf_type, controller_id);
+   disp_info->intf_type, controller_id);
/*
 * The phys_params might represent either an INTF or a WB unit, 
but not
 

Re: [Freedreno] [PATCH v9 04/10] drm/hdcp: Expand HDCP helper library for enable/disable/check

2023-04-16 Thread kernel test robot
Hi Mark,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-intel/for-linux-next-fixes]
[also build test WARNING on drm/drm-next linus/master v6.3-rc6]
[cannot apply to drm-tip/drm-tip drm-misc/drm-misc-next 
drm-intel/for-linux-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Mark-Yacoub/drm-hdcp-Add-drm_hdcp_atomic_check/20230412-032412
base:   git://anongit.freedesktop.org/drm-intel for-linux-next-fixes
patch link:
https://lore.kernel.org/r/20230411192134.508113-5-markyacoub%40google.com
patch subject: [PATCH v9 04/10] drm/hdcp: Expand HDCP helper library for 
enable/disable/check
config: i386-randconfig-s001 
(https://download.01.org/0day-ci/archive/20230416/202304162307.7pcvuwlb-...@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# 
https://github.com/intel-lab-lkp/linux/commit/972a98f65fb56b3be4370593c2b81f1283750db7
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Mark-Yacoub/drm-hdcp-Add-drm_hdcp_atomic_check/20230412-032412
git checkout 972a98f65fb56b3be4370593c2b81f1283750db7
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir 
ARCH=i386 olddefconfig
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir 
ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/display/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 
| Link: 
https://lore.kernel.org/oe-kbuild-all/202304162307.7pcvuwlb-...@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/display/drm_hdcp_helper.c:675:5: sparse: sparse: symbol 
>> 'drm_hdcp_helper_hdcp1_capable_dp' was not declared. Should it be static?

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests


Re: [Freedreno] [PATCH v3 6/7] drm: Add fdinfo memory stats

2023-04-16 Thread Daniel Vetter
On Fri, Apr 14, 2023 at 06:40:27AM -0700, Rob Clark wrote:
> On Fri, Apr 14, 2023 at 1:57 AM Tvrtko Ursulin
>  wrote:
> >
> >
> > On 13/04/2023 21:05, Daniel Vetter wrote:
> > > On Thu, Apr 13, 2023 at 05:40:21PM +0100, Tvrtko Ursulin wrote:
> > >>
> > >> On 13/04/2023 14:27, Daniel Vetter wrote:
> > >>> On Thu, Apr 13, 2023 at 01:58:34PM +0100, Tvrtko Ursulin wrote:
> > 
> >  On 12/04/2023 20:18, Daniel Vetter wrote:
> > > On Wed, Apr 12, 2023 at 11:42:07AM -0700, Rob Clark wrote:
> > >> On Wed, Apr 12, 2023 at 11:17 AM Daniel Vetter  
> > >> wrote:
> > >>>
> > >>> On Wed, Apr 12, 2023 at 10:59:54AM -0700, Rob Clark wrote:
> >  On Wed, Apr 12, 2023 at 7:42 AM Tvrtko Ursulin
> >   wrote:
> > >
> > >
> > > On 11/04/2023 23:56, Rob Clark wrote:
> > >> From: Rob Clark 
> > >>
> > >> Add support to dump GEM stats to fdinfo.
> > >>
> > >> v2: Fix typos, change size units to match docs, use div_u64
> > >> v3: Do it in core
> > >>
> > >> Signed-off-by: Rob Clark 
> > >> Reviewed-by: Emil Velikov 
> > >> ---
> > >>  Documentation/gpu/drm-usage-stats.rst | 21 
> > >>  drivers/gpu/drm/drm_file.c| 76 
> > >> +++
> > >>  include/drm/drm_file.h|  1 +
> > >>  include/drm/drm_gem.h | 19 +++
> > >>  4 files changed, 117 insertions(+)
> > >>
> > >> diff --git a/Documentation/gpu/drm-usage-stats.rst 
> > >> b/Documentation/gpu/drm-usage-stats.rst
> > >> index b46327356e80..b5e7802532ed 100644
> > >> --- a/Documentation/gpu/drm-usage-stats.rst
> > >> +++ b/Documentation/gpu/drm-usage-stats.rst
> > >> @@ -105,6 +105,27 @@ object belong to this client, in the 
> > >> respective memory region.
> > >>  Default unit shall be bytes with optional unit specifiers 
> > >> of 'KiB' or 'MiB'
> > >>  indicating kibi- or mebi-bytes.
> > >>
> > >> +- drm-shared-memory:  [KiB|MiB]
> > >> +
> > >> +The total size of buffers that are shared with another file 
> > >> (ie. have more
> > >> +than a single handle).
> > >> +
> > >> +- drm-private-memory:  [KiB|MiB]
> > >> +
> > >> +The total size of buffers that are not shared with another file.
> > >> +
> > >> +- drm-resident-memory:  [KiB|MiB]
> > >> +
> > >> +The total size of buffers that are resident in system memory.
> > >
> > > I think this naming maybe does not work best with the existing
> > > drm-memory- keys.
> > 
> >  Actually, it was very deliberate not to conflict with the existing
> >  drm-memory- keys ;-)
> > 
> >  I wouldn't have preferred drm-memory-{active,resident,...} but it
> >  could be mis-parsed by existing userspace so my hands were a bit 
> >  tied.
> > 
> > > How about introduce the concept of a memory region from the start 
> > > and
> > > use naming similar like we do for engines?
> > >
> > > drm-memory-$CATEGORY-$REGION: ...
> > >
> > > Then we document a bunch of categories and their semantics, for 
> > > instance:
> > >
> > > 'size' - All reachable objects
> > > 'shared' - Subset of 'size' with handle_count > 1
> > > 'resident' - Objects with backing store
> > > 'active' - Objects in use, subset of resident
> > > 'purgeable' - Or inactive? Subset of resident.
> > >
> > > We keep the same semantics as with process memory accounting (if 
> > > I got
> > > it right) which could be desirable for a simplified mental model.
> > >
> > > (AMD needs to remind me of their 'drm-memory-...' keys semantics. 
> > > If we
> > > correctly captured this in the first round it should be 
> > > equivalent to
> > > 'resident' above. In any case we can document no category is 
> > > equal to
> > > which category, and at most one of the two must be output.)
> > >
> > > Region names we at most partially standardize. Like we could say
> > > 'system' is to be used where backing store is system RAM and 
> > > others are
> > > driver defined.
> > >
> > > Then discrete GPUs could emit N sets of key-values, one for each 
> > > memory
> > > region they support.
> > >
> > > I think this all also works for objects which can be migrated 
> > > between
> > > memory regions. 'Size' accounts them against all regions while for
> > > 'resident' they only appear in the region of their current 
> > >