{"action":"opened","issue":{"url":"https://api.github.com/repos/rockchip-linux/libmali/issues/14","repository_url":"https://api.github.com/repos/rockchip-linux/libmali","labels_url":"https://api.github.com/repos/rockchip-linux/libmali/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/rockchip-linux/libmali/issues/14/comments","events_url":"https://api.github.com/repos/rockchip-linux/libmali/issues/14/events","html_url":"https://github.com/rockchip-linux/libmali/issues/14","id":260106018,"number":14,"title":"xcb_dri3_pixmap_from_buffer on MPP decoded frame fails with BadAlloc due to gbm_bo_import returning NULL","user":{"login":"ydirson","id":1190950,"avatar_url":"https://avatars2.githubusercontent.com/u/1190950?v=4","gravatar_id":"","url":"https://api.github.com/users/ydirson","html_url":"https://github.com/ydirson","followers_url":"https://api.github.com/users/ydirson/followers","following_url":"https://api.github.com/users/ydirson/following{/other_user}","gists_url":"https://api.github.com/users/ydirson/gists{/gist_id}","starred_url":"https://api.github.com/users/ydirson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ydirson/subscriptions","organizations_url":"https://api.github.com/users/ydirson/orgs","repos_url":"https://api.github.com/users/ydirson/repos","events_url":"https://api.github.com/users/ydirson/events{/privacy}","received_events_url":"https://api.github.com/users/ydirson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-24T18:43:04Z","updated_at":"2017-09-24T18:43:04Z","closed_at":null,"author_association":"NONE","body":"I'm trying to render MPP-decoded frames using DRI3+XPresent, as Xorg answers \"yes I support those extensions\".\r\n\r\nMy call basically looks like:\r\n\r\n```\r\n        MppBuffer buf = mpp_frame_get_buffer(frm);\r\n        xcb_pixmap_t pixmap = xcb_generate_id(xcb);\r\n        xcb_void_cookie_t cookie =\r\n             xcb_dri3_pixmap_from_buffer_checked (xcb,\r\n                                                 pixmap,\r\n                                                 x11_window,\r\n                                                 mpp_buffer_get_size(buf), // mesa uses 0?\r\n                                                 mpp_buffer_get_width(frm),\r\n                                                 mpp_buffer_get_height(frm),\r\n                                                 mpp_buffer_get_stride(frm),\r\n                                                 32, // FIXME depth\r\n                                                 32, // bpp\r\n                                                 mpp_buffer_get_fd(buf));\r\n        xcb_generic_error_t *error;\r\n        if ((error = xcb_request_check(xcb, cookie))) {\r\n            fprintf(stderr, \"dri3_pixmap_from_buffer failure: code=%d value=%d\\n\",\r\n                    error->error_code, error->resource_id);\r\n            free(error);\r\n            return -1;\r\n        }\r\n```\r\n\r\nI tried several values for depth and bpp, being quite unsure of what DRI3 expects since we're feeding it a NV12 buffer.  All attempts resulted in an ALLOC error. Using gdb I could trace it down until glamor_back_pixmap_from_fd which then calls libMali's gbm_bo_import and gets a failure:\r\n\r\n```\r\n#0  glamor_back_pixmap_from_fd (pixmap=pixmap@entry=0x55794ed6e0, fd=fd@entry=17, width=width@entry=1920, height=height@entry=1080, stride=stride@entry=1920, depth=depth@entry=32 ' ',\r\n    bpp=bpp@entry=32 ' ') at ../../../../glamor/glamor_egl.c:576\r\n#1  0x0000007f9a8bad24 in glamor_pixmap_from_fd (screen=0x5578ffc5d0, fd=17, width=1920, height=1080, stride=1920, depth=32 ' ', bpp=32 ' ') at ../../../../glamor/glamor_egl.c:590\r\n#2  0x000000555707733c in dri3_pixmap_from_fd (ppixmap=0x7ffe368ce0, ppixmap@entry=0x7ffe368d10, screen=<optimized out>, fd=fd@entry=17, width=<optimized out>, height=<optimized out>,\r\n    stride=<optimized out>, depth=<optimized out>, bpp=<optimized out>) at ../../dri3/dri3_screen.c:73\r\n#3  0x0000005557076f3c in proc_dri3_pixmap_from_buffer (client=0x5579175470) at ../../dri3/dri3_request.c:162\r\n#4  0x0000005556f48674 in Dispatch () at ../../dix/dispatch.c:431\r\n\r\n(gdb) p import_data\r\n$3 = {fd = 17, width = 1920, height = 1080, stride = 1920, format = 875713089}\r\n```\r\n\r\nI'm a bit worried about the ARGB8888 format, so I also tried to force it to 0x3231564E through gdb before the call, but that does not help.\r\n\r\nAm I doing anything wrong, or is PRIME buffer import not supported yet by the Mali driver ?\r\n\r\n"}}
{"actor":{"display_login":"ydirson"}}