Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D drm-hwcomposer
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 13
    • Issues 13
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • drm-hwcomposer
  • drm-hwcomposer
  • Issues
  • #55
Closed
Open
Issue created Jul 16, 2021 by yanyan jiang@jiangyy0202

Android q: failed to import prime fd

Replace the hwcomposer.drm.so to hwcomposer.xx.so. The android q system can not work.dumpsys SurfaceFlinger have the only plane bootanimation. The logcat has:

01-01 08:03:14.464  2223  2270 E jyyhwc-drm-two: jyy ValidateDisplay
01-01 08:03:14.464  2223  2270 E jyyhwc-drm-two: jyy CreateComposition
01-01 08:03:14.464  2223  2270 E jyyhwc-drm-two: jyy PopulateDrmLayer
01-01 08:03:14.464  2223  2270 E jyhwc-platform-drm-generic: jyy [ImportBuffer 106] handle 0xb556e300
01-01 08:03:14.465  2223  2270 E jyhwc-platform-drm-generic: jyy [ImportBuffer 121] handle 0xb556e300  yuv width 1920 height 1080 format 43 stride 7680 HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED 34 ret1 0
01-01 08:03:14.465  2223  2270 E jyhwc-platform-drm-generic: jyy [ImportBuffer 126] handle 0xb556e300 prime fd 33 width 36 height 37 format 4294967295 stride -1 HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED 34
01-01 08:03:14.469  2223  2270 E jyhwc-platform-drm-generic: failed to import prime fd 33 ret=-1
01-01 08:03:14.469  2223  2270 E jyyhwc-drm-two: Failed to import layer, ret=-1
01-01 08:03:14.469  2223  2270 E jyyhwc-drm-two: jyy GetChangedCompositionTypes
01-01 08:03:14.469  2223  2270 E jyyhwc-drm-two: jyy GetChangedCompositionTypes
01-01 08:03:14.469  2223  2270 E jyyhwc-drm-two: jyy GetDisplayRequests
01-01 08:03:14.469  2223  2270 E jyyhwc-drm-two: jyy GetDisplayRequests
01-01 08:03:14.470  5184  5184 I PackageBackwardCompatibility: Could not find android.content.pm.AndroidTestBaseUpdater, ignoring
01-01 08:03:14.470  5186  5186 I CameraProviderManager: Connecting to new camera provider: external/0, isRemote? 1
01-01 08:03:14.470  2223  2270 E jyyhwc-drm-two: jyy AcceptDisplayChanges
01-01 08:03:14.470  2223  2270 E jyyhwc-drm-two: jyy SetClientTarget
01-01 08:03:14.470  2223  2270 E jyyhwc-drm-two: jyy SetLayerDataspace
01-01 08:03:14.470  2223  2270 E jyyhwc-drm-two: jyy PresentDisplay
01-01 08:03:14.470  2223  2270 E jyyhwc-drm-two: jyy CreateComposition
01-01 08:03:14.470  2223  2270 E jyyhwc-drm-two: jyy PopulateDrmLayer
01-01 08:03:14.470  2223  2270 E jyhwc-platform-drm-generic: jyy [ImportBuffer 106] handle 0xb556e480
01-01 08:03:14.471  2223  2270 E jyhwc-platform-drm-generic: jyy [ImportBuffer 121] handle 0xb556e480  yuv width 1920 height 1080 format 5 stride 7680 HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED 34 ret1 0
01-01 08:03:14.471  2223  2270 E jyhwc-platform-drm-generic: jyy [ImportBuffer 126] handle 0xb556e480 prime fd 38 width 41 height 42 format 4294967295 stride -1 HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED 34
01-01 08:03:14.471  2223  2270 E jyhwc-platform-drm-generic: Cannot convert hal format to drm format 4294967295
01-01 08:03:14.471  2223  2270 E jyhwc-platform-drm-generic: Cannot convert hal format 4294967274 to bpp (returning 32)
01-01 08:03:14.471  2223  2270 E jyhwc-platform-drm-generic: could not create drm fb -22
01-01 08:03:14.471  2223  2270 E jyyhwc-drm-two: Failed to import layer, ret=-22
01-01 08:03:14.471  2120  2120 E HWComposer: presentAndGetReleaseFences: present failed for display 0: NoResources (6)

code is : the info in gr_handle in log that seem not correct. I do not know how to debug this error.

int DrmGenericImporter::ImportBuffer(buffer_handle_t handle, hwc_drm_bo_t *bo) {
105    gralloc_handle_t *gr_handle = gralloc_handle(handle);
106    if (!gr_handle)
107      return -EINVAL;
108  
109    uint32_t gem_handle;
110    int ret = drmPrimeFDToHandle(drm_->fd(), gr_handle->prime_fd, &gem_handle);
111    if (ret) {
112      ALOGE("failed to import prime fd %d ret=%d", gr_handle->prime_fd, ret);
113      return ret;
114    }

I confuse that
gralloc_handle_t *gr_handle = gralloc_handle(handle);

how can buffer_handle_t translate to gralloc_handle_t. where the prime fd come from.

struct gralloc_handle_t {
37  	native_handle_t base;
38  
39  	/* dma-buf file descriptor
40  	 * Must be located first since, native_handle_t is allocated
41  	 * using native_handle_create(), which allocates space for
42  	 * sizeof(native_handle_t) + sizeof(int) * (numFds + numInts)
43  	 * numFds = GRALLOC_HANDLE_NUM_FDS
44  	 * numInts = GRALLOC_HANDLE_NUM_INTS
45  	 * Where numFds represents the number of FDs and
46  	 * numInts represents the space needed for the
47  	 * remainder of this struct.
48  	 * And the FDs are expected to be found first following
49  	 * native_handle_t.
50  	 */
51  	int prime_fd;
52  
53  	/* api variables */
54  	uint32_t magic; /* differentiate between allocator impls */
55  	uint32_t version; /* api version */
56  
57  	uint32_t width; /* width of buffer in pixels */
58  	uint32_t height; /* height of buffer in pixels */
59  	uint32_t format; /* pixel format (Android) */
60  	uint32_t usage; /* android libhardware usage flags */
61  
62  	uint32_t stride; /* the stride in bytes */
63  	uint64_t modifier; /* buffer modifiers */
64  
65  	int data_owner; /* owner of data (for validation) */
66  	union {
67  		void *data; /* pointer to struct gralloc_gbm_bo_t */
68  		uint64_t reserved;
69  	} __attribute__((aligned(8)));
70  };

How can I debug this problems? Is gr_handle_t info is wrong? If anyone know how to debugg this problem.Look forward to your reply. Thank you very much.

Edited Aug 04, 2021 by yanyan jiang
Assignee
Assign to
Time tracking