[PATCH 2/2] drm/nouveau: Grab an rpm reference before/after DP AUX transactions

2018-11-16 Thread Lyude Paul
Now that we have ->pre_transfer() and ->post_transfer() for DP AUX
channel devices, we can implement these hooks in order to ensure that
the GPU is actually woken up before AUX transactions happen. This fixes
/dev/drm_dp_aux* not working while the GPU is suspended, along with some
more rare issues where the GPU might runtime-suspend if the time between
two DP AUX channel transactions ends up being longer then the runtime
suspend delay (sometimes observed on KASAN kernels where everything is
slow).

Additionally, we add tracking for the current task that's running our
runtime suspend/resume callbacks. We need this in order to avoid trying
to grab a runtime power reference when nouveau uses the DP AUX channel
for MST suspend/resume in it's runtime susped/resume callbacks.

Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 36 +
 drivers/gpu/drm/nouveau/nouveau_drm.c   | 12 ++-
 drivers/gpu/drm/nouveau/nouveau_drv.h   |  8 +
 3 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c 
b/drivers/gpu/drm/nouveau/nouveau_connector.c
index fd80661dff92..d2e9752f2f91 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1171,6 +1171,38 @@ nouveau_connector_hotplug(struct nvif_notify *notify)
return NVIF_NOTIFY_KEEP;
 }
 
+static int
+nouveau_connector_aux_pre_xfer(struct drm_dp_aux *obj)
+{
+   struct nouveau_connector *nv_connector =
+   container_of(obj, typeof(*nv_connector), aux);
+   struct nouveau_drm *drm = nouveau_drm(nv_connector->base.dev);
+   int ret;
+
+   if (nouveau_is_rpm_worker(drm))
+   return 0;
+
+   ret = pm_runtime_get_sync(drm->dev->dev);
+   if (ret < 0 && ret != -EAGAIN)
+   return ret;
+
+   return 0;
+}
+
+static void
+nouveau_connector_aux_post_xfer(struct drm_dp_aux *obj)
+{
+   struct nouveau_connector *nv_connector =
+   container_of(obj, typeof(*nv_connector), aux);
+   struct nouveau_drm *drm = nouveau_drm(nv_connector->base.dev);
+
+   if (nouveau_is_rpm_worker(drm))
+   return;
+
+   pm_runtime_mark_last_busy(drm->dev->dev);
+   pm_runtime_put_autosuspend(drm->dev->dev);
+}
+
 static ssize_t
 nouveau_connector_aux_xfer(struct drm_dp_aux *obj, struct drm_dp_aux_msg *msg)
 {
@@ -1341,6 +1373,10 @@ nouveau_connector_create(struct drm_device *dev, int 
index)
case DRM_MODE_CONNECTOR_DisplayPort:
case DRM_MODE_CONNECTOR_eDP:
nv_connector->aux.dev = dev->dev;
+   nv_connector->aux.pre_transfer =
+   nouveau_connector_aux_pre_xfer;
+   nv_connector->aux.post_transfer =
+   nouveau_connector_aux_post_xfer;
nv_connector->aux.transfer = nouveau_connector_aux_xfer;
ret = drm_dp_aux_register(_connector->aux);
if (ret) {
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 2b2baf6e0e0d..4323e9e61c2e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -859,6 +859,7 @@ nouveau_pmops_runtime_suspend(struct device *dev)
 {
struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev);
+   struct nouveau_drm *drm = nouveau_drm(drm_dev);
int ret;
 
if (!nouveau_pmops_runtime()) {
@@ -866,6 +867,8 @@ nouveau_pmops_runtime_suspend(struct device *dev)
return -EBUSY;
}
 
+   drm->rpm_task = current;
+
nouveau_switcheroo_optimus_dsm();
ret = nouveau_do_suspend(drm_dev, true);
pci_save_state(pdev);
@@ -873,6 +876,8 @@ nouveau_pmops_runtime_suspend(struct device *dev)
pci_ignore_hotplug(pdev);
pci_set_power_state(pdev, PCI_D3cold);
drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
+
+   drm->rpm_task = NULL;
return ret;
 }
 
@@ -881,6 +886,7 @@ nouveau_pmops_runtime_resume(struct device *dev)
 {
struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev);
+   struct nouveau_drm *drm = nouveau_drm(drm_dev);
struct nvif_device *device = _drm(drm_dev)->client.device;
int ret;
 
@@ -889,11 +895,13 @@ nouveau_pmops_runtime_resume(struct device *dev)
return -EBUSY;
}
 
+   drm->rpm_task = current;
+
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
ret = pci_enable_device(pdev);
if (ret)
-   return ret;
+   goto out;
pci_set_master(pdev);
 
ret = nouveau_do_resume(drm_dev, true);
@@ -905,6 +913,8 @@ nouveau_pmops_runtime_resume(struct device *dev)
/* Monitors may have been connected / disconnected during suspend */

[PATCH 0/2] drm/nouveau: Fix DP AUX RPM issues

2018-11-16 Thread Lyude Paul
Here's some fixes for the less important DP AUX issues I mentioned a
while back.

Lyude Paul (2):
  drm/dp: Add ->pre/post_transfer() hooks for drm_dp_aux
  drm/nouveau: Grab an rpm reference before/after DP AUX transactions

 drivers/gpu/drm/drm_dp_helper.c |  5 ++
 drivers/gpu/drm/nouveau/nouveau_connector.c | 36 
 drivers/gpu/drm/nouveau/nouveau_drm.c   | 12 ++-
 drivers/gpu/drm/nouveau/nouveau_drv.h   |  8 ++
 include/drm/drm_dp_helper.h | 91 +
 5 files changed, 151 insertions(+), 1 deletion(-)

-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] drm/dp: Add ->pre/post_transfer() hooks for drm_dp_aux

2018-11-16 Thread Lyude Paul
Many DRM drivers unfortunately need to be able to access the DP AUX
channel during their suspend/resume callbacks. This leads to an annoying
catch-22: drivers which try to ensure that the DP AUX channel is
initialized and ready may need to runtime-resume the device housing the
channel, which would lead to a deadlock between runtime power management
and drm_dp_aux->hw_mutex.

So: add a simple set of optional hooks that drivers can implement in
order to perform such setup before hw_mutex is locked, then clean up
afterwards. We additionally add the drm_dp_aux_get() and
drm_dp_aux_put() functions so that users of the AUX channel that need to
prepare the AUX channel ahead of time to avoid other kinds of locking
version can do so. We'll need this if we ever want to have a universal
dp_mst_status debugfs node, since dumping the MST topology without
having the AUX channel prepared beforehand would lead to lock inversion.

Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/drm_dp_helper.c |  5 ++
 include/drm/drm_dp_helper.h | 91 +
 2 files changed, 96 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 6d483487f2b4..fb1912a2f246 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -224,6 +224,10 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 
request,
msg.buffer = buffer;
msg.size = size;
 
+   ret = drm_dp_aux_get(aux);
+   if (ret)
+   return ret;
+
mutex_lock(>hw_mutex);
 
/*
@@ -265,6 +269,7 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 
request,
 
 unlock:
mutex_unlock(>hw_mutex);
+   drm_dp_aux_put(aux);
return ret;
 }
 
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 3314e91f6eb3..b0208bc666d1 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -1243,6 +1243,46 @@ struct drm_dp_aux {
struct mutex hw_mutex;
struct work_struct crc_work;
u8 crc_count;
+   /**
+* @pre_transfer:
+*
+* An optional callback for drivers that if implemented, will be
+* called before locking @hw_mutex and beginning a DP AUX transaction.
+*
+* Drivers can use this to perform any initialization that might be
+* required before the DP AUX channel is ready to be used, such as
+* waking up the device housing the AUX channel.
+*
+* This callback may be called more then once for a single
+* transaction.
+*
+* See also:
+* drm_dp_aux_get()
+* drm_dp_aux_put()
+*
+* Returns:
+*
+* 0 on success, negative error code on failure.
+*/
+   int (*pre_transfer)(struct drm_dp_aux *aux);
+   /**
+* @post_transfer:
+*
+* An optional callback for drivers that if implemented, will be
+* called after having performed a DP AUX transaction.
+*
+* Drivers can use this to undo any initialization that was performed
+* by @pre_transfer, such as putting the device housing the DP AUX
+* channel back to sleep.
+*
+* This callback may be called more then once for a single
+* transaction.
+*
+* See also:
+* drm_dp_aux_get()
+* drm_dp_aux_put()
+*/
+   void (*post_transfer)(struct drm_dp_aux *aux);
ssize_t (*transfer)(struct drm_dp_aux *aux,
struct drm_dp_aux_msg *msg);
/**
@@ -1259,6 +1299,57 @@ struct drm_dp_aux {
struct drm_dp_aux_cec cec;
 };
 
+/**
+ * drm_dp_aux_get() - Prepare a DP AUX channel for a transaction
+ * @aux: DisplayPort AUX channel to initialize
+ *
+ * If implemented by the driver, this function will invoke the
+ * _dp_aux.pre_transfer callback for the given @aux device. This function
+ * can be used to setup the DP AUX channel before going under lock, in order
+ * to avoid lock inversion between the DP AUX channel setup and
+ * _dp_aux.hw_mutex. This function is implicitly called by
+ * drm_dp_dpcd_read(), drm_dp_dpcd_readb(), drm_dp_dpcd_write(), and
+ * drm_dp_dpcd_writeb().
+ *
+ * Each call to drm_dp_aux_get() must have a matching drm_dp_aux_put() call to
+ * cleanup any resources that were required for the DP AUX transaction.
+ *
+ * See also:
+ * drm_dp_aux_put()
+ *
+ * Returns:
+ * 0 on success, negative error code on failure
+ */
+static inline int drm_dp_aux_get(struct drm_dp_aux *aux)
+{
+   if (aux->pre_transfer)
+   return aux->pre_transfer(aux);
+   else
+   return 0;
+}
+
+/**
+ * drm_dp_aux_put() - Cleanup after performing a transaction on a DP AUX
+ * channel
+ * @aux: DisplayPort AUX channel to cleanup
+ *
+ * If implemented by the driver, this function will invoke the
+ * _dp_aux.post_transfer callback for the given @aux device. This function
+ * is implicitly 

[PATCH 3/6] drm/nouveau: Stop reading port->mgr in nv50_mstc_get_modes()

2018-11-16 Thread Lyude Paul
mstc->port isn't validated here so it could be null or worse when we
access it. And drivers aren't ever supposed to be looking at it's
contents anyway. Plus, we can already get the MST manager from
>mstm->mgr.

Signed-off-by: Lyude Paul 
Cc: sta...@vger.kernel.org
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c 
b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index e6f72ca0b1fa..66c40b56a0cb 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -893,7 +893,8 @@ nv50_mstc_get_modes(struct drm_connector *connector)
struct nv50_mstc *mstc = nv50_mstc(connector);
int ret = 0;
 
-   mstc->edid = drm_dp_mst_get_edid(>connector, mstc->port->mgr, 
mstc->port);
+   mstc->edid = drm_dp_mst_get_edid(>connector,
+>mstm->mgr, mstc->port);
drm_connector_update_edid_property(>connector, mstc->edid);
if (mstc->edid)
ret = drm_add_edid_modes(>connector, mstc->edid);
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 6/6] drm/i915: Start using struct drm_dp_mst_port again

2018-11-16 Thread Lyude Paul
Originally we started storing pointers to the drm_dp_mst_port struct for
each intel_connector as void* to stop people from trying to dereference
them. Now that we've removed the public struct definition for
drm_dp_mst_port however, it's no longer possible to dereference the port
structure even when using the proper type. So, move back to struct
drm_dp_mst_port from void* for clarity.

Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
 drivers/gpu/drm/i915/intel_drv.h| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c 
b/drivers/gpu/drm/i915/intel_dp_mst.c
index 4de247ddf05f..3408efe67694 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -39,7 +39,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder 
*encoder,
struct intel_digital_port *intel_dig_port = intel_mst->primary;
struct intel_dp *intel_dp = _dig_port->dp;
struct drm_connector *connector = conn_state->connector;
-   void *port = to_intel_connector(connector)->port;
+   struct drm_dp_mst_port *port = to_intel_connector(connector)->port;
struct drm_atomic_state *state = pipe_config->base.state;
int bpp;
int lane_count, slots = 0;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index f575ba2a59da..1bb69097d6cb 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -415,7 +415,7 @@ struct intel_connector {
   state of connector->polled in case hotplug storm detection changes 
it */
u8 polled;
 
-   void *port; /* store this opaque as its illegal to dereference it */
+   struct drm_dp_mst_port *port;
 
struct intel_dp *mst_port;
 
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 4/6] drm/nouveau: Stop reading port->mgr in nv50_mstc_detect()

2018-11-16 Thread Lyude Paul
Same as the previous commit, but for nv50_mstc_detect() this time.

Signed-off-by: Lyude Paul 
Cc: sta...@vger.kernel.org
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c 
b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 66c40b56a0cb..a08dd827e892 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -930,7 +930,7 @@ nv50_mstc_detect(struct drm_connector *connector, bool 
force)
if (ret < 0 && ret != -EACCES)
return connector_status_disconnected;
 
-   conn_status = drm_dp_mst_detect_port(connector, mstc->port->mgr,
+   conn_status = drm_dp_mst_detect_port(connector, >mstm->mgr,
 mstc->port);
 
pm_runtime_mark_last_busy(connector->dev->dev);
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 5/6] drm/dp_mst: Hide drm_dp_mst_port contents from drivers

2018-11-16 Thread Lyude Paul
It hasn't been OK to access any of the contents of struct
drm_dp_mst_port without validating the port first for quite a long time
now, since a drm_dp_mst_port structure can be freed at any given moment
in time outside of the driver's contorl. Any kind of information a
driver needs from drm_dp_mst_port should be exposed through a helper
function instead that handles validating the port pointer, along with
anything else that's needed.

Since we've removed the last dangerous remanents of ->port accesses in
the DRM tree, let's finish this off and move the struct drm_dp_mst_port
definition out of drm_dp_mst_helper.h, into drm_dp_mst_topology.c, and
then replace it's header definition with an incomplete struct type. This
way drivers can still use the struct type, and no one else will make the
mistake of trying to access the contents of port.

Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 59 ++
 include/drm/drm_dp_mst_helper.h   | 60 +--
 2 files changed, 60 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 4336d17ce904..5fa898a8a64d 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -41,6 +41,65 @@
  * protocol. The helpers contain a topology manager and bandwidth manager.
  * The helpers encapsulate the sending and received of sideband msgs.
  */
+
+/**
+ * struct drm_dp_mst_port - MST port
+ * @kref: reference count for this port.
+ * @port_num: port number
+ * @input: if this port is an input port.
+ * @mcs: message capability status - DP 1.2 spec.
+ * @ddps: DisplayPort Device Plug Status - DP 1.2
+ * @pdt: Peer Device Type
+ * @ldps: Legacy Device Plug Status
+ * @dpcd_rev: DPCD revision of device on this port
+ * @num_sdp_streams: Number of simultaneous streams
+ * @num_sdp_stream_sinks: Number of stream sinks
+ * @available_pbn: Available bandwidth for this port.
+ * @next: link to next port on this branch device
+ * @mstb: branch device attach below this port
+ * @aux: i2c aux transport to talk to device connected to this port.
+ * @parent: branch device parent of this port
+ * @vcpi: Virtual Channel Payload info for this port.
+ * @connector: DRM connector this port is connected to.
+ * @mgr: topology manager this port lives under.
+ *
+ * This structure represents an MST port endpoint on a device somewhere
+ * in the MST topology.
+ */
+struct drm_dp_mst_port {
+   struct kref kref;
+
+   u8 port_num;
+   bool input;
+   bool mcs;
+   bool ddps;
+   u8 pdt;
+   bool ldps;
+   u8 dpcd_rev;
+   u8 num_sdp_streams;
+   u8 num_sdp_stream_sinks;
+   uint16_t available_pbn;
+   struct list_head next;
+   struct drm_dp_mst_branch *mstb; /* pointer to an mstb if this port has 
one */
+   struct drm_dp_aux aux; /* i2c bus for this port? */
+   struct drm_dp_mst_branch *parent;
+
+   struct drm_dp_vcpi vcpi;
+   struct drm_connector *connector;
+   struct drm_dp_mst_topology_mgr *mgr;
+
+   /**
+* @cached_edid: for DP logical ports - make tiling work by ensuring
+* that the EDID for all connectors is read immediately.
+*/
+   struct edid *cached_edid;
+   /**
+* @has_audio: Tracks whether the sink connector to this port is
+* audio-capable.
+*/
+   bool has_audio;
+};
+
 static bool dump_dp_payload_table(struct drm_dp_mst_topology_mgr *mgr,
  char *buf);
 static int test_calc_pbn_mode(void);
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
index 9cc93ea60e7e..3076a45aef4d 100644
--- a/include/drm/drm_dp_mst_helper.h
+++ b/include/drm/drm_dp_mst_helper.h
@@ -26,7 +26,7 @@
 #include 
 #include 
 
-struct drm_dp_mst_branch;
+struct drm_dp_mst_port;
 
 /**
  * struct drm_dp_vcpi - Virtual Channel Payload Identifier
@@ -42,64 +42,6 @@ struct drm_dp_vcpi {
int num_slots;
 };
 
-/**
- * struct drm_dp_mst_port - MST port
- * @kref: reference count for this port.
- * @port_num: port number
- * @input: if this port is an input port.
- * @mcs: message capability status - DP 1.2 spec.
- * @ddps: DisplayPort Device Plug Status - DP 1.2
- * @pdt: Peer Device Type
- * @ldps: Legacy Device Plug Status
- * @dpcd_rev: DPCD revision of device on this port
- * @num_sdp_streams: Number of simultaneous streams
- * @num_sdp_stream_sinks: Number of stream sinks
- * @available_pbn: Available bandwidth for this port.
- * @next: link to next port on this branch device
- * @mstb: branch device attach below this port
- * @aux: i2c aux transport to talk to device connected to this port.
- * @parent: branch device parent of this port
- * @vcpi: Virtual Channel Payload info for this port.
- * @connector: DRM connector this port is connected to.
- * @mgr: topology manager this port lives under.
- *
- * This structure represents an MST port 

[PATCH 2/6] drm/nouveau: Use drm_dp_get_payload_info() for getting payload/vcpi

2018-11-16 Thread Lyude Paul
Currently, nouveau tries to go through the drm_dp_mst_port structures
itself in order to retrieve the relevant payload and VCPI information
that it needs to report to the GPU. This is wrong: mstc->port could be
destroyed at any point, and additionally the payload could be changed at
any point because it doesn't bother trying to grab the payload lock. So;
remove nv50_msto_payload entirely and use the new
drm_dp_get_payload_info() helper.

Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 55 ++---
 1 file changed, 21 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c 
b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index 6cbbae3f438b..e6f72ca0b1fa 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -665,41 +665,24 @@ struct nv50_msto {
bool disabled;
 };
 
-static struct drm_dp_payload *
-nv50_msto_payload(struct nv50_msto *msto)
-{
-   struct nouveau_drm *drm = nouveau_drm(msto->encoder.dev);
-   struct nv50_mstc *mstc = msto->mstc;
-   struct nv50_mstm *mstm = mstc->mstm;
-   int vcpi = mstc->port->vcpi.vcpi, i;
-
-   NV_ATOMIC(drm, "%s: vcpi %d\n", msto->encoder.name, vcpi);
-   for (i = 0; i < mstm->mgr.max_payloads; i++) {
-   struct drm_dp_payload *payload = >mgr.payloads[i];
-   NV_ATOMIC(drm, "%s: %d: vcpi %d start 0x%02x slots 0x%02x\n",
- mstm->outp->base.base.name, i, payload->vcpi,
- payload->start_slot, payload->num_slots);
-   }
-
-   for (i = 0; i < mstm->mgr.max_payloads; i++) {
-   struct drm_dp_payload *payload = >mgr.payloads[i];
-   if (payload->vcpi == vcpi)
-   return payload;
-   }
-
-   return NULL;
-}
-
 static void
 nv50_msto_cleanup(struct nv50_msto *msto)
 {
struct nouveau_drm *drm = nouveau_drm(msto->encoder.dev);
struct nv50_mstc *mstc = msto->mstc;
struct nv50_mstm *mstm = mstc->mstm;
+   struct drm_dp_payload payload;
+   struct drm_dp_vcpi vcpi;
+   int ret;
 
NV_ATOMIC(drm, "%s: msto cleanup\n", msto->encoder.name);
-   if (mstc->port && mstc->port->vcpi.vcpi > 0 && !nv50_msto_payload(msto))
-   drm_dp_mst_deallocate_vcpi(>mgr, mstc->port);
+   if (mstc->port) {
+   ret = drm_dp_get_payload_info(>mgr, mstc->port,
+ , );
+   if (!ret)
+   drm_dp_mst_deallocate_vcpi(>mgr, mstc->port);
+   }
+
if (msto->disabled) {
msto->mstc = NULL;
msto->head = NULL;
@@ -713,6 +696,9 @@ nv50_msto_prepare(struct nv50_msto *msto)
struct nouveau_drm *drm = nouveau_drm(msto->encoder.dev);
struct nv50_mstc *mstc = msto->mstc;
struct nv50_mstm *mstm = mstc->mstm;
+   struct drm_dp_payload payload;
+   struct drm_dp_vcpi vcpi;
+   int ret;
struct {
struct nv50_disp_mthd_v1 base;
struct nv50_disp_sor_dp_mst_vcpi_v0 vcpi;
@@ -725,13 +711,14 @@ nv50_msto_prepare(struct nv50_msto *msto)
};
 
NV_ATOMIC(drm, "%s: msto prepare\n", msto->encoder.name);
-   if (mstc->port && mstc->port->vcpi.vcpi > 0) {
-   struct drm_dp_payload *payload = nv50_msto_payload(msto);
-   if (payload) {
-   args.vcpi.start_slot = payload->start_slot;
-   args.vcpi.num_slots = payload->num_slots;
-   args.vcpi.pbn = mstc->port->vcpi.pbn;
-   args.vcpi.aligned_pbn = mstc->port->vcpi.aligned_pbn;
+   if (mstc->port) {
+   ret = drm_dp_get_payload_info(>mgr, mstc->port,
+ , );
+   if (!ret) {
+   args.vcpi.start_slot = payload.start_slot;
+   args.vcpi.num_slots = payload.num_slots;
+   args.vcpi.pbn = vcpi.pbn;
+   args.vcpi.aligned_pbn = vcpi.aligned_pbn;
}
}
 
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 0/6] Remove all bad dp_mst_port uses and hide struct def

2018-11-16 Thread Lyude Paul
So we don't ever have to worry about drivers touching drm_dp_mst_port
structs without verifying them and crashing again.

Lyude Paul (6):
  drm/dp_mst: Add drm_dp_get_payload_info()
  drm/nouveau: Use drm_dp_get_payload_info() for getting payload/vcpi
  drm/nouveau: Stop reading port->mgr in nv50_mstc_get_modes()
  drm/nouveau: Stop reading port->mgr in nv50_mstc_detect()
  drm/dp_mst: Hide drm_dp_mst_port contents from drivers
  drm/i915: Start using struct drm_dp_mst_port again

 drivers/gpu/drm/drm_dp_mst_topology.c   | 115 
 drivers/gpu/drm/i915/intel_dp_mst.c |   2 +-
 drivers/gpu/drm/i915/intel_drv.h|   2 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c |  60 +
 include/drm/drm_dp_mst_helper.h |  65 ++
 5 files changed, 146 insertions(+), 98 deletions(-)

-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/6] drm/dp_mst: Add drm_dp_get_payload_info()

2018-11-16 Thread Lyude Paul
Some hardware (nvidia hardware in particular) needs to be notified of
the exact VCPI and payload settings that the topology manager decided on
for each mstb port. Since there isn't currently any way to get this
information without going through port (which drivers are very much not
supposed to do by themselves, ever), let's add one.

Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 56 +++
 include/drm/drm_dp_mst_helper.h   |  5 ++-
 2 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 529414556962..4336d17ce904 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1982,6 +1982,62 @@ int drm_dp_update_payload_part2(struct 
drm_dp_mst_topology_mgr *mgr)
 }
 EXPORT_SYMBOL(drm_dp_update_payload_part2);
 
+/**
+ * drm_dp_get_payload_info() - Retrieve payload/vcpi information for the given
+ * @port
+ * @mgr: manager to use
+ * @port: the port to get the relevant payload information for
+ * @vcpi_out: where to copy the port's VCPI information to
+ * @payload_out: where to copy the port's payload information to
+ *
+ * Searches the current payloads for @mgr and finds the relevant payload and
+ * VCPI information that was programmed by the topology mgr, then copies it
+ * into @vcpi_out and @payload_out. Drivers which need to know this
+ * information must use this helper as opposed to checking @port themselves,
+ * as this helper will ensure the port reference is still valid and grab the
+ * appropriate locks in @mgr.
+ *
+ * Returns:
+ * 0 on success, negative error code if the port is no longer valid or a
+ * programmed payload could not be found for @port.
+ */
+int drm_dp_get_payload_info(struct drm_dp_mst_topology_mgr *mgr,
+   struct drm_dp_mst_port *port,
+   struct drm_dp_vcpi *vcpi_out,
+   struct drm_dp_payload *payload_out)
+{
+   struct drm_dp_payload *payload = NULL;
+   int i;
+   int ret = 0;
+
+   port = drm_dp_get_validated_port_ref(mgr, port);
+   if (!port)
+   return -EINVAL;
+
+   mutex_lock(>payload_lock);
+   /* Figure out which of the payloads belongs to this port */
+   for (i = 0; i < mgr->max_payloads; i++) {
+   if (mgr->payloads[i].vcpi == port->vcpi.vcpi) {
+   payload = >payloads[i];
+   break;
+   }
+   }
+
+   if (!payload) {
+   DRM_DEBUG_KMS("Failed to find payload for port %p\n", port);
+   ret = -EINVAL;
+   goto out;
+   }
+
+   *payload_out = *payload;
+   *vcpi_out = port->vcpi;
+out:
+   mutex_unlock(>payload_lock);
+   drm_dp_put_port(port);
+   return ret;
+}
+EXPORT_SYMBOL(drm_dp_get_payload_info);
+
 #if 0 /* unused as of yet */
 static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
 struct drm_dp_mst_port *port,
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
index 59f005b419cf..9cc93ea60e7e 100644
--- a/include/drm/drm_dp_mst_helper.h
+++ b/include/drm/drm_dp_mst_helper.h
@@ -592,7 +592,10 @@ bool drm_dp_mst_allocate_vcpi(struct 
drm_dp_mst_topology_mgr *mgr,
  struct drm_dp_mst_port *port, int pbn, int slots);
 
 int drm_dp_mst_get_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct 
drm_dp_mst_port *port);
-
+int drm_dp_get_payload_info(struct drm_dp_mst_topology_mgr *mgr,
+   struct drm_dp_mst_port *port,
+   struct drm_dp_vcpi *vcpi_out,
+   struct drm_dp_payload *payload_out);
 
 void drm_dp_mst_reset_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct 
drm_dp_mst_port *port);
 
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 0/2] drm/amd/dm: Misc MST connector fixes

2018-11-16 Thread Lyude Paul
Some fixes for things I spotted after trying to look at a bug Jerry Zuo
mentioned to me. Didn't manage to reproduce the bug! But I found these.

Cc: Jerry Zuo 

Lyude Paul (2):
  drm/amd/dm: Don't forget to attach MST encoders
  drm/amd/dm: Understand why attaching path/tile properties are needed

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/2] drm/amd/dm: Understand why attaching path/tile properties are needed

2018-11-16 Thread Lyude Paul
Path property is used for userspace to know what MST connector goes to
what actual DRM DisplayPort connector, the tiling property is for tiling
configurations. Not sure what else there is to figure out.

Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 0cca1809fdcd..1b0d209d8367 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -345,9 +345,6 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
drm_connector_attach_encoder(>base,
 >mst_encoder->base);
 
-   /*
-* TODO: understand why this one is needed
-*/
drm_object_attach_property(
>base,
dev->mode_config.path_property,
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] drm/amd/dm: Don't forget to attach MST encoders

2018-11-16 Thread Lyude Paul
Drive-by fix, this is bound to cause problems somewhere.

Signed-off-by: Lyude Paul 
Cc: Jerry Zuo 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index d02c32a1039c..0cca1809fdcd 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -342,6 +342,8 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
master->connector_id);
 
aconnector->mst_encoder = dm_dp_create_fake_mst_encoder(master);
+   drm_connector_attach_encoder(>base,
+>mst_encoder->base);
 
