[Freedreno] [RFC] checking drm_framebuffer against config width/height

2019-09-18 Thread jsanka
Hello All, 

I bumped into the below check [1] enforced in drm_framebuffer creation which
checks the requested framebuffer width/height parameters against the drm
mode config width/height limits. As I understand, drm_mode_config: min/max
width/height indicate the upper and lower bounds of the display panel
(drm_connector) resolutions the DRM device can support. But the pixel
processing pipeline can apply cropping/scaling transformations on much
larger input framebuffers and flip the buffers within the display
resolution. Such configurations are very common and the final resolution
will be still within drm_mode_config bounds. So I believe the checks should
be relaxed / removed from the drm_framebuffer creation api's. 

 

If my understanding is incorrect, could somehow explain the motivation
behind having these checks here?

 

Thanks and Regards,

Jeykumar S.

 

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/driv
ers/gpu/drm/drm_framebuffer.c?h=v5.3#n303

 

struct drm_framebuffer *
drm_internal_framebuffer_create(struct drm_device *dev,
   const struct drm_mode_fb_cmd2 *r,
   struct drm_file *file_priv)
{

 /* snip */

 

if ((config->min_width > r->width) || (r->width >
config->max_width)) {

   DRM_DEBUG_KMS("bad framebuffer width %d, should be >= %d &&
<= %d\n",

 r->width, config->min_width, config->max_width);

   return ERR_PTR(-EINVAL);

}

if ((config->min_height > r->height) || (r->height >
config->max_height)) {

   DRM_DEBUG_KMS("bad framebuffer height %d, should be >= %d &&
<= %d\n",

 r->height, config->min_height, config->max_height);

   return ERR_PTR(-EINVAL);

}

/* snip */

}

 

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

Re: [Freedreno] [RFC PULL] Add Display Support for Qualcomm SDM845

2018-02-14 Thread jsanka



On 2/13/2018 12:00 PM, Rob Clark wrote:

On Tue, Feb 13, 2018 at 2:18 PM, Sean Paul  wrote:

Hi dri-devel,
Qualcomm has been working for the past few weeks on forward porting their
downstream drm driver from 4.14 to mainline. Please consider this PR as a
request for review, rather than an attempt at mainlining the code as it
currently stands. The goal is get this driver in shape over the next coming
months.

In the meantime, I'll be hosting a tree here [1] to stage the fixes. Patches
will be posted and reviewed on linux-arm-...@vger.kernel.org. Once things look
good, I'll send another pull 4realz.

To get the ball rolling, I've done some review on the new connector code, my
comments are below.

Thanks in advance for your constructive feedback :)

Sean

[1]- git://people.freedesktop.org/~seanpaul/dpu-staging

Review feedback:


just so others aren't confused, s/sde/dpu/g in the list below (we did
our DAL->DC rename before sending first RFC :-P)


- Solve the splash screen handling (or remove it)
- Simplify devicetree binding (remove register offsets)
feedback from reviewing sde_connector.c:
- Rationalize backlight implementation in sde_connector (display_count static)
- Sort out the dsi event passing between dsi/encoder/connector (move to encoder)
- include/uapi/drm/msm_drm_pp.h needs opensource userspace (or removal)
- connector->state access violations reading/writing mode_info
- s/sde_rect/drm_rect/
- sde_kms_info usage needs to be replaced with formal data structures (not
   stringified keypairs)
- sde_connector_ops needs to be trimmed, duplicates connector helpers, info
   hooks circumvent state, and other hooks should be stored in state or
   prepopulated (get_dst_format)
- sde_connector_get_dpms unused
- esd status check should migrate to encoder from connector
- backlight should be handled in panel drivers, not in the generic connector/dsi
   encoder
- sde_connector_helper_bridge_disable is called from encoder and calls back into
   set_power encoder function. if backlight, and esd status are removed,
   pre_kickoff can probably go away
- sde_connector_clk_ctrl is another example of encoder->connector->encoder call
- RETIRE_FENCE connector property should be removed, opting for the native
   atomic fences
- ROI (regions of interest) should be expressed per-plane instead of connector.
   there is work ongoing to support dirty_rects per-plane by Deepak Singh Rawat
and Lukasz Spintzyk 
- Uma Shankar  has proposed HDR source metadata
   properties on the list, we should pivot to those instead of hand-rolling them
   in the sde driver
- Convert HDCP implementation to upstream Content Protection property
- Merge dsi and dsi_staging into one driver
- Writeback connector has been proposed by ARM (Liviu Dudau and Brian Starkey),
   we should work with their proposal instead of rolling OUT_FB ourselves
- sde_connector_set_property should be replaced with atomic helper
- dsi hotplug can probably be punted to the panel driver
- dpms should switch to enable/disable (or at least use the atomic helpers)
- dsi mode handling should also defer to the panel driver
- SDE_WB_CONFIG ioctl should be removed in favor of the existing ioctl to add
   user-defined modes
