<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 22, 2013 at 7:28 PM, Inki Dae <span dir="ltr"><<a href="mailto:inki.dae@samsung.com" target="_blank">inki.dae@samsung.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">2013/10/22 Sean Paul <<a href="mailto:seanpaul@chromium.org">seanpaul@chromium.org</a>>:<br>
<div><div class="h5">> On Tue, Oct 22, 2013 at 1:30 AM, Inki Dae <<a href="mailto:inki.dae@samsung.com">inki.dae@samsung.com</a>> wrote:<br>
>><br>
>><br>
>>> -----Original Message-----<br>
>>> From: Sean Paul [mailto:<a href="mailto:seanpaul@chromium.org">seanpaul@chromium.org</a>]<br>
>>> Sent: Tuesday, October 22, 2013 6:18 AM<br>
>>> To: Inki Dae<br>
>>> Cc: dri-devel; Dave Airlie; Tomasz Figa; Stéphane Marchesin<br>
>>> Subject: Re: [PATCH v2 12/26] drm/exynos: Split manager/display/subdrv<br>
>>><br>
>>> On Mon, Oct 21, 2013 at 10:46 AM, Sean Paul <<a href="mailto:seanpaul@chromium.org">seanpaul@chromium.org</a>> wrote:<br>
>>> > On Thu, Oct 17, 2013 at 10:31 PM, Inki Dae <<a href="mailto:inki.dae@samsung.com">inki.dae@samsung.com</a>> wrote:<br>
>>> >><br>
>>> >><br>
>>> >>> -----Original Message-----<br>
>>> >>> From: Sean Paul [mailto:<a href="mailto:seanpaul@chromium.org">seanpaul@chromium.org</a>]<br>
>>> >>> Sent: Thursday, October 17, 2013 11:37 PM<br>
>>> >>> To: Inki Dae<br>
>>> >>> Cc: dri-devel; Dave Airlie; Tomasz Figa; Stéphane Marchesin<br>
>>> >>> Subject: Re: [PATCH v2 12/26] drm/exynos: Split manager/display/subdrv<br>
>>> >>><br>
>>> >>> On Thu, Oct 17, 2013 at 4:21 AM, Inki Dae <<a href="mailto:inki.dae@samsung.com">inki.dae@samsung.com</a>><br>
>> wrote:<br>
>>> >>> ><br>
>>> >>> ><br>
>>> >>> >> -----Original Message-----<br>
>>> >>> >> From: Sean Paul [mailto:<a href="mailto:seanpaul@chromium.org">seanpaul@chromium.org</a>]<br>
>>> >>> >> Sent: Thursday, October 17, 2013 4:27 AM<br>
>>> >>> >> To: <a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a>; <a href="mailto:inki.dae@samsung.com">inki.dae@samsung.com</a><br>
>>> >>> >> Cc: <a href="mailto:airlied@linux.ie">airlied@linux.ie</a>; <a href="mailto:tomasz.figa@gmail.com">tomasz.figa@gmail.com</a>; <a href="mailto:marcheu@chromium.org">marcheu@chromium.org</a>;<br>
>>> Sean<br>
>>> >>> >> Paul<br>
>>> >>> >> Subject: [PATCH v2 12/26] drm/exynos: Split manager/display/subdrv<br>
>>> >>> >><br>
>>> >>> >> This patch splits display and manager from subdrv. The result is<br>
>>> that<br>
>>> >>> >> crtc functions can directly call into manager callbacks and encoder<br>
>>> >>> >> functions can directly call into display callbacks. This will allow<br>
>>> >>> >> us to remove the exynos_drm_hdmi shim and support mixer/hdmi &<br>
>>> fimd/dp<br>
>>> >>> >> with common code.<br>
>>> >>> >><br>
>>> >>> >> Signed-off-by: Sean Paul <<a href="mailto:seanpaul@chromium.org">seanpaul@chromium.org</a>><br>
>>> >>> >> ---<br>
>>> >>> >><br>
>>> >>> >> Changes in v2:<br>
>>> >>> >> - Pass display into display_ops instead of context<br>
>>> >>> ><br>
>>> >>> > Sorry but it seems like more reasonable to pass device object into<br>
>>> >>> > display_ops and manager_ops.<br>
>>> >>> ><br>
>>> >>><br>
>>> >>><br>
>>> >>> So you've changed your mind from when you said the following?<br>
>>> >>><br>
>>> >>> >>> manager->ops->xxx(manager, ...);<br>
>>> >>> >>> display->ops->xxx(display, ...);<br>
>>> >>> >>><br>
>>> >>> >>> Agree.<br>
>>> >>><br>
>>> >><br>
>>> >><br>
>>> >> True. Before that, My comment was to pass device object into<br>
>>> display_ops and<br>
>>> >> manager_ops, and then you said the good solution is to pass manager and<br>
>>> >> display to each driver. At that time, I thought no matter how the<br>
>>> callback<br>
>>> >> is called if the framework doesn't call callbacks of each driver with<br>
>>> ctx.<br>
>>> >> So I agreed.<br>
>>> >><br>
>>> >><br>
>>> >>> It would have been nice if you had changed your mind *before* I<br>
>>> >>> reworked everything. At any rate, I think it's still the right thing<br>
>>> >>> to do.<br>
>>> >><br>
>>> >> Really sorry about that. And I will add new patch for it so you don't<br>
>>> need<br>
>>> >> to concern about that.<br>
>>> >><br>
>>> >>><br>
>>> >>><br>
>>> >>> > I'm not sure but display_ops could be implemented in other framework<br>
>>> >>> based<br>
>>> >>> > driver such as CDF based lcd panel driver. So if you pass display -<br>
>>> it's<br>
>>> >>> > specific to exynos drm framework - into display_ops, the other<br>
>>> framework<br>
>>> >>> > based driver should include specific exynos drm header.<br>
>>> >>> ><br>
>>> >>><br>
>>> >>> AFAIK, CDF will not land in its current separate-from-drm form, we<br>
>>> >>> don't need to worry about this. Furthermore, these ops should just go<br>
>>> >>> away and become drm_crtc/drm_encoder/drm_connector funcs anyways.<br>
>>> >>><br>
>>> >><br>
>>> >> Can you assure the display_ops never implemented in other framework<br>
>>> based<br>
>>> >> driver, not CDF? At any rate, I think all possibilities should be<br>
>>> opened.<br>
>>> >><br>
>>> ><br>
>>> > I don't think we should let an RFC framework make the code more<br>
>>> > complicated for unclear benefit. By removing manager/display entirely,<br>
>>> > we can get rid of a *lot* of other code that is basically just<br>
>>> > plumbing drm hooks (exynos_drm_connector is a good example).<br>
>>> ><br>
>>><br>
>>> I hacked this up today to prove it out. Check out the top 5 commits in<br>
>>> <a href="https://github.com/crseanpaul/exynos-drm-next/commits/linux-next-exynos-" target="_blank">https://github.com/crseanpaul/exynos-drm-next/commits/linux-next-exynos-</a><br>
>>> staging.<br>
>>> It removes exynos_drm_connector in favor of just implementing<br>
>>> drm_connector directly. This same treatment should be done for<br>
>>> exynos_drm_encoder and exynos_drm_crtc, but I didn't get around to<br>
>>> doing this.<br>
>>><br>
>>> As you can see, it cuts out a lot of code and removes an entire<br>
>>> abstraction layer. Much nicer :)<br>
>>><br>
>><br>
>> It seems that you implements connector in each device driver. Can't they be<br>
>> combined as common spot, exynos_connector, again to avoid codes from<br>
>> duplicated? :)<br>
><br>
> There's nothing of substance being duplicated.<br>
<br>
</div></div>Not true. xxx_create_connector is duplicated.<br>
<div class="im"><br>
> In fact, by getting rid<br>
> of the exynos_drm_connector layer, we deleted 150 lines. If you really<br>
> take a look at exynos_drm_connector, it's not doing anything useful.<br>
<br>
</div>No, That is for each driver has no any dependency of drm framework.<br>
<div class="im"><br>
> All it does is translate the drm callbacks into display callbacks, so<br>
> I think it's much better to just implement the drm callbacks directly.<br>
><br>
<br>
</div>No, It has strongly dependency of drm framework. Assume that we<br>
implemented the drm callbacks directly, and then some features are<br>
added to drm framework, drm_connector side. At this time, we will have<br>
to take care of each device driver according to the change. That is<br>
really not good. Why device drivers should have dependency of drm<br>
framework? Just to reduce line counts?<br></blockquote><div><br></div><br>You seem to miss the point here and elsewhere in the discussion.<br>drm/exynos is a drm driver, and as such it should use the drm<br>framework, especially if this reduces the line count and the code<br>
complexity (as is the case for this patch series). If you don't want<br>to maintain a drm driver, it simply should be moved away from drm/,<br>and it should be replaced by a real drm driver in my opinion.<br><br><div>
Stéphane</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im"><br>
> There are a bunch of real bugs that we've found as a result of having<br>
> these abstraction layers. Take, for example, dpms. Before this<br>
> patchset, dpms for fimd was being tracked separately in fimd driver,<br>
> exynos_drm_encoder, exynos_drm_crtc, and exynos_drm_connector.<br>
> Furthermore, during suspend, only fimd driver's dpms state was<br>
> updated, so the others were incorrect. There was also this weird<br>
> gymnastics that had to happen when dpms was changed in the encoder<br>
> since it had to walk up to the connector level to change its dpms<br>
> state. If fimd just directly implemented<br>
> drm_crtc/drm_encoder/drm_connector (before dp was moved in), this<br>
> problem wouldn't exist. The same goes for HDMI/mixer.<br>
><br>
<br>
</div>That is a issue we should take care of by using the independent layer.<br>
Then, aren't you take care of that well with the re-factoring patch<br>
set? :) It seems that you are outside real point.<br>
<div class="im"><br>
> Take a look at exynos_drm_encoder.c in my tree<br>
> (<a href="https://github.com/crseanpaul/exynos-drm-next/blob/linux-next-exynos-staging/drivers/gpu/drm/exynos/exynos_drm_encoder.c" target="_blank">https://github.com/crseanpaul/exynos-drm-next/blob/linux-next-exynos-staging/drivers/gpu/drm/exynos/exynos_drm_encoder.c</a>),<br>
> what does it do that's useful to abstract? All that it does is just<br>
> call display ops, it's completely useless. The same is true for<br>
> exynos_drm_connector, it's just dead weight. There is some useful<br>
> stuff in exynos_drm_crtc for page flipping, that would be better<br>
> served as a helper library, though.<br>
><br>
>> The abstraction layer you mentioned also means a common spot.<br>
>> Another one, you patch also makes each sub driver have strongly dependency<br>
>> of drm framework. So how we can support existing backlight and lcd class<br>
>> based lcd panel drivers if the connector is implemented in each device<br>
>> driver later? the drm header files should be included in<br>
>> drivers/video/backlight/xxx_lcd.c?<br>
>><br>
><br>
> drm_bridge or drm_panel seem like good candidates for this.<br>
><br>
<br>
</div>Yes, exynos_drm_display could be replaced with drm_panel later if the<br>
drm_panel can be merged to mainline.<br>
<div class="im"><br>
><br>
>> And, I will introduce a new framework to support existing lcd panel drivers<br>
>> and display bus drivers soon; as of now for Exynos drm, and the framework is<br>
>> being tested internally. With this framework, encoder and connector will be<br>
>> created when lcd panel or display bus driver such as eDP is probed: it<br>
>> doesn’t really need to create encoder and connector in advance if lcd panel<br>
>> or display bus driver isn't probed yet. Regardless of crtc, and encoder and<br>
>> connector creation order, when last one is created, crtc and connector will<br>
>> be connected each other. And exynos_drm_display could be implemented in<br>
>> other frameworks if we have common structure for display device driver. And<br>
>> also the framework will support lvds driver according to Linux device driver<br>
>> model.<br>
>><br>
><br>
> I don't really follow what you're trying to do here, but I think we<br>
> should be moving in the direction of fewer abstractions in the exynos<br>
> driver, not more :)<br>
><br>
<br>
</div>Not abstraction layer, just a bridge for connecting crtc and its<br>
corresponding encoder/connector, and lvds regardless of creation<br>
order, and for connecting drm connector and other framework based<br>
display ops such as drm_panel later.<br>
<div class=""><div class="h5"><br>
> Sean<br>
><br>
><br>
><br>
>> Thanks,<br>
>> Inki Dae<br>
>><br>
>>> Sean<br>
>>><br>
>>> >>><br>
>>> >>> > And another one, the patch 6 passes manager object to manager_ops,<br>
>>> and<br>
>>> >>> for<br>
>>> >>> > this, you made the manager object to be set to driver data;<br>
>>> >>> > platform_set_drvdata(pdev, &manager). That isn't reasonable.<br>
>>> Generally,<br>
>>> >>> > driver_data would point to device driver's context object.<br>
>>> >>> ><br>
>>> >>><br>
>>> >>> I'm not sure why this isn't reasonable, but it's a moot point. The<br>
>>> >>> driver data is only used up until we get rid of the pm ops, it needn't<br>
>>> >>> be set at all once things go through dpms.<br>
>>> >>><br>
>>> >><br>
>>> >> Generally, device drivers can call its own internal functions, and they<br>
>>> will<br>
>>> >> call that functions with ctx. However, if you set manager to<br>
>>> driver_data<br>
>>> >> then that functions should be called with manager object and also<br>
>>> internally<br>
>>> >> that functions should get ctx from the manager object. What is the<br>
>>> purpose<br>
>>> >> of manager? Do you think it's reasonable?<br>
>>> >><br>
>>> ><br>
>>> > So, to avoid setting the manager as the drvdata, we could implement<br>
>>> > something like fimd_dpms_ctx(ctx, mode) that takes ctx and the manager<br>
>>> > callback calls it fimd_dpms(mgr, mode) { ctx = mgr->ctx;<br>
>>> > fimd_dpms_ctx(ctx, mode); }. Alternatively, you can save a pointer to<br>
>>> > mgr in ctx, but that creates a circular link between the two. IMO,<br>
>>> > both of those solutions suck :)<br>
>>> ><br>
>>> > I'd much rather just set drvdata to the manager and call the hook<br>
>>> > directly. Like I said earlier, this is just a temporary step since we<br>
>>> > remove these pm ops later in the patch series.<br>
>>> ><br>
>>> > Sean<br>
>>> ><br>
>>> ><br>
>>> >> Anyway, I'd like to say really sorry about inconvenient again. So I<br>
>>> will fix<br>
>>> >> it.<br>
>>> >><br>
>>> >> Thanks,<br>
>>> >> Inki Dae<br>
>>> >><br>
>>> >>> Sean<br>
>>> >>><br>
>>> >>><br>
>>> >>> > Thanks,<br>
>>> >>> > Inki Dae<br>
>>> >>> ><br>
>>> >><br>
>><br>
> _______________________________________________<br>
> dri-devel mailing list<br>
> <a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/dri-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/dri-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
</div></div></blockquote></div><br></div></div>