/*
 * TODO: understand why this one is needed
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 08/12] dt-bindings: mediatek: Change the binding for mmsys clocks

2018-11-16 Thread Rob Herring
On Fri, Nov 16, 2018 at 01:54:45PM +0100, matthias@kernel.org wrote:
> From: Matthias Brugger 
> 
> On SoCs with no publical available HW or no working graphic stack
> we change the devicetree binding for the mmsys clock part. This
> way we don't need to register a platform device explicitly in the
> drm driver. Instead we can create a mmsys child which invokes the
> clock driver.
> 
> Signed-off-by: Matthias Brugger 
> ---
>  .../bindings/arm/mediatek/mediatek,mmsys.txt  | 21 ---
>  .../display/mediatek/mediatek,disp.txt|  4 
>  2 files changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git 
> a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt 
> b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
> index 4468345f8b1a..d4e205981363 100644
> --- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
> +++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
> @@ -1,4 +1,4 @@
> -Mediatek mmsys controller
> +Mediatek mmsys clock controller
>  
>  
>  The Mediatek mmsys controller provides various clocks to the system.
> @@ -6,18 +6,25 @@ The Mediatek mmsys controller provides various clocks to 
> the system.
>  Required Properties:
>  
>  - compatible: Should be one of:
> - - "mediatek,mt2712-mmsys", "syscon"
> - - "mediatek,mt6797-mmsys", "syscon"
> + - "mediatek,mt2712-mmsys-clk", "syscon"
> + - "mediatek,mt6797-mmsys-clk", "syscon"

Doesn't match the example.

>  - #clock-cells: Must be 1
>  
> -The mmsys controller uses the common clk binding from
> +The mmsys clock controller uses the common clk binding from
>  Documentation/devicetree/bindings/clock/clock-bindings.txt
>  The available clocks are defined in dt-bindings/clock/mt*-clk.h.
> +It is a child of the mmsys block, see binding at:
> +Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
>  
>  Example:
>  
> -mmsys: clock-controller@1400 {
> - compatible = "mediatek,mt8173-mmsys", "syscon";
> +mmsys: syscon@1400 {
> + compatible = "mediatek,mt2712-mmsys", "syscon", "simple-mfd";
>   reg = <0 0x1400 0 0x1000>;
> - #clock-cells = <1>;
> +
> + mmsys_clk: clock-controller@1400 {
> + compatible = "mediatek,mt2712-mmsys-clk";
> + #clock-cells = <1>;

This goes against the general direction of not defining separate nodes 
for providers with no resources.

Why do you need this and what does it buy if you have to continue to 
support the existing chips?

Rob
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 07/12] dt-bindings: clock: mediatek: delete mmsys clocks

2018-11-16 Thread Rob Herring
On Fri, 16 Nov 2018 13:54:44 +0100, matthias@kernel.org wrote:
> From: Matthias Brugger 
> 
> Some SoCs will now load the clock part of mmsys via
> a platform device from the dsiplay driver.
> Remove the compatible from the clock bindings description.
> 
> Signed-off-by: Matthias Brugger 
> ---
>  .../devicetree/bindings/arm/mediatek/mediatek,mmsys.txt| 3 ---
>  1 file changed, 3 deletions(-)
> 

Reviewed-by: Rob Herring 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 06/12] drm/mediatek: update dt-bindings

2018-11-16 Thread Rob Herring
On Fri, Nov 16, 2018 at 01:54:43PM +0100, matthias@kernel.org wrote:
> From: Matthias Brugger 

The subject is pretty vague...

> 
> Add mmsys bindings description.
> 
> Signed-off-by: Matthias Brugger 
> ---
>  .../display/mediatek/mediatek,disp.txt| 30 +++
>  1 file changed, 17 insertions(+), 13 deletions(-)
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt 
> b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
> index 8469de510001..4b008d992398 100644
> --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
> +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
> @@ -27,20 +27,24 @@ 
> Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt.
>  
>  Required properties (all function blocks):
>  - compatible: "mediatek,-disp-", one of
> - "mediatek,-disp-ovl"   - overlay (4 layers, blending, csc)
> - "mediatek,-disp-rdma"  - read DMA / line buffer
> - "mediatek,-disp-wdma"  - write DMA
> - "mediatek,-disp-color" - color processor
> - "mediatek,-disp-aal"   - adaptive ambient light controller
> - "mediatek,-disp-gamma" - gamma correction
> - "mediatek,-disp-merge" - merge streams from two RDMA sources
> - "mediatek,-disp-split" - split stream to two encoders
> - "mediatek,-disp-ufoe"  - data compression engine
> - "mediatek,-dsi"- DSI controller, see mediatek,dsi.txt
> - "mediatek,-dpi"- DPI controller, see mediatek,dpi.txt
> - "mediatek,-disp-mutex" - display mutex
> - "mediatek,-disp-od"- overdrive
> + "mediatek,-disp-ovl"  - overlay (4 layers, blending, 
> csc)
> + "mediatek,-disp-rdma" - read DMA / line buffer
> + "mediatek,-disp-wdma" - write DMA
> + "mediatek,-disp-color"- color processor
> + "mediatek,-disp-aal"  - adaptive ambient light 
> controller
> + "mediatek,-disp-gamma"- gamma correction
> + "mediatek,-disp-merge"- merge streams from two RDMA 
> sources
> + "mediatek,-disp-split"- split stream to two encoders
> + "mediatek,-disp-ufoe" - data compression engine
> + "mediatek,-dsi"   - DSI controller, see 
> mediatek,dsi.txt
> + "mediatek,-dpi"   - DPI controller, see 
> mediatek,dpi.txt
> + "mediatek,-disp-mutex"- display mutex
> + "mediatek,-disp-od"   - overdrive
> + "mediatek,-mmsys", "syscon"   - provide clocks and components 
> management

A lot of reformatting for a 1 line change. It's fine if you want to 
leave this as one patch, but make the commit msg clear what's really 
changing here.

>the supported chips are mt2701, mt2712 and mt8173.
> +  For mt7623, compatible must be:
> + "mediatek,mt7623-" , "mediatek,mt2701-"
> +
>  - reg: Physical base address and length of the function block register space
>  - interrupts: The interrupt signal from the function block (required, except 
> for
>merge and split function blocks).
> -- 
> 2.19.1
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv4 4/6] drm/omap: fix incorrect union usage

2018-11-16 Thread Sebastian Reichel
Hi Tomi,

On Fri, Nov 16, 2018 at 03:41:24PM +0200, Tomi Valkeinen wrote:
> On 16/11/18 01:06, Sebastian Reichel wrote:
> > The DSI encoder sets dssdev->ops->dsi.set_config, which is stored at the
> > same offset as dssdev->ops->hdmi.set_hdmi_mode. The code in omap_encoder
> > only checks if dssdev->ops->hdmi.set_hdmi_mode is NULL. Due to the way
> > union works, it won't be NULL if dsi.set_config is set. This means
> > dsi_set_config will be called with config=hdmi_mode=false=NULL parameter
> > resulting in a NULL dereference. Also the dereference happens while
> > console is locked, so kernel hangs without any debug output (can be
> > avoided by fbmem's lockless_register_fb=1 parameter).
> > 
> > This fixes the issue by exiting early if the output type definitely
> > has no hdmi_set operations.
> > 
> > Fixes: 83910ad3f51fb ("drm/omap: Move most omap_dss_driver operations to 
> > omap_dss_device_ops")
> > Signed-off-by: Sebastian Reichel 
> > ---
> >  drivers/gpu/drm/omapdrm/omap_encoder.c | 8 
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c 
> > b/drivers/gpu/drm/omapdrm/omap_encoder.c
> > index 32bbe3a80e7d..ba0099f0644c 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> > +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> > @@ -122,6 +122,14 @@ static void omap_encoder_mode_set(struct drm_encoder 
> > *encoder,
> >  
> > dssdev = omap_encoder->output;
> >  
> > +   /* The following operations access dssdev->ops->hdmi, which is a union
> > +* also used by DSI. This ensures, that the field does not have data
> > +* for DSI (or any other future output type).
> > +*/
> > +   if (dssdev->output_type != OMAP_DISPLAY_TYPE_HDMI &&
> > +   dssdev->output_type != OMAP_DISPLAY_TYPE_DVI)
> 
> Good catch.
> 
> Why DVI?
> 
> I think the whole code block starting from
> 
> /* Set the HDMI mode and HDMI infoframe if applicable. */
> 
> to the end of the function should be inside
> 
> if (dssdev->output_type == OMAP_DISPLAY_TYPE_HDMI)

When I identified the issue I whitelisted DVI, since I wasn't sure
if it also has the HDMI functionality. I planned to check the code
later and then forgot about it. You are right, this should only
check for HDMI.

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH -next] drm/msm: dpu: Fix "WARNING: invalid free of devm_ allocated data"

2018-11-16 Thread Sean Paul
On Fri, Nov 16, 2018 at 07:25:26PM +0800, YueHaibing wrote:
> 'dpu_enc' is a member of 'drm_enc'

It's the other way around :)

> And 'drm_enc' got allocated with devm_kzalloc in dpu_encoder_init.
> 
> This gives this error message:
> ./drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c:459:1-6:
>  WARNING: invalid free of devm_ allocated data
> 
> Signed-off-by: YueHaibing 

Reviewed-by: Sean Paul 

> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index 82c55ef..99526d9 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -455,8 +455,6 @@ static void dpu_encoder_destroy(struct drm_encoder 
> *drm_enc)
>  
>   drm_encoder_cleanup(drm_enc);
>   mutex_destroy(_enc->enc_lock);
> -
> - kfree(dpu_enc);
>  }
>  
>  void dpu_encoder_helper_split_config(
> -- 
> 2.7.0
> 
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/2] drm/msm/dpu: add dpu encoder uninit

2018-11-16 Thread Sean Paul
On Fri, Nov 16, 2018 at 04:35:26PM -0500, Sean Paul wrote:
> On Fri, Nov 16, 2018 at 11:22:21AM -0800, Jeykumar Sankaran wrote:
> > Add encoder interface to release dpu encoder
> > on mode_init failures in kms.
> > 
> > Signed-off-by: Jeykumar Sankaran 
> > ---
> >  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 12 ++--
> >  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h |  6 ++
> >  2 files changed, 16 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
> > b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > index dd7ab85..b253165 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> > @@ -422,6 +422,15 @@ void dpu_encoder_get_hw_resources(struct drm_encoder 
> > *drm_enc,
> > }
> >  }
> >  
> > +void dpu_encoder_uninit(struct drm_encoder *drm_enc)
> > +{
> > +   struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
> > +
> > +   drm_encoder_cleanup(drm_enc);
> > +
> > +   kfree(dpu_enc);
> > +}
> > +
> >  static void dpu_encoder_destroy(struct drm_encoder *drm_enc)
> >  {
> > struct dpu_encoder_virt *dpu_enc = NULL;
> > @@ -453,10 +462,9 @@ static void dpu_encoder_destroy(struct drm_encoder 
> > *drm_enc)
> > dpu_enc->num_phys_encs = 0;
> > mutex_unlock(_enc->enc_lock);
> >  
> > -   drm_encoder_cleanup(drm_enc);
> > mutex_destroy(_enc->enc_lock);
> >  
> > -   kfree(dpu_enc);
> > +   dpu_encoder_uninit(drm_enc);
> >  }
> >  
> >  void dpu_encoder_helper_split_config(
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h 
> > b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> > index 9dbf38f..60b88bd 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> > @@ -142,6 +142,12 @@ struct drm_encoder *dpu_encoder_init(
> > int drm_enc_mode);
> >  
> >  /**
> > + * dpu_encoder_uninit - uninitialize virtual encoder object
> > + * @drm_enc:  Pointer to drm encoder
> > + */
> > +void dpu_encoder_uninit(struct drm_encoder *drm_enc);
> 
> Just make it static?

I just saw YueHaibing's patch to remove the kfree entirely since dpu_enc is
devm_* managed. IMO, that'd be a better solution than this.

Sean


> 
> > +
> > +/**
> >   * dpu_encoder_setup - setup dpu_encoder for the display probed
> >   * @dev:   Pointer to drm device structure
> >   * @enc:   Pointer to the drm_encoder
> > -- 
> > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> > a Linux Foundation Collaborative Project
> > 
> 
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 4/5] drm/cma-helper: Add DRM_GEM_CMA_VMAP_DRIVER_OPS

2018-11-16 Thread Eric Anholt
Noralf Trønnes  writes:

> This adds functionality to the CMA helper which ensures that the kernel
> virtual address is set on the CMA GEM object also for imported buffers.
>
> The drivers have been audited to ensure that none set ->vaddr on imported
> buffers, making the conditional dma_buf_vunmap() call in
> drm_gem_cma_free_object() safe.
>
> Signed-off-by: Noralf Trønnes 

I didn't look through 1-3 much since they had acks, but 4/5 get my:

Reviewed-by: Eric Anholt 


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/2] drm/msm/dpu: add dpu encoder uninit

2018-11-16 Thread Sean Paul
On Fri, Nov 16, 2018 at 11:22:21AM -0800, Jeykumar Sankaran wrote:
> Add encoder interface to release dpu encoder
> on mode_init failures in kms.
> 
> Signed-off-by: Jeykumar Sankaran 
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 12 ++--
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h |  6 ++
>  2 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index dd7ab85..b253165 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -422,6 +422,15 @@ void dpu_encoder_get_hw_resources(struct drm_encoder 
> *drm_enc,
>   }
>  }
>  
> +void dpu_encoder_uninit(struct drm_encoder *drm_enc)
> +{
> + struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
> +
> + drm_encoder_cleanup(drm_enc);
> +
> + kfree(dpu_enc);
> +}
> +
>  static void dpu_encoder_destroy(struct drm_encoder *drm_enc)
>  {
>   struct dpu_encoder_virt *dpu_enc = NULL;
> @@ -453,10 +462,9 @@ static void dpu_encoder_destroy(struct drm_encoder 
> *drm_enc)
>   dpu_enc->num_phys_encs = 0;
>   mutex_unlock(_enc->enc_lock);
>  
> - drm_encoder_cleanup(drm_enc);
>   mutex_destroy(_enc->enc_lock);
>  
> - kfree(dpu_enc);
> + dpu_encoder_uninit(drm_enc);
>  }
>  
>  void dpu_encoder_helper_split_config(
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h 
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> index 9dbf38f..60b88bd 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
> @@ -142,6 +142,12 @@ struct drm_encoder *dpu_encoder_init(
>   int drm_enc_mode);
>  
>  /**
> + * dpu_encoder_uninit - uninitialize virtual encoder object
> + * @drm_enc:  Pointer to drm encoder
> + */
> +void dpu_encoder_uninit(struct drm_encoder *drm_enc);

Just make it static?

> +
> +/**
>   * dpu_encoder_setup - setup dpu_encoder for the display probed
>   * @dev: Pointer to drm device structure
>   * @enc: Pointer to the drm_encoder
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 14/24] drm/msm: dpu: Grab the modeset locks in frame_event

2018-11-16 Thread Sean Paul
On Fri, Nov 16, 2018 at 12:02:54PM -0800, Jeykumar Sankaran wrote:
> On 2018-11-16 10:42, Sean Paul wrote:
> > From: Sean Paul 
> > 
> > This patch wraps dpu_core_perf_crtc_release_bw() with modeset locks
> > since it digs into the state objects.
> > 
> > Changes in v2:
> > - None
> > 
> > Signed-off-by: Sean Paul 
> > ---
> Reviewed-by: Jeykumar Sankaran 
> 
> >  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > index 80de5289ada3..156f4c77ca44 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > @@ -335,7 +335,9 @@ static void dpu_crtc_frame_event_work(struct
> > kthread_work *work)
> > /* release bandwidth and other resources */
> > trace_dpu_crtc_frame_event_done(DRMID(crtc),
> > fevent->event);
> > +   drm_modeset_lock_all(crtc->dev);
> > dpu_core_perf_crtc_release_bw(crtc);
> > +   drm_modeset_unlock_all(crtc->dev);
> We might need to revisit this locking when we measure for performance as it
> could block the incoming frame locking.
> 

Definitely something to keep an eye on.

That said, we really do want it to block the incoming frame since we're reducing
bw. It would be really unfortunate if this happened concurrently with a commit.
If this _does_ cause a performance problem, we should really investigate the
criteria for reducing bw.

Sean

> > } else {
> > 
> > trace_dpu_crtc_frame_event_more_pending(DRMID(crtc),
> > 
> > fevent->event);
> 
> -- 
> Jeykumar S

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 15/24] drm/msm: dpu: Stop using encoder->crtc pointer

2018-11-16 Thread Sean Paul
On Fri, Nov 16, 2018 at 12:05:09PM -0800, Jeykumar Sankaran wrote:
> On 2018-11-16 10:42, Sean Paul wrote:
> > From: Sean Paul 
> > 
> > It's for legacy drivers, for atomic drivers crtc->state->encoder_mask
> > should be used to map encoder to crtc.
> > 
> > Changes in v2:
> > - None
> > 
> > Signed-off-by: Sean Paul 
> > ---
> >  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 46 
> >  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  | 19 +++---
> >  2 files changed, 29 insertions(+), 36 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > index 156f4c77ca44..a008a87a8113 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > @@ -284,9 +284,9 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct
> > drm_crtc *crtc)
> > return INTF_MODE_NONE;
> > }
> > 
> > -   drm_for_each_encoder(encoder, crtc->dev)
> > -   if (encoder->crtc == crtc)
> > -   return dpu_encoder_get_intf_mode(encoder);
> > +   /* TODO: Returns the first INTF_MODE, could there be multiple
> > values? */
> > +   drm_for_each_encoder_mask(encoder, crtc->dev,
> > crtc->state->encoder_mask)
> > +   return dpu_encoder_get_intf_mode(encoder);
> > 
> > return INTF_MODE_NONE;
> >  }
> > @@ -551,13 +551,9 @@ static void dpu_crtc_atomic_begin(struct drm_crtc
> > *crtc,
> > spin_unlock_irqrestore(>event_lock, flags);
> > }
> > 
> > -   list_for_each_entry(encoder, >mode_config.encoder_list, head)
> > {
> > -   if (encoder->crtc != crtc)
> > -   continue;
> > -
> > -   /* encoder will trigger pending mask now */
> > +   /* encoder will trigger pending mask now */
> > +   drm_for_each_encoder_mask(encoder, crtc->dev,
> > crtc->state->encoder_mask)
> > dpu_encoder_trigger_kickoff_pending(encoder);
> > -   }
> > 
> > /*
> >  * If no mixers have been allocated in dpu_crtc_atomic_check(),
> > @@ -704,7 +700,6 @@ static int _dpu_crtc_wait_for_frame_done(struct
> > drm_crtc *crtc)
> >  void dpu_crtc_commit_kickoff(struct drm_crtc *crtc)
> >  {
> > struct drm_encoder *encoder;
> > -   struct drm_device *dev = crtc->dev;
> > struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
> > struct dpu_kms *dpu_kms = _dpu_crtc_get_kms(crtc);
> > struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc->state);
> > @@ -720,16 +715,13 @@ void dpu_crtc_commit_kickoff(struct drm_crtc
> > *crtc)
> > 
> > DPU_ATRACE_BEGIN("crtc_commit");
> > 
> > -   list_for_each_entry(encoder, >mode_config.encoder_list, head)
> > {
> > +   /*
> > +* Encoder will flush/start now, unless it has a tx pending. If
> > so, it
> > +* may delay and flush at an irq event (e.g. ppdone)
> > +*/
> > +   drm_for_each_encoder_mask(encoder, crtc->dev,
> > + crtc->state->encoder_mask) {
> > struct dpu_encoder_kickoff_params params = { 0 };
> > -
> > -   if (encoder->crtc != crtc)
> > -   continue;
> > -
> > -   /*
> > -* Encoder will flush/start now, unless it has a tx
> > pending.
> > -* If so, it may delay and flush at an irq event (e.g.
> > ppdone)
> > -*/
> > dpu_encoder_prepare_for_kickoff(encoder, );
> > }
> > 
> > @@ -754,12 +746,8 @@ void dpu_crtc_commit_kickoff(struct drm_crtc *crtc)
> > 
> > dpu_vbif_clear_errors(dpu_kms);
> > 
> > -   list_for_each_entry(encoder, >mode_config.encoder_list, head)
> > {
> > -   if (encoder->crtc != crtc)
> > -   continue;
> > -
> > +   drm_for_each_encoder_mask(encoder, crtc->dev,
> > crtc->state->encoder_mask)
> > dpu_encoder_kickoff(encoder);
> > -   }
> We wont be holding the modeset locks here (and in crtc_atomic_begin) in the
> display thread. Is
> it safe to iterate over encoder_mask?

Hmm, I'm not sure I follow. AFAICT, there are 2 callsites for
dpu_crtc_commit_kickoff():

1- dpu_kms_encoder_enable() which is called via the encoder->funcs->enable hook
2- dpu_kms_commit() which is called in the 
mode_config->funcs->atomic_commit_tail

Both of these callsites will hold the modeset locks.

Am I missing something?

Thanks for your review,

Sean

> > 
> >  end:
> > reinit_completion(_crtc->frame_done_comp);
> > @@ -883,11 +871,8 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
> > 
> > dpu_core_perf_crtc_update(crtc, 0, true);
> > 
> > -   drm_for_each_encoder(encoder, crtc->dev) {
> > -   if (encoder->crtc != crtc)
> > -   continue;
> > +   drm_for_each_encoder_mask(encoder, crtc->dev,
> > crtc->state->encoder_mask)
> > dpu_encoder_register_frame_event_callback(encoder, NULL,
> > NULL);
> > -   }
> > 
> > memset(cstate->mixers, 0, sizeof(cstate->mixers));
> > cstate->num_mixers = 0;
> > @@ -922,12 +907,9 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
> > 

Re: [PATCH 2/2] drm/msm/dpu: add display port support in DPU

2018-11-16 Thread Jordan Crouse
On Fri, Nov 16, 2018 at 11:22:22AM -0800, Jeykumar Sankaran wrote:
> Add display port support in DPU by creating hooks
> for DP encoder enumeration and encoder mode
> initialization.
> 
> This change is based on the SDM845 Display port
> driver changes[1].
> 
> [1] https://lwn.net/Articles/768265/
> 
> Signed-off-by: Jeykumar Sankaran 
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  3 ++
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 49 
> +
>  2 files changed, 46 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index b253165..e9c7edc6 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -2048,6 +2048,9 @@ static int dpu_encoder_setup_display(struct 
> dpu_encoder_virt *dpu_enc,
>   case DRM_MODE_ENCODER_DSI:
>   intf_type = INTF_DSI;
>   break;
> + case DRM_MODE_ENCODER_TMDS:
> + intf_type = INTF_DP;
> + break;
>   default:
>   DPU_ERROR_ENC(dpu_enc, "unsupported display interface type\n");
>   return -EINVAL;
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 985c855..b823a37 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -473,6 +473,31 @@ static void _dpu_kms_initialize_dsi(struct drm_device 
> *dev,
>   }
>  }
>  
> +static void _dpu_kms_initialize_displayport(struct drm_device *dev,
> + struct msm_drm_private *priv,
> + struct dpu_kms *dpu_kms)
> +{
> + struct drm_encoder *encoder = NULL;
> + int rc;
> +
> + if (!priv->dp)
> + return;
> +
> + encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS);
> + if (IS_ERR_OR_NULL(encoder)) {

dpu_encoder_init() only returns valid pointer or ERR_PTR() so a Only IS_ERR() is
needed.

> + DPU_ERROR("encoder init failed for dsi display\n");
> + return;
> + }
> +
> + priv->encoders[priv->num_encoders++] = encoder;
> +
> + rc = msm_dp_modeset_init(priv->dp, dev, encoder);
> + if (rc) {
> + DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
> + dpu_encoder_uninit(encoder);
> + }
> +}
> +
>  /**
>   * _dpu_kms_setup_displays - create encoders, bridges and connectors
>   *   for underlying displays
> @@ -487,6 +512,8 @@ static void _dpu_kms_setup_displays(struct drm_device 
> *dev,
>  {
>   _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
>  
> + _dpu_kms_initialize_displayport(dev, priv, dpu_kms);
> +
>   /**
>* Extend this function to initialize other
>* types of displays
> @@ -723,13 +750,23 @@ static void _dpu_kms_set_encoder_mode(struct msm_kms 
> *kms,
>   info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE :
>   MSM_DISPLAY_CAP_VID_MODE;
>  
> - /* TODO: No support for DSI swap */
> - for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> - if (priv->dsi[i]) {
> - info.h_tile_instance[info.num_of_h_tiles] = i;
> - info.num_of_h_tiles++;
> + switch (info.intf_type) {
> + case DRM_MODE_ENCODER_DSI:
> + /* TODO: No support for DSI swap */
> + for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> + if (priv->dsi[i]) {
> + info.h_tile_instance[info.num_of_h_tiles] = i;
> + info.num_of_h_tiles++;
> + }
>   }
> - }
> + break;
> + case DRM_MODE_ENCODER_TMDS:
> + info.num_of_h_tiles = 1;
> + break;
> + default:
> + DPU_ERROR("Invalid connector type\n");
> + return;
> + };

This is still going to be one of two options, a simple if/else can suffice here
and you don't need a log message and a default path.
>  
>   rc = dpu_encoder_setup(encoder->dev, encoder, );
>   if (rc)

Jordan
-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH -next] drm/msm: dpu: Fix "WARNING: invalid free of devm_ allocated data"

2018-11-16 Thread Jordan Crouse
On Fri, Nov 16, 2018 at 07:25:26PM +0800, YueHaibing wrote:
> 'dpu_enc' is a member of 'drm_enc'
> And 'drm_enc' got allocated with devm_kzalloc in dpu_encoder_init.
> 
> This gives this error message:
> ./drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c:459:1-6:
>  WARNING: invalid free of devm_ allocated data

I had partial fix of this in my ill-fated patch from a few weeks ago but this
is better.

Reviewed-by: Jordan Crouse 

> Signed-off-by: YueHaibing 
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index 82c55ef..99526d9 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -455,8 +455,6 @@ static void dpu_encoder_destroy(struct drm_encoder 
> *drm_enc)
>  
>   drm_encoder_cleanup(drm_enc);
>   mutex_destroy(_enc->enc_lock);
> -
> - kfree(dpu_enc);
>  }
>  
>  void dpu_encoder_helper_split_config(
> -- 
> 2.7.0
> 
> 

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 16/24] drm/msm: dpu: Add modeset lock checks where applicable

2018-11-16 Thread Jeykumar Sankaran

On 2018-11-16 10:42, Sean Paul wrote:

From: Sean Paul 

Add modeset lock checks to functions that could be called outside the
core atomic stack.

Changes in v2:
- None

Signed-off-by: Sean Paul 
---


Reviewed-by: Jeykumar Sankaran 


 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 ++
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index a008a87a8113..cd0a0bea4335 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -284,6 +284,8 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct
drm_crtc *crtc)
return INTF_MODE_NONE;
}

+   WARN_ON(!drm_modeset_is_locked(>mutex));
+
/* TODO: Returns the first INTF_MODE, could there be multiple
values? */
drm_for_each_encoder_mask(encoder, crtc->dev,
crtc->state->encoder_mask)
return dpu_encoder_get_intf_mode(encoder);
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 64134d619748..5104fc01147e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -358,6 +358,7 @@ void dpu_kms_encoder_enable(struct drm_encoder
*encoder)
if (funcs && funcs->commit)
funcs->commit(encoder);

+
WARN_ON(!drm_modeset_is_locked(>mode_config.connection_mutex));
drm_for_each_crtc(crtc, dev) {
if (!(crtc->state->encoder_mask &
drm_encoder_mask(encoder)))
continue;


--
Jeykumar S
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 15/24] drm/msm: dpu: Stop using encoder->crtc pointer

2018-11-16 Thread Jeykumar Sankaran

On 2018-11-16 10:42, Sean Paul wrote:

From: Sean Paul 

It's for legacy drivers, for atomic drivers crtc->state->encoder_mask
should be used to map encoder to crtc.

Changes in v2:
- None

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 46 
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  | 19 +++---
 2 files changed, 29 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 156f4c77ca44..a008a87a8113 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -284,9 +284,9 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct
drm_crtc *crtc)
return INTF_MODE_NONE;
}

-   drm_for_each_encoder(encoder, crtc->dev)
-   if (encoder->crtc == crtc)
-   return dpu_encoder_get_intf_mode(encoder);
+   /* TODO: Returns the first INTF_MODE, could there be multiple
values? */
+   drm_for_each_encoder_mask(encoder, crtc->dev,
crtc->state->encoder_mask)
+   return dpu_encoder_get_intf_mode(encoder);

return INTF_MODE_NONE;
 }
@@ -551,13 +551,9 @@ static void dpu_crtc_atomic_begin(struct drm_crtc
*crtc,
spin_unlock_irqrestore(>event_lock, flags);
}

-   list_for_each_entry(encoder, >mode_config.encoder_list, head)
{
-   if (encoder->crtc != crtc)
-   continue;
-
-   /* encoder will trigger pending mask now */
+   /* encoder will trigger pending mask now */
+   drm_for_each_encoder_mask(encoder, crtc->dev,
crtc->state->encoder_mask)
dpu_encoder_trigger_kickoff_pending(encoder);
-   }