- dp implementation should use the existing dp helpers wherever possible
- lots of duplicated structures in dsi_defs.h that can be replaced with existing
   drm structs
- mode_valid should be split up and implemented directly in connector/encoder as
   appropriate
- sde_connector->aspace seems like it's unused?


To add to that, a few things I've noticed (but I've mostly only gotten
as far as the front-end of the pipeline, ie. dpu_plane):

  - It looks like, as was the case with mdp4/mdp5 (and really most other hw)
there are still unequal capabilities for planes (ie. some can do YUV,
scaling, etc).

But drm-hwc (or weston) isn't going to know about that, so I think we'll
need to add support for dynamically assigning dpu_plane::pipe, similar
to what mdp5 does w/ plane<->hwpipe.  (Which I actually added specifically
for drm-hwc ;-))
We are working on plane virtualization focused primarily to support 4K / 
wider displays which cannot
be catered by one hwpipe. The plan is to gang up two *fixed* hwpipes of 
similar capabilities (in terms of formats,
sub hw blocks like scalar, post processing ) and expose them as a single 
plane so that user space
compositor ( drm-hwc or weston) need not worry about max pixel width 
supported by the planes. But mapping
planes <-> hwpipe dynamically may need more than just virtualization. 
Kernel need to keep track of hwpipes
especially when dealing with multiple displays. And it get complicated 
when planes start moving around CRTC's

for different sized buffers.

Given that DRM exposes planes with its own list of format/modifiers, I 
think its not that big of a deal for a

compositor to look up for plane to support the format and use it.


  - I *think* we also need the same trick for 

Re: [Freedreno] [DPU PATCH 2/2] drm/msm: remove partial update support

2018-02-27 Thread jsanka

On 2018-02-26 07:21, Sean Paul wrote:

On Thu, Feb 22, 2018 at 06:32:05PM -0800, Jeykumar Sankaran wrote:

Implementation of partial update in DPU DRM is heavily
dependent on custom properties and dsi hooks. Removing the
support for now. We may need to revisit the support in the
future.

Change-Id: Idd87272fe4d4c0a26fcb405154c0605af1edf1ba
Signed-off-by: Jeykumar Sankaran 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_connector.c  | 143 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_connector.h  |   7 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c   | 544 
+

 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h   |  18 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c| 266 
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c |   2 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h|   8 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms_utils.c  |  42 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c  |  13 -
 drivers/gpu/drm/msm/msm_drv.h  |  56 ---
 10 files changed, 90 insertions(+), 1009 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_connector.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_connector.c

index 57b8627..6478e89 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_connector.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_connector.c
@@ -424,8 +424,7 @@ int dpu_connector_pre_kickoff(struct drm_connector 
*connector)

 {
struct dpu_connector *c_conn;
struct dpu_connector_state *c_state;
-   struct msm_display_kickoff_params params;
-   int idx, rc;
+   int idx, rc = 0;

if (!connector) {
DPU_ERROR("invalid argument\n");
@@ -462,14 +461,7 @@ int dpu_connector_pre_kickoff(struct 
drm_connector *connector)

}
}

-   if (!c_conn->ops.pre_kickoff)
-   return 0;
-
-   params.rois = &c_state->rois;
-
-   DPU_EVT32_VERBOSE(connector->base.id);
-
-   rc = c_conn->ops.pre_kickoff(connector, c_conn->display, ¶ms);
+   DPU_EVT32_VERBOSE(connector->base.id);

return rc;
 }
@@ -645,122 +637,6 @@ static void dpu_connector_atomic_reset(struct 
drm_connector *connector)

return &c_state->base;
 }

-static int _dpu_connector_roi_v1_check_roi(
-   struct dpu_connector *c_conn,
-   struct drm_clip_rect *roi_conn,
-   const struct msm_roi_caps *caps)
-{
-   const struct msm_roi_alignment *align = &caps->align;
-   int w = roi_conn->x2 - roi_conn->x1;
-   int h = roi_conn->y2 - roi_conn->y1;
-
-   if (w <= 0 || h <= 0) {
-   DPU_ERROR_CONN(c_conn, "invalid conn roi w %d h %d\n", w, h);
-   return -EINVAL;
-   }
-
-   if (w < align->min_width || w % align->width_pix_align) {
-   DPU_ERROR_CONN(c_conn,
-   "invalid conn roi width %d min %d align %d\n",
-   w, align->min_width, align->width_pix_align);
-   return -EINVAL;
-   }
-
-   if (h < align->min_height || h % align->height_pix_align) {
-   DPU_ERROR_CONN(c_conn,
-   "invalid conn roi height %d min %d align %d\n",
-   h, align->min_height, align->height_pix_align);
-   return -EINVAL;
-   }
-
-   if (roi_conn->x1 % align->xstart_pix_align) {
-   DPU_ERROR_CONN(c_conn, "invalid conn roi x1 %d align %d\n",
-   roi_conn->x1, align->xstart_pix_align);
-   return -EINVAL;
-   }
-
-   if (roi_conn->y1 % align->ystart_pix_align) {
-   DPU_ERROR_CONN(c_conn, "invalid conn roi y1 %d align %d\n",
-   roi_conn->y1, align->ystart_pix_align);
-   return -EINVAL;
-   }
-
-   return 0;
-}
-
-static int _dpu_connector_set_roi_v1(
-   struct dpu_connector *c_conn,
-   struct dpu_connector_state *c_state,
-   void *usr_ptr)
-{
-   struct dpu_drm_roi_v1 roi_v1;
-   struct msm_display_info display_info;
-   struct msm_roi_caps *caps;
-   int i, rc;
-
-   if (!c_conn || !c_state) {
-   DPU_ERROR("invalid args\n");
-   return -EINVAL;
-   }
-
-   rc = dpu_connector_get_info(&c_conn->base, &display_info);
-   if (rc) {
-   DPU_ERROR_CONN(c_conn, "display get info error: %d\n", rc);
-   return rc;
-   }
-
-   caps = &display_info.roi_caps;
-   if (!caps->enabled) {
-   DPU_ERROR_CONN(c_conn, "display roi capability is disabled\n");
-   return -ENOTSUPP;
-   }
-
-   memset(&c_state->rois, 0, sizeof(c_state->rois));
-
-   if (!usr_ptr) {
-   DPU_DEBUG_CONN(c_conn, "rois cleared\n");
-   return 0;
-   }
-
-   if (copy_from_user(&roi_v1, usr_ptr, sizeof(roi_v1))) {
-   DPU_ERROR_CONN(c_conn, "failed to copy roi_v1 data\n");
-   return -EINVAL;
-   }
-
-

Re: [Freedreno] [DPU PATCH 06/11] drm/msm: Remove msm_commit/kthread, use atomic helper commit

2018-02-28 Thread jsanka

On 2018-02-28 11:19, Sean Paul wrote:

Moving further towards switching fully to the the atomic helpers, this
patch removes the hand-rolled kthread nonblock commit code and uses the
atomic helpers commit_work model.

There's still a lot of copypasta here, but it's still needed to
facilitate the swap_state and prepare_fence private functions. These
will be sorted out in a follow-on patch.

Change-Id: I9fcba27824ba63d3fab96cb2bc194bfa6f3475b7
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/msm/msm_atomic.c | 199 ++-
 drivers/gpu/drm/msm/msm_drv.c|   1 -
 drivers/gpu/drm/msm/msm_drv.h|   4 -
 3 files changed, 35 insertions(+), 169 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_atomic.c
b/drivers/gpu/drm/msm/msm_atomic.c
index 3a18bd3dc215..7e54eb65d096 100644
--- a/drivers/gpu/drm/msm/msm_atomic.c
+++ b/drivers/gpu/drm/msm/msm_atomic.c
@@ -21,51 +21,6 @@
 #include "msm_gem.h"
 #include "msm_fence.h"

-struct msm_commit {
-   struct drm_device *dev;
-   struct drm_atomic_state *state;
-   uint32_t crtc_mask;
-   bool nonblock;
-   struct kthread_work commit_work;
-};
-
-/* block until specified crtcs are no longer pending update, and
- * atomically mark them as pending update
- */
-static int start_atomic(struct msm_drm_private *priv, uint32_t 
crtc_mask)

-{
-   int ret;
-
-   spin_lock(&priv->pending_crtcs_event.lock);
-   ret = wait_event_interruptible_locked(priv->pending_crtcs_event,
-   !(priv->pending_crtcs & crtc_mask));
-   if (ret == 0) {
-   DBG("start: %08x", crtc_mask);
-   priv->pending_crtcs |= crtc_mask;
-   }
-   spin_unlock(&priv->pending_crtcs_event.lock);
-
-   return ret;
-}
-
-/* clear specified crtcs (no longer pending update)
- */
-static void end_atomic(struct msm_drm_private *priv, uint32_t 
crtc_mask)

-{
-   spin_lock(&priv->pending_crtcs_event.lock);
-   DBG("end: %08x", crtc_mask);
-   priv->pending_crtcs &= ~crtc_mask;
-   wake_up_all_locked(&priv->pending_crtcs_event);
-   spin_unlock(&priv->pending_crtcs_event.lock);
-}
-
-static void commit_destroy(struct msm_commit *c)
-{
-   end_atomic(c->dev->dev_private, c->crtc_mask);
-   if (c->nonblock)
-   kfree(c);
-}
-
 static void msm_atomic_wait_for_commit_done(
struct drm_device *dev,
struct drm_atomic_state *old_state)
@@ -118,6 +73,10 @@ static void msm_atomic_commit_tail(struct
drm_atomic_state *state)

msm_atomic_wait_for_commit_done(dev, state);

+   drm_atomic_helper_commit_hw_done(state);
+
+   drm_atomic_helper_wait_for_vblanks(dev, state);
+
drm_atomic_helper_cleanup_planes(dev, state);

kms->funcs->complete_commit(kms, state);
@@ -126,109 +85,25 @@ static void msm_atomic_commit_tail(struct
drm_atomic_state *state)
 /* The (potentially) asynchronous part of the commit.  At this point
  * nothing can fail short of armageddon.
  */
-static void complete_commit(struct msm_commit *c)
+static void commit_tail(struct drm_atomic_state *state)
 {
-   struct drm_atomic_state *state = c->state;
-   struct drm_device *dev = state->dev;
+   drm_atomic_helper_wait_for_fences(state->dev, state, false);

-   drm_atomic_helper_wait_for_fences(dev, state, false);
+   drm_atomic_helper_wait_for_dependencies(state);

msm_atomic_commit_tail(state);

-   drm_atomic_state_put(state);
-}
-
-static void _msm_drm_commit_work_cb(struct kthread_work *work)
-{
-   struct msm_commit *commit =  NULL;
-
-   if (!work) {
-   DRM_ERROR("%s: Invalid commit work data!\n", __func__);
-   return;
-   }
-
-   commit = container_of(work, struct msm_commit, commit_work);
-
-   complete_commit(commit);
-
-   commit_destroy(commit);
-}
-
-static struct msm_commit *commit_init(struct drm_atomic_state *state,
-   bool nonblock)
-{
-   struct msm_commit *c = kzalloc(sizeof(*c), GFP_KERNEL);
+   drm_atomic_helper_commit_cleanup_done(state);

-   if (!c)
-   return NULL;
-
-   c->dev = state->dev;
-   c->state = state;
-   c->nonblock = nonblock;
-
-   kthread_init_work(&c->commit_work, _msm_drm_commit_work_cb);
-
-   return c;
+   drm_atomic_state_put(state);
 }

-/* Start display thread function */
-static void msm_atomic_commit_dispatch(struct drm_device *dev,
-   struct drm_atomic_state *state, struct msm_commit *commit)
+static void commit_work(struct work_struct *work)
 {
-   struct msm_drm_private *priv = dev->dev_private;
-   struct drm_crtc *crtc = NULL;
-   struct drm_crtc_state *new_crtc_state = NULL;
-   int ret = -EINVAL, i = 0, j = 0;
-   bool nonblock;
-
-   /* cache since work will kfree commit in non-blocking case */
-   nonblock = commit->nonblock;
-
-   for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
-   for (j =

Re: [Freedreno] [DPU PATCH 06/11] drm/msm: Remove msm_commit/kthread, use atomic helper commit

2018-03-01 Thread jsanka

On 2018-03-01 07:27, Sean Paul wrote:

On Wed, Feb 28, 2018 at 08:07:00PM -0800, jsa...@codeaurora.org wrote:

On 2018-02-28 11:19, Sean Paul wrote:
> Moving further towards switching fully to the the atomic helpers, this
> patch removes the hand-rolled kthread nonblock commit code and uses

the

> atomic helpers commit_work model.
>
> There's still a lot of copypasta here, but it's still needed to
> facilitate the swap_state and prepare_fence private functions. These
> will be sorted out in a follow-on patch.
>
> Change-Id: I9fcba27824ba63d3fab96cb2bc194bfa6f3475b7
> Signed-off-by: Sean Paul 
> ---
>  drivers/gpu/drm/msm/msm_atomic.c | 199

++-

>  drivers/gpu/drm/msm/msm_drv.c|   1 -
>  drivers/gpu/drm/msm/msm_drv.h|   4 -
>  3 files changed, 35 insertions(+), 169 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_atomic.c
> b/drivers/gpu/drm/msm/msm_atomic.c
> index 3a18bd3dc215..7e54eb65d096 100644
> --- a/drivers/gpu/drm/msm/msm_atomic.c
> +++ b/drivers/gpu/drm/msm/msm_atomic.c
> @@ -21,51 +21,6 @@
>  #include "msm_gem.h"
>  #include "msm_fence.h"
>
> -struct msm_commit {
> -  struct drm_device *dev;
> -  struct drm_atomic_state *state;
> -  uint32_t crtc_mask;
> -  bool nonblock;
> -  struct kthread_work commit_work;
> -};
> -
> -/* block until specified crtcs are no longer pending update, and
> - * atomically mark them as pending update
> - */
> -static int start_atomic(struct msm_drm_private *priv, uint32_t
> crtc_mask)
> -{
> -  int ret;
> -
> -  spin_lock(&priv->pending_crtcs_event.lock);
> -  ret = wait_event_interruptible_locked(priv->pending_crtcs_event,
> -  !(priv->pending_crtcs & crtc_mask));
> -  if (ret == 0) {
> -  DBG("start: %08x", crtc_mask);
> -  priv->pending_crtcs |= crtc_mask;
> -  }
> -  spin_unlock(&priv->pending_crtcs_event.lock);
> -
> -  return ret;
> -}
> -
> -/* clear specified crtcs (no longer pending update)
> - */
> -static void end_atomic(struct msm_drm_private *priv, uint32_t
> crtc_mask)
> -{
> -  spin_lock(&priv->pending_crtcs_event.lock);
> -  DBG("end: %08x", crtc_mask);
> -  priv->pending_crtcs &= ~crtc_mask;
> -  wake_up_all_locked(&priv->pending_crtcs_event);
> -  spin_unlock(&priv->pending_crtcs_event.lock);
> -}
> -
> -static void commit_destroy(struct msm_commit *c)
> -{
> -  end_atomic(c->dev->dev_private, c->crtc_mask);
> -  if (c->nonblock)
> -  kfree(c);
> -}
> -
>  static void msm_atomic_wait_for_commit_done(
>struct drm_device *dev,
>struct drm_atomic_state *old_state)
> @@ -118,6 +73,10 @@ static void msm_atomic_commit_tail(struct
> drm_atomic_state *state)
>
>msm_atomic_wait_for_commit_done(dev, state);
>
> +  drm_atomic_helper_commit_hw_done(state);
> +
> +  drm_atomic_helper_wait_for_vblanks(dev, state);
> +
>drm_atomic_helper_cleanup_planes(dev, state);
>
>kms->funcs->complete_commit(kms, state);
> @@ -126,109 +85,25 @@ static void msm_atomic_commit_tail(struct
> drm_atomic_state *state)
>  /* The (potentially) asynchronous part of the commit.  At this point
>   * nothing can fail short of armageddon.
>   */
> -static void complete_commit(struct msm_commit *c)
> +static void commit_tail(struct drm_atomic_state *state)
>  {
> -  struct drm_atomic_state *state = c->state;
> -  struct drm_device *dev = state->dev;
> +  drm_atomic_helper_wait_for_fences(state->dev, state, false);
>
> -  drm_atomic_helper_wait_for_fences(dev, state, false);
> +  drm_atomic_helper_wait_for_dependencies(state);
>
>msm_atomic_commit_tail(state);
>
> -  drm_atomic_state_put(state);
> -}
> -
> -static void _msm_drm_commit_work_cb(struct kthread_work *work)
> -{
> -  struct msm_commit *commit =  NULL;
> -
> -  if (!work) {
> -  DRM_ERROR("%s: Invalid commit work data!\n", __func__);
> -  return;
> -  }
> -
> -  commit = container_of(work, struct msm_commit, commit_work);
> -
> -  complete_commit(commit);
> -
> -  commit_destroy(commit);
> -}
> -
> -static struct msm_commit *commit_init(struct drm_atomic_state *state,
> -  bool nonblock)
> -{
> -  struct msm_commit *c = kzalloc(sizeof(*c), GFP_KERNEL);
> +  drm_atomic_helper_commit_cleanup_done(state);
>
> -  if (!c)
> -  return NULL;
> -
> -  c->dev = state->dev;
> -  c->state = state;
> -  c->nonblock = nonblock;
> -
> -  kthread_init_work(&c->commit_work, _msm_drm_commit_work_cb);
> -
> -  return c;
> +  drm_atomic_state_put(state);
>  }
>
> -/* Start display thread function */
> -static void msm_atomic_commit_dispatch(struct drm_device *dev,
> -  struct drm_atomic_state *state, struct msm_commit *commit)
> +static void commit_work(struct work_struct *work)
>  {
> -  struct msm_drm_private *priv = dev->dev_private;
> -  struct drm_crtc *crtc = NULL;
> -  struct drm_crtc_state *new_crtc_state = NULL;
> -  int ret = -EINVAL, i = 0, j = 0;
> -  bool nonblock;
> -
> -  /* cache since work will kfree commit in non-blocking case */
> -  nonblock = commit->nonblock;
> -
> -

Re: [Freedreno] [DPU PATCH] drm/msm: Remove secure fb/plane support from dpu

2018-03-02 Thread jsanka

On 2018-02-21 13:42, Sean Paul wrote:

We need to have a discussion about how to introduce this in a way that
it can be leveraged by other platforms/userspaces. For now, remove
support since we don't need it yet.

Signed-off-by: Sean Paul 


Reviewed-by: Jeykumar Sankaran 


---
 drivers/gpu/drm/drm_framebuffer.c |  3 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c  | 16 ---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h  | 43 ---
 .../drm/msm/disp/dpu1/dpu_encoder_phys_wb.c   | 11 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_rot.c|  1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_rot.h|  2 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c   | 30 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h   | 21 +++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c |  3 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h |  1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |  8 +---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h   | 15 ---
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 41 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h |  1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_wb.c| 10 -
 drivers/gpu/drm/msm/msm_drv.h |  3 --
 include/uapi/drm/dpu_drm.h| 42 --
 include/uapi/drm/drm_mode.h   |  1 -
 18 files changed, 9 insertions(+), 243 deletions(-)

diff --git a/drivers/gpu/drm/drm_framebuffer.c
b/drivers/gpu/drm/drm_framebuffer.c
index 8222ff7d3e93..5a13ff29f4f0 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -268,8 +268,7 @@ drm_internal_framebuffer_create(struct drm_device
*dev,
struct drm_framebuffer *fb;
int ret;

-   if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS |
-   DRM_MODE_FB_SECURE)) {
+   if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS))
{
DRM_DEBUG_KMS("bad framebuffer flags 0x%08x\n", r->flags);
return ERR_PTR(-EINVAL);
}
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index df6cbeb15cf5..3cdf1e3d9d96 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -39,13 +39,6 @@
 #include "dpu_core_perf.h"
 #include "dpu_trace.h"

-/* defines for secure channel call */
-#define SEC_SID_CNT   2
-#define SEC_SID_MASK_00x80881
-#define SEC_SID_MASK_10x80C81
-#define MEM_PROTECT_SD_CTRL_SWITCH 0x18
-#define MDP_DEVICE_ID0x1A
-
 struct dpu_crtc_irq_info {
struct dpu_irq_callback irq;
u32 event;
@@ -3994,10 +3987,6 @@ static void dpu_crtc_install_properties(struct
drm_crtc *crtc,
struct drm_device *dev;
struct dpu_kms_info *info;
struct dpu_kms *dpu_kms;
-   static const struct drm_prop_enum_list e_secure_level[] = {
-   {DPU_DRM_SEC_NON_SEC, "sec_and_non_sec"},
-   {DPU_DRM_SEC_ONLY, "sec_only"},
-   };

DPU_DEBUG("\n");

@@ -4080,11 +4069,6 @@ static void dpu_crtc_install_properties(struct
drm_crtc *crtc,
msm_property_install_volatile_range(&dpu_crtc->property_info,
"dpu_drm_roi_v1", 0x0, 0, ~0, 0, CRTC_PROP_ROI_V1);

-   msm_property_install_enum(&dpu_crtc->property_info,
"security_level",
-   0x0, 0, e_secure_level,
-   ARRAY_SIZE(e_secure_level),
-   CRTC_PROP_SECURITY_LEVEL);
-
dpu_kms_info_reset(info);

if (catalog->has_dim_layer) {
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
index 17d21fff3f0a..b63df243be33 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
@@ -51,20 +51,14 @@ enum dpu_crtc_client_type {
  * enum dpu_crtc_smmu_state:   smmu state
  * @ATTACHED:   all the context banks are attached.
  * @DETACHED:   all the context banks are detached.
- * @DETACHED_SEC:   secure context bank is detached.
  * @ATTACH_ALL_REQ: transient state of attaching context banks.
  * @DETACH_ALL_REQ: transient state of detaching context banks.
- * @DETACH_SEC_REQ: tranisent state of secure context bank is
detached
- * @ATTACH_SEC_REQ: transient state of attaching secure context bank.
  */
 enum dpu_crtc_smmu_state {
ATTACHED = 0,
DETACHED,
-   DETACHED_SEC,
ATTACH_ALL_REQ,
DETACH_ALL_REQ,
-   DETACH_SEC_REQ,
-   ATTACH_SEC_REQ,
 };

 /**
@@ -621,41 +615,4 @@ void dpu_crtc_res_put(struct drm_crtc_state 
*state,

u32 type, u64 tag);
 void dpu_crtc_get_crtc_roi(struct drm_crtc_state *state,
const struct dpu_rect **crtc_roi);

-/** dpu_crt_get_secure_level - retrieve the secure level from the give
state
- * object, this is used to determine the secure state of the crtc
- * @crtc : Pointer to drm crtc structure
- * @usr

Re: [Freedreno] [DPU PATCH] drm: Remove unused drm_connector fields.

2018-03-02 Thread jsanka

On 2018-02-26 08:49, Sean Paul wrote:

They're not used, so let's get rid of them.

Signed-off-by: Sean Paul 


Reviewed-by: Jeykumar Sankaran 


---
 include/drm/drm_connector.h | 19 ---
 1 file changed, 19 deletions(-)

diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 9d9d5405ebfd..ed38df4ac204 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -754,15 +754,6 @@ struct drm_cmdline_mode {
  * @audio_latency: audio latency info from ELD, if found
  * @null_edid_counter: track sinks that give us all zeros for the EDID
  * @bad_edid_counter: track sinks that give us an EDID with invalid
checksum
- * @pt_scan_info: PT scan info obtained from the VCDB of EDID
- * @it_scan_info: IT scan info obtained from the VCDB of EDID
- * @ce_scan_info: CE scan info obtained from the VCDB of EDID
- * @hdr_eotf: Electro optical transfer function obtained from HDR 
block

- * @hdr_metadata_type_one: Metadata type one obtained from HDR block
- * @hdr_max_luminance: desired max luminance obtained from HDR block
- * @hdr_avg_luminance: desired avg luminance obtained from HDR block
- * @hdr_min_luminance: desired min luminance obtained from HDR block
- * @hdr_supported: does the sink support HDR content
  * @edid_corrupt: indicates whether the last read EDID was corrupt
  * @debugfs_entry: debugfs directory for this connector
  * @has_tile: is this connector connected to a tiled monitor
@@ -943,16 +934,6 @@ struct drm_connector {
int null_edid_counter; /* needed to workaround some HW bugs where
we get all 0s */
unsigned bad_edid_counter;

-   u8 pt_scan_info;
-   u8 it_scan_info;
-   u8 ce_scan_info;
-   u32 hdr_eotf;
-   bool hdr_metadata_type_one;
-   u32 hdr_max_luminance;
-   u32 hdr_avg_luminance;
-   u32 hdr_min_luminance;
-   bool hdr_supported;
-
/* Flag for raw EDID header corruption - used in Displayport
 * compliance testing - * Displayport Link CTS Core 1.2 rev1.1
4.2.2.6
 */

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [DPU PATCH 01/11] drm/msm: Skip seamless disables in crtc/encoder

2018-03-02 Thread jsanka

On 2018-02-28 11:18, Sean Paul wrote:

Instead of duplicating whole swaths of atomic helper functions (which
are already out-of-date), just skip the encoder/crtc disables in the
.disable hooks.

Change-Id: I7bd9183ae60624204fb1de9550656b776efc7202
Signed-off-by: Sean Paul 


Can you consider getting rid of these checks?


---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c|   8 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |   8 +
 drivers/gpu/drm/msm/msm_atomic.c| 185 +---
 3 files changed, 17 insertions(+), 184 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 3cdf1e3d9d96..a3ab6ed2bf1d 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -3393,6 +3393,7 @@ static void dpu_crtc_disable(struct drm_crtc 
*crtc)

 {
struct dpu_crtc *dpu_crtc;
struct dpu_crtc_state *cstate;
+   struct drm_display_mode *mode;
struct drm_encoder *encoder;
struct msm_drm_private *priv;
unsigned long flags;
@@ -3407,8 +3408,15 @@ static void dpu_crtc_disable(struct drm_crtc 
*crtc)

}
dpu_crtc = to_dpu_crtc(crtc);
cstate = to_dpu_crtc_state(crtc->state);
+   mode = &cstate->base.adjusted_mode;
priv = crtc->dev->dev_private;

+   if (msm_is_mode_seamless(mode) || msm_is_mode_seamless_vrr(mode)
||
+   msm_is_mode_seamless_dms(mode)) {
+   DPU_DEBUG("Seamless mode is being applied, skip
disable\n");
+   return;
+   }
+

Another topic of discussion which should be brought up with dri-devel.

May not be common in PC world, but there are a handful of mobile OEM's
using panels which supports more than one resolution. Primary use cases
involve "seamless" switching to optimized display resolution when
streaming content changes resolutions or rendering lossless data.

Jeykumar S.


DPU_DEBUG("crtc%d\n", crtc->base.id);

if (dpu_kms_is_suspend_state(crtc->dev))
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 3d168fa09f3f..28ceb589ee40 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -2183,6 +2183,7 @@ static void dpu_encoder_virt_disable(struct
drm_encoder *drm_enc)
struct dpu_encoder_virt *dpu_enc = NULL;
struct msm_drm_private *priv;
struct dpu_kms *dpu_kms;
+   struct drm_display_mode *mode;
int i = 0;

if (!drm_enc) {
@@ -2196,6 +2197,13 @@ static void dpu_encoder_virt_disable(struct
drm_encoder *drm_enc)
return;
}

+   mode = &drm_enc->crtc->state->adjusted_mode;
+   if (msm_is_mode_seamless(mode) || msm_is_mode_seamless_vrr(mode)
||
+   msm_is_mode_seamless_dms(mode)) {
+   DPU_DEBUG("Seamless mode is being applied, skip
disable\n");
+   return;
+   }
+
dpu_enc = to_dpu_encoder_virt(drm_enc);
DPU_DEBUG_ENC(dpu_enc, "\n");

diff --git a/drivers/gpu/drm/msm/msm_atomic.c
b/drivers/gpu/drm/msm/msm_atomic.c
index 46536edb72ee..5cfb80345052 100644
--- a/drivers/gpu/drm/msm/msm_atomic.c
+++ b/drivers/gpu/drm/msm/msm_atomic.c
@@ -84,189 +84,6 @@ static void msm_atomic_wait_for_commit_done(
}
 }

-static void
-msm_disable_outputs(struct drm_device *dev, struct drm_atomic_state
*old_state)
-{
-   struct drm_connector *connector;
-   struct drm_connector_state *old_conn_state, *new_conn_state;
-   struct drm_crtc *crtc;
-   struct drm_crtc_state *old_crtc_state, *new_crtc_state;
-   int i;
-
-   for_each_oldnew_connector_in_state(old_state, connector,
old_conn_state, new_conn_state, i) {
-   const struct drm_encoder_helper_funcs *funcs;
-   struct drm_encoder *encoder;
-   struct drm_crtc_state *old_crtc_state;
-   unsigned int crtc_idx;
-
-   /*
-* Shut down everything that's in the changeset and
currently
-* still on. So need to check the old, saved state.
-*/
-   if (!old_conn_state->crtc)
-   continue;
-
-   crtc_idx = drm_crtc_index(old_conn_state->crtc);
-   old_crtc_state = drm_atomic_get_old_crtc_state(old_state,
-
old_conn_state->crtc);
-
-   if (!old_crtc_state->active ||
-
!drm_atomic_crtc_needs_modeset(old_conn_state->crtc->state))
-   continue;
-
-   encoder = old_conn_state->best_encoder;
-
-   /* We shouldn't get this far if we didn't previously have
-* an encoder.. but WARN_ON() rather than explode.
-*/
-   if (WARN_ON(!encoder))
-   continue;
-
-   if (msm_is_mode_seamless(
-   &connector->encoder->crtc->state->mode) ||
-   msm_is_mode_seamless_

Re: [Freedreno] [DPU PATCH 04/11] drm/msm: Move implicit sync fence handling to prepare_fb

2018-03-02 Thread jsanka

On 2018-02-28 11:18, Sean Paul wrote:
This is another piece that can be moved out of atomic to facilitate 
using

the atomic helpers.

Change-Id: I6dc3c4e5df508942bbc378c73a44e46e511b8469
Signed-off-by: Sean Paul 


Reviewed-by: Jeykumar Sankaran 


---
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c |  8 
 drivers/gpu/drm/msm/msm_atomic.c  | 13 -
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index 834dcc0bfefd..29e72b39fd72 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -2720,6 +2720,8 @@ static int dpu_plane_prepare_fb(struct drm_plane
*plane,
struct dpu_plane_rot_state *new_rstate;
struct dpu_hw_fmt_layout layout;
struct msm_gem_address_space *aspace;
+   struct msm_gem_object *msm_obj;
+   struct dma_fence *fence;
int ret;

if (!new_state->fb)
@@ -2761,6 +2763,12 @@ static int dpu_plane_prepare_fb(struct drm_plane
*plane,
return ret;
}

+   /* To support implicit sync, set a fence on the plane if
appropriate */
+   msm_obj = to_msm_bo(msm_framebuffer_bo(fb, 0));
+   fence = reservation_object_get_excl_rcu(msm_obj->resv);
+   if (fence)
+   drm_atomic_set_fence_for_plane(new_state, fence);
+
return 0;
 }

diff --git a/drivers/gpu/drm/msm/msm_atomic.c
b/drivers/gpu/drm/msm/msm_atomic.c
index eb2ccda5da0f..3a18bd3dc215 100644
--- a/drivers/gpu/drm/msm/msm_atomic.c
+++ b/drivers/gpu/drm/msm/msm_atomic.c
@@ -282,19 +282,6 @@ int msm_atomic_commit(struct drm_device *dev,
for_each_new_crtc_in_state(state, crtc, crtc_state, i)
c->crtc_mask |= drm_crtc_mask(crtc);

-   /*
-* Figure out what fence to wait for:
-*/
-   for_each_oldnew_plane_in_state(state, plane, old_plane_state,
new_plane_state, i) {
-   if ((new_plane_state->fb != old_plane_state->fb) &&
new_plane_state->fb) {
-   struct drm_gem_object *obj =
msm_framebuffer_bo(new_plane_state->fb, 0);
-   struct msm_gem_object *msm_obj = to_msm_bo(obj);
-   struct dma_fence *fence =
reservation_object_get_excl_rcu(msm_obj->resv);
-
-   drm_atomic_set_fence_for_plane(new_plane_state,
fence);
-   }
-   }
-
/*
 * Wait for pending updates on any of the same crtc's and then
 * mark our set of crtc's as busy:

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno