drm_hwcomposer: Add Importer CheckBuffer to validate buffers aren't larger...

drm_hwcomposer: Add Importer CheckBuffer to validate buffers aren't larger then max resolution sizes

When doing a test composition CreateComposition(), goes on to
call ImportBuffer(), for each layer which in may include large
(2880x2560) sized buffer (I'm guessing this is the full res
background image).

Then in HisiImporter::ImportBuffer() we try to call the kernel
via drmModeAddFB2(), but that bombs out in
drm_internal_framebuffer_create() due to:
"bad framebuffer width 2880, should be >= 0 && <= 2048"

Which is due to the mode_config.max_width/height values in the
kirin drivers being limited to 2048 (which while not really
appropriate for the HiKey960 is reasonable for the HiKey and
other more limited hardware).

Stefan Schake suggested we use the max resolution values already
read from drmModeGetResources and skip adding layers to the zmap
when they are too big. So this patch tries to implement that.

The one gotcha is the the gralloc handle structures are opaque
in the common code, so we have to do the resolution check in
Importer specific code, thus this patch adds a CheckBuffer()
method to the Importer.

This CheckBuffer method allows us to pre-check the buffers
before we try to import them, and we can likely grow what is
checked in future patches as resolution issues are only one of
many potential errors.

Change-Id: I9671670b20d9daacff3238286b5b95586b4565b7
Signed-off-by: John Stultz <john.stultz@linaro.org>
1 job for drm_hwc in 46 seconds (queued for 1 second)
latest