/*
 * If no mixers have been allocated in dpu_crtc_atomic_check(),
@@ -704,7 +700,6 @@ static int _dpu_crtc_wait_for_frame_done(struct
drm_crtc *crtc)
 void dpu_crtc_commit_kickoff(struct drm_crtc *crtc)
 {
struct drm_encoder *encoder;
-   struct drm_device *dev = crtc->dev;
struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
struct dpu_kms *dpu_kms = _dpu_crtc_get_kms(crtc);
struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc->state);
@@ -720,16 +715,13 @@ void dpu_crtc_commit_kickoff(struct drm_crtc 
*crtc)


DPU_ATRACE_BEGIN("crtc_commit");

-   list_for_each_entry(encoder, >mode_config.encoder_list, head)
{
+   /*
+* Encoder will flush/start now, unless it has a tx pending. If
so, it
+* may delay and flush at an irq event (e.g. ppdone)
+*/
+   drm_for_each_encoder_mask(encoder, crtc->dev,
+ crtc->state->encoder_mask) {
struct dpu_encoder_kickoff_params params = { 0 };
-
-   if (encoder->crtc != crtc)
-   continue;
-
-   /*
-* Encoder will flush/start now, unless it has a tx
pending.
-* If so, it may delay and flush at an irq event (e.g.
ppdone)
-*/
dpu_encoder_prepare_for_kickoff(encoder, );
}

@@ -754,12 +746,8 @@ void dpu_crtc_commit_kickoff(struct drm_crtc 
*crtc)


dpu_vbif_clear_errors(dpu_kms);

-   list_for_each_entry(encoder, >mode_config.encoder_list, head)
{
-   if (encoder->crtc != crtc)
-   continue;
-
+   drm_for_each_encoder_mask(encoder, crtc->dev,
crtc->state->encoder_mask)
dpu_encoder_kickoff(encoder);
-   }
We wont be holding the modeset locks here (and in crtc_atomic_begin) in 
the display thread. Is

it safe to iterate over encoder_mask?


 end:
reinit_completion(_crtc->frame_done_comp);
@@ -883,11 +871,8 @@ static void dpu_crtc_disable(struct drm_crtc 
*crtc)


dpu_core_perf_crtc_update(crtc, 0, true);

-   drm_for_each_encoder(encoder, crtc->dev) {
-   if (encoder->crtc != crtc)
-   continue;
+   drm_for_each_encoder_mask(encoder, crtc->dev,
crtc->state->encoder_mask)
dpu_encoder_register_frame_event_callback(encoder, NULL,
NULL);
-   }

memset(cstate->mixers, 0, sizeof(cstate->mixers));
cstate->num_mixers = 0;
@@ -922,12 +907,9 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
DRM_DEBUG_KMS("crtc%d\n", crtc->base.id);
dpu_crtc = to_dpu_crtc(crtc);

-   drm_for_each_encoder(encoder, crtc->dev) {
-   if (encoder->crtc != crtc)
-   continue;
+   drm_for_each_encoder_mask(encoder, crtc->dev,
crtc->state->encoder_mask)
dpu_encoder_register_frame_event_callback(encoder,
dpu_crtc_frame_event_cb, (void *)crtc);
-   }

mutex_lock(_crtc->crtc_lock);
trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc);
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 1bec4540f3e1..64134d619748 100644
--- 

Re: [PATCH v2 14/24] drm/msm: dpu: Grab the modeset locks in frame_event

2018-11-16 Thread Jeykumar Sankaran

On 2018-11-16 10:42, Sean Paul wrote:

From: Sean Paul 

This patch wraps dpu_core_perf_crtc_release_bw() with modeset locks
since it digs into the state objects.

Changes in v2:
- None

Signed-off-by: Sean Paul 
---

Reviewed-by: Jeykumar Sankaran 


 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 80de5289ada3..156f4c77ca44 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -335,7 +335,9 @@ static void dpu_crtc_frame_event_work(struct
kthread_work *work)
/* release bandwidth and other resources */
trace_dpu_crtc_frame_event_done(DRMID(crtc),
fevent->event);
+   drm_modeset_lock_all(crtc->dev);
dpu_core_perf_crtc_release_bw(crtc);
+   drm_modeset_unlock_all(crtc->dev);
We might need to revisit this locking when we measure for performance as 
it

could block the incoming frame locking.


} else {

trace_dpu_crtc_frame_event_more_pending(DRMID(crtc),

fevent->event);


--
Jeykumar S
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 3/3] drm/msm: dpu: Make legacy cursor updates asynchronous

2018-11-16 Thread Sean Paul
On Thu, Nov 08, 2018 at 02:00:51PM -0800, Jeykumar Sankaran wrote:
> On 2018-10-30 09:00, Sean Paul wrote:
> > From: Sean Paul 
> > 
> > This patch sprinkles a few async/legacy_cursor_update checks
> > through commit to ensure that cursor updates aren't blocked on vsync.
> > There are 2 main components to this, the first is that we don't want to
> > wait_for_commit_done in msm_atomic  before returning from
> > atomic_complete.
> > The second is that in dpu we don't want to wait for frame_done events
> > when
> > updating the cursor.
> > 
> > Changes in v2:
> > - None
> > 
> > Signed-off-by: Sean Paul 
> > ---
> >  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c| 44 +++--
> >  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h|  3 +-
> >  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 22 +++
> >  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h |  6 ++-
> >  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |  5 ++-
> >  drivers/gpu/drm/msm/msm_atomic.c|  3 +-
> >  6 files changed, 49 insertions(+), 34 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > index ed84cf44a222..1e3e57817b72 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > @@ -702,7 +702,7 @@ static int _dpu_crtc_wait_for_frame_done(struct
> > drm_crtc *crtc)
> > return rc;
> >  }
> > 
> > -void dpu_crtc_commit_kickoff(struct drm_crtc *crtc)
> > +void dpu_crtc_commit_kickoff(struct drm_crtc *crtc, bool async)
> >  {
> > struct drm_encoder *encoder;
> > struct drm_device *dev = crtc->dev;
> > @@ -731,27 +731,30 @@ void dpu_crtc_commit_kickoff(struct drm_crtc
> > *crtc)
> >  * Encoder will flush/start now, unless it has a tx
> > pending.
> >  * If so, it may delay and flush at an irq event (e.g.
> > ppdone)
> >  */
> > -   dpu_encoder_prepare_for_kickoff(encoder, );
> > +   dpu_encoder_prepare_for_kickoff(encoder, , async);
> > }
> > 
> > -   /* wait for frame_event_done completion */
> > -   DPU_ATRACE_BEGIN("wait_for_frame_done_event");
> > -   ret = _dpu_crtc_wait_for_frame_done(crtc);
> > -   DPU_ATRACE_END("wait_for_frame_done_event");
> > -   if (ret) {
> > -   DPU_ERROR("crtc%d wait for frame done
> > failed;frame_pending%d\n",
> > -   crtc->base.id,
> > -   atomic_read(_crtc->frame_pending));
> > -   goto end;
> > -   }
> > 
> > -   if (atomic_inc_return(_crtc->frame_pending) == 1) {
> > -   /* acquire bandwidth and other resources */
> > -   DPU_DEBUG("crtc%d first commit\n", crtc->base.id);
> > -   } else
> > -   DPU_DEBUG("crtc%d commit\n", crtc->base.id);
> > +   if (!async) {
> > +   /* wait for frame_event_done completion */
> > +   DPU_ATRACE_BEGIN("wait_for_frame_done_event");
> > +   ret = _dpu_crtc_wait_for_frame_done(crtc);
> > +   DPU_ATRACE_END("wait_for_frame_done_event");
> > +   if (ret) {
> > +   DPU_ERROR("crtc%d wait for frame done
> > failed;frame_pending%d\n",
> > +   crtc->base.id,
> > +
> > atomic_read(_crtc->frame_pending));
> > +   goto end;
> > +   }
> > +
> > +   if (atomic_inc_return(_crtc->frame_pending) == 1) {
> > +   /* acquire bandwidth and other resources */
> > +   DPU_DEBUG("crtc%d first commit\n", crtc->base.id);
> > +   } else
> > +   DPU_DEBUG("crtc%d commit\n", crtc->base.id);
> > 
> > -   dpu_crtc->play_count++;
> > +   dpu_crtc->play_count++;
> > +   }
> > 
> > dpu_vbif_clear_errors(dpu_kms);
> > 
> > @@ -759,11 +762,12 @@ void dpu_crtc_commit_kickoff(struct drm_crtc
> > *crtc)
> > if (encoder->crtc != crtc)
> > continue;
> > 
> > -   dpu_encoder_kickoff(encoder);
> > +   dpu_encoder_kickoff(encoder, async);
> > }
> > 
> >  end:
> > -   reinit_completion(_crtc->frame_done_comp);
> > +   if (!async)
> > +   reinit_completion(_crtc->frame_done_comp);
> > DPU_ATRACE_END("crtc_commit");
> >  }
> > 
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> > b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> > index 4822602402f9..ec633ce3ee6c 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> > @@ -277,8 +277,9 @@ int dpu_crtc_vblank(struct drm_crtc *crtc, bool en);
> >  /**
> >   * dpu_crtc_commit_kickoff - trigger kickoff of the commit for this
> > crtc
> >   * @crtc: Pointer to drm crtc object
> > + * @async: true if the commit is asynchronous, false otherwise
> >   */
> > -void dpu_crtc_commit_kickoff(struct drm_crtc *crtc);
> > +void dpu_crtc_commit_kickoff(struct drm_crtc *crtc, bool async);
> > 
> >  /**
> >   * dpu_crtc_complete_commit - callback signalling completion of current
> > commit

[PATCH 2/2] drm/msm/dpu: add display port support in DPU

2018-11-16 Thread Jeykumar Sankaran
Add display port support in DPU by creating hooks
for DP encoder enumeration and encoder mode
initialization.

This change is based on the SDM845 Display port
driver changes[1].

[1] https://lwn.net/Articles/768265/

Signed-off-by: Jeykumar Sankaran 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  3 ++
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 49 +
 2 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index b253165..e9c7edc6 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -2048,6 +2048,9 @@ static int dpu_encoder_setup_display(struct 
dpu_encoder_virt *dpu_enc,
case DRM_MODE_ENCODER_DSI:
intf_type = INTF_DSI;
break;
+   case DRM_MODE_ENCODER_TMDS:
+   intf_type = INTF_DP;
+   break;
default:
DPU_ERROR_ENC(dpu_enc, "unsupported display interface type\n");
return -EINVAL;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 985c855..b823a37 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -473,6 +473,31 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev,
}
 }
 
+static void _dpu_kms_initialize_displayport(struct drm_device *dev,
+   struct msm_drm_private *priv,
+   struct dpu_kms *dpu_kms)
+{
+   struct drm_encoder *encoder = NULL;
+   int rc;
+
+   if (!priv->dp)
+   return;
+
+   encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS);
+   if (IS_ERR_OR_NULL(encoder)) {
+   DPU_ERROR("encoder init failed for dsi display\n");
+   return;
+   }
+
+   priv->encoders[priv->num_encoders++] = encoder;
+
+   rc = msm_dp_modeset_init(priv->dp, dev, encoder);
+   if (rc) {
+   DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
+   dpu_encoder_uninit(encoder);
+   }
+}
+
 /**
  * _dpu_kms_setup_displays - create encoders, bridges and connectors
  *   for underlying displays
@@ -487,6 +512,8 @@ static void _dpu_kms_setup_displays(struct drm_device *dev,
 {
_dpu_kms_initialize_dsi(dev, priv, dpu_kms);
 
+   _dpu_kms_initialize_displayport(dev, priv, dpu_kms);
+
/**
 * Extend this function to initialize other
 * types of displays
@@ -723,13 +750,23 @@ static void _dpu_kms_set_encoder_mode(struct msm_kms *kms,
info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE :
MSM_DISPLAY_CAP_VID_MODE;
 
-   /* TODO: No support for DSI swap */
-   for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
-   if (priv->dsi[i]) {
-   info.h_tile_instance[info.num_of_h_tiles] = i;
-   info.num_of_h_tiles++;
+   switch (info.intf_type) {
+   case DRM_MODE_ENCODER_DSI:
+   /* TODO: No support for DSI swap */
+   for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
+   if (priv->dsi[i]) {
+   info.h_tile_instance[info.num_of_h_tiles] = i;
+   info.num_of_h_tiles++;
+   }
}
-   }
+   break;
+   case DRM_MODE_ENCODER_TMDS:
+   info.num_of_h_tiles = 1;
+   break;
+   default:
+   DPU_ERROR("Invalid connector type\n");
+   return;
+   };
 
rc = dpu_encoder_setup(encoder->dev, encoder, );
if (rc)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] drm/msm/dpu: add dpu encoder uninit

2018-11-16 Thread Jeykumar Sankaran
Add encoder interface to release dpu encoder
on mode_init failures in kms.

Signed-off-by: Jeykumar Sankaran 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 12 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h |  6 ++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index dd7ab85..b253165 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -422,6 +422,15 @@ void dpu_encoder_get_hw_resources(struct drm_encoder 
*drm_enc,
}
 }
 
+void dpu_encoder_uninit(struct drm_encoder *drm_enc)
+{
+   struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
+
+   drm_encoder_cleanup(drm_enc);
+
+   kfree(dpu_enc);
+}
+
 static void dpu_encoder_destroy(struct drm_encoder *drm_enc)
 {
struct dpu_encoder_virt *dpu_enc = NULL;
@@ -453,10 +462,9 @@ static void dpu_encoder_destroy(struct drm_encoder 
*drm_enc)
dpu_enc->num_phys_encs = 0;
mutex_unlock(_enc->enc_lock);
 
-   drm_encoder_cleanup(drm_enc);
mutex_destroy(_enc->enc_lock);
 
-   kfree(dpu_enc);
+   dpu_encoder_uninit(drm_enc);
 }
 
 void dpu_encoder_helper_split_config(
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
index 9dbf38f..60b88bd 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
@@ -142,6 +142,12 @@ struct drm_encoder *dpu_encoder_init(
int drm_enc_mode);
 
 /**
+ * dpu_encoder_uninit - uninitialize virtual encoder object
+ * @drm_enc:  Pointer to drm encoder
+ */
+void dpu_encoder_uninit(struct drm_encoder *drm_enc);
+
+/**
  * dpu_encoder_setup - setup dpu_encoder for the display probed
  * @dev:   Pointer to drm device structure
  * @enc:   Pointer to the drm_encoder
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108771] [amdgpu]] *ERROR* ring gfx timeout

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108771

--- Comment #1 from John  ---
Created attachment 142493
  --> https://bugs.freedesktop.org/attachment.cgi?id=142493=edit
xorg log

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108771] [amdgpu]] *ERROR* ring gfx timeout

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108771

Bug ID: 108771
   Summary: [amdgpu]] *ERROR* ring gfx timeout
   Product: Mesa
   Version: git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/radeonsi
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: john.etted...@gmail.com
QA Contact: dri-devel@lists.freedesktop.org

Created attachment 142492
  --> https://bugs.freedesktop.org/attachment.cgi?id=142492=edit
dmesg

Hello there,

I constantly get this issue with a RX 580 while playing a couple certain scenes
of The Last Story on the Dolphin emulator.

To pass the first scenes I had to lower all graphics options and it worked with
OpenGL or Vulkan with RADV.

To pass the 2nd one I had to use OGL only, which was super slow compared to VK,
so I'm guessing it was not sending enough data to trigger the issue.

I've had other similar system crashes in this game in the past few days, but
they were not sticking like this one, just restarting the machine would allow
me to proceed, so I am not sure if it was related or not.

I've tried Linux 4.18.15, 4.18.17, 4.18.19 and 4.19.2 with no difference.
I've also tried a few LLVM/Mesa builds from the 29th October to the 13th
November and no difference either.

I'm on Arch Linux 64b, Xorg 1.20.3, xf86-video-amdgpu 18.1.0, mesa 90d68858ed,
llvm 346744, with an i7 4790k, a 580 and 16Gb of RAM.


I wasn't sure where to file this bug so I hope this is correct.

Thank you!

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 20/24] drm/msm: dpu: Use atomic_disable for dpu_crtc_disable

2018-11-16 Thread Sean Paul
From: Sean Paul 

Matches dpu_crtc_enable and we'll need the old state in a future patch

Changes in v2:
- None

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 4d7f9ff1e9f4..9efb41c7973b 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -815,7 +815,8 @@ static struct drm_crtc_state 
*dpu_crtc_duplicate_state(struct drm_crtc *crtc)
return >base;
 }
 
-static void dpu_crtc_disable(struct drm_crtc *crtc)
+static void dpu_crtc_disable(struct drm_crtc *crtc,
+struct drm_crtc_state *old_crtc_state)
 {
struct dpu_crtc *dpu_crtc;
struct dpu_crtc_state *cstate;
@@ -1407,7 +1408,7 @@ static const struct drm_crtc_funcs dpu_crtc_funcs = {
 };
 
 static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = {
-   .disable = dpu_crtc_disable,
+   .atomic_disable = dpu_crtc_disable,
.atomic_enable = dpu_crtc_enable,
.atomic_check = dpu_crtc_atomic_check,
.atomic_begin = dpu_crtc_atomic_begin,
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 15/24] drm/msm: dpu: Stop using encoder->crtc pointer

2018-11-16 Thread Sean Paul
From: Sean Paul 

It's for legacy drivers, for atomic drivers crtc->state->encoder_mask
should be used to map encoder to crtc.

Changes in v2:
- None

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 46 
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  | 19 +++---
 2 files changed, 29 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 156f4c77ca44..a008a87a8113 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -284,9 +284,9 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct drm_crtc 
*crtc)
return INTF_MODE_NONE;
}
 
-   drm_for_each_encoder(encoder, crtc->dev)
-   if (encoder->crtc == crtc)
-   return dpu_encoder_get_intf_mode(encoder);
+   /* TODO: Returns the first INTF_MODE, could there be multiple values? */
+   drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask)
+   return dpu_encoder_get_intf_mode(encoder);
 
return INTF_MODE_NONE;
 }
@@ -551,13 +551,9 @@ static void dpu_crtc_atomic_begin(struct drm_crtc *crtc,
spin_unlock_irqrestore(>event_lock, flags);
}
 
-   list_for_each_entry(encoder, >mode_config.encoder_list, head) {
-   if (encoder->crtc != crtc)
-   continue;
-
-   /* encoder will trigger pending mask now */
+   /* encoder will trigger pending mask now */
+   drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask)
dpu_encoder_trigger_kickoff_pending(encoder);
-   }
 
/*
 * If no mixers have been allocated in dpu_crtc_atomic_check(),
@@ -704,7 +700,6 @@ static int _dpu_crtc_wait_for_frame_done(struct drm_crtc 
*crtc)
 void dpu_crtc_commit_kickoff(struct drm_crtc *crtc)
 {
struct drm_encoder *encoder;
-   struct drm_device *dev = crtc->dev;
struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
struct dpu_kms *dpu_kms = _dpu_crtc_get_kms(crtc);
struct dpu_crtc_state *cstate = to_dpu_crtc_state(crtc->state);
@@ -720,16 +715,13 @@ void dpu_crtc_commit_kickoff(struct drm_crtc *crtc)
 
DPU_ATRACE_BEGIN("crtc_commit");
 
-   list_for_each_entry(encoder, >mode_config.encoder_list, head) {
+   /*
+* Encoder will flush/start now, unless it has a tx pending. If so, it
+* may delay and flush at an irq event (e.g. ppdone)
+*/
+   drm_for_each_encoder_mask(encoder, crtc->dev,
+ crtc->state->encoder_mask) {
struct dpu_encoder_kickoff_params params = { 0 };
-
-   if (encoder->crtc != crtc)
-   continue;
-
-   /*
-* Encoder will flush/start now, unless it has a tx pending.
-* If so, it may delay and flush at an irq event (e.g. ppdone)
-*/
dpu_encoder_prepare_for_kickoff(encoder, );
}
 
@@ -754,12 +746,8 @@ void dpu_crtc_commit_kickoff(struct drm_crtc *crtc)
 
dpu_vbif_clear_errors(dpu_kms);
 
-   list_for_each_entry(encoder, >mode_config.encoder_list, head) {
-   if (encoder->crtc != crtc)
-   continue;
-
+   drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask)
dpu_encoder_kickoff(encoder);
-   }
 
 end:
reinit_completion(_crtc->frame_done_comp);
@@ -883,11 +871,8 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
 
dpu_core_perf_crtc_update(crtc, 0, true);
 
-   drm_for_each_encoder(encoder, crtc->dev) {
-   if (encoder->crtc != crtc)
-   continue;
+   drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask)
dpu_encoder_register_frame_event_callback(encoder, NULL, NULL);
-   }
 
memset(cstate->mixers, 0, sizeof(cstate->mixers));
cstate->num_mixers = 0;
@@ -922,12 +907,9 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
DRM_DEBUG_KMS("crtc%d\n", crtc->base.id);
dpu_crtc = to_dpu_crtc(crtc);
 
-   drm_for_each_encoder(encoder, crtc->dev) {
-   if (encoder->crtc != crtc)
-   continue;
+   drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask)
dpu_encoder_register_frame_event_callback(encoder,
dpu_crtc_frame_event_cb, (void *)crtc);
-   }
 
mutex_lock(_crtc->crtc_lock);
trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc);
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 1bec4540f3e1..64134d619748 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -320,7 +320,10 @@ static void dpu_kms_prepare_commit(struct msm_kms 

[PATCH v2 16/24] drm/msm: dpu: Add modeset lock checks where applicable

2018-11-16 Thread Sean Paul
From: Sean Paul 

Add modeset lock checks to functions that could be called outside the
core atomic stack.

Changes in v2:
- None

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 ++
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index a008a87a8113..cd0a0bea4335 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -284,6 +284,8 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct drm_crtc 
*crtc)
return INTF_MODE_NONE;
}
 
+   WARN_ON(!drm_modeset_is_locked(>mutex));
+
/* TODO: Returns the first INTF_MODE, could there be multiple values? */
drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask)
return dpu_encoder_get_intf_mode(encoder);
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 64134d619748..5104fc01147e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -358,6 +358,7 @@ void dpu_kms_encoder_enable(struct drm_encoder *encoder)
if (funcs && funcs->commit)
funcs->commit(encoder);
 
+   WARN_ON(!drm_modeset_is_locked(>mode_config.connection_mutex));
drm_for_each_crtc(crtc, dev) {
if (!(crtc->state->encoder_mask & drm_encoder_mask(encoder)))
continue;
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 19/24] drm/msm: dpu: Remove vblank_callback from encoder

2018-11-16 Thread Sean Paul
From: Sean Paul 

The indirection of registering a callback and opaque pointer isn't reall
useful when there's only one callsite. So instead of having the
vblank_cb registration, just give encoder a crtc and let it directly
call the vblank handler.

In a later patch, we'll make use of this further.

Changes in v2:
- None

Cc: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|  8 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h|  6 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 25 +++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 10 -
 4 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 141ed1b0e90a..4d7f9ff1e9f4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -293,9 +293,8 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct drm_crtc 
*crtc)
return INTF_MODE_NONE;
 }
 
-static void dpu_crtc_vblank_cb(void *data)
+void dpu_crtc_vblank_callback(struct drm_crtc *crtc)
 {
-   struct drm_crtc *crtc = (struct drm_crtc *)data;
struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
 
/* keep statistics on vblank callback - with auto reset via debugfs */
@@ -771,8 +770,7 @@ static void _dpu_crtc_vblank_enable_no_lock(
 DRMID(enc), enable,
 dpu_crtc);
 
-   dpu_encoder_register_vblank_callback(enc,
-   dpu_crtc_vblank_cb, (void *)crtc);
+   dpu_encoder_assign_crtc(enc, crtc);
}
} else {
list_for_each_entry(enc, >mode_config.encoder_list, head) {
@@ -783,7 +781,7 @@ static void _dpu_crtc_vblank_enable_no_lock(
 DRMID(enc), enable,
 dpu_crtc);
 
-   dpu_encoder_register_vblank_callback(enc, NULL, NULL);
+   dpu_encoder_assign_crtc(enc, NULL);
}
}
 }
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
index 93d21a61a040..54595cc29be5 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
@@ -270,6 +270,12 @@ static inline int dpu_crtc_frame_pending(struct drm_crtc 
*crtc)
  */
 int dpu_crtc_vblank(struct drm_crtc *crtc, bool en);
 
+/**
+ * dpu_crtc_vblank_callback - called on vblank irq, issues completion events
+ * @crtc: Pointer to drm crtc object
+ */
+void dpu_crtc_vblank_callback(struct drm_crtc *crtc);
+
 /**
  * dpu_crtc_commit_kickoff - trigger kickoff of the commit for this crtc
  * @crtc: Pointer to drm crtc object
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index d89ac520f7e6..fd6514f681ae 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -142,9 +142,11 @@ enum dpu_enc_rc_states {
  * @intfs_swapped  Whether or not the phys_enc interfaces have been swapped
  * for partial update right-only cases, such as pingpong
  * split where virtual pingpong does not generate IRQs
- * @crtc_vblank_cb:Callback into the upper layer / CRTC for
- * notification of the VBLANK
- * @crtc_vblank_cb_data:   Data from upper layer for VBLANK notification
+ * @crtc:  Pointer to the currently assigned crtc. Normally you
+ * would use crtc->state->encoder_mask to determine the
+ * link between encoder/crtc. However in this case we need
+ * to track crtc in the disable() hook which is called
+ * _after_ encoder_mask is cleared.
  * @crtc_kickoff_cb:   Callback into CRTC that will flush & start
  * all CTL paths
  * @crtc_kickoff_cb_data:  Opaque user data given to crtc_kickoff_cb
@@ -186,8 +188,7 @@ struct dpu_encoder_virt {
 
bool intfs_swapped;
 
-   void (*crtc_vblank_cb)(void *);
-   void *crtc_vblank_cb_data;
+   struct drm_crtc *crtc;
 
struct dentry *debugfs_root;
struct mutex enc_lock;
@@ -1241,8 +1242,8 @@ static void dpu_encoder_vblank_callback(struct 
drm_encoder *drm_enc,
dpu_enc = to_dpu_encoder_virt(drm_enc);
 
spin_lock_irqsave(_enc->enc_spinlock, lock_flags);
-   if (dpu_enc->crtc_vblank_cb)
-   dpu_enc->crtc_vblank_cb(dpu_enc->crtc_vblank_cb_data);
+   if (dpu_enc->crtc)
+   dpu_crtc_vblank_callback(dpu_enc->crtc);
spin_unlock_irqrestore(_enc->enc_spinlock, lock_flags);
 
atomic_inc(_enc->vsync_cnt);
@@ -1262,15 +1263,14 @@ static void dpu_encoder_underrun_callback(struct 

[PATCH v2 23/24] drm/msm: dpu: Remove vblank_requested flag from dpu_crtc

2018-11-16 Thread Sean Paul
From: Sean Paul 

It's just for debugfs output, we don't need it

Changes in v2:
- None

Cc: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c  |  6 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h  |  2 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 14 --
 3 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 725e15178cdb..f15cba2584a0 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1149,10 +1149,6 @@ int dpu_crtc_vblank(struct drm_crtc *crtc, bool en)
dpu_encoder_toggle_vblank_for_crtc(enc, crtc, en);
}
 
-   mutex_lock(_crtc->crtc_lock);
-   dpu_crtc->vblank_requested = en;
-   mutex_unlock(_crtc->crtc_lock);
-
return 0;
 }
 
@@ -1268,8 +1264,6 @@ static int _dpu_debugfs_status_show(struct seq_file *s, 
void *data)
dpu_crtc->vblank_cb_time = ktime_set(0, 0);
}
 
-   seq_printf(s, "vblank_enable:%d\n", dpu_crtc->vblank_requested);
-
mutex_unlock(_crtc->crtc_lock);
drm_modeset_unlock_all(crtc->dev);
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
index 54595cc29be5..2b358546af49 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
@@ -132,7 +132,6 @@ struct dpu_crtc_frame_event {
  * @vblank_cb_count : count of vblank callback since last reset
  * @play_count: frame count between crtc enable and disable
  * @vblank_cb_time  : ktime at vblank count reset
- * @vblank_requested : whether the user has requested vblank events
  * @enabled   : whether the DPU CRTC is currently enabled. updated in the
  *  commit-thread, not state-swap time which is earlier, so
  *  safe to make decisions on during VBLANK on/off work
@@ -166,7 +165,6 @@ struct dpu_crtc {
u32 vblank_cb_count;
u64 play_count;
ktime_t vblank_cb_time;
-   bool vblank_requested;
bool enabled;
 
struct list_head feature_list;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
index 328df37d7580..c78b521ceda1 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
@@ -728,20 +728,17 @@ TRACE_EVENT(dpu_crtc_vblank_enable,
__field(uint32_t,   enc_id  )
__field(bool,   enable  )
__field(bool,   enabled )
-   __field(bool,   vblank_requested )
),
TP_fast_assign(
__entry->drm_id = drm_id;
__entry->enc_id = enc_id;
__entry->enable = enable;
__entry->enabled = crtc->enabled;
-   __entry->vblank_requested = crtc->vblank_requested;
),
-   TP_printk("id:%u encoder:%u enable:%s state{enabled:%s vblank_req:%s}",
+   TP_printk("id:%u encoder:%u enable:%s state{enabled:%s}",
  __entry->drm_id, __entry->enc_id,
  __entry->enable ? "true" : "false",
- __entry->enabled ? "true" : "false",
- __entry->vblank_requested ? "true" : "false")
+ __entry->enabled ? "true" : "false")
 );
 
 DECLARE_EVENT_CLASS(dpu_crtc_enable_template,
@@ -751,18 +748,15 @@ DECLARE_EVENT_CLASS(dpu_crtc_enable_template,
__field(uint32_t,   drm_id  )
__field(bool,   enable  )
__field(bool,   enabled )
-   __field(bool,   vblank_requested )
),
TP_fast_assign(
__entry->drm_id = drm_id;
__entry->enable = enable;
__entry->enabled = crtc->enabled;
-   __entry->vblank_requested = crtc->vblank_requested;
),
-   TP_printk("id:%u enable:%s state{enabled:%s vblank_req:%s}",
+   TP_printk("id:%u enable:%s state{enabled:%s}",
  __entry->drm_id, __entry->enable ? "true" : "false",
- __entry->enabled ? "true" : "false",
- __entry->vblank_requested ? "true" : "false")
+ __entry->enabled ? "true" : "false")
 );
 DEFINE_EVENT(dpu_crtc_enable_template, dpu_crtc_enable,
TP_PROTO(uint32_t drm_id, bool enable, struct dpu_crtc *crtc),
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 21/24] drm/msm: dpu: Don't bother checking ->enabled in dpu_crtc_vblank

2018-11-16 Thread Sean Paul
From: Sean Paul 

The drm_crtc_vblank_on/off calls in enable/disable guarantee that we
won't call this function when crtc is not enabled.

Changes in v2:
- None

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 9efb41c7973b..54bb777b2d0c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1162,9 +1162,7 @@ int dpu_crtc_vblank(struct drm_crtc *crtc, bool en)
 
mutex_lock(_crtc->crtc_lock);
trace_dpu_crtc_vblank(DRMID(_crtc->base), en, dpu_crtc);
-   if (dpu_crtc->enabled) {
-   _dpu_crtc_vblank_enable_no_lock(dpu_crtc, en);
-   }
+   _dpu_crtc_vblank_enable_no_lock(dpu_crtc, en);
dpu_crtc->vblank_requested = en;
mutex_unlock(_crtc->crtc_lock);
 
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 24/24] drm/msm: dpu: Remove crtc_lock

2018-11-16 Thread Sean Paul
From: Sean Paul 

Each time it's called we're holding the crtc modeset lock, so it's
redundant.

Changes in v2:
- None

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 11 ---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h |  3 ---
 2 files changed, 14 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index f15cba2584a0..70b5104d 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -69,7 +69,6 @@ static void dpu_crtc_destroy(struct drm_crtc *crtc)
return;
 
drm_crtc_cleanup(crtc);
-   mutex_destroy(_crtc->crtc_lock);
kfree(dpu_crtc);
 }
 
@@ -806,8 +805,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc,
  old_crtc_state->encoder_mask)
dpu_encoder_assign_crtc(encoder, NULL);
 
-   mutex_lock(_crtc->crtc_lock);
-
/* wait for frame_event_done completion */
if (_dpu_crtc_wait_for_frame_done(crtc))
DPU_ERROR("crtc%d wait for frame done failed;frame_pending%d\n",
@@ -836,8 +833,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc,
cstate->bw_control = false;
cstate->bw_split_vote = false;
 
-   mutex_unlock(_crtc->crtc_lock);
-
if (crtc->state->event && !crtc->state->active) {
spin_lock_irqsave(>dev->event_lock, flags);
drm_crtc_send_vblank_event(crtc, crtc->state->event);
@@ -870,12 +865,9 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
dpu_encoder_register_frame_event_callback(encoder,
dpu_crtc_frame_event_cb, (void *)crtc);
 
-   mutex_lock(_crtc->crtc_lock);
trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc);
dpu_crtc->enabled = true;
 
-   mutex_unlock(_crtc->crtc_lock);
-
drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask)
dpu_encoder_assign_crtc(encoder, crtc);
 
@@ -1177,7 +1169,6 @@ static int _dpu_debugfs_status_show(struct seq_file *s, 
void *data)
drm_modeset_lock_all(crtc->dev);
cstate = to_dpu_crtc_state(crtc->state);
 
-   mutex_lock(_crtc->crtc_lock);
mode = >state->adjusted_mode;
out_width = _dpu_crtc_get_mixer_width(cstate, mode);
 
@@ -1264,7 +1255,6 @@ static int _dpu_debugfs_status_show(struct seq_file *s, 
void *data)
dpu_crtc->vblank_cb_time = ktime_set(0, 0);
}
 
-   mutex_unlock(_crtc->crtc_lock);
drm_modeset_unlock_all(crtc->dev);
 
return 0;
@@ -1414,7 +1404,6 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, 
struct drm_plane *plane,
crtc = _crtc->base;
crtc->dev = dev;
 
-   mutex_init(_crtc->crtc_lock);
spin_lock_init(_crtc->spin_lock);
atomic_set(_crtc->frame_pending, 0);
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
index 2b358546af49..34f0c4d4d774 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
@@ -140,7 +140,6 @@ struct dpu_crtc_frame_event {
  * @dirty_list: list of color processing features are dirty
  * @ad_dirty: list containing ad properties that are dirty
  * @ad_active: list containing ad properties that are active
- * @crtc_lock : crtc lock around create, destroy and access.
  * @frame_pending : Whether or not an update is pending
  * @frame_events  : static allocation of in-flight frame events
  * @frame_event_list : available frame event list
@@ -173,8 +172,6 @@ struct dpu_crtc {
struct list_head ad_dirty;
struct list_head ad_active;
 
-   struct mutex crtc_lock;
-
atomic_t frame_pending;
struct dpu_crtc_frame_event frame_events[DPU_CRTC_FRAME_EVENT_SIZE];
struct list_head frame_event_list;
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 14/24] drm/msm: dpu: Grab the modeset locks in frame_event

2018-11-16 Thread Sean Paul
From: Sean Paul 

This patch wraps dpu_core_perf_crtc_release_bw() with modeset locks
since it digs into the state objects.

Changes in v2:
- None

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 80de5289ada3..156f4c77ca44 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -335,7 +335,9 @@ static void dpu_crtc_frame_event_work(struct kthread_work 
*work)
/* release bandwidth and other resources */
trace_dpu_crtc_frame_event_done(DRMID(crtc),
fevent->event);
+   drm_modeset_lock_all(crtc->dev);
dpu_core_perf_crtc_release_bw(crtc);
+   drm_modeset_unlock_all(crtc->dev);
} else {
trace_dpu_crtc_frame_event_more_pending(DRMID(crtc),
fevent->event);
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 17/24] drm/msm: dpu: Move pm_runtime_(get|put) from vblank_enable

2018-11-16 Thread Sean Paul
From: Sean Paul 

There are 4 times that _dpu_crtc_vblank_enable_no_lock() is called:

1- crtc enable
2- crtc disable
3- crtc vblank enable
4- crtc vblank disable

When we enable or disable the crtc, we call drm_crtc_vblank_on and
drm_crtc_vblank_off respectively. That will gate vblank enables and
disables to only being called when the crtc is active. That means that
we can just enable/disable pm runtime in crtc enable/disable. This will
be beneficial in trying to eliminate blocking calls from the vblank call
chain.

Changes in v2:
- None

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index cd0a0bea4335..c49aaf412b6e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -769,8 +769,6 @@ static void _dpu_crtc_vblank_enable_no_lock(
struct drm_encoder *enc;
 
if (enable) {
-   pm_runtime_get_sync(dev->dev);
-
list_for_each_entry(enc, >mode_config.encoder_list, head) {
if (enc->crtc != crtc)
continue;
@@ -793,8 +791,6 @@ static void _dpu_crtc_vblank_enable_no_lock(
 
dpu_encoder_register_vblank_callback(enc, NULL, NULL);
}
-
-   pm_runtime_put_sync(dev->dev);
}
 }
 
@@ -891,6 +887,8 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
crtc->state->event = NULL;
spin_unlock_irqrestore(>dev->event_lock, flags);
}
+
+   pm_runtime_put_sync(crtc->dev->dev);
 }
 
 static void dpu_crtc_enable(struct drm_crtc *crtc,
@@ -906,6 +904,8 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
}
priv = crtc->dev->dev_private;
 
+   pm_runtime_get_sync(crtc->dev->dev);
+
DRM_DEBUG_KMS("crtc%d\n", crtc->base.id);
dpu_crtc = to_dpu_crtc(crtc);
 
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 18/24] drm/msm: dpu: Remove crtc_lock from setup_mixers

2018-11-16 Thread Sean Paul
From: Sean Paul 

I think the intention here was to protect the enc->crtc access, but
that's insufficient to avoid enc->crtc changing. Fortunately we're
already holding the modeset lock when this is called (from
atomic_check), so remove the crtc_lock and add a modeset lock check.

While we're at it, use the encoder mask from crtc state instead of
legacy pointer.

Changes in v2:
- None

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index c49aaf412b6e..141ed1b0e90a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -474,19 +474,13 @@ static void _dpu_crtc_setup_mixer_for_encoder(
 
 static void _dpu_crtc_setup_mixers(struct drm_crtc *crtc)
 {
-   struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
struct drm_encoder *enc;
 
-   mutex_lock(_crtc->crtc_lock);
-   /* Check for mixers on all encoders attached to this crtc */
-   list_for_each_entry(enc, >dev->mode_config.encoder_list, head) {
-   if (enc->crtc != crtc)
-   continue;
+   WARN_ON(!drm_modeset_is_locked(>mutex));
 
+   /* Check for mixers on all encoders attached to this crtc */
+   drm_for_each_encoder_mask(enc, crtc->dev, crtc->state->encoder_mask)
_dpu_crtc_setup_mixer_for_encoder(crtc, enc);
-   }
-
-   mutex_unlock(_crtc->crtc_lock);
 }
 
 static void _dpu_crtc_setup_lm_bounds(struct drm_crtc *crtc,
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 22/24] drm/msm: dpu: Separate crtc assignment from vblank enable

2018-11-16 Thread Sean Paul
From: Sean Paul 

Instead of assigning/clearing the crtc on vblank enable/disable, we can
just assign and clear the crtc on modeset. That allows us to just toggle
the encoder's vblank interrupts on vblank_enable.

So why is this important? Previously the driver was using the legacy
pointers to assign/clear the crtc. Legacy pointers are cleared _after_
disabling the hardware, so the legacy pointer was valid during
vblank_disable, but that's not something we should rely on.

Instead of relying on the core ordering the legacy pointer assignments
just so, we'll assign the crtc in dpu_crtc enable/disable. This is the
only place that mapping can change, so we're covered there.

We're also taking advantage of drm_crtc_vblank_on/off. By using this, we
ensure that vblank_enable/disable can never be called while the crtc is
off (which means the assigned crtc will always be valid). As such, we
don't need to use modeset locks or the crtc_lock in the
vblank_enable/disable routine to be sure state is consistent.

...I think.

Changes in v2:
- Changed crtc check in toggle_vblank to != (Jeykumar)

Cc: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c| 77 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 27 +---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 10 +++
 3 files changed, 59 insertions(+), 55 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 54bb777b2d0c..725e15178cdb 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -749,43 +749,6 @@ void dpu_crtc_commit_kickoff(struct drm_crtc *crtc)
DPU_ATRACE_END("crtc_commit");
 }
 
-/**
- * _dpu_crtc_vblank_enable_no_lock - update power resource and vblank request
- * @dpu_crtc: Pointer to dpu crtc structure
- * @enable: Whether to enable/disable vblanks
- */
-static void _dpu_crtc_vblank_enable_no_lock(
-   struct dpu_crtc *dpu_crtc, bool enable)
-{
-   struct drm_crtc *crtc = _crtc->base;
-   struct drm_device *dev = crtc->dev;
-   struct drm_encoder *enc;
-
-   if (enable) {
-   list_for_each_entry(enc, >mode_config.encoder_list, head) {
-   if (enc->crtc != crtc)
-   continue;
-
-   trace_dpu_crtc_vblank_enable(DRMID(_crtc->base),
-DRMID(enc), enable,
-dpu_crtc);
-
-   dpu_encoder_assign_crtc(enc, crtc);
-   }
-   } else {
-   list_for_each_entry(enc, >mode_config.encoder_list, head) {
-   if (enc->crtc != crtc)
-   continue;
-
-   trace_dpu_crtc_vblank_enable(DRMID(_crtc->base),
-DRMID(enc), enable,
-dpu_crtc);
-
-   dpu_encoder_assign_crtc(enc, NULL);
-   }
-   }
-}
-
 /**
  * dpu_crtc_duplicate_state - state duplicate hook
  * @crtc: Pointer to drm crtc structure
@@ -839,6 +802,10 @@ static void dpu_crtc_disable(struct drm_crtc *crtc,
/* Disable/save vblank irq handling */
drm_crtc_vblank_off(crtc);
 
+   drm_for_each_encoder_mask(encoder, crtc->dev,
+ old_crtc_state->encoder_mask)
+   dpu_encoder_assign_crtc(encoder, NULL);
+
mutex_lock(_crtc->crtc_lock);
 
/* wait for frame_event_done completion */
@@ -848,9 +815,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc,
atomic_read(_crtc->frame_pending));
 
trace_dpu_crtc_disable(DRMID(crtc), false, dpu_crtc);
-   if (dpu_crtc->enabled && dpu_crtc->vblank_requested) {
-   _dpu_crtc_vblank_enable_no_lock(dpu_crtc, false);
-   }
dpu_crtc->enabled = false;
 
if (atomic_read(_crtc->frame_pending)) {
@@ -908,13 +872,13 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
 
mutex_lock(_crtc->crtc_lock);
trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc);
-   if (!dpu_crtc->enabled && dpu_crtc->vblank_requested) {
-   _dpu_crtc_vblank_enable_no_lock(dpu_crtc, true);
-   }
dpu_crtc->enabled = true;
 
mutex_unlock(_crtc->crtc_lock);
 
+   drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask)
+   dpu_encoder_assign_crtc(encoder, crtc);
+
/* Enable/restore vblank irq handling */
drm_crtc_vblank_on(crtc);
 }
@@ -1159,10 +1123,33 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
 int dpu_crtc_vblank(struct drm_crtc *crtc, bool en)
 {
struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
+   struct drm_encoder *enc;
 
-   mutex_lock(_crtc->crtc_lock);
trace_dpu_crtc_vblank(DRMID(_crtc->base), 

[PATCH v2 11/24] drm/msm: dpu: Add ->enabled to dpu_encoder_virt

2018-11-16 Thread Sean Paul
From: Sean Paul 

Add a bool to dpu_encoder_virt to track whether the encoder is enabled
or not. Repurpose the enc_lock mutex to ensure that it is consistent
with the hw state.

Changes in v2:
- None

Cc: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 27 +
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 10a0676d1dcf..3daa86220d47 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -132,6 +132,7 @@ enum dpu_enc_rc_states {
  * @base:  drm_encoder base class for registration with DRM
  * @enc_spinlock:  Virtual-Encoder-Wide Spin Lock for IRQ purposes
  * @bus_scaling_client:Client handle to the bus scaling interface
+ * @enabled:   True if the encoder is active, protected by enc_lock
  * @num_phys_encs: Actual number of physical encoders contained.
  * @phys_encs: Container of physical encoders managed.
  * @cur_master:Pointer to the current master in this mode. 
Optimization
@@ -148,8 +149,8 @@ enum dpu_enc_rc_states {
  * all CTL paths
  * @crtc_kickoff_cb_data:  Opaque user data given to crtc_kickoff_cb
  * @debugfs_root:  Debug file system root file node
- * @enc_lock:  Lock around physical encoder create/destroy and
-   access.
+ * @enc_lock:  Lock around physical encoder
+ * create/destroy/enable/disable
  * @frame_busy_mask:   Bitmask tracking which phys_enc we are still
  * busy processing current command.
  * Bit0 = phys_encs[0] etc.
@@ -175,6 +176,8 @@ struct dpu_encoder_virt {
spinlock_t enc_spinlock;
uint32_t bus_scaling_client;
 
+   bool enabled;
+
unsigned int num_phys_encs;
struct dpu_encoder_phys *phys_encs[MAX_PHYS_ENCODERS_PER_VIRTUAL];
struct dpu_encoder_phys *cur_master;
@@ -1121,6 +1124,8 @@ static void dpu_encoder_virt_enable(struct drm_encoder 
*drm_enc)
return;
}
dpu_enc = to_dpu_encoder_virt(drm_enc);
+
+   mutex_lock(_enc->enc_lock);
cur_mode = _enc->base.crtc->state->adjusted_mode;
 
trace_dpu_enc_enable(DRMID(drm_enc), cur_mode->hdisplay,
@@ -1137,10 +1142,15 @@ static void dpu_encoder_virt_enable(struct drm_encoder 
*drm_enc)
if (ret) {
DPU_ERROR_ENC(dpu_enc, "dpu resource control failed: %d\n",
ret);
-   return;
+   goto out;
}
 
_dpu_encoder_virt_enable_helper(drm_enc);
+
+   dpu_enc->enabled = true;
+
+out:
+   mutex_unlock(_enc->enc_lock);
 }
 
 static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)
@@ -1162,11 +1172,14 @@ static void dpu_encoder_virt_disable(struct drm_encoder 
*drm_enc)
return;
}
 
-   mode = _enc->crtc->state->adjusted_mode;
-
dpu_enc = to_dpu_encoder_virt(drm_enc);
DPU_DEBUG_ENC(dpu_enc, "\n");
 
+   mutex_lock(_enc->enc_lock);
+   dpu_enc->enabled = false;
+
+   mode = _enc->crtc->state->adjusted_mode;
+
priv = drm_enc->dev->dev_private;
dpu_kms = to_dpu_kms(priv->kms);
 
@@ -1200,6 +1213,8 @@ static void dpu_encoder_virt_disable(struct drm_encoder 
*drm_enc)
DPU_DEBUG_ENC(dpu_enc, "encoder disabled\n");
 
dpu_rm_release(_kms->rm, drm_enc);
+
+   mutex_unlock(_enc->enc_lock);
 }
 
 static enum dpu_intf dpu_encoder_get_intf(struct dpu_mdss_cfg *catalog,
@@ -2233,6 +2248,8 @@ struct drm_encoder *dpu_encoder_init(struct drm_device 
*dev,
 
drm_encoder_helper_add(_enc->base, _encoder_helper_funcs);
 
+   dpu_enc->enabled = false;
+
return _enc->base;
 }
 
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 12/24] drm/msm: dpu: Move crtc runtime resume to encoder

2018-11-16 Thread Sean Paul
From: Sean Paul 

The crtc runtime resume doesn't actually operate on the crtc, but rather
its encoders. The problem with this is that we need to inspect the crtc
state to get the currently connected encoders. Since runtime resume
isn't guaranteed to be called while holding the modeset locks (although
it sometimes is), this presents a race condition.

Now that we have ->enabled on the virtual encoders, and a lock to
protect it, just call resume on each encoder and only restore the ones
that are enabled.

Changes in v2:
- None

Cc: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c| 24 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h|  6 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 24 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h |  4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |  6 +++---
 5 files changed, 15 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index d8f58caf2772..9be24907f8c1 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -841,30 +841,6 @@ static struct drm_crtc_state 
*dpu_crtc_duplicate_state(struct drm_crtc *crtc)
return >base;
 }
 
-void dpu_crtc_runtime_resume(struct drm_crtc *crtc)
-{
-   struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
-   struct drm_encoder *encoder;
-
-   mutex_lock(_crtc->crtc_lock);
-
-   if (!dpu_crtc->enabled)
-   goto end;
-
-   trace_dpu_crtc_runtime_resume(DRMID(crtc));
-
-   /* restore encoder; crtc will be programmed during commit */
-   drm_for_each_encoder(encoder, crtc->dev) {
-   if (encoder->crtc != crtc)
-   continue;
-
-   dpu_encoder_virt_restore(encoder);
-   }
-
-end:
-   mutex_unlock(_crtc->crtc_lock);
-}
-
 static void dpu_crtc_disable(struct drm_crtc *crtc)
 {
struct dpu_crtc *dpu_crtc;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
index 1dca91d1210f..93d21a61a040 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
@@ -329,10 +329,4 @@ static inline bool dpu_crtc_is_enabled(struct drm_crtc 
*crtc)
return crtc ? crtc->enabled : false;
 }
 
-/**
- * dpu_crtc_runtime_resume - called by the top-level on pm_runtime_resume
- * @crtc: CRTC to resume
- */
-void dpu_crtc_runtime_resume(struct drm_crtc *crtc);
-
 #endif /* _DPU_CRTC_H_ */
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 3daa86220d47..d89ac520f7e6 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -1089,28 +1089,24 @@ static void _dpu_encoder_virt_enable_helper(struct 
drm_encoder *drm_enc)
_dpu_encoder_update_vsync_source(dpu_enc, _enc->disp_info);
 }
 
-void dpu_encoder_virt_restore(struct drm_encoder *drm_enc)
+void dpu_encoder_virt_runtime_resume(struct drm_encoder *drm_enc)
 {
-   struct dpu_encoder_virt *dpu_enc = NULL;
-   int i;
-
-   if (!drm_enc) {
-   DPU_ERROR("invalid encoder\n");
-   return;
-   }
-   dpu_enc = to_dpu_encoder_virt(drm_enc);
+   struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
 
-   for (i = 0; i < dpu_enc->num_phys_encs; i++) {
-   struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i];
+   mutex_lock(_enc->enc_lock);
 
-   if (phys && (phys != dpu_enc->cur_master) && phys->ops.restore)
-   phys->ops.restore(phys);
-   }
+   if (!dpu_enc->enabled)
+   goto out;
 
+   if (dpu_enc->cur_slave && dpu_enc->cur_slave->ops.restore)
+   dpu_enc->cur_slave->ops.restore(dpu_enc->cur_slave);
if (dpu_enc->cur_master && dpu_enc->cur_master->ops.restore)
dpu_enc->cur_master->ops.restore(dpu_enc->cur_master);
 
_dpu_encoder_virt_enable_helper(drm_enc);
+
+out:
+   mutex_unlock(_enc->enc_lock);
 }
 
 static void dpu_encoder_virt_enable(struct drm_encoder *drm_enc)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
index 9dbf38f446d9..aa4f135218fa 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h
@@ -126,10 +126,10 @@ int dpu_encoder_wait_for_event(struct drm_encoder 
*drm_encoder,
 enum dpu_intf_mode dpu_encoder_get_intf_mode(struct drm_encoder *encoder);
 
 /**
- * dpu_encoder_virt_restore - restore the encoder configs
+ * dpu_encoder_virt_runtime_resume - pm runtime resume the encoder configs
  * @encoder:   encoder pointer
  */
-void dpu_encoder_virt_restore(struct drm_encoder *encoder);
+void dpu_encoder_virt_runtime_resume(struct drm_encoder *encoder);
 
 /**
  * dpu_encoder_init - initialize virtual encoder 

[PATCH v2 13/24] drm/msm: dpu: Don't drop locks in crtc_vblank_enable

2018-11-16 Thread Sean Paul
From: Sean Paul 

Now that runtime resume is handled in encoder, we don't need to worry
about crtc_lock recursion when calling pm_runtime_(get|put). So drop the
lock drops in _dpu_crtc_vblank_enable_no_lock().

Changes in v2:
- None

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 9be24907f8c1..80de5289ada3 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -777,10 +777,7 @@ static void _dpu_crtc_vblank_enable_no_lock(
struct drm_encoder *enc;
 
if (enable) {
-   /* drop lock since power crtc cb may try to re-acquire lock */
-   mutex_unlock(_crtc->crtc_lock);
pm_runtime_get_sync(dev->dev);
-   mutex_lock(_crtc->crtc_lock);
 
list_for_each_entry(enc, >mode_config.encoder_list, head) {
if (enc->crtc != crtc)
@@ -805,10 +802,7 @@ static void _dpu_crtc_vblank_enable_no_lock(
dpu_encoder_register_vblank_callback(enc, NULL, NULL);
}
 
-   /* drop lock since power crtc cb may try to re-acquire lock */
-   mutex_unlock(_crtc->crtc_lock);
pm_runtime_put_sync(dev->dev);
-   mutex_lock(_crtc->crtc_lock);
}
 }
 
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 10/24] drm/msm: dpu: Fix typo in dpu_encoder

2018-11-16 Thread Sean Paul
From: Sean Paul 

enc_spinlock instead of enc_spin_lock.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 82c55efb500f..10a0676d1dcf 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -130,7 +130,7 @@ enum dpu_enc_rc_states {
  * Virtual encoder defers as much as possible to the physical encoders.
  * Virtual encoder registers itself with the DRM Framework as the encoder.
  * @base:  drm_encoder base class for registration with DRM
- * @enc_spin_lock: Virtual-Encoder-Wide Spin Lock for IRQ purposes
+ * @enc_spinlock:  Virtual-Encoder-Wide Spin Lock for IRQ purposes
  * @bus_scaling_client:Client handle to the bus scaling interface
  * @num_phys_encs: Actual number of physical encoders contained.
  * @phys_encs: Container of physical encoders managed.
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 01/24] drm/msm: dpu: Remove dpu_power_handle_get_dbus_name()

2018-11-16 Thread Sean Paul
From: Sean Paul 

It's only used for debugfs, so just output the enum value instead.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c |  6 ++
 drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c | 14 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h |  7 ---
 3 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index ed84cf44a222..e09209d6c469 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1381,11 +1381,9 @@ static int dpu_crtc_debugfs_state_show(struct seq_file 
*s, void *v)
dpu_crtc->cur_perf.core_clk_rate);
for (i = DPU_POWER_HANDLE_DBUS_ID_MNOC;
i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) {
-   seq_printf(s, "bw_ctl[%s]: %llu\n",
-   dpu_power_handle_get_dbus_name(i),
+   seq_printf(s, "bw_ctl[%d]: %llu\n", i,
dpu_crtc->cur_perf.bw_ctl[i]);
-   seq_printf(s, "max_per_pipe_ib[%s]: %llu\n",
-   dpu_power_handle_get_dbus_name(i),
+   seq_printf(s, "max_per_pipe_ib[%d]: %llu\n", i,
dpu_crtc->cur_perf.max_per_pipe_ib[i]);
}
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
index fc14116789f2..8c6f92aaaf87 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
@@ -24,20 +24,6 @@
 #include "dpu_power_handle.h"
 #include "dpu_trace.h"
 
-static const char *data_bus_name[DPU_POWER_HANDLE_DBUS_ID_MAX] = {
-   [DPU_POWER_HANDLE_DBUS_ID_MNOC] = "qcom,dpu-data-bus",
-   [DPU_POWER_HANDLE_DBUS_ID_LLCC] = "qcom,dpu-llcc-bus",
-   [DPU_POWER_HANDLE_DBUS_ID_EBI] = "qcom,dpu-ebi-bus",
-};
-
-const char *dpu_power_handle_get_dbus_name(u32 bus_id)
-{
-   if (bus_id < DPU_POWER_HANDLE_DBUS_ID_MAX)
-   return data_bus_name[bus_id];
-
-   return NULL;
-}
-
 static void dpu_power_event_trigger_locked(struct dpu_power_handle *phandle,
u32 event_type)
 {
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h
index a65b7a297f21..f627ae28ec68 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h
@@ -207,11 +207,4 @@ struct dpu_power_event *dpu_power_handle_register_event(
 void dpu_power_handle_unregister_event(struct dpu_power_handle *phandle,
struct dpu_power_event *event);
 
-/**
- * dpu_power_handle_get_dbus_name - get name of given data bus identifier
- * @bus_id:data bus identifier
- * Return: Pointer to name string if success; NULL otherwise
- */
-const char *dpu_power_handle_get_dbus_name(u32 bus_id);
-
 #endif /* _DPU_POWER_HANDLE_H_ */
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 09/24] drm/msm: dpu: Remove dpu_power_handle

2018-11-16 Thread Sean Paul
From: Sean Paul 

Now that we don't have any event handlers, remove dpu_power_handle!

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/Makefile  |   1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |  11 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h   |   3 -
 .../gpu/drm/msm/disp/dpu1/dpu_power_handle.c  | 136 --
 .../gpu/drm/msm/disp/dpu1/dpu_power_handle.h  | 113 ---
 5 files changed, 264 deletions(-)
 delete mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
 delete mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h

diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
index 19ab521d4c3a..7d02ef3655b5 100644
--- a/drivers/gpu/drm/msm/Makefile
+++ b/drivers/gpu/drm/msm/Makefile
@@ -72,7 +72,6 @@ msm-y := \
disp/dpu1/dpu_kms.o \
disp/dpu1/dpu_mdss.o \
disp/dpu1/dpu_plane.o \
-   disp/dpu1/dpu_power_handle.o \
disp/dpu1/dpu_rm.o \
disp/dpu1/dpu_vbif.o \
msm_atomic.o \
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index af666d917a0b..9f7da56bb453 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -1060,8 +1060,6 @@ static int dpu_bind(struct device *dev, struct device 
*master, void *data)
return ret;
}
 
-   dpu_power_resource_init(pdev, _kms->phandle);
-
platform_set_drvdata(pdev, dpu_kms);
 
msm_kms_init(_kms->base, _funcs);
@@ -1081,7 +1079,6 @@ static void dpu_unbind(struct device *dev, struct device 
*master, void *data)
struct dpu_kms *dpu_kms = platform_get_drvdata(pdev);
struct dss_module_power *mp = _kms->mp;
 
-   dpu_power_resource_deinit(pdev, _kms->phandle);
msm_dss_put_clk(mp->clk_config, mp->num_clk);
devm_kfree(>dev, mp->clk_config);
mp->num_clk = 0;
@@ -1120,10 +1117,6 @@ static int __maybe_unused dpu_runtime_suspend(struct 
device *dev)
return rc;
}
 
-   rc = dpu_power_resource_enable(_kms->phandle, false);
-   if (rc)
-   DPU_ERROR("resource disable failed: %d\n", rc);
-
rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, false);
if (rc)
DPU_ERROR("clock disable failed rc:%d\n", rc);
@@ -1157,10 +1150,6 @@ static int __maybe_unused dpu_runtime_resume(struct 
device *dev)
drm_for_each_crtc(crtc, ddev)
dpu_crtc_runtime_resume(crtc);
 
