2015-10-27 16:56 GMT+08:00 Tapani Pälli <
tapani...@intel.com>:
> On 10/27/2015 10:41 AM, Chih-Wei Huang wrote:
>>
>>
>> Hi Tapani,
>> Recently the Mesa developers (Emil and Rob) pointed out
>> there are some funny mapping defined in drm_format_from_hal
>> of drm_gralloc. (see above discussion)
>>
>> Checking the git history, I found you made a change
>> to this mapping at 2012/08/31 (submitted by Daniel Leung):
>>
>>
>>
https://sourceforge.net/p/android-x86/external_drm_gralloc/ci/28d19f649f276ed8302a7d3bab078f692a84e6d9/
>>
>> The mapping of HAL_PIXEL_FORMAT_RGB_888 and
>> HAL_PIXEL_FORMAT_BGRA_8888 was silently changed
>> from DRM_FORMAT_ARGB8888 to DRM_FORMAT_XRGB8888
>>
>> Could you explain it? Is there any rationale?
>> Shouldn't it be DRM_FORMAT_BGRA8888?
>>
>
> Sorry, I can't recall what has been the motivation for this. What I do know
> is that some of the code is buggy and some of the fixes we had internally
> were never pushed/released when I stopped working on that project.
>
> Fortunately Google has picked up on this code and has made several fixes +
> updated functionality in to how gralloc+hwcomposer combo is defined today
> (kms pieces should not live in gralloc anymore).
>
>
https://android.googlesource.com/platform/external/drm_gralloc
>
> My recommendation is to check if this issue is fixed there.
Tapani, thank you for the suggestion.
Originally I prefer not to use google's branch
since it's pulled from an old commit of drm_gralloc
from android-x86 repository.
We have a lot of improvements since that point.
Simply merging them results in many conflicts.
But I decide to give it a try as you suggested.
However, there are some building errors.
Google's drm_hwcomposer uses an old
drm atomic apis, while we use the (almost) latest libdrm.
I tried to replace the old apis by the new apis
( drmModePropertySetPtr -> drmModeAtomicReqPtr,
drmModePropertySetAdd -> drmModeAtomicAddProperty, ...)
Not sure if I did it correctly. But finaly it built ok.
However, SurfaceFlinger crashed on hwcomposer.drm
initializing. The call failed (in drmresources.cpp):
ret = drmSetClientCap(fd_, DRM_CLIENT_CAP_ATOMIC, 1);
Tracing kernel drm and i915 module, seems I need to set
drm.atomic=1 and i915.nuclear_pageflip=1 to make it work.
But then it failed again:
10-29 07:26:23.966 1639 1639 E hwc-drm-resources: Failed to get
properties for 19/cccccccc
10-29 07:26:23.966 1639 1639 E hwc-drm-crtc: Failed to get ACTIVE property
10-29 07:26:23.966 1639 1639 E hwc-drm-resources: Failed to initialize crtc 19
10-29 07:26:23.966 1639 1639 E hwcomposer-drm: Can't initialize Drm object -19
The failed call is (also in drmresources.cpp):
props = drmModeObjectGetProperties(fd_, obj_id, obj_type);
Due to my limited knowledge about drm/hwc,
I was unable to debug further.
My impression is Google's hwcomposer uses the relative
new drm atomic apis which are not supported well in
our current drm and i915 drivers of kernel 4.0.
Is it true? Should I try a newer kernel, say 4.3-rcX?
Please advice how to proceed.
PS. The pixelformat mapping defined in Google's hwcomposer
is different than ours. Looks more reasonable.
https://android.googlesource.com/platform/external/drm_hwcomposer/+/marshmallow-release/drmgenericimporter.cpp#68
(Emil, Rob, how do you think about it?)