<div dir="ltr">On Thu, Aug 29, 2013 at 12:36 AM, Ville Syrjälä <span dir="ltr"><<a href="mailto:ville.syrjala@linux.intel.com" target="_blank">ville.syrjala@linux.intel.com</a>></span> wrote:<br><div class="gmail_extra">






<div class="gmail_quote"><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>On Wed, Aug 28, 2013 at 11:51:59PM -0400, Rob Clark wrote:<br>







> On Wed, Aug 28, 2013 at 9:51 PM, Greg Hackmann <<a href="mailto:ghackmann@google.com" target="_blank">ghackmann@google.com</a>> wrote:<span style="color:rgb(34,34,34)"> </span></div></blockquote><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>> > 1.  The API is geared toward updating one object at a time.  Android's graphics stack needs the entire screen updated atomically to avoid tearing, and on some SoCs to avoid wedging the display hardware.  Rob Clark's atomic modeset patchset worked, but copy/update/commit design meant the driver had to keep a lot more internal state.<br>







> ><br>
><br>
> I'm not entirely sure how to avoid that, because at least some hw we<br>
> need to have the entire new-state in order to validate if it is<br>
> possible.<br>
<br>
</div>I guess the only reason adf is a bit different is that there can only be<br>
one custom (driver specific!) blob in the ioctl, so the driver is just<br>
free to dump that directly into whatever internal structure it uses to<br>
store the full state. So it just frees you from the per-prop state<br>
buildup process.<br></blockquote><div><br></div><div>Right, the difference is that clients send the complete state they want rather than deltas against the current state.  This means the driver doesn't have to track its current state and duplicate it at the beginning of the flip operation, which is a minor pain on hardware with a ton of knobs to twist across different hardware blocks.</div>

<div><br></div><div>Maybe the important question is whether incremental atomic updates is a use-case that clients need in practice.  SurfaceFlinger tells the HW composer each frame "here's a complete description of what I want onscreen, make it so" and IIRC Weston works the same way.</div>



<div><br></div><div>I used a blob rather than property/value pairs because the composition is going to be inherently device specific anyway.  Display controllers have such different features and constraints that you'd end up with each driver exposing a bunch of hardware-specific properties, and I'm not convinced that's any better than just letting the driver dictate how the requests are structured (modulo a handful of hardware-agnostic properties).  I'm not strongly tied to blobs over properties but I think the former's easier on driver developers.</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">


But if the idea would to be totally driver specific anyway, I wouldn't<br>
even bother with any of this fancy framework stuff. Just specify some<br>
massive driver specific structure with a custom ioctl and call it a<br>
day.<br></blockquote><div><br></div><div>I disagree -- this is basically what vendors do today to support Android, and there's a lot of common scaffolding that could go into a framework.  The custom ioctl handlers all look reasonably close to this:</div>






<div><br></div><div>1) import dma-bufs and fences from their respective fds</div><div>2) map the buffers into the display device</div><div>3) validate the buffer sizes against their formats and width/stride/height<br>
</div><div>4) validate the requested layout doesn't violate hardware constraints<br></div><div>5) hand everything off to a worker that waits for the buffers' sync fences to fire </div><div>6) commit the requested layout to hardware</div>





<div>7) unmap and release all the buffers that just left the screen<br></div>
<div><div>8) advance the sync timeline</div></div><div><br></div><div>with some leeway on the ordering of (2)-(4) and (7)-(8).  ADF handles all of this except for (4) and (6), which are inherently hardware-specific and delegated to driver ops.</div>


</div></div></div>