-   rc = dpu_power_resource_enable(_kms->phandle, true);
-   if (rc)
-   DPU_ERROR("resource enable failed: %d\n", rc);
-
return rc;
 }
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
index 4e5acacb3065..59e18e2d3c59 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
@@ -31,7 +31,6 @@
 #include "dpu_hw_top.h"
 #include "dpu_io_util.h"
 #include "dpu_rm.h"
-#include "dpu_power_handle.h"
 #include "dpu_irq.h"
 #include "dpu_core_perf.h"
 
@@ -114,8 +113,6 @@ struct dpu_kms {
int core_rev;
struct dpu_mdss_cfg *catalog;
 
-   struct dpu_power_handle phandle;
-
/* directory entry for debugfs */
struct dentry *debugfs_root;
struct dentry *debugfs_danger;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
deleted file mode 100644
index 8e64f0a52147..
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#define pr_fmt(fmt)"[drm:%s:%d]: " fmt, __func__, __LINE__
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "dpu_power_handle.h"
-#include "dpu_trace.h"
-
-static void dpu_power_event_trigger_locked(struct dpu_power_handle *phandle,
-   u32 event_type)
-{
-   struct dpu_power_event *event;
-
-   list_for_each_entry(event, >event_list, list) {
-   if (event->event_type & event_type)
-   event->cb_fnc(event_type, event->usr);
-   }
-}
-
-void dpu_power_resource_init(struct platform_device *pdev,
-   struct dpu_power_handle *phandle)
-{
-   phandle->dev = >dev;
-
-   INIT_LIST_HEAD(>event_list);
-
-   mutex_init(>phandle_lock);
-}
-
-void 

[PATCH v2 02/24] drm/msm: dpu: Remove unused trace_dpu_perf_update_bus()

2018-11-16 Thread Sean Paul
From: Sean Paul 

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 21 -
 1 file changed, 21 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
index 0c122e173892..7ab0ba8224f6 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
@@ -99,27 +99,6 @@ TRACE_EVENT(dpu_perf_set_ot,
__entry->vbif_idx)
 )
 
-TRACE_EVENT(dpu_perf_update_bus,
-   TP_PROTO(int client, unsigned long long ab_quota,
-   unsigned long long ib_quota),
-   TP_ARGS(client, ab_quota, ib_quota),
-   TP_STRUCT__entry(
-   __field(int, client)
-   __field(u64, ab_quota)
-   __field(u64, ib_quota)
-   ),
-   TP_fast_assign(
-   __entry->client = client;
-   __entry->ab_quota = ab_quota;
-   __entry->ib_quota = ib_quota;
-   ),
-   TP_printk("Request client:%d ab=%llu ib=%llu",
-   __entry->client,
-   __entry->ab_quota,
-   __entry->ib_quota)
-)
-
-
 TRACE_EVENT(dpu_cmd_release_bw,
TP_PROTO(u32 crtc_id),
TP_ARGS(crtc_id),
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 07/24] drm/msm: dpu: Include dpu_io_util.h directly in dpu_kms.h

2018-11-16 Thread Sean Paul
From: Sean Paul 

It's needed for struct dss_module_power, and is currently being pulled
in by dpu_power_handle.h

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
index 5f08be187c86..4e5acacb3065 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
@@ -29,6 +29,7 @@
 #include "dpu_hw_lm.h"
 #include "dpu_hw_interrupts.h"
 #include "dpu_hw_top.h"
+#include "dpu_io_util.h"
 #include "dpu_rm.h"
 #include "dpu_power_handle.h"
 #include "dpu_irq.h"
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 08/24] drm/msm: dpu: Move DPU_POWER_HANDLE_DBUS_ID to core_perf

2018-11-16 Thread Sean Paul
From: Sean Paul 

It's only used in core_perf, so stick it there (and change the name to
reflect that).

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 34 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 17 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c  |  4 +--
 .../gpu/drm/msm/disp/dpu1/dpu_power_handle.h  | 13 ---
 4 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
index ef6dd43f8bec..bffc51e496e7 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
@@ -95,20 +95,20 @@ static void _dpu_core_perf_calc_crtc(struct dpu_kms *kms,
memset(perf, 0, sizeof(struct dpu_core_perf_params));
 
if (!dpu_cstate->bw_control) {
-   for (i = 0; i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) {
+   for (i = 0; i < DPU_CORE_PERF_DATA_BUS_ID_MAX; i++) {
perf->bw_ctl[i] = kms->catalog->perf.max_bw_high *
1000ULL;
perf->max_per_pipe_ib[i] = perf->bw_ctl[i];
}
perf->core_clk_rate = kms->perf.max_core_clk_rate;
} else if (kms->perf.perf_tune.mode == DPU_PERF_MODE_MINIMUM) {
-   for (i = 0; i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) {
+   for (i = 0; i < DPU_CORE_PERF_DATA_BUS_ID_MAX; i++) {
perf->bw_ctl[i] = 0;
perf->max_per_pipe_ib[i] = 0;
}
perf->core_clk_rate = 0;
} else if (kms->perf.perf_tune.mode == DPU_PERF_MODE_FIXED) {
-   for (i = 0; i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) {
+   for (i = 0; i < DPU_CORE_PERF_DATA_BUS_ID_MAX; i++) {
perf->bw_ctl[i] = kms->perf.fix_core_ab_vote;
perf->max_per_pipe_ib[i] = kms->perf.fix_core_ib_vote;
}
@@ -118,12 +118,12 @@ static void _dpu_core_perf_calc_crtc(struct dpu_kms *kms,
DPU_DEBUG(
"crtc=%d clk_rate=%llu core_ib=%llu core_ab=%llu llcc_ib=%llu 
llcc_ab=%llu mem_ib=%llu mem_ab=%llu\n",
crtc->base.id, perf->core_clk_rate,
-   perf->max_per_pipe_ib[DPU_POWER_HANDLE_DBUS_ID_MNOC],
-   perf->bw_ctl[DPU_POWER_HANDLE_DBUS_ID_MNOC],
-   perf->max_per_pipe_ib[DPU_POWER_HANDLE_DBUS_ID_LLCC],
-   perf->bw_ctl[DPU_POWER_HANDLE_DBUS_ID_LLCC],
-   perf->max_per_pipe_ib[DPU_POWER_HANDLE_DBUS_ID_EBI],
-   perf->bw_ctl[DPU_POWER_HANDLE_DBUS_ID_EBI]);
+   perf->max_per_pipe_ib[DPU_CORE_PERF_DATA_BUS_ID_MNOC],
+   perf->bw_ctl[DPU_CORE_PERF_DATA_BUS_ID_MNOC],
+   perf->max_per_pipe_ib[DPU_CORE_PERF_DATA_BUS_ID_LLCC],
+   perf->bw_ctl[DPU_CORE_PERF_DATA_BUS_ID_LLCC],
+   perf->max_per_pipe_ib[DPU_CORE_PERF_DATA_BUS_ID_EBI],
+   perf->bw_ctl[DPU_CORE_PERF_DATA_BUS_ID_EBI]);
 }
 
 int dpu_core_perf_crtc_check(struct drm_crtc *crtc,
@@ -158,8 +158,8 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc,
/* obtain new values */
_dpu_core_perf_calc_crtc(kms, crtc, state, _cstate->new_perf);
 
-   for (i = DPU_POWER_HANDLE_DBUS_ID_MNOC;
-   i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) {
+   for (i = DPU_CORE_PERF_DATA_BUS_ID_MNOC;
+   i < DPU_CORE_PERF_DATA_BUS_ID_MAX; i++) {
bw_sum_of_intfs = dpu_cstate->new_perf.bw_ctl[i];
curr_client_type = dpu_crtc_get_client_type(crtc);
 
@@ -290,7 +290,7 @@ void dpu_core_perf_crtc_release_bw(struct drm_crtc *crtc)
if (kms->perf.enable_bw_release) {
trace_dpu_cmd_release_bw(crtc->base.id);
DPU_DEBUG("Release BW crtc=%d\n", crtc->base.id);
-   for (i = 0; i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) {
+   for (i = 0; i < DPU_CORE_PERF_DATA_BUS_ID_MAX; i++) {
dpu_crtc->cur_perf.bw_ctl[i] = 0;
_dpu_core_perf_crtc_update_bus(kms, crtc, i);
}
@@ -367,7 +367,7 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc,
new = _cstate->new_perf;
 
if (_dpu_core_perf_crtc_is_power_on(crtc) && !stop_req) {
-   for (i = 0; i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) {
+   for (i = 0; i < DPU_CORE_PERF_DATA_BUS_ID_MAX; i++) {
/*
 * cases for bus bandwidth update.
 * 1. new bandwidth vote - "ab or ib vote" is higher
@@ -409,13 +409,13 @@ int dpu_core_perf_crtc_update(struct drm_crtc *crtc,
update_clk = 1;
}

[PATCH v2 06/24] drm/msm: dpu: Remove power_handle from core_perf

2018-11-16 Thread Sean Paul
From: Sean Paul 

It's unused

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 3 ---
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h | 5 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   | 1 -
 3 files changed, 9 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
index 22e84b3d7f98..ef6dd43f8bec 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
@@ -605,7 +605,6 @@ void dpu_core_perf_destroy(struct dpu_core_perf *perf)
dpu_core_perf_debugfs_destroy(perf);
perf->max_core_clk_rate = 0;
perf->core_clk = NULL;
-   perf->phandle = NULL;
perf->catalog = NULL;
perf->dev = NULL;
 }
@@ -613,12 +612,10 @@ void dpu_core_perf_destroy(struct dpu_core_perf *perf)
 int dpu_core_perf_init(struct dpu_core_perf *perf,
struct drm_device *dev,
struct dpu_mdss_cfg *catalog,
-   struct dpu_power_handle *phandle,
struct dss_clk *core_clk)
 {
perf->dev = dev;
perf->catalog = catalog;
-   perf->phandle = phandle;
perf->core_clk = core_clk;
 
perf->max_core_clk_rate = core_clk->max_rate;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
index fbcbe0c7527a..68b84d85eb8f 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h
@@ -19,7 +19,6 @@
 #include 
 
 #include "dpu_hw_catalog.h"
-#include "dpu_power_handle.h"
 
 #defineDPU_PERF_DEFAULT_MAX_CORE_CLK_RATE  41250
 
@@ -52,7 +51,6 @@ struct dpu_core_perf_tune {
  * @dev: Pointer to drm device
  * @debugfs_root: top level debug folder
  * @catalog: Pointer to catalog configuration
- * @phandle: Pointer to power handler
  * @core_clk: Pointer to core clock structure
  * @core_clk_rate: current core clock rate
  * @max_core_clk_rate: maximum allowable core clock rate
@@ -66,7 +64,6 @@ struct dpu_core_perf {
struct drm_device *dev;
struct dentry *debugfs_root;
struct dpu_mdss_cfg *catalog;
-   struct dpu_power_handle *phandle;
struct dss_clk *core_clk;
u64 core_clk_rate;
u64 max_core_clk_rate;
@@ -113,13 +110,11 @@ void dpu_core_perf_destroy(struct dpu_core_perf *perf);
  * @perf: Pointer to core performance context
  * @dev: Pointer to drm device
  * @catalog: Pointer to catalog
- * @phandle: Pointer to power handle
  * @core_clk: pointer to core clock
  */
 int dpu_core_perf_init(struct dpu_core_perf *perf,
struct drm_device *dev,
struct dpu_mdss_cfg *catalog,
-   struct dpu_power_handle *phandle,
struct dss_clk *core_clk);
 
 /**
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 654ea5060e02..af666d917a0b 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -957,7 +957,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
}
 
rc = dpu_core_perf_init(_kms->perf, dev, dpu_kms->catalog,
-   _kms->phandle,
_dpu_kms_get_clk(dpu_kms, "core"));
if (rc) {
DPU_ERROR("failed to init perf %d\n", rc);
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 04/24] drm/msm: dpu: Don't use power_event for vbif_init_memtypes

2018-11-16 Thread Sean Paul
From: Sean Paul 

power_events are only used for pm_runtime, and that's all handled in
dpu_kms. So just call vbif_init_memtypes at the correct times.

Changes in v2:
- Removed obsolete comment (Jeykumar)

Cc: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 24 +++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h |  1 -
 2 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 23094d108e81..ab8574ab8327 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -651,10 +651,6 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms)
dpu_hw_intr_destroy(dpu_kms->hw_intr);
dpu_kms->hw_intr = NULL;
 
-   if (dpu_kms->power_event)
-   dpu_power_handle_unregister_event(
-   _kms->phandle, dpu_kms->power_event);
-
/* safe to call these more than once during shutdown */
_dpu_debugfs_destroy(dpu_kms);
_dpu_kms_mmu_destroy(dpu_kms);
@@ -832,16 +828,6 @@ u64 dpu_kms_get_clk_rate(struct dpu_kms *dpu_kms, char 
*clock_name)
return clk_get_rate(clk->clk);
 }
 
-static void dpu_kms_handle_power_event(u32 event_type, void *usr)
-{
-   struct dpu_kms *dpu_kms = usr;
-
-   if (!dpu_kms)
-   return;
-
-   dpu_vbif_init_memtypes(dpu_kms);
-}
-
 static int dpu_kms_hw_init(struct msm_kms *kms)
 {
struct dpu_kms *dpu_kms;
@@ -1012,13 +998,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 */
dev->mode_config.allow_fb_modifiers = true;
 
-   /*
-* Handle (re)initializations during power enable
-*/
-   dpu_kms_handle_power_event(DPU_POWER_EVENT_ENABLE, dpu_kms);
-   dpu_kms->power_event = dpu_power_handle_register_event(
-   _kms->phandle, DPU_POWER_EVENT_ENABLE,
-   dpu_kms_handle_power_event, dpu_kms, "kms");
+   dpu_vbif_init_memtypes(dpu_kms);
 
pm_runtime_put_sync(_kms->pdev->dev);
 
@@ -1172,6 +1152,8 @@ static int __maybe_unused dpu_runtime_resume(struct 
device *dev)
return rc;
}
 
+   dpu_vbif_init_memtypes(dpu_kms);
+
rc = dpu_power_resource_enable(_kms->phandle, true);
if (rc)
DPU_ERROR("resource enable failed: %d\n", rc);
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
index f2c78deb0854..5f08be187c86 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
@@ -114,7 +114,6 @@ struct dpu_kms {
struct dpu_mdss_cfg *catalog;
 
struct dpu_power_handle phandle;
-   struct dpu_power_event *power_event;
 
/* directory entry for debugfs */
struct dentry *debugfs_root;
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 05/24] drm/msm: dpu: Handle crtc pm_runtime_resume() directly

2018-11-16 Thread Sean Paul
From: Sean Paul 

Instead of registering through dpu_power_handle just to get a call on
runtime_resume, call the crtc function directly.

Changes in v2:
- None

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c  | 23 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h  | 10 ++
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |  4 
 drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h |  8 
 4 files changed, 20 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index e09209d6c469..c55cb751e2b4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -33,7 +33,6 @@
 #include "dpu_plane.h"
 #include "dpu_encoder.h"
 #include "dpu_vbif.h"
-#include "dpu_power_handle.h"
 #include "dpu_core_perf.h"
 #include "dpu_trace.h"
 
@@ -69,8 +68,6 @@ static void dpu_crtc_destroy(struct drm_crtc *crtc)
if (!crtc)
return;
 
-   dpu_crtc->phandle = NULL;
-
drm_crtc_cleanup(crtc);
mutex_destroy(_crtc->crtc_lock);
kfree(dpu_crtc);
@@ -844,15 +841,17 @@ static struct drm_crtc_state 
*dpu_crtc_duplicate_state(struct drm_crtc *crtc)
return >base;
 }
 
-static void dpu_crtc_handle_power_event(u32 event_type, void *arg)
+void dpu_crtc_runtime_resume(struct drm_crtc *crtc)
 {
-   struct drm_crtc *crtc = arg;
struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
struct drm_encoder *encoder;
 
mutex_lock(_crtc->crtc_lock);
 
-   trace_dpu_crtc_handle_power_event(DRMID(crtc), event_type);
+   if (!dpu_crtc->enabled)
+   goto end;
+
+   trace_dpu_crtc_runtime_resume(DRMID(crtc));
 
/* restore encoder; crtc will be programmed during commit */
drm_for_each_encoder(encoder, crtc->dev) {
@@ -862,6 +861,7 @@ static void dpu_crtc_handle_power_event(u32 event_type, 
void *arg)
dpu_encoder_virt_restore(encoder);
}
 
+end:
mutex_unlock(_crtc->crtc_lock);
 }
 
@@ -917,10 +917,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc)
dpu_encoder_register_frame_event_callback(encoder, NULL, NULL);
}
 
-   if (dpu_crtc->power_event)
-   dpu_power_handle_unregister_event(dpu_crtc->phandle,
-   dpu_crtc->power_event);
-
memset(cstate->mixers, 0, sizeof(cstate->mixers));
cstate->num_mixers = 0;
 
@@ -972,11 +968,6 @@ static void dpu_crtc_enable(struct drm_crtc *crtc,
 
/* Enable/restore vblank irq handling */
drm_crtc_vblank_on(crtc);
-
-   dpu_crtc->power_event = dpu_power_handle_register_event(
-   dpu_crtc->phandle, DPU_POWER_EVENT_ENABLE,
-   dpu_crtc_handle_power_event, crtc, dpu_crtc->name);
-
 }
 
 struct plane_state {
@@ -1522,8 +1513,6 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, 
struct drm_plane *plane,
/* initialize event handling */
spin_lock_init(_crtc->event_lock);
 
-   dpu_crtc->phandle = >phandle;
-
DPU_DEBUG("%s: successfully initialized crtc\n", dpu_crtc->name);
return crtc;
 }
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
index 4822602402f9..1dca91d1210f 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
@@ -151,7 +151,6 @@ struct dpu_crtc_frame_event {
  * @event_worker  : Event worker queue
  * @event_lock: Spinlock around event handling code
  * @phandle: Pointer to power handler
- * @power_event   : registered power event handle
  * @cur_perf  : current performance committed to clock/bandwidth driver
  */
 struct dpu_crtc {
@@ -187,9 +186,6 @@ struct dpu_crtc {
/* for handling internal event thread */
spinlock_t event_lock;
 
-   struct dpu_power_handle *phandle;
-   struct dpu_power_event *power_event;
-
struct dpu_core_perf_params cur_perf;
 
struct dpu_crtc_smmu_state_data smmu_state;
@@ -333,4 +329,10 @@ static inline bool dpu_crtc_is_enabled(struct drm_crtc 
*crtc)
return crtc ? crtc->enabled : false;
 }
 
+/**
+ * dpu_crtc_runtime_resume - called by the top-level on pm_runtime_resume
+ * @crtc: CRTC to resume
+ */
+void dpu_crtc_runtime_resume(struct drm_crtc *crtc);
+
 #endif /* _DPU_CRTC_H_ */
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index ab8574ab8327..654ea5060e02 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -1137,6 +1137,7 @@ static int __maybe_unused dpu_runtime_resume(struct 
device *dev)
int rc = -1;
struct platform_device *pdev = to_platform_device(dev);
struct dpu_kms *dpu_kms = platform_get_drvdata(pdev);
+   struct drm_crtc *crtc;
struct drm_device *ddev;
struct dss_module_power *mp = _kms->mp;
 
@@ -1154,6 +1155,9 

[PATCH v2 03/24] drm/msm: dpu: Remove dpu_power_client

2018-11-16 Thread Sean Paul
From: Sean Paul 

There's only one client -- core, and it's only used for runtime pm which
is already refcounted.

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   | 22 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h   |  1 -
 .../gpu/drm/msm/disp/dpu1/dpu_power_handle.c  | 96 +--
 .../gpu/drm/msm/disp/dpu1/dpu_power_handle.h  | 86 +
 4 files changed, 6 insertions(+), 199 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 985c855796ae..23094d108e81 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -676,11 +676,6 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms)
dpu_hw_catalog_deinit(dpu_kms->catalog);
dpu_kms->catalog = NULL;
 
-   if (dpu_kms->core_client)
-   dpu_power_client_destroy(_kms->phandle,
-   dpu_kms->core_client);
-   dpu_kms->core_client = NULL;
-
if (dpu_kms->vbif[VBIF_NRT])
devm_iounmap(_kms->pdev->dev, dpu_kms->vbif[VBIF_NRT]);
dpu_kms->vbif[VBIF_NRT] = NULL;
@@ -913,17 +908,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
dpu_kms->reg_dma_len = dpu_iomap_size(dpu_kms->pdev, "regdma");
}
 
-   dpu_kms->core_client = dpu_power_client_create(_kms->phandle,
-   "core");
-   if (IS_ERR_OR_NULL(dpu_kms->core_client)) {
-   rc = PTR_ERR(dpu_kms->core_client);
-   if (!dpu_kms->core_client)
-   rc = -EINVAL;
-   DPU_ERROR("dpu power client create failed: %d\n", rc);
-   dpu_kms->core_client = NULL;
-   goto error;
-   }
-
pm_runtime_get_sync(_kms->pdev->dev);
 
_dpu_kms_core_hw_rev_init(dpu_kms);
@@ -1157,8 +1141,7 @@ static int __maybe_unused dpu_runtime_suspend(struct 
device *dev)
return rc;
}
 
-   rc = dpu_power_resource_enable(_kms->phandle,
-   dpu_kms->core_client, false);
+   rc = dpu_power_resource_enable(_kms->phandle, false);
if (rc)
DPU_ERROR("resource disable failed: %d\n", rc);
 
@@ -1189,8 +1172,7 @@ static int __maybe_unused dpu_runtime_resume(struct 
device *dev)
return rc;
}
 
-   rc = dpu_power_resource_enable(_kms->phandle,
-   dpu_kms->core_client, true);
+   rc = dpu_power_resource_enable(_kms->phandle, true);
if (rc)
DPU_ERROR("resource enable failed: %d\n", rc);
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
index 2a3625eef6d3..f2c78deb0854 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
@@ -114,7 +114,6 @@ struct dpu_kms {
struct dpu_mdss_cfg *catalog;
 
struct dpu_power_handle phandle;
-   struct dpu_power_client *core_client;
struct dpu_power_event *power_event;
 
/* directory entry for debugfs */
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
index 8c6f92aaaf87..8e64f0a52147 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
@@ -35,59 +35,11 @@ static void dpu_power_event_trigger_locked(struct 
dpu_power_handle *phandle,
}
 }
 
-struct dpu_power_client *dpu_power_client_create(
-   struct dpu_power_handle *phandle, char *client_name)
-{
-   struct dpu_power_client *client;
-   static u32 id;
-
-   if (!client_name || !phandle) {
-   pr_err("client name is null or invalid power data\n");
-   return ERR_PTR(-EINVAL);
-   }
-
-   client = kzalloc(sizeof(struct dpu_power_client), GFP_KERNEL);
-   if (!client)
-   return ERR_PTR(-ENOMEM);
-
-   mutex_lock(>phandle_lock);
-   strlcpy(client->name, client_name, MAX_CLIENT_NAME_LEN);
-   client->usecase_ndx = VOTE_INDEX_DISABLE;
-   client->id = id;
-   client->active = true;
-   pr_debug("client %s created:%pK id :%d\n", client_name,
-   client, id);
-   id++;
-   list_add(>list, >power_client_clist);
-   mutex_unlock(>phandle_lock);
-
-   return client;
-}
-
-void dpu_power_client_destroy(struct dpu_power_handle *phandle,
-   struct dpu_power_client *client)
-{
-   if (!client  || !phandle) {
-   pr_err("reg bus vote: invalid client handle\n");
-   } else if (!client->active) {
-   pr_err("dpu power deinit already done\n");
-   kfree(client);
-   } else {
-   pr_debug("bus vote client %s destroyed:%pK id:%u\n",
-   client->name, client, client->id);
-   mutex_lock(>phandle_lock);
- 

[PATCH v2 00/24] drm/msm: Various dpu locking and legacy cleanups

2018-11-16 Thread Sean Paul
From: Sean Paul 

This was originally 3 patchsets, but none have gotten full review, so I
figured I'd package the v2's all up into one set so it's easier to track.

Set 1- 
https://lists.freedesktop.org/archives/dri-devel/2018-November/196170.html
Set 2- 
https://lists.freedesktop.org/archives/dri-devel/2018-November/196184.html
Set 3- 
https://lists.freedesktop.org/archives/dri-devel/2018-November/196276.html

Thanks,
Sean


Sean Paul (24):
  drm/msm: dpu: Remove dpu_power_handle_get_dbus_name()
  drm/msm: dpu: Remove unused trace_dpu_perf_update_bus()
  drm/msm: dpu: Remove dpu_power_client
  drm/msm: dpu: Don't use power_event for vbif_init_memtypes
  drm/msm: dpu: Handle crtc pm_runtime_resume() directly
  drm/msm: dpu: Remove power_handle from core_perf
  drm/msm: dpu: Include dpu_io_util.h directly in dpu_kms.h
  drm/msm: dpu: Move DPU_POWER_HANDLE_DBUS_ID to core_perf
  drm/msm: dpu: Remove dpu_power_handle
  drm/msm: dpu: Fix typo in dpu_encoder
  drm/msm: dpu: Add ->enabled to dpu_encoder_virt
  drm/msm: dpu: Move crtc runtime resume to encoder
  drm/msm: dpu: Don't drop locks in crtc_vblank_enable
  drm/msm: dpu: Grab the modeset locks in frame_event
  drm/msm: dpu: Stop using encoder->crtc pointer
  drm/msm: dpu: Add modeset lock checks where applicable
  drm/msm: dpu: Move pm_runtime_(get|put) from vblank_enable
  drm/msm: dpu: Remove crtc_lock from setup_mixers
  drm/msm: dpu: Remove vblank_callback from encoder
  drm/msm: dpu: Use atomic_disable for dpu_crtc_disable
  drm/msm: dpu: Don't bother checking ->enabled in dpu_crtc_vblank
  drm/msm: dpu: Separate crtc assignment from vblank enable
  drm/msm: dpu: Remove vblank_requested flag from dpu_crtc
  drm/msm: dpu: Remove crtc_lock

 drivers/gpu/drm/msm/Makefile  |   1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c |  37 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h |  22 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c  | 216 +---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h  |  15 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c   |  97 ---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h   |  24 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |  76 ++
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h   |   6 +-
 .../gpu/drm/msm/disp/dpu1/dpu_power_handle.c  | 240 --
 .../gpu/drm/msm/disp/dpu1/dpu_power_handle.h  | 217 
 drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h |  43 +---
 12 files changed, 204 insertions(+), 790 deletions(-)
 delete mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
 delete mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h

-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 3/8] drm/msm: dpu: Remove vblank_callback from encoder

2018-11-16 Thread Sean Paul
On Wed, Nov 14, 2018 at 02:43:51PM -0500, Sean Paul wrote:
> On Wed, Nov 14, 2018 at 11:33:53AM -0800, Jeykumar Sankaran wrote:
> > On 2018-11-14 07:13, Sean Paul wrote:
> > > On Tue, Nov 13, 2018 at 04:47:22PM -0800, Jeykumar Sankaran wrote:
> > > > On 2018-11-13 12:52, Sean Paul wrote:
> > > > > From: Sean Paul 
> > > > >
> > > > > The indirection of registering a callback and opaque pointer isn't
> > > real
> > > > > useful when there's only one callsite. So instead of having the
> > > > > vblank_cb registration, just give encoder a crtc and let it directly
> > > > > call the vblank handler.
> > > > >
> > > > > In a later patch, we'll make use of this further.
> > > > >
> > > > > Signed-off-by: Sean Paul 
> > > > > ---
> > > > >  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|  8 +++
> > > > >  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h|  6 +
> > > > >  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 25
> > > +++--
> > > > >  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 10 -
> > > > >  4 files changed, 26 insertions(+), 23 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > > > > b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > > > > index adda0aa0cbaa..38119b4d4a80 100644
> > > > > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > > > > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> > > > > @@ -291,9 +291,8 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct
> > > > > drm_crtc *crtc)
> > > > >   return INTF_MODE_NONE;
> > > > >  }
> > > > >
> > > > > -static void dpu_crtc_vblank_cb(void *data)
> > > > > +void dpu_crtc_vblank_callback(struct drm_crtc *crtc)
> > > > >  {
> > > > > - struct drm_crtc *crtc = (struct drm_crtc *)data;
> > > > >   struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
> > > > 
> > > > Since we are calling into a locally stored CRTC and not tracking
> > > disable.
> > > > Should
> > > > we check for crtc->enable before processing the callback?
> > > > 
> > > > I see vblank_on/off cant be called when CRTC is disabled with the rest
> > > > of the patches in the series. But this callback is triggered by IRQ's
> > > > context.
> > > 
> > > Hmm, yeah, I had assumed that we wouldn't have any interrupts after irq
> > > disable.
> > > However it doesn't seem like that's the case.
> > > 
> > > That said, I don't think checking crtc->enable is quite what we want. In
> > > the
> > > case of disable, the crtc is cleared from the encoder, so checking for
> > > crtc != NULL would be better here. SGTY?
> > That would still cause a race as crtc assignment will be protected by
> > modeset
> > locks and crtc != NULL check isn't.
> 
> Right, we'd need to wrap the callback in the encoder spinlock.

Just went to do this, and it's already wrapped in the encoder spinlock. So
AFAICT, no further changes needed.

Sean

> 
> > > 
> > > Now that I've dug into the vblank irq handling a bit in the encoder, it
> > > seems
> > > like that could be moved to the crtc and a bunch of the
> > > encoder->crtc->encoder
> > > bouncing around could be avoided. Off the top of your head, is there any
> > > reason
> > > we couldn't move the vblank irq handling into crtc from encoder?
> > vblank irq handlers are only needed for video mode. As with all the other
> > IRQ's, the handlers are implemented in phys_encoder level and the events
> > are forwarded as and when needed.
> > 
> 
> I took a look at how that might work, and it seems possible but probably not
> worthwhile.
> 
> Sean
> 
> > BTW, the vblank irq flows from phys_enc->virtual_enc->crtc.
> > 
> > Thanks,
> > Jeykumar S.
> > 
> > > 
> > > Sean
> > > 
> > > > 
> > > > >
> > > > >   /* keep statistics on vblank callback - with auto reset via
> > > > > debugfs */
> > > > > @@ -779,8 +778,7 @@ static void _dpu_crtc_vblank_enable_no_lock(
> > > > >DRMID(enc), enable,
> > > > >dpu_crtc);
> > > > >
> > > > > - dpu_encoder_register_vblank_callback(enc,
> > > > > - dpu_crtc_vblank_cb, (void 
> > > > > *)crtc);
> > > > > + dpu_encoder_assign_crtc(enc, crtc);
> > > > >   }
> > > > >   } else {
> > > > >   list_for_each_entry(enc, >mode_config.encoder_list,
> > > > > head) {
> > > > > @@ -791,7 +789,7 @@ static void _dpu_crtc_vblank_enable_no_lock(
> > > > >DRMID(enc), enable,
> > > > >dpu_crtc);
> > > > >
> > > > > - dpu_encoder_register_vblank_callback(enc, NULL,
> > > > > NULL);
> > > > > + dpu_encoder_assign_crtc(enc, NULL);
> > > > >   }
> > > > >   }
> > > > >  }
> > > > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> > > > > b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> > > > > index 93d21a61a040..54595cc29be5 100644

Re: [PATCH 1/9] mm: Introduce new vm_insert_range API

2018-11-16 Thread Slavomir Kaslev
On Thu, Nov 15, 2018 at 5:42 PM Souptick Joarder  wrote:
>
> Previouly drivers have their own way of mapping range of
> kernel pages/memory into user vma and this was done by
> invoking vm_insert_page() within a loop.
>
> As this pattern is common across different drivers, it can
> be generalized by creating a new function and use it across
> the drivers.
>
> vm_insert_range is the new API which will be used to map a
> range of kernel memory/pages to user vma.
>
> Signed-off-by: Souptick Joarder 
> Reviewed-by: Matthew Wilcox 
> ---
>  include/linux/mm_types.h |  3 +++
>  mm/memory.c  | 28 
>  mm/nommu.c   |  7 +++
>  3 files changed, 38 insertions(+)
>
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 5ed8f62..15ae24f 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -523,6 +523,9 @@ extern void tlb_gather_mmu(struct mmu_gather *tlb, struct 
> mm_struct *mm,
>  extern void tlb_finish_mmu(struct mmu_gather *tlb,
> unsigned long start, unsigned long end);
>
> +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr,
> +   struct page **pages, unsigned long page_count);
> +
>  static inline void init_tlb_flush_pending(struct mm_struct *mm)
>  {
> atomic_set(>tlb_flush_pending, 0);
> diff --git a/mm/memory.c b/mm/memory.c
> index 15c417e..da904ed 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1478,6 +1478,34 @@ static int insert_page(struct vm_area_struct *vma, 
> unsigned long addr,
>  }
>
>  /**
> + * vm_insert_range - insert range of kernel pages into user vma
> + * @vma: user vma to map to
> + * @addr: target user address of this page
> + * @pages: pointer to array of source kernel pages
> + * @page_count: no. of pages need to insert into user vma
> + *
> + * This allows drivers to insert range of kernel pages they've allocated
> + * into a user vma. This is a generic function which drivers can use
> + * rather than using their own way of mapping range of kernel pages into
> + * user vma.
> + */
> +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr,
> +   struct page **pages, unsigned long page_count)
> +{
> +   unsigned long uaddr = addr;
> +   int ret = 0, i;
> +
> +   for (i = 0; i < page_count; i++) {
> +   ret = vm_insert_page(vma, uaddr, pages[i]);
> +   if (ret < 0)
> +   return ret;
> +   uaddr += PAGE_SIZE;
> +   }
> +
> +   return ret;
> +}

+ EXPORT_SYMBOL(vm_insert_range);

> +
> +/**
>   * vm_insert_page - insert single page into user vma
>   * @vma: user vma to map to
>   * @addr: target user address of this page
> diff --git a/mm/nommu.c b/mm/nommu.c
> index 749276b..d6ef5c7 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -473,6 +473,13 @@ int vm_insert_page(struct vm_area_struct *vma, unsigned 
> long addr,
>  }
>  EXPORT_SYMBOL(vm_insert_page);
>
> +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr,
> +   struct page **pages, unsigned long page_count)
> +{
> +   return -EINVAL;
> +}
> +EXPORT_SYMBOL(vm_insert_range);
> +
>  /*
>   *  sys_brk() for the most part doesn't need the global kernel
>   *  lock, except when an application is doing something nasty
> --
> 1.9.1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 3/9] drm: replace "drm_dev_unref" function with "drm_dev_put"

2018-11-16 Thread Fernando
On Fri, Nov 16, 2018, at 11:15 AM, Lucas Stach wrote:
> Am Donnerstag, den 15.11.2018, 23:16 +0100 schrieb Fernando Ramos:
> > This patch unifies the naming of DRM functions for reference counting as
> > requested on Documentation/gpu/todo.rst
> > 
> > > Signed-off-by: Fernando Ramos 
> > ---
> >  drivers/gpu/drm/arc/arcpgu_drv.c | 4 ++--
> >  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 4 ++--
> >  drivers/gpu/drm/etnaviv/etnaviv_drv.c| 4 ++--
> 
> At least the etnaviv part of the patch is already fixed in linux-next.
> 
> Regards,
> Lucas
 

Thanks for the notice.

I'm new on this, how should I proceed? Should I create a new (V2) patch series 
with these changes reverted? Or will the maintainer automatically take care of 
this when merging?

And, related to this, what is the "good" branch to start developing new drm 
patches? Is is "drm-next" or "linux-next"? Or does it change depending on how 
much time until the merge window closes?

Thanks!
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [git pull] drm fixes for 4.20-rc3

2018-11-16 Thread pr-tracker-bot
The pull request you sent on Fri, 16 Nov 2018 09:03:51 +1000:

> git://anongit.freedesktop.org/drm/drm tags/drm-fixes-2018-11-16

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/4efd34602fc0da31f87dca8669388edcafba622d

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105113] [hawaii, radeonsi, clover] Running Piglit cl/program/execute/{, tail-}calls{, -struct, -workitem-id}.cl cause GPU VM error and ring stalled GPU lockup

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105113

--- Comment #6 from Maciej S. Szmigiero  ---
There are really two issues at play here:
1) If the LLVM-generated code cannot be run properly then it should be simply
rejected by whatever is actually in charge of submitting it to the GPU (I guess
this would be Mesa?).
This way an application will know it cannot use OpenCL for computation, at
least
not with this compute kernel.

Instead, it currently looks like many of these test run but give incorrect
results, which is obviously rather bad.

2) Some (previous) Mesa + LLVM versions generate a command stream that crashes
the GPU and, as far as I can remember, sometimes even lockup the whole machine.

It should not be possible to crash the GPU, regardless how incorrect a command
stream that userspace sends to it is - because otherwise it is possible for
an unprivileged user with GPU access to DoS the machine.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108330] WarThunder game performance killed after Ryzen optimisations

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108330

Emil Velikov  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Emil Velikov  ---
As pointed out L3 thread pinning is disabled now. With the commit present in
both master and 18.3.0-rc3.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105733] Amdgpu randomly hangs and only ssh works. Mouse cursor moves sometimes but does nothing. Keyboard stops working.

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105733

--- Comment #42 from krutoiles...@gmail.com ---
What's your ram on the machine? I swapped mine for gskills and the freezes
are completely gone now.

On Fri, Nov 16, 2018, 07:28  *Comment # 41  on
> bug 105733  from
> Philipp  *
>
> I can second much of what John W. says. The crashes have become less frequent
> with recent fimware/kernel versions, but they still happen.
> Also for me the crashes only started on my vega 64, when I threw out my 
> ancient
> Intel CPU and replaced it with an AMD Ryzen 5 1600 on a GR-AB350M-Gaming 3
> Board.
> I've done stability tests on that other OS, so I don't think I've got faulty
> hardware here.
>
> One of my crash logs:
>
> Nov 16 15:18:29 localhorst kernel: amdgpu :08:00.0: [gfxhub] VMC page 
> fault
> (src_id:0 ring:158 vmid:7 pasid:32776, for process RocketLeague pid 6347 
> thread
> RocketLeag:cs0 pid 6400
> )
> Nov 16 15:18:29 localhorst kernel: amdgpu :08:00.0:   at address
> 0x800319593000 from 27
> Nov 16 15:18:29 localhorst kernel: amdgpu :08:00.0:
> VM_L2_PROTECTION_FAULT_STATUS:0x0070053C
> Nov 16 15:18:30 localhorst kernel: amdgpu :08:00.0: [gfxhub] VMC page 
> fault
> (src_id:0 ring:220 vmid:7 pasid:32776, for process RocketLeague pid 6347 
> thread
> RocketLeag:cs0 pid 6400
> )
> Nov 16 15:18:30 localhorst kernel: amdgpu :08:00.0:   at address
> 0x8201004e from 27
> Nov 16 15:18:30 localhorst kernel: amdgpu :08:00.0:
> VM_L2_PROTECTION_FAULT_STATUS:0x007013B8
> Nov 16 15:18:40 localhorst kernel: [drm:amdgpu_job_timedout [amdgpu]] *ERROR*
> ring gfx timeout, signaled seq=38153, emitted seq=38155
> Nov 16 15:18:40 localhorst kernel: [drm] GPU recovery disabled.
>
> --
> You are receiving this mail because:
>
>- You are on the CC list for the bug.
>
>

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108767] [CI][Runner] Abort on network down

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108767

--- Comment #1 from Martin Peres  ---
https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_5146/fi-skl-6700k2/igt@i915_selftest@live_workarounds.html

https://intel-gfx-ci.01.org/tree/drm-tip/IGT_4716/fi-skl-6700k2/igt@drv_selftest@live_contexts.html

Both runs got killed because of the network issue

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108763] [CI] Make IGT_runner exit with an error code != 0 when aborting

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108763

--- Comment #2 from Petri Latvala  ---
https://patchwork.freedesktop.org/series/52615/

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108767] [CI][Runner] Abort on network down

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108767

Martin Peres  changed:

   What|Removed |Added

   Priority|medium  |highest
 Whiteboard||ReadyForDev

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108767] [CI][Runner] Abort on network down

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108767

Bug ID: 108767
   Summary: [CI][Runner] Abort on network down
   Product: DRI
   Version: XOrg git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: IGT
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: martin.pe...@free.fr

When the network is down, the external watchdogs are bound to come and kill the
machine.

Protect ourselves against these random incompletes by stopping the execution
early and exiting.

The current plan was to allow the configuration of a host to ping before
executing a new binary to make sure that the network is still up. The host to
ping should be specified in igtrc. If none are specified, no pings should be
made.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108075] [CI][BAT] igt_runner: abort on TAINT_PAGE, TAINT_DIE, and TAINT_OOPS

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108075

Martin Peres  changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108075] [CI][BAT] igt_runner: abort on TAINT_PAGE, TAINT_DIE, and TAINT_OOPS

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108075

Martin Peres  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #3 from Martin Peres  ---
author  Petri Latvala  2018-11-09 13:13:03 +0200
committer   Petri Latvala  2018-11-15 10:35:23
+0200
commit  111593c49d812a4f4ff9ab0ef053a3ab88a6f73f (patch)
tree7f8a34859645b3972bc587af663c7530abdec24a
parent  cab148ca3ec904a94d0cd43476cf7e1f8663f906 (diff)

runner: Implement --abort-on-monitored-error

Deviating a bit from the piglit command line flag, igt_runner takes an
optional comma-separated list as an argument to
--abort-on-monitored-error for the list of conditions to abort
on. Without a list all possible conditions will be checked.

Two conditions implemented:
 - "taint" checks the kernel taint level for TAINT_PAGE, TAINT_DIE and
 TAINT_OOPS
 - "lockdep" checks the kernel lockdep status

Checking is done after every test binary execution, and if an abort
condition is met, the reason is printed to stderr (unless log level is
quiet) and the runner doesn't execute any further tests. Aborting
between subtests (when running in --multiple-mode) is not done.

v2:
 - Remember to fclose
 - Taints are unsigned long (Chris)
 - Use getline instead of fgets (Chris)
v3:
 - Fix brainfart with lockdep
v4:
 - Rebase
 - Refactor the abort condition checking to pass down strings
 - Present the abort result in results.json as a pseudo test result
 - Unit tests for the pseudo result
v5:
 - Refactors (Chris)
 - Don't claim lockdep was triggered if debug_locks is not on
   anymore. Just say it's not active.
 - Dump lockdep_stats when aborting due to lockdep (Chris)
 - Use igt@runner@aborted instead for the pseudo result (Martin)
v6:
 - If aborting after a test, generate results.json. Like was already
   done for aborting at startup.
 - Print the test that would be executed next as well when aborting,
   as requested by Tomi.
v7:
 - Remove the resolved TODO item from commit message

Signed-off-by: Petri Latvala 
Cc: Arkadiusz Hiler 
Cc: Tomi Sarvela 
Cc: Martin Peres 
Cc: Daniel Vetter 
Cc: Chris Wilson 
Reviewed-by: Arkadiusz Hiler 

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105733] Amdgpu randomly hangs and only ssh works. Mouse cursor moves sometimes but does nothing. Keyboard stops working.

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105733

--- Comment #41 from Philipp  ---
I can second much of what John W. says. The crashes have become less frequent
with recent fimware/kernel versions, but they still happen.
Also for me the crashes only started on my vega 64, when I threw out my ancient
Intel CPU and replaced it with an AMD Ryzen 5 1600 on a GR-AB350M-Gaming 3
Board.
I've done stability tests on that other OS, so I don't think I've got faulty
hardware here.

One of my crash logs:

Nov 16 15:18:29 localhorst kernel: amdgpu :08:00.0: [gfxhub] VMC page fault
(src_id:0 ring:158 vmid:7 pasid:32776, for process RocketLeague pid 6347 thread
RocketLeag:cs0 pid 6400
)
Nov 16 15:18:29 localhorst kernel: amdgpu :08:00.0:   at address
0x800319593000 from 27
Nov 16 15:18:29 localhorst kernel: amdgpu :08:00.0:
VM_L2_PROTECTION_FAULT_STATUS:0x0070053C
Nov 16 15:18:30 localhorst kernel: amdgpu :08:00.0: [gfxhub] VMC page fault
(src_id:0 ring:220 vmid:7 pasid:32776, for process RocketLeague pid 6347 thread
RocketLeag:cs0 pid 6400
)
Nov 16 15:18:30 localhorst kernel: amdgpu :08:00.0:   at address
0x8201004e from 27
Nov 16 15:18:30 localhorst kernel: amdgpu :08:00.0:
VM_L2_PROTECTION_FAULT_STATUS:0x007013B8
Nov 16 15:18:40 localhorst kernel: [drm:amdgpu_job_timedout [amdgpu]] *ERROR*
ring gfx timeout, signaled seq=38153, emitted seq=38155
Nov 16 15:18:40 localhorst kernel: [drm] GPU recovery disabled.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108763] [CI] Make IGT_runner exit with an error code != 0 when aborting

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108763

Martin Peres  changed:

   What|Removed |Added

   Assignee|intel-gfx-bugs@lists.freede |dri-devel@lists.freedesktop
   |sktop.org   |.org
 QA Contact|intel-gfx-bugs@lists.freede |
   |sktop.org   |
Summary|[CI][SHARDS] shard-iclb6|[CI] Make IGT_runner exit
   |dies on boot without giving |with an error code != 0
   |out its precious logs   |when aborting
  Component|DRM/Intel   |IGT

--- Comment #1 from Martin Peres  ---
Right now, our shards do not reboot after the kernel got tainted because it
cannot know if the execution of IGT went well or not.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 107955] AMDGPU driver keeps reloading on hybrid graphics system causing stuttering.

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107955

--- Comment #29 from Ransu  ---
(In reply to Mike Lothian from comment #22)
> Created attachment 141907 [details]
> report with amdgpu DDX
> 
> this is still happening with the amdgpu DDX

Are you still having issues?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCHv4 4/6] drm/omap: fix incorrect union usage

2018-11-16 Thread Tomi Valkeinen
On 16/11/18 01:06, Sebastian Reichel wrote:
> The DSI encoder sets dssdev->ops->dsi.set_config, which is stored at the
> same offset as dssdev->ops->hdmi.set_hdmi_mode. The code in omap_encoder
> only checks if dssdev->ops->hdmi.set_hdmi_mode is NULL. Due to the way
> union works, it won't be NULL if dsi.set_config is set. This means
> dsi_set_config will be called with config=hdmi_mode=false=NULL parameter
> resulting in a NULL dereference. Also the dereference happens while
> console is locked, so kernel hangs without any debug output (can be
> avoided by fbmem's lockless_register_fb=1 parameter).
> 
> This fixes the issue by exiting early if the output type definitely
> has no hdmi_set operations.
> 
> Fixes: 83910ad3f51fb ("drm/omap: Move most omap_dss_driver operations to 
> omap_dss_device_ops")
> Signed-off-by: Sebastian Reichel 
> ---
>  drivers/gpu/drm/omapdrm/omap_encoder.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c 
> b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index 32bbe3a80e7d..ba0099f0644c 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -122,6 +122,14 @@ static void omap_encoder_mode_set(struct drm_encoder 
> *encoder,
>  
>   dssdev = omap_encoder->output;
>  
> + /* The following operations access dssdev->ops->hdmi, which is a union
> +  * also used by DSI. This ensures, that the field does not have data
> +  * for DSI (or any other future output type).
> +  */
> + if (dssdev->output_type != OMAP_DISPLAY_TYPE_HDMI &&
> + dssdev->output_type != OMAP_DISPLAY_TYPE_DVI)

Good catch.

Why DVI?

I think the whole code block starting from

/* Set the HDMI mode and HDMI infoframe if applicable. */

to the end of the function should be inside

if (dssdev->output_type == OMAP_DISPLAY_TYPE_HDMI)

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 10/12] arm64: dts: mt6797: Use the new mmsys clock compatible

2018-11-16 Thread matthias . bgg
From: Matthias Brugger 

Move the clock part of mmsys in a child node.

Signed-off-by: Matthias Brugger 
---
 arch/arm64/boot/dts/mediatek/mt6797.dtsi | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt6797.dtsi 
b/arch/arm64/boot/dts/mediatek/mt6797.dtsi
index 4beaa71107d7..3ca635c81de1 100644
--- a/arch/arm64/boot/dts/mediatek/mt6797.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt6797.dtsi
@@ -206,9 +206,13 @@
};
 
mmsys: mmsys_config@1400 {
-   compatible = "mediatek,mt6797-mmsys", "syscon";
+   compatible = "mediatek,mt6797-mmsys", "syscon", "simple-mfd";
reg = <0 0x1400 0 0x1000>;
-   #clock-cells = <1>;
+
+   mmsys_clk: clock-controller@1400 {
+   compatible = "mediatek,mt6797-mmsys-clk";
+   #clock-cells = <1>;
+   };
};
 
imgsys: imgsys_config@1500  {
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 12/12] clk: mediatek: mt6797: Probe with new compatible

2018-11-16 Thread matthias . bgg
From: Matthias Brugger 

The clock node is now a child of the mmsys node.
Update the driver to support this and thenew compatible
in the driver.

Signed-off-by: Matthias Brugger 
---
 drivers/clk/mediatek/clk-mt6797-mm.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/mediatek/clk-mt6797-mm.c 
b/drivers/clk/mediatek/clk-mt6797-mm.c
index c57d3eed270d..051bab99d10f 100644
--- a/drivers/clk/mediatek/clk-mt6797-mm.c
+++ b/drivers/clk/mediatek/clk-mt6797-mm.c
@@ -101,7 +101,7 @@ static const struct mtk_gate mm_clks[] = {
 };
 
 static const struct of_device_id of_match_clk_mt6797_mm[] = {
-   { .compatible = "mediatek,mt6797-mmsys", },
+   { .compatible = "mediatek,mt6797-mmsys-clk", },
{}
 };
 
@@ -109,14 +109,15 @@ static int clk_mt6797_mm_probe(struct platform_device 
*pdev)
 {
struct clk_onecell_data *clk_data;
int r;
-   struct device_node *node = pdev->dev.of_node;
+   struct device *parent = pdev->dev.parent;
 
clk_data = mtk_alloc_clk_data(CLK_MM_NR);
 
-   mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks),
+   mtk_clk_register_gates(parent->of_node, mm_clks, ARRAY_SIZE(mm_clks),
   clk_data);
 
-   r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
+   r = of_clk_add_provider(parent->of_node, of_clk_src_onecell_get,
+   clk_data);
if (r)
dev_err(>dev,
"could not register clock provider: %s: %d\n",
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 11/12] clk: mediatek: mt2712e: Probe with new compatible

2018-11-16 Thread matthias . bgg
From: Matthias Brugger 

The clock node is now a child of the mmsys node.
Update the driver to support this and thenew compatible
in the driver.

Signed-off-by: Matthias Brugger 
---
 drivers/clk/mediatek/clk-mt2712-mm.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/mediatek/clk-mt2712-mm.c 
b/drivers/clk/mediatek/clk-mt2712-mm.c
index a8b4b6d42488..5f4ee8f0deaa 100644
--- a/drivers/clk/mediatek/clk-mt2712-mm.c
+++ b/drivers/clk/mediatek/clk-mt2712-mm.c
@@ -138,14 +138,15 @@ static int clk_mt2712_mm_probe(struct platform_device 
*pdev)
 {
struct clk_onecell_data *clk_data;
int r;
-   struct device_node *node = pdev->dev.of_node;
+   struct device   parent = pdev->dev.parent;
 
clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
 
-   mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks),
+   mtk_clk_register_gates(parent->of_node, mm_clks, ARRAY_SIZE(mm_clks),
clk_data);
 
-   r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
+   r = of_clk_add_provider(parent->of_node, of_clk_src_onecell_get,
+   clk_data);
 
if (r != 0)
pr_err("%s(): could not register clock provider: %d\n",
@@ -155,7 +156,7 @@ static int clk_mt2712_mm_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id of_match_clk_mt2712_mm[] = {
-   { .compatible = "mediatek,mt2712-mmsys", },
+   { .compatible = "mediatek,mt2712-mmsys-clk", },
{}
 };
 
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 00/12] arm/arm64: mediatek: Fix mmsys device probing

2018-11-16 Thread matthias . bgg
From: Matthias Brugger 

This is version four of the series. The biggest change are the last
four patches which introduce how this should be handled in the future.
Instead of creating the platform device in the DRM driver the device
tree has in the mmsys memory range a child node to probe the clock
part. That breaks backwards compatibility, so I only introduce that for
SoCs which are not available to the general public (mt2712e) or only
have the mmsys clock driver part implemented (mt6797).


Changes since v4:
- fix missing regmap accessors in drm diver (patch 1)
- omit probe deffered warning on all drivers (patch 5)
- update drm and clk bindings (patch 6 and 7)
- put mmsys clock part in dts child node of mmsys. Only done
for HW where no dts backport compatible breakage is expected 
(either DRM driver not yet implemented or no HW available to
the public) (patch 9 to 12)

Changes since v3:
- use platform device to probe clock driver
- add Acked-by CK Hu for the probe deferred patch

Changes since v2:
- fix kconfig typo (shame on me)
- delete __initconst from mm_clocks as converted to a platform driver
  
Changes since v1:
- add binding documentation
- ddp: use regmap_update_bits
- ddp: ignore EPROBE_DEFER on clock probing
- mfd: delete mmsys_private
- add Reviewed-by and Acked-by tags
 
MMSYS in Mediatek SoCs has some registers to control clock gates (which is 
used in the clk driver) and some registers to set the routing and enable
the differnet blocks of the display subsystem.

Up to now both drivers, clock and drm are probed with the same device tree
compatible. But only the first driver get probed, which in effect breaks
graphics on mt8173 and mt2701.

This patch uses a platform device registration in the DRM driver, which
will trigger the probe of the corresponding clock driver. It was tested on the
bananapi-r2 and the Acer R13 Chromebook.


Matthias Brugger (12):
  drm/mediatek: Use regmap for register access
  clk: mediatek: mt2701-mmsys: switch to platform device probing
  clk: mediatek: mt8173: switch mmsys to platform device probing
  drm/mediatek: Add support for mmsys through a pdev
  drm: mediatek: Omit warning on probe defers
  drm/mediatek: update dt-bindings
  dt-bindings: clock: mediatek: delete mmsys clocks
  dt-bindings: mediatek: Change the binding for mmsys clocks
  arm64: dts: mt2712e: Use the new mmsys clock compatible
  arm64: dts: mt6797: Use the new mmsys clock compatible
  clk: mediatek: mt2712e: Probe with new compatible
  clk: mediatek: mt6797: Probe with new compatible

 .../bindings/arm/mediatek/mediatek,mmsys.txt  | 24 +
 .../display/mediatek/mediatek,disp.txt| 34 +++-
 arch/arm64/boot/dts/mediatek/mt2712e.dtsi |  8 ++-
 arch/arm64/boot/dts/mediatek/mt6797.dtsi  |  8 ++-
 drivers/clk/mediatek/clk-mt2701-mm.c  | 42 ++-
 drivers/clk/mediatek/clk-mt2712-mm.c  |  9 ++--
 drivers/clk/mediatek/clk-mt6797-mm.c  |  9 ++--
 drivers/clk/mediatek/clk-mt8173.c | 51 +++---
 drivers/gpu/drm/mediatek/mtk_disp_color.c |  4 +-
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c   |  4 +-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c  |  4 +-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c   |  4 +-
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c| 53 ---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h|  4 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c| 34 +---
 drivers/gpu/drm/mediatek/mtk_drm_drv.h|  4 +-
 drivers/gpu/drm/mediatek/mtk_dsi.c|  6 ++-
 17 files changed, 200 insertions(+), 102 deletions(-)

-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 02/12] clk: mediatek: mt2701-mmsys: switch to platform device probing

2018-11-16 Thread matthias . bgg
From: Matthias Brugger 

Switch probing for the MMSYS to support invocation to a plain
paltform device. The driver will be probed by the DRM subsystem.

Signed-off-by: Matthias Brugger 
---
 drivers/clk/mediatek/clk-mt2701-mm.c | 42 
 1 file changed, 30 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/mediatek/clk-mt2701-mm.c 
b/drivers/clk/mediatek/clk-mt2701-mm.c
index fe1f85072fc5..200b1842b94b 100644
--- a/drivers/clk/mediatek/clk-mt2701-mm.c
+++ b/drivers/clk/mediatek/clk-mt2701-mm.c
@@ -12,14 +12,20 @@
  * GNU General Public License for more details.
  */
 
+#include 
 #include 
 #include 
+#include 
 
 #include "clk-mtk.h"
 #include "clk-gate.h"
 
 #include 
 
+struct clk_mt2701_mm_priv {
+   struct clk_onecell_data *clk_data;
+};
+
 static const struct mtk_gate_regs disp0_cg_regs = {
.set_ofs = 0x0104,
.clr_ofs = 0x0108,
@@ -87,23 +93,25 @@ static const struct mtk_gate mm_clks[] = {
GATE_DISP1(CLK_MM_TVE_FMM, "mm_tve_fmm", "mm_sel", 14),
 };
 
-static const struct of_device_id of_match_clk_mt2701_mm[] = {
-   { .compatible = "mediatek,mt2701-mmsys", },
-   {}
-};
-
 static int clk_mt2701_mm_probe(struct platform_device *pdev)
 {
-   struct clk_onecell_data *clk_data;
int r;
-   struct device_node *node = pdev->dev.of_node;
+   struct device_node *node = pdev->dev.parent->of_node;
+   struct clk_mt2701_mm_priv *private;
+
+   private = devm_kzalloc(>dev, sizeof(*private), GFP_KERNEL);
+   if (!private)
+   return -ENOMEM;
 
-   clk_data = mtk_alloc_clk_data(CLK_MM_NR);
+   private->clk_data = mtk_alloc_clk_data(CLK_MM_NR);
+
+   platform_set_drvdata(pdev, private);
 
mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks),
-   clk_data);
+   private->clk_data);
 
-   r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
+   r = of_clk_add_provider(node, of_clk_src_onecell_get,
+   private->clk_data);
if (r)
dev_err(>dev,
"could not register clock provider: %s: %d\n",
@@ -112,12 +120,22 @@ static int clk_mt2701_mm_probe(struct platform_device 
*pdev)
return r;
 }
 
+static int clk_mt2701_mm_remove(struct platform_device *pdev)
+{
+   struct clk_mt2701_mm_priv *private = platform_get_drvdata(pdev);
+
+   kfree(private->clk_data);
+   kfree(private);
+
+   return 0;
+}
+
 static struct platform_driver clk_mt2701_mm_drv = {
.probe = clk_mt2701_mm_probe,
+   .remove = clk_mt2701_mm_remove,
.driver = {
.name = "clk-mt2701-mm",
-   .of_match_table = of_match_clk_mt2701_mm,
},
 };
 
-builtin_platform_driver(clk_mt2701_mm_drv);
+module_platform_driver(clk_mt2701_mm_drv);
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 09/12] arm64: dts: mt2712e: Use the new mmsys clock compatible

2018-11-16 Thread matthias . bgg
From: Matthias Brugger 

Move the clock part of the mmsys in a child node.

Signed-off-by: Matthias Brugger 
---
 arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt2712e.dtsi 
b/arch/arm64/boot/dts/mediatek/mt2712e.dtsi
index ee627a7c7b45..dd6837df92c7 100644
--- a/arch/arm64/boot/dts/mediatek/mt2712e.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt2712e.dtsi
@@ -412,9 +412,13 @@
};
 
mmsys: syscon@1400 {
-   compatible = "mediatek,mt2712-mmsys", "syscon";
+   compatible = "mediatek,mt2712-mmsys", "syscon", "simple-mfd";
reg = <0 0x1400 0 0x1000>;
-   #clock-cells = <1>;
+
+   mmsys_clk: clock-controller@1400 {
+   compatible = "mediatek,mt2712-mmsys-clk";
+   #clock-cells = <1>;
+   };
};
 
imgsys: syscon@1500 {
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 08/12] dt-bindings: mediatek: Change the binding for mmsys clocks

2018-11-16 Thread matthias . bgg
From: Matthias Brugger 

On SoCs with no publical available HW or no working graphic stack
we change the devicetree binding for the mmsys clock part. This
way we don't need to register a platform device explicitly in the
drm driver. Instead we can create a mmsys child which invokes the
clock driver.

Signed-off-by: Matthias Brugger 
---
 .../bindings/arm/mediatek/mediatek,mmsys.txt  | 21 ---
 .../display/mediatek/mediatek,disp.txt|  4 
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt 
b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
index 4468345f8b1a..d4e205981363 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
@@ -1,4 +1,4 @@
-Mediatek mmsys controller
+Mediatek mmsys clock controller
 
 
 The Mediatek mmsys controller provides various clocks to the system.
@@ -6,18 +6,25 @@ The Mediatek mmsys controller provides various clocks to the 
system.
 Required Properties:
 
 - compatible: Should be one of:
-   - "mediatek,mt2712-mmsys", "syscon"
-   - "mediatek,mt6797-mmsys", "syscon"
+   - "mediatek,mt2712-mmsys-clk", "syscon"
+   - "mediatek,mt6797-mmsys-clk", "syscon"
 - #clock-cells: Must be 1
 
-The mmsys controller uses the common clk binding from
+The mmsys clock controller uses the common clk binding from
 Documentation/devicetree/bindings/clock/clock-bindings.txt
 The available clocks are defined in dt-bindings/clock/mt*-clk.h.
+It is a child of the mmsys block, see binding at:
+Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
 
 Example:
 
-mmsys: clock-controller@1400 {
-   compatible = "mediatek,mt8173-mmsys", "syscon";
+mmsys: syscon@1400 {
+   compatible = "mediatek,mt2712-mmsys", "syscon", "simple-mfd";
reg = <0 0x1400 0 0x1000>;
-   #clock-cells = <1>;
+
+   mmsys_clk: clock-controller@1400 {
+   compatible = "mediatek,mt2712-mmsys-clk";
+   #clock-cells = <1>;
+   };
+
 };
diff --git 
a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt 
b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
index 4b008d992398..38c708cb7e55 100644
--- a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
+++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
@@ -54,6 +54,10 @@ Required properties (all function blocks):
   DPI controller nodes have multiple clock inputs. These are documented in
   mediatek,dsi.txt and mediatek,dpi.txt, respectively.
 
+Some chips have a separate binding for the clock controller, which is a child 
node
+of the mmsys device, for more information see:
+Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
+
 Required properties (DMA function blocks):
 - compatible: Should be one of
"mediatek,-disp-ovl"
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 07/12] dt-bindings: clock: mediatek: delete mmsys clocks

2018-11-16 Thread matthias . bgg
From: Matthias Brugger 

Some SoCs will now load the clock part of mmsys via
a platform device from the dsiplay driver.
Remove the compatible from the clock bindings description.

Signed-off-by: Matthias Brugger 
---
 .../devicetree/bindings/arm/mediatek/mediatek,mmsys.txt| 3 ---
 1 file changed, 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt 
b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
index 15d977afad31..4468345f8b1a 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
@@ -6,11 +6,8 @@ The Mediatek mmsys controller provides various clocks to the 
system.
 Required Properties:
 
 - compatible: Should be one of:
-   - "mediatek,mt2701-mmsys", "syscon"
- "mediatek,mt2712-mmsys", "syscon"
- "mediatek,mt6797-mmsys", "syscon"
-   - "mediatek,mt7623-mmsys", "mediatek,mt2701-mmsys", "syscon"
-   - "mediatek,mt8173-mmsys", "syscon"
 - #clock-cells: Must be 1
 
 The mmsys controller uses the common clk binding from
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 01/12] drm/mediatek: Use regmap for register access

2018-11-16 Thread matthias . bgg
From: Matthias Brugger 

The mmsys memory space is shared between the drm and the
clk driver. Use regmap to access it.

Signed-off-by: Matthias Brugger 
Reviewed-by: Philipp Zabel 
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  4 +-
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 50 +++--
 drivers/gpu/drm/mediatek/mtk_drm_ddp.h  |  4 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 13 ++-
 drivers/gpu/drm/mediatek/mtk_drm_drv.h  |  2 +-
 5 files changed, 30 insertions(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 92ecb9bf982c..cc34660eb946 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -33,7 +33,7 @@
  * @enabled: records whether crtc_enable succeeded
  * @planes: array of 4 drm_plane structures, one for each overlay plane
  * @pending_planes: whether any plane has pending changes to be applied
- * @config_regs: memory mapped mmsys configuration register space
+ * @config_regs: regmap mapped mmsys configuration register space
  * @mutex: handle to one of the ten disp_mutex streams
  * @ddp_comp_nr: number of components in ddp_comp
  * @ddp_comp: array of pointers the mtk_ddp_comp structures used by this crtc
@@ -49,7 +49,7 @@ struct mtk_drm_crtc {
unsigned intlayer_nr;
boolpending_planes;
 
-   void __iomem*config_regs;
+   struct regmap   *config_regs;
struct mtk_disp_mutex   *mutex;
unsigned intddp_comp_nr;
struct mtk_ddp_comp **ddp_comp;
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 579ce28d801d..b06cd9d4b525 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -339,61 +339,53 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id 
cur,
return value;
 }
 
-static void mtk_ddp_sout_sel(void __iomem *config_regs,
+static void mtk_ddp_sout_sel(struct regmap *config_regs,
 enum mtk_ddp_comp_id cur,
 enum mtk_ddp_comp_id next)
 {
if (cur == DDP_COMPONENT_BLS && next == DDP_COMPONENT_DSI0) {
-   writel_relaxed(BLS_TO_DSI_RDMA1_TO_DPI1,
-  config_regs + DISP_REG_CONFIG_OUT_SEL);
+   regmap_write(config_regs, DISP_REG_CONFIG_OUT_SEL,
+   BLS_TO_DSI_RDMA1_TO_DPI1);
} else if (cur == DDP_COMPONENT_BLS && next == DDP_COMPONENT_DPI0) {
-   writel_relaxed(BLS_TO_DPI_RDMA1_TO_DSI,
-  config_regs + DISP_REG_CONFIG_OUT_SEL);
-   writel_relaxed(DSI_SEL_IN_RDMA,
-  config_regs + DISP_REG_CONFIG_DSI_SEL);
-   writel_relaxed(DPI_SEL_IN_BLS,
-  config_regs + DISP_REG_CONFIG_DPI_SEL);
+   regmap_write(config_regs, DISP_REG_CONFIG_OUT_SEL,
+   BLS_TO_DPI_RDMA1_TO_DSI);
+   regmap_write(config_regs, DISP_REG_CONFIG_DSI_SEL,
+   DSI_SEL_IN_RDMA);
+   regmap_write(config_regs, DISP_REG_CONFIG_DPI_SEL,
+   DPI_SEL_IN_BLS);
}
 }
 
-void mtk_ddp_add_comp_to_path(void __iomem *config_regs,
+void mtk_ddp_add_comp_to_path(struct regmap *config_regs,
  enum mtk_ddp_comp_id cur,
  enum mtk_ddp_comp_id next)
 {
-   unsigned int addr, value, reg;
+   unsigned int addr, value;
 
value = mtk_ddp_mout_en(cur, next, );
-   if (value) {
-   reg = readl_relaxed(config_regs + addr) | value;
-   writel_relaxed(reg, config_regs + addr);
-   }
+   if (value)
+   regmap_update_bits(config_regs, addr, value, value);
 
mtk_ddp_sout_sel(config_regs, cur, next);
 
value = mtk_ddp_sel_in(cur, next, );
-   if (value) {
-   reg = readl_relaxed(config_regs + addr) | value;
-   writel_relaxed(reg, config_regs + addr);
-   }
+   if (value)
+   regmap_update_bits(config_regs, addr, value, value);
 }
 
-void mtk_ddp_remove_comp_from_path(void __iomem *config_regs,
+void mtk_ddp_remove_comp_from_path(struct regmap *config_regs,
   enum mtk_ddp_comp_id cur,
   enum mtk_ddp_comp_id next)
 {
-   unsigned int addr, value, reg;
+   unsigned int addr, value;
 
value = mtk_ddp_mout_en(cur, next, );
-   if (value) {
-   reg = readl_relaxed(config_regs + addr) & ~value;
-   writel_relaxed(reg, config_regs + addr);
-   }
+   if (value)
+   regmap_update_bits(config_regs, addr, value, 0);
 
value = mtk_ddp_sel_in(cur, next, );
-   if 

[PATCH v5 06/12] drm/mediatek: update dt-bindings

2018-11-16 Thread matthias . bgg
From: Matthias Brugger 

Add mmsys bindings description.

Signed-off-by: Matthias Brugger 
---
 .../display/mediatek/mediatek,disp.txt| 30 +++
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt 
b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
index 8469de510001..4b008d992398 100644
--- a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
+++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
@@ -27,20 +27,24 @@ 
Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt.
 
 Required properties (all function blocks):
 - compatible: "mediatek,-disp-", one of
-   "mediatek,-disp-ovl"   - overlay (4 layers, blending, csc)
-   "mediatek,-disp-rdma"  - read DMA / line buffer
-   "mediatek,-disp-wdma"  - write DMA
-   "mediatek,-disp-color" - color processor
-   "mediatek,-disp-aal"   - adaptive ambient light controller
-   "mediatek,-disp-gamma" - gamma correction
-   "mediatek,-disp-merge" - merge streams from two RDMA sources
-   "mediatek,-disp-split" - split stream to two encoders
-   "mediatek,-disp-ufoe"  - data compression engine
-   "mediatek,-dsi"- DSI controller, see mediatek,dsi.txt
-   "mediatek,-dpi"- DPI controller, see mediatek,dpi.txt
-   "mediatek,-disp-mutex" - display mutex
-   "mediatek,-disp-od"- overdrive
+   "mediatek,-disp-ovl"  - overlay (4 layers, blending, 
csc)
+   "mediatek,-disp-rdma" - read DMA / line buffer
+   "mediatek,-disp-wdma" - write DMA
+   "mediatek,-disp-color"- color processor
+   "mediatek,-disp-aal"  - adaptive ambient light 
controller
+   "mediatek,-disp-gamma"- gamma correction
+   "mediatek,-disp-merge"- merge streams from two RDMA 
sources
+   "mediatek,-disp-split"- split stream to two encoders
+   "mediatek,-disp-ufoe" - data compression engine
+   "mediatek,-dsi"   - DSI controller, see 
mediatek,dsi.txt
+   "mediatek,-dpi"   - DPI controller, see 
mediatek,dpi.txt
+   "mediatek,-disp-mutex"- display mutex
+   "mediatek,-disp-od"   - overdrive
+   "mediatek,-mmsys", "syscon"   - provide clocks and components 
management
   the supported chips are mt2701, mt2712 and mt8173.
+  For mt7623, compatible must be:
+   "mediatek,mt7623-" , "mediatek,mt2701-"
+
 - reg: Physical base address and length of the function block register space
 - interrupts: The interrupt signal from the function block (required, except 
for
   merge and split function blocks).
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 05/12] drm: mediatek: Omit warning on probe defers

2018-11-16 Thread matthias . bgg
From: Matthias Brugger 

It can happen that the mmsys clock drivers aren't probed before the
platform driver gets invoked. The platform driver used to print a warning
that the driver failed to get the clocks. Omit this error on
the defered probe path.

Signed-off-by: Matthias Brugger 
---
 drivers/gpu/drm/mediatek/mtk_disp_color.c | 4 +++-
 drivers/gpu/drm/mediatek/mtk_disp_ovl.c   | 4 +++-
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c  | 4 +++-
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c| 3 ++-
 drivers/gpu/drm/mediatek/mtk_dsi.c| 6 --
 5 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_color.c 
b/drivers/gpu/drm/mediatek/mtk_disp_color.c
index f609b62b8be6..1ea3178d4c18 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_color.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_color.c
@@ -126,7 +126,9 @@ static int mtk_disp_color_probe(struct platform_device 
*pdev)
ret = mtk_ddp_comp_init(dev, dev->of_node, >ddp_comp, comp_id,
_disp_color_funcs);
if (ret) {
-   dev_err(dev, "Failed to initialize component: %d\n", ret);
+   if (ret != -EPROBE_DEFER)
+   dev_err(dev, "Failed to initialize component: %d\n",
+   ret);
return ret;
}
 
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c 
b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 28d191192945..5ebbcaa4e70e 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -293,7 +293,9 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
ret = mtk_ddp_comp_init(dev, dev->of_node, >ddp_comp, comp_id,
_disp_ovl_funcs);
if (ret) {
-   dev_err(dev, "Failed to initialize component: %d\n", ret);
+   if (ret != -EPROBE_DEFER)
+   dev_err(dev, "Failed to initialize component: %d\n",
+   ret);
return ret;
}
 
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c 
b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
index b0a5cffe345a..59a08ed5fea5 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
@@ -295,7 +295,9 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
ret = mtk_ddp_comp_init(dev, dev->of_node, >ddp_comp, comp_id,
_disp_rdma_funcs);
if (ret) {
-   dev_err(dev, "Failed to initialize component: %d\n", ret);
+   if (ret != -EPROBE_DEFER)
+   dev_err(dev, "Failed to initialize component: %d\n",
+   ret);
return ret;
}
 
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index b06cd9d4b525..b76a2d071a97 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -566,7 +566,8 @@ static int mtk_ddp_probe(struct platform_device *pdev)
 
ddp->clk = devm_clk_get(dev, NULL);
if (IS_ERR(ddp->clk)) {
-   dev_err(dev, "Failed to get clock\n");
+   if (PTR_ERR(ddp->clk) != -EPROBE_DEFER)
+   dev_err(dev, "Failed to get clock\n");
return PTR_ERR(ddp->clk);
}
 
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c 
b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 90109a0d6fff..cc6de75636c3 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1103,14 +1103,16 @@ static int mtk_dsi_probe(struct platform_device *pdev)
dsi->engine_clk = devm_clk_get(dev, "engine");
if (IS_ERR(dsi->engine_clk)) {
ret = PTR_ERR(dsi->engine_clk);
-   dev_err(dev, "Failed to get engine clock: %d\n", ret);
+   if (ret != -EPROBE_DEFER)
+   dev_err(dev, "Failed to get engine clock: %d\n", ret);
return ret;
}
 
dsi->digital_clk = devm_clk_get(dev, "digital");
if (IS_ERR(dsi->digital_clk)) {
ret = PTR_ERR(dsi->digital_clk);
-   dev_err(dev, "Failed to get digital clock: %d\n", ret);
+   if (ret != -EPROBE_DEFER)
+   dev_err(dev, "Failed to get digital clock: %d\n", ret);
return ret;
}
 
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 03/12] clk: mediatek: mt8173: switch mmsys to platform device probing

2018-11-16 Thread matthias . bgg
From: Matthias Brugger 

Switch probing for the MMSYS to support invocation to a
plain paltform device. The driver will be probed by the DRM subsystem.

Signed-off-by: Matthias Brugger 
---
 drivers/clk/mediatek/clk-mt8173.c | 51 ++-
 1 file changed, 44 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/mediatek/clk-mt8173.c 
b/drivers/clk/mediatek/clk-mt8173.c
index 96c292c3e440..10b6a0251123 100644
--- a/drivers/clk/mediatek/clk-mt8173.c
+++ b/drivers/clk/mediatek/clk-mt8173.c
@@ -13,8 +13,11 @@
  */
 
 #include 
+#include 
 #include 
 #include 
+#include 
+#include 
 
 #include "clk-mtk.h"
 #include "clk-gate.h"
@@ -791,7 +794,7 @@ static const struct mtk_gate_regs mm1_cg_regs __initconst = 
{
.ops = _clk_gate_ops_setclr,\
}
 
-static const struct mtk_gate mm_clks[] __initconst = {
+static const struct mtk_gate mm_clks[] = {
/* MM0 */
GATE_MM0(CLK_MM_SMI_COMMON, "mm_smi_common", "mm_sel", 0),
GATE_MM0(CLK_MM_SMI_LARB0, "mm_smi_larb0", "mm_sel", 1),
@@ -1152,22 +1155,56 @@ static void __init mtk_imgsys_init(struct device_node 
*node)
 }
 CLK_OF_DECLARE(mtk_imgsys, "mediatek,mt8173-imgsys", mtk_imgsys_init);
 
-static void __init mtk_mmsys_init(struct device_node *node)
-{
+struct mtk_mmsys_priv {
struct clk_onecell_data *clk_data;
+};
+
+static int mtk_mmsys_probe(struct platform_device *pdev)
+{
int r;
+   struct device_node *node;
+   struct mtk_mmsys_priv *private;
+
+   node = pdev->dev.parent->of_node;
 
-   clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
+   private = devm_kzalloc(>dev, sizeof(*private), GFP_KERNEL);
+   if (!private)
+   return -ENOMEM;
+
+   private->clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
+
+   platform_set_drvdata(pdev, private);
 
mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks),
-   clk_data);
+   private->clk_data);
 
-   r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
+   r = of_clk_add_provider(node, of_clk_src_onecell_get,
+   private->clk_data);
if (r)
pr_err("%s(): could not register clock provider: %d\n",
__func__, r);
+
+   return r;
+}
+
+static int mtk_mmsys_remove(struct platform_device *pdev)
+{
+   struct mtk_mmsys_priv *private = platform_get_drvdata(pdev);
+
+   kfree(private->clk_data);
+   kfree(private);
+
+   return 0;
 }
-CLK_OF_DECLARE(mtk_mmsys, "mediatek,mt8173-mmsys", mtk_mmsys_init);
+
+static struct platform_driver clk_mt8173_mm_drv = {
+   .probe = mtk_mmsys_probe,
+   .probe = mtk_mmsys_remove,
+   .driver = {
+   .name = "clk-mt8173-mm",
+   },
+};
+module_platform_driver(clk_mt8173_mm_drv);
 
 static void __init mtk_vdecsys_init(struct device_node *node)
 {
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 04/12] drm/mediatek: Add support for mmsys through a pdev

2018-11-16 Thread matthias . bgg
From: Matthias Brugger 

The MMSYS subsystem includes clocks and drm components.
This patch adds an initailization path through a platform device
for the clock part, so that both drivers get probed from the same
device tree compatible.

Signed-off-by: Matthias Brugger 
---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 23 +++
 drivers/gpu/drm/mediatek/mtk_drm_drv.h |  2 ++
 2 files changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 99dd612a6683..18fc761ba94f 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -199,6 +199,7 @@ static const struct mtk_mmsys_driver_data 
mt2701_mmsys_driver_data = {
.ext_path = mt2701_mtk_ddp_ext,
.ext_len = ARRAY_SIZE(mt2701_mtk_ddp_ext),
.shadow_register = true,
+   .clk_drv_name = "clk-mt2701-mm",
 };
 
 static const struct mtk_mmsys_driver_data mt2712_mmsys_driver_data = {
@@ -215,6 +216,7 @@ static const struct mtk_mmsys_driver_data 
mt8173_mmsys_driver_data = {
.main_len = ARRAY_SIZE(mt8173_mtk_ddp_main),
.ext_path = mt8173_mtk_ddp_ext,
.ext_len = ARRAY_SIZE(mt8173_mtk_ddp_ext),
+   .clk_drv_name = "clk-mt8173-mm",
 };
 
 static int mtk_drm_kms_init(struct drm_device *drm)
@@ -473,6 +475,24 @@ static int mtk_drm_probe(struct platform_device *pdev)
if (IS_ERR(private->config_regs))
return PTR_ERR(private->config_regs);
 
+   /*
+* For legacy reasons we need to probe the clock driver via
+* a platfomr device. This is outdated and should not be used
+* in newer SoCs.
+*/
+   if (private->data->clk_drv_name) {
+   private->clk_dev = platform_device_register_data(dev,
+   private->data->clk_drv_name, -1,
+   NULL, 0);
+
+   if (IS_ERR(private->clk_dev)) {
+   pr_err("failed to register %s platform device\n",
+   private->data->clk_drv_name);
+
+   return PTR_ERR(private->clk_dev);
+   }
+   }
+
/* Iterate over sibling DISP function blocks */
for_each_child_of_node(dev->of_node->parent, node) {
const struct of_device_id *of_id;
@@ -577,6 +597,9 @@ static int mtk_drm_remove(struct platform_device *pdev)
for (i = 0; i < DDP_COMPONENT_ID_MAX; i++)
of_node_put(private->comp_node[i]);
 
+   if (private->clk_dev)
+   platform_device_unregister(private->clk_dev);
+
return 0;
 }
 
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h 
b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
index ab0adbd7d4ee..515ac4cae922 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
@@ -37,11 +37,13 @@ struct mtk_mmsys_driver_data {
unsigned int third_len;
 
bool shadow_register;
+   const char *clk_drv_name;
 };
 
 struct mtk_drm_private {
struct drm_device *drm;
struct device *dma_dev;
+   struct platform_device *clk_dev;
 
unsigned int num_pipes;
 
-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108352] On GIGABYTE Radeon RX Vega 64 Gaming OC 8G applications `sensor` and `xsensor` showed last rpm before fan off when really fan is off

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108352

Wilko Bartels  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|NEW |RESOLVED

--- Comment #2 from Wilko Bartels  ---


*** This bug has been marked as a duplicate of bug 105718 ***

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105718] amdgpu reported fan speed looks too high (dual fan Sapphire Pulse Vega 56)

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105718

Wilko Bartels  changed:

   What|Removed |Added

 CC||mikhail.v.gavri...@gmail.co
   ||m

--- Comment #2 from Wilko Bartels  ---
*** Bug 108352 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 105718] amdgpu reported fan speed looks too high (dual fan Sapphire Pulse Vega 56)

2018-11-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105718

--- Comment #1 from Wilko Bartels  ---
(In reply to Shmerl from comment #0)
> I have Sapphire Pulse Vega 56, which ships with two fans. According to this:
> https://www.youtube.com/watch?v=3mKSrSluxbM=1m25s
> in a normal scenario, fans should spin at under 650 RPM. However sensors
> report for idle load around 1280 RPM for me, which looks like a double value
> of the above:
> 
> amdgpu-pci-2f00
> Adapter: PCI adapter
> fan1: 1281 RPM
> temp1: +29.0°C (crit = +0.0°C, hyst = +0.0°C)
> 
> pwm1 is set to auto:
> 
> sudo cat /sys/class/drm/card0/device/hwmon/hwmon3/pwm1_enable
> 2
> 
> Is this a misdetection, or it's supposed to be like that? Actual fans are
> pretty silent.
> 
> System: Debian testing, x86_64 (kernel 4.15.4).

i notice the same for my vega pulse.
in ur example im pretty sure the fans are even off.they should at such a low
temp. the rpm information seems to work as long at it goes up. but when the
temperature falls below 55°C the fan are going to stop and the rpm info doesnt
get updated anymore and stays there.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] backlight: pwm_bl: fix devicetree parsing with auto-generated brightness tables

2018-11-16 Thread Daniel Thompson
On Mon, Nov 12, 2018 at 10:02:57AM +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner 
> 
> Commit 88ba95bedb79 ("backlight: pwm_bl: Compute brightness of LED linearly
> to human eye") made the parse-dt function return early when using an auto-
> generated brightness-table, but didn't take into account that some more
> settings were handled below the brightness handling, like power-on-delays
> and also setting the pdata enable-gpio to -EINVAL.
> 
> This surfaces for example in the case of a backlight without any
> enable-gpio which then tries to use gpio-0 in error.
> 
> Fix this by simply moving the trailing settings above the brightness
> handling.
> 
> Fixes: 88ba95bedb79 ("backlight: pwm_bl: Compute brightness of LED linearly 
> to human eye")
> Signed-off-by: Heiko Stuebner 

Acked-by: Daniel Thompson 

> ---
>  drivers/video/backlight/pwm_bl.c | 19 ++-
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/video/backlight/pwm_bl.c 
> b/drivers/video/backlight/pwm_bl.c
> index bcd08b41765d..b7b5b31f3824 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -272,6 +272,16 @@ static int pwm_backlight_parse_dt(struct device *dev,
>  
>   memset(data, 0, sizeof(*data));
>  
> + /*
> +  * These values are optional and set as 0 by default, the out values
> +  * are modified only if a valid u32 value can be decoded.
> +  */
> + of_property_read_u32(node, "post-pwm-on-delay-ms",
> +  >post_pwm_on_delay);
> + of_property_read_u32(node, "pwm-off-delay-ms", >pwm_off_delay);
> +
> + data->enable_gpio = -EINVAL;
> +
>   /*
>* Determine the number of brightness levels, if this property is not
>* set a default table of brightness levels will be used.
> @@ -384,15 +394,6 @@ static int pwm_backlight_parse_dt(struct device *dev,
>   data->max_brightness--;
>   }
>  
> - /*
> -  * These values are optional and set as 0 by default, the out values
> -  * are modified only if a valid u32 value can be decoded.
> -  */
> - of_property_read_u32(node, "post-pwm-on-delay-ms",
> -  >post_pwm_on_delay);
> - of_property_read_u32(node, "pwm-off-delay-ms", >pwm_off_delay);
> -
> - data->enable_gpio = -EINVAL;
>   return 0;
>  }
>  
> -- 
> 2.18.0
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] backlight: pwm_bl: re-add driver internal enabled tracking

2018-11-16 Thread Daniel Thompson
On Fri, Nov 09, 2018 at 10:48:57AM +0100, Heiko Stuebner wrote:
> Commit e6bcca0890b9 ("backlight: pwm_bl: Switch to using "atomic" PWM API")
> removed the driver internal enabled tracking in favor of simply checking
> the pwm state.
> 
> This can lead to issues as all of gpio-, regulator- and pwm-state are used
> to determine the initial state and the bootloader or kernel can leave them
> in an inconsistent state at boot.
> 
> In my case on rk3399-kevin, the pwm backlight is build as module and the
> kernel disables the supply regulator as unused while keeping the pwm running
> thus pwm_bl calling pwm_backlight_power_off() during probe and creating an
> unmatched regulator-disable call, as it never got enabled from the pwm-bl
> before.
> 
> To prevent these consistency issues, reintroduce the driver-internal
> tracking of the enabled state.
> 
> Fixes: e6bcca0890b9 ("backlight: pwm_bl: Switch to using "atomic" PWM API")
> Signed-off-by: Heiko Stuebner 

Acked-by: Daniel Thompson 

> ---
>  drivers/video/backlight/pwm_bl.c | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/backlight/pwm_bl.c 
> b/drivers/video/backlight/pwm_bl.c
> index 678b27063198..bcd08b41765d 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -30,6 +30,7 @@ struct pwm_bl_data {
>   struct device   *dev;
>   unsigned intlth_brightness;
>   unsigned int*levels;
> + boolenabled;
>   struct regulator*power_supply;
>   struct gpio_desc*enable_gpio;
>   unsigned intscale;
> @@ -50,7 +51,7 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb)
>   int err;
>  
>   pwm_get_state(pb->pwm, );
> - if (state.enabled)
> + if (pb->enabled)
>   return;
>  
>   err = regulator_enable(pb->power_supply);
> @@ -65,6 +66,8 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb)
>  
>   if (pb->enable_gpio)
>   gpiod_set_value_cansleep(pb->enable_gpio, 1);
> +
> + pb->enabled = true;
>  }
>  
>  static void pwm_backlight_power_off(struct pwm_bl_data *pb)
> @@ -72,7 +75,7 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb)
>   struct pwm_state state;
>  
>   pwm_get_state(pb->pwm, );
> - if (!state.enabled)
> + if (!pb->enabled)
>   return;
>  
>   if (pb->enable_gpio)
> @@ -86,6 +89,7 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb)
>   pwm_apply_state(pb->pwm, );
>  
>   regulator_disable(pb->power_supply);
> + pb->enabled = false;
>  }
>  
>  static int compute_duty_cycle(struct pwm_bl_data *pb, int brightness)
> @@ -483,6 +487,7 @@ static int pwm_backlight_probe(struct platform_device 
> *pdev)
>   pb->check_fb = data->check_fb;
>   pb->exit = data->exit;
>   pb->dev = >dev;
> + pb->enabled = false;
>   pb->post_pwm_on_delay = data->post_pwm_on_delay;
>   pb->pwm_off_delay = data->pwm_off_delay;
>  
> -- 
> 2.18.0
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 3/9] drm: replace "drm_dev_unref" function with "drm_dev_put"

2018-11-16 Thread Lucas Stach
Am Donnerstag, den 15.11.2018, 23:16 +0100 schrieb Fernando Ramos:
> This patch unifies the naming of DRM functions for reference counting as
> requested on Documentation/gpu/todo.rst
> 
> > Signed-off-by: Fernando Ramos 
> ---
>  drivers/gpu/drm/arc/arcpgu_drv.c | 4 ++--
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 4 ++--
>  drivers/gpu/drm/etnaviv/etnaviv_drv.c| 4 ++--

At least the etnaviv part of the patch is already fixed in linux-next.

Regards,
Lucas

>  drivers/gpu/drm/mxsfb/mxsfb_drv.c| 4 ++--
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c| 2 +-
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c | 4 ++--
>  drivers/gpu/drm/tve200/tve200_drv.c  | 4 ++--
>  drivers/gpu/drm/zte/zx_drm_drv.c | 4 ++--
>  8 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c 
> b/drivers/gpu/drm/arc/arcpgu_drv.c
> index f067de4e1e82..dcb06d4e9135 100644
> --- a/drivers/gpu/drm/arc/arcpgu_drv.c
> +++ b/drivers/gpu/drm/arc/arcpgu_drv.c
> @@ -216,7 +216,7 @@ static int arcpgu_probe(struct platform_device *pdev)
> >     arcpgu_unload(drm);
>  
>  err_unref:
> > -   drm_dev_unref(drm);
> > +   drm_dev_put(drm);
>  
> >     return ret;
>  }
> @@ -227,7 +227,7 @@ static int arcpgu_remove(struct platform_device *pdev)
>  
> >     drm_dev_unregister(drm);
> >     arcpgu_unload(drm);
> > -   drm_dev_unref(drm);
> > +   drm_dev_put(drm);
>  
> >     return 0;
>  }
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c 
> b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index 843cac222e60..f8da51a63e2f 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -775,7 +775,7 @@ static int atmel_hlcdc_dc_drm_probe(struct 
> platform_device *pdev)
> >     atmel_hlcdc_dc_unload(ddev);
>  
>  err_unref:
> > -   drm_dev_unref(ddev);
> > +   drm_dev_put(ddev);
>  
> >     return ret;
>  }
> @@ -786,7 +786,7 @@ static int atmel_hlcdc_dc_drm_remove(struct 
> platform_device *pdev)
>  
> >     drm_dev_unregister(ddev);
> >     atmel_hlcdc_dc_unload(ddev);
> > -   drm_dev_unref(ddev);
> > +   drm_dev_put(ddev);
>  
> >     return 0;
>  }
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c 
> b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index 83c1f46670bf..52802e6049e0 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -550,7 +550,7 @@ static int etnaviv_bind(struct device *dev)
>  out_bind:
> >     kfree(priv);
>  out_unref:
> > -   drm_dev_unref(drm);
> > +   drm_dev_put(drm);
>  
> >     return ret;
>  }
> @@ -567,7 +567,7 @@ static void etnaviv_unbind(struct device *dev)
> >     drm->dev_private = NULL;
> >     kfree(priv);
>  
> > -   drm_dev_unref(drm);
> > +   drm_dev_put(drm);
>  }
>  
>  static const struct component_master_ops etnaviv_master_ops = {
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c 
> b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> index 2393e6d16ffd..88ba003979e6 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> @@ -417,7 +417,7 @@ static int mxsfb_probe(struct platform_device *pdev)
>  err_unload:
> >     mxsfb_unload(drm);
>  err_free:
> > -   drm_dev_unref(drm);
> > +   drm_dev_put(drm);
>  
> >     return ret;
>  }
> @@ -428,7 +428,7 @@ static int mxsfb_remove(struct platform_device *pdev)
>  
> >     drm_dev_unregister(drm);
> >     mxsfb_unload(drm);
> > -   drm_dev_unref(drm);
> > +   drm_dev_put(drm);
>  
> >     return 0;
>  }
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index 084f58df4a8c..c7fe2433ab9e 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -454,7 +454,7 @@ static int rcar_du_remove(struct platform_device *pdev)
> >     drm_kms_helper_poll_fini(ddev);
> >     drm_mode_config_cleanup(ddev);
>  
> > -   drm_dev_unref(ddev);
> > +   drm_dev_put(ddev);
>  
> >     return 0;
>  }
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c 
> b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> index 6ececad6f845..8554102a6ead 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> @@ -194,7 +194,7 @@ static int shmob_drm_remove(struct platform_device *pdev)
> >     drm_kms_helper_poll_fini(ddev);
> >     drm_mode_config_cleanup(ddev);
> >     drm_irq_uninstall(ddev);
> > -   drm_dev_unref(ddev);
> > +   drm_dev_put(ddev);
>  
> >     return 0;
>  }
> @@ -290,7 +290,7 @@ static int shmob_drm_probe(struct platform_device *pdev)
> >     drm_kms_helper_poll_fini(ddev);
> >     drm_mode_config_cleanup(ddev);
>  err_free_drm_dev:
> > -   drm_dev_unref(ddev);
> > +   drm_dev_put(ddev);
>  
> >     return ret;
>  }
> diff --git a/drivers/gpu/drm/tve200/tve200_drv.c 
> b/drivers/gpu/drm/tve200/tve200_drv.c
> index 72efcecb44f7..28e2d03c0ccf 100644
> --- a/drivers/gpu/drm/tve200/tve200_drv.c
> +++ 

Re: [Mesa-dev] [PATCH] vulkan: Add VK_GOOGLE_display_timing extension (x11+display, anv+radv) [v6]

2018-11-16 Thread Michel Dänzer
On 2018-11-15 7:06 p.m., Keith Packard wrote:
> This adds support for the VK_GOOGLE_display timing extension, which
> provides two things:
> 
>  1) Detailed information about when frames are displayed, including
> slack time between GPU execution and display frame.
> 
>  2) Absolute time control over swapchain queue processing. This allows
> the application to request frames be displayed at specific
> absolute times, using the same timebase as that provided in vblank
> events.
> 
> Support for this extension has been implemented for the x11 and
> display backends; adding support to other backends should be
> reasonable straightforward for one familiar with those systems and
> should not require any additional device-specific code.
> 
> v2:
>   Adjust GOOGLE_display_timing earliest value.  The
>   earliestPresentTime for an image cannot be before the previous
>   image was displayed, or even a frame later (in FIFO mode).
> 
>   Make GOOGLE_display_timing use render completed time.  Switch
>   from VK_PIPELINE_TOP_OF_PIPE_BIT to
>   VK_PIPELINE_STAGE_ALL_COMMANDS_BIT so that the time reported
>   to applications as the end of rendering reflects the latest
>   possible value to ensure that applications don't underestimate
>   the amount of work done in the frame.
> 
> v3:
>   Adopt Jason Ekstrand's coding conventions.  Declare variables
>   at first use, eliminate extra whitespace between types and
>   names. Wrap lines to 80 columns.
> 
> Suggested-by: Jason Ekstrand 
> 
> v4:
>   Adapt to changes in MESA_query_timestamp extension
> 
> v5:
>   Squash core bits and anv/radv wrappers into a single patch
> 
> Suggested-by: Jason Ekstrand 
> 
> v6:
>   Switch from MESA_query_timestamp to EXT_calibrated_timestamps
> 
> Signed-off-by: Keith Packard 
> 
> [...]
> 
> @@ -979,9 +1187,49 @@ wsi_common_queue_present(const struct wsi_device *wsi,
>*/
>   struct wsi_image *image =
>  swapchain->get_wsi_image(swapchain, 
> pPresentInfo->pImageIndices[i]);
> - submit_info.commandBufferCount = 1;
> - submit_info.pCommandBuffers =
> ->prime.blit_cmd_buffers[queue_family_index];
> + submit_buffers[submit_info.commandBufferCount++] = 
> +image->prime.blit_cmd_buffers[queue_family_index];
> +  }
> +
> +  /* Set up GOOGLE_display_timing bits */
> +  if (present_times_info &&
> +  present_times_info->pTimes != NULL &&
> +  i < present_times_info->swapchainCount)
> +  {
> + const VkPresentTimeGOOGLE *present_time =
> +_times_info->pTimes[i];
> +
> + struct wsi_image *image =
> +swapchain->get_wsi_image(swapchain, 
> pPresentInfo->pImageIndices[i]);
> +
> + timing = wsi_next_timing(swapchain, pPresentInfo->pImageIndices[i]);
> + timing->timing.presentID = present_time->presentID;
> + timing->timing.desiredPresentTime = 
> present_time->desiredPresentTime;
> + timing->target_msc = 0;
> + image->timing = timing;
> +
> + if (present_time->desiredPresentTime != 0)
> + {
> +int64_t delta_nsec = (int64_t) (present_time->desiredPresentTime 
> -
> +swapchain->frame_ust);
> +
> +/* Set the target msc only if it's no more than two seconds from
> + * now, and not stale
> + */
> +if (0 <= delta_nsec && delta_nsec <= 20ul) {
> +   VkRefreshCycleDurationGOOGLE refresh_timing;
> +
> +   swapchain->get_refresh_cycle_duration(swapchain,
> + _timing);
> +
> +   int64_t refresh = (int64_t) refresh_timing.refreshDuration;
> +   int64_t frames = (delta_nsec + refresh/2) / refresh;

desiredPresentTime has "no sooner than" semantics, so I think this should be

   int64_t frames = (delta_nsec + refresh-1) / refresh;


> +   timing->target_msc = swapchain->frame_msc + frames;
> +}
> + }

Note that MSC based timing won't work well with variable refresh rate.
In the long term, support for PresentOptionUST should be implemented and
used.


> @@ -1691,6 +1760,66 @@ wsi_display_queue_present(struct wsi_swapchain 
> *drv_chain,
>  
> pthread_mutex_lock(>wait_mutex);
>  
> +   if (image->base.timing && image->base.timing->target_msc != 0) {
> +  VkIcdSurfaceDisplay *surface = chain->surface;
> +  wsi_display_mode *display_mode =
> + wsi_display_mode_from_handle(surface->displayMode);
> +  wsi_display_connector *connector = display_mode->connector;
> +
> +  wsi_display_debug("delta frame %ld\n",
> +image->base.timing->target_msc - 
> connector->last_frame);
> +  if (image->base.timing->target_msc > connector->last_frame) {
> + uint64_t frame_queued;
> +   

[PATCH] drm/amdgpu: Reorder uvd ring init before uvd resume

2018-11-16 Thread Chris Wilson
As amd_uvd_resume() accesses the uvd ring, it must be initialised first
or else we trigger errors like:

[5.595963] [drm] Found UVD firmware Version: 1.87 Family ID: 17
[5.595969] [drm] PSP loading UVD firmware
[5.596266] [ cut here ]
[5.596268] ODEBUG: assert_init not available (active state 0) object type: 
timer_list hint:   (null)
[5.596285] WARNING: CPU: 0 PID: 507 at lib/debugobjects.c:329 
debug_print_object+0x6a/0x80
[5.596286] Modules linked in: amdgpu(+) hid_logitech_hidpp(+) chash 
gpu_sched amd_iommu_v2 ttm drm_kms_helper crc32c_intel drm hid_sony ff_memless 
igb hid_logitech_dj nvme dca i2c_algo_bit nvme_core wmi pinctrl_amd uas 
usb_storage
[5.596299] CPU: 0 PID: 507 Comm: systemd-udevd Tainted: GW 
4.20.0-0.rc1.git4.1.fc30.x86_64 #1
[5.596301] Hardware name: System manufacturer System Product Name/ROG STRIX 
X470-I GAMING, BIOS 0901 07/23/2018
[5.596303] RIP: 0010:debug_print_object+0x6a/0x80
[5.596305] Code: 8b 43 10 83 c2 01 8b 4b 14 4c 89 e6 89 15 e6 82 b0 02 4c 
8b 45 00 48 c7 c7 60 fd 34 a6 48 8b 14 c5 a0 da 08 a6 e8 6a 6a b8 ff <0f> 0b 5b 
83 05 d0 45 3e 01 01 5d 41 5c c3 83 05 c5 45 3e 01 01 c3
[5.596306] RSP: 0018:a02ac863f8c0 EFLAGS: 00010282
[5.596307] RAX:  RBX: a02ac863f8e0 RCX: 0006
[5.596308] RDX: 0007 RSI: 9160e9a7bfe8 RDI: 9160f91d6c60
[5.596310] RBP: a6742740 R08: 0002 R09: 
[5.596311] R10:  R11:  R12: a634ff69
[5.596312] R13: 000b79d0 R14: a80f76d8 R15: 00266000
[5.596313] FS:  7f762abf7940() GS:9160f900() 
knlGS:
[5.596314] CS:  0010 DS:  ES:  CR0: 80050033
[5.596315] CR2: 55fdc593f000 CR3: 0007e999c000 CR4: 003406f0
[5.596317] Call Trace:
[5.596321]  debug_object_assert_init+0x14a/0x180
[5.596327]  del_timer+0x2e/0x90
[5.596383]  amdgpu_fence_process+0x47/0x100 [amdgpu]
[5.596430]  amdgpu_uvd_resume+0xf6/0x120 [amdgpu]
[5.596475]  uvd_v7_0_sw_init+0xe0/0x280 [amdgpu]
[5.596523]  amdgpu_device_init.cold.30+0xf97/0x14b6 [amdgpu]
[5.596563]  ? amdgpu_driver_load_kms+0x53/0x330 [amdgpu]
[5.596604]  amdgpu_driver_load_kms+0x86/0x330 [amdgpu]
[5.596614]  drm_dev_register+0x115/0x150 [drm]
[5.596654]  amdgpu_pci_probe+0xbd/0x120 [amdgpu]
[5.596658]  local_pci_probe+0x41/0x90
[5.596661]  pci_device_probe+0x188/0x1a0
[5.59]  really_probe+0xf8/0x3b0
[5.596669]  driver_probe_device+0xb3/0xf0
[5.596672]  __driver_attach+0xe1/0x110
[5.596674]  ? driver_probe_device+0xf0/0xf0
[5.596676]  bus_for_each_dev+0x79/0xc0
[5.596679]  bus_add_driver+0x155/0x230
[5.596681]  ? 0xc07d9000
[5.596683]  driver_register+0x6b/0xb0
[5.596685]  ? 0xc07d9000
[5.596688]  do_one_initcall+0x5d/0x2be
[5.596691]  ? rcu_read_lock_sched_held+0x79/0x80
[5.596693]  ? kmem_cache_alloc_trace+0x264/0x290
[5.596695]  ? do_init_module+0x22/0x210
[5.596698]  do_init_module+0x5a/0x210
[5.596701]  load_module+0x2137/0x2430
[5.596703]  ? lockdep_hardirqs_on+0xed/0x180
[5.596714]  ? __do_sys_init_module+0x150/0x1a0
[5.596715]  __do_sys_init_module+0x150/0x1a0
[5.596722]  do_syscall_64+0x60/0x1f0
[5.596725]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
[5.596726] RIP: 0033:0x7f762b877dee
[5.596728] Code: 48 8b 0d 9d 20 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 
0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 af 00 00 00 0f 05 <48> 3d 01 
f0 ff ff 73 01 c3 48 8b 0d 6a 20 0c 00 f7 d8 64 89 01 48
[5.596729] RSP: 002b:7ffc777b8558 EFLAGS: 0246 ORIG_RAX: 
00af
[5.596730] RAX: ffda RBX: 55fdc48da320 RCX: 7f762b877dee
[5.596731] RDX: 7f762b9f284d RSI: 006c5fc6 RDI: 55fdc527a060
[5.596732] RBP: 7f762b9f284d R08: 0003 R09: 0002
[5.596733] R10: 55fdc48ad010 R11: 0246 R12: 55fdc527a060
[5.596734] R13: 55fdc48dca20 R14: 0002 R15: 
[5.596740] irq event stamp: 134618
[5.596743] hardirqs last  enabled at (134617): [] 
console_unlock+0x45e/0x610
[5.596744] hardirqs last disabled at (134618): [] 
trace_hardirqs_off_thunk+0x1a/0x1c
[5.596746] softirqs last  enabled at (133146): [] 
__do_softirq+0x365/0x47c
[5.596748] softirqs last disabled at (133139): [] 
irq_exit+0x119/0x120
[5.596749] ---[ end trace eaee508abfebccdc ]---

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108709
Signed-off-by: Chris Wilson 
Cc: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 8 
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 8 
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 8 
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 8 
 4 files changed, 16 

Re: [PATCH v2 8/9] phy: Add Cadence D-PHY support

2018-11-16 Thread Maxime Ripard
Hi!

On Mon, Nov 12, 2018 at 03:21:56PM +0530, Kishon Vijay Abraham I wrote:
> > +static int cdns_dphy_validate(struct phy *phy, enum phy_mode mode,
> > + union phy_configure_opts *opts)
> > +{
> > +   struct cdns_dphy_cfg cfg = { 0 };
> > +
> > +   if (mode != PHY_MODE_MIPI_DPHY)
> > +   return -EINVAL;
> > +
> > +   return cdns_dphy_config_from_opts(phy, >mipi_dphy, );
> > +}
> > +
> > +static int cdns_dphy_configure(struct phy *phy, union phy_configure_opts 
> > *opts)
> > +{
> > +   struct cdns_dphy *dphy = phy_get_drvdata(phy);
> > +   struct cdns_dphy_cfg cfg = { 0 };
> > +   int ret;
> > +
> > +   ret = cdns_dphy_config_from_opts(phy, >mipi_dphy, );
> > +   if (ret)
> > +   return ret;
> 
> Can you explain why you need the same function to be invoked from both 
> validate
> and configure callback? I see this to be redundant.

Sure.

Validate and configure serve two rather different purposes. validate
is here to make sure that a configuration can work with the PHY, and
to let the phy adjust the configuration to find a more optimal one.

configure, on the other hand, apply a configuration. We still have to
make sure that the configuration can work, since:
  - We might have called validate any number of times, with any number
of configurations before calling configure, so we don't know which
configuration we validate is actually going to be applied later on
(if it's even applied)
  - If we don't care about the validation at all, we might just call
configure directly

Does that make sense?

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCHv4 0/6] omapdrm: DSI command mode panel support

2018-11-16 Thread Sebastian Reichel
Hi,

It's time for a new revision of the DSI command mode panel
patchset. The patches have been rebased to 4.20-rc1 + fixes
from Laurent and Tony. I dropped the patches for OMAP3 support
(it needs a workaround for a hardware bug) and for automatic
display rotation. They should get their own series, once this
patchset has landed.

Tested on Droid 4:
 * Framebuffer Console, updated at 1Hz due to blinking cursor
 * Display blanking
 * Xorg 1.19 with modesetting driver
 * Weston 5.0 with DRM backend
 * kmstest (static image)
 * No updates send when nothing needs to be sent

Known issues:
 * OMAP3 is untested and most likely broken due to missing
   workaround(s) for hardware bugs.
 * Weston 5.0 with fbdev backend does not work, since it
   uses neither page flip nor dirty ioctl. You need to use
   the drm backend.

Changes since PATCHv3:
 * Drop all Tested/Acked-by tags
 * Drop the rotation patches for now
 * Rebase to 4.20-rc1 + fixes from Laurent and Tony
 * Add fixes for DSI regressions introduced in 4.20-rc1
 * Store info update manual update mode in omap_crtc_state
 * Lock modesetting in omap_framebuffer_dirty
 * Directly loop through CRTCs instead of connectors in dirty function
 * Properly refresh display during page flips and get Weston working
 * Add more comments about implementation details

Changes since PATCHv2:
 * Drop omap3 quirk patch (OMAP3 should get its own mini-series)
 * Rebase to current linux-next
 * Use existing 'rotation' DT property to set DRM orientation hint
 * Add Tested-by from Tony

Changes since PATCHv1:
 * Drop patches, that were queued by Tomi
 * Rebase to current master
 * Rework the omap3 workaround patch to only affect omap3
 * Add orientation DRM property support

-- Sebastian

Sebastian Reichel (6):
  drm/omap: use DRM_DEBUG_DRIVER instead of CORE
  drm/omap: populate DSI platform bus earlier
  drm/omap: don't check dispc timings for DSI
  drm/omap: fix incorrect union usage
  drm/omap: add framedone interrupt support
  drm/omap: add support for manually updated displays

 drivers/gpu/drm/omapdrm/dss/dsi.c|  20 +--
 drivers/gpu/drm/omapdrm/omap_connector.c |   8 +-
 drivers/gpu/drm/omapdrm/omap_crtc.c  | 166 ++-
 drivers/gpu/drm/omapdrm/omap_crtc.h  |   2 +
 drivers/gpu/drm/omapdrm/omap_drv.h   |   4 +-
 drivers/gpu/drm/omapdrm/omap_encoder.c   |  16 ++-
 drivers/gpu/drm/omapdrm/omap_fb.c|  41 ++
 drivers/gpu/drm/omapdrm/omap_irq.c   |  25 
 drivers/gpu/drm/omapdrm/omap_irq.h   |   1 +
 9 files changed, 260 insertions(+), 23 deletions(-)

-- 
2.19.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH -next] drm/nouveau: fix copy-paste error in nouveau_fence_wait_uevent_handler

2018-11-16 Thread YueHaibing
Fixes gcc '-Wunused-but-set-variable' warning:

drivers/gpu/drm/nouveau/nouveau_fence.c: In function 
'nouveau_fence_wait_uevent_handler':
drivers/gpu/drm/nouveau/nouveau_fence.c:156:27: warning:
 variable 'chan' set but not used [-Wunused-but-set-variable]

nouveau_fence_update should use rcu protected 'chan'
rather than 'fence->channel'

Fixes: 0ec5f02f0e2c ("drm/nouveau: prevent stale fence->channel pointers, and 
protect with rcu")
Signed-off-by: YueHaibing 
---
 drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c 
b/drivers/gpu/drm/nouveau/nouveau_fence.c
index d4964f3..91286d0 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -157,7 +157,7 @@
 
fence = list_entry(fctx->pending.next, typeof(*fence), head);
chan = rcu_dereference_protected(fence->channel, 
lockdep_is_held(>lock));
-   if (nouveau_fence_update(fence->channel, fctx))
+   if (nouveau_fence_update(chan, fctx))
ret = NVIF_NOTIFY_DROP;
}
spin_unlock_irqrestore(>lock, flags);



___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/ast: Remove existing framebuffers before loading driver

2018-11-16 Thread Jean Delvare
On Thu, 2018-11-15 at 11:42 +0100, Thomas Zimmermann wrote:
> If vesafb attaches to the AST device, it configures the framebuffer memory
> for uncached access by default. When ast.ko later tries to attach itself to
> the device, it wants to use write-combining on the framebuffer memory, but
> vesefb's existing configuration for uncached access takes precedence. This
> results in reduced performance.
> 
> Removing the framebuffer's configuration before loding the AST driver fixes
> the problem. Other DRM drivers already contain equivalent code.
> 
> Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1112963
> Signed-off-by: Thomas Zimmermann 
> Tested-by: Y.C. Chen 
> ---
>  drivers/gpu/drm/ast/ast_drv.c | 21 +
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> index 69dab82a3771..bf589c53b908 100644
> --- a/drivers/gpu/drm/ast/ast_drv.c
> +++ b/drivers/gpu/drm/ast/ast_drv.c
> @@ -60,8 +60,29 @@ static const struct pci_device_id pciidlist[] = {
>  
>  MODULE_DEVICE_TABLE(pci, pciidlist);
>  
> +static void ast_kick_out_firmware_fb(struct pci_dev *pdev)
> +{
> + struct apertures_struct *ap;
> + bool primary = false;
> +
> + ap = alloc_apertures(1);
> + if (!ap)
> + return;
> +
> + ap->ranges[0].base = pci_resource_start(pdev, 0);
> + ap->ranges[0].size = pci_resource_len(pdev, 0);
> +
> +#ifdef CONFIG_X86
> + primary = pdev->resource[PCI_ROM_RESOURCE].flags & 
> IORESOURCE_ROM_SHADOW;
> +#endif
> + drm_fb_helper_remove_conflicting_framebuffers(ap, "astdrmfb", primary);
> + kfree(ap);
> +}
> +
>  static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id 
> *ent)
>  {
> + ast_kick_out_firmware_fb(pdev);
> +
>   return drm_get_pci_dev(pdev, ent, );
>  }
>  

Thank you very much Thomas.

Reviewed-by: Jean Delvare 
Tested-by: Jean Delvare 

-- 
Jean Delvare
SUSE L3 Support
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


  1   2   >