<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 2014年09月25日 20:11, Mark yao wrote:<br>
    </div>
    <blockquote cite="mid:5424067B.7090908@rock-chips.com" type="cite">
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
      <div class="moz-cite-prefix">On 2014年09月25日 16:58, Mark yao wrote:<br>
      </div>
      <blockquote cite="mid:5423D951.4030703@rock-chips.com" type="cite">
        <meta content="text/html; charset=UTF-8"
          http-equiv="Content-Type">
        <div class="moz-cite-prefix">On 2014年09月25日 00:20, Daniel Kurtz
          wrote:<br>
        </div>
        <blockquote
cite="mid:CAGS+omBKKktuqOfiek0VN5Nk6KGC64Yc7i_HbM=Wf3gyJZC8bw@mail.gmail.com"
          type="cite">
          <pre wrap="">Hi Mark,

Please review comments inline...

On Wed, Sep 24, 2014 at 10:12 AM, Mark yao <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:mark.yao@rock-chips.com"><mark.yao@rock-chips.com></a> wrote:
</pre>
        </blockquote>
        <blockquote
cite="mid:CAGS+omBKKktuqOfiek0VN5Nk6KGC64Yc7i_HbM=Wf3gyJZC8bw@mail.gmail.com"
          type="cite">
          <blockquote type="cite"> </blockquote>
          <pre wrap="">To match the enum name, use ROCKCHIP_OUTPUT_TYPE_*.
Also, no need to explicitly set the first one to 0.
However, see below.  I don't think we to modify the drm_display_mode
to include an output type.
</pre>
        </blockquote>
        but vop devices need know the connector type, connector enable
        register is in vop.<br>
        can I do that like under to  get connector type for crtc?<br>
        <br>
            static int rockchip_get_connector_type(struct drm_crtc
        *crtc)<br>
            {<br>
                  struct drm_device *dev = crtc->dev;<br>
                  struct drm_connector * connector;<br>
        <br>
                  list_for_each_entry(connector,
        &dev->mode_config.connector_list, head) {<br>
                  if (!connector->encoder)<br>
                          continue;<br>
                  /*<br>
                   * one crtc only has one connector in my case, so just
        find the first connector at list.<br>
                   */<br>
                  if (connector->encoder->crtc == crtc)<br>
                          break;<br>
            }<br>
        <br>
            if (!connector)<br>
                    return -EINVAL;<br>
        <br>
            return connector->connector_type;<br>
        } </blockquote>
      Oh, sorry, forgot to drop this comment, <br>
      for connector type problem, I try to new a help function for
      encoder to call as Daniel advices.<br>
      <blockquote cite="mid:5423D951.4030703@rock-chips.com" type="cite">
        <blockquote
cite="mid:CAGS+omBKKktuqOfiek0VN5Nk6KGC64Yc7i_HbM=Wf3gyJZC8bw@mail.gmail.com"
          type="cite">
          <blockquote type="cite">
            <pre wrap="">
+#define to_rockchip_plane(x) container_of(x, struct rockchip_plane, base)
+
+struct rockchip_plane {
+       int id;
+       struct drm_plane base;
+       const struct vop_win *win;
+       struct vop_context *ctx;
</pre>
          </blockquote>
        </blockquote>
        <blockquote
cite="mid:CAGS+omBKKktuqOfiek0VN5Nk6KGC64Yc7i_HbM=Wf3gyJZC8bw@mail.gmail.com"
          type="cite">
          <blockquote type="cite"> </blockquote>
          <pre wrap="">Isn't ctx just: to_vop_ctx(base->crtc)

</pre>
        </blockquote>
        OK. we can use to_vop_ctx(base->crtc) to get ctx. </blockquote>
      I have do a test to use "to_vop_ctx(base->crtc)", but found
      that "base->crtc" maybe not init.<br>
      for cursor plane, base->crtc always is NULL. and disable_plane
      will fail.<br>
      maybe we can add "base->crtc = crtc" at update_plane, but it
      seems not good.<br>
      so I think still use "rockchip_plane->ctx" would be better.<br>
      <br>
      -Mark<br>
    </blockquote>
    I found that: plane->crtc will be set if update_plane success,
    and will be set NULL if disable_plane <span style="color: rgb(51,
      51, 51); font-family: arial; font-size: 14px; font-style: normal;
      font-variant: normal; font-weight: normal; letter-spacing: normal;
      line-height: 22px; orphans: auto; text-align: start; text-indent:
      0px; text-transform: none; white-space: normal; widows: auto;
      word-spacing: 0px; -webkit-text-stroke-width: 0px;
      background-color: rgb(255, 255, 255); display: inline !important;
      float: none;"></span>success.<br>
    so disable_plane must after update_plane.<br>
    disable_plane get crtc==NULL problem is that disable_plane was
    called before update_plane or been called  twice.<br>
    for this reason we can just check if crtc is NULL at disable_plane.<br>
    <br>
    -Mark<br>
    <br>
    <br>
    <br>
    <br>
  </body>
</html>