Re: [RFC][PATCH 2/2] drm_hwcomposer: Fall back to client compositon if the gl precompostior fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 24, 2018 at 10:09 AM, Alexandru-Cosmin Gheorghe
<Alexandru-Cosmin.Gheorghe@xxxxxxx> wrote:
> On Mon, Apr 23, 2018 at 05:06:44PM -0700, John Stultz wrote:
>> If the gl precompositor isn't being used, we cannot accept
>> every layer as a device composited layer.
>>
>> Thus this patch adds some extra logic in the validate function
>> to try to map layers to available device planes, falling back
>> to client side compositing if we run-out of planes.
>>
>> Credit to Rob Herring, who's work this single plane patch was
>> originally based on.
>>
>> Feedback or alternative ideas would be greatly appreciated!
>>
>> Cc: Marissa Wall <marissaw@xxxxxxxxxx>
>> Cc: Sean Paul <seanpaul@xxxxxxxxxx>
>> Cc: Dmitry Shmidt <dimitrysh@xxxxxxxxxx>
>> Cc: Robert Foss <robert.foss@xxxxxxxxxxxxx>
>> Cc: Matt Szczesiak <matt.szczesiak@xxxxxxx>
>> Cc: Liviu Dudau <Liviu.Dudau@xxxxxxx>
>> Cc: David Hanna <david.hanna11@xxxxxxxxx>
>> Cc: Rob Herring <rob.herring@xxxxxxxxxx>
>> Cc: Alexandru-Cosmin Gheorghe <Alexandru-Cosmin.Gheorghe@xxxxxxx>
>> Cc: Alistair Strachan <astrachan@xxxxxxxxxx>
>> Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
>> Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
>> ---
>>  drmhwctwo.cpp | 18 ++++++++++++++++++
>>  1 file changed, 18 insertions(+)
>>
>> diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp
>> index dfca1a6..437a439 100644
>> --- a/drmhwctwo.cpp
>> +++ b/drmhwctwo.cpp
>> @@ -686,6 +686,15 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types,
>>    supported(__func__);
>>    *num_types = 0;
>>    *num_requests = 0;
>> +  int avail_planes = primary_planes_.size() + overlay_planes_.size();
>> +
>> +  /*
>> +   * If more layers then planes, save one plane
>> +   * for client composited layers
>> +   */
>> +  if (avail_planes < layers_.size())
>> +     avail_planes--;
>> +
>>    for (std::pair<const hwc2_layer_t, DrmHwcTwo::HwcLayer> &l : layers_) {
>>      DrmHwcTwo::HwcLayer &layer = l.second;
>>      switch (layer.sf_type()) {
>> @@ -695,6 +704,15 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types,
>>          layer.set_validated_type(HWC2::Composition::Client);
>>          ++*num_types;
>>          break;
>> +      case HWC2::Composition::Device:
>> +        if (!compositor_.uses_GL() && !avail_planes) {
>
> Something is not entirely correct here, you can't assume just because
> you have planes available they can be used.
> E.g Layer has rotation, but the plane doesn't support it.
> This part is handled by the planning part in presentDisplay which
> falls back on GPU.
>
> I think the easiest and safe way is to just fallback to
> Composition::Client whenever the GLCompositor failed to initialize.
>

I agree, this would only work out for the single plane case where you end
up using client composition for everything.

In the spirit of DRM what we would probably want is to atomic test a
composition, and if that fails we can still fallback to client or GL
compositor depending on its availability. And then in a far far away
future we might even do a few iterations simplifying our composition until
it atomic tests correctly so we can still offload some "simple" parts
like the cursor.

Thanks,
Stefan
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux