{"id":18984,"url":"https://patchwork.libcamera.org/api/1.1/covers/18984/?format=json","web_url":"https://patchwork.libcamera.org/cover/18984/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230912-gralloc-api-v4-v1-0-0f80402d8e7a@baylibre.com>","date":"2023-09-12T09:36:09","name":"[libcamera-devel,0/4] android: switch over to modern gralloc API via libui","submitter":{"id":153,"url":"https://patchwork.libcamera.org/api/1.1/people/153/?format=json","name":"Mattijs Korpershoek","email":"mkorpershoek@baylibre.com"},"mbox":"https://patchwork.libcamera.org/cover/18984/mbox/","series":[{"id":4016,"url":"https://patchwork.libcamera.org/api/1.1/series/4016/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4016","date":"2023-09-12T09:36:09","name":"android: switch over to modern gralloc API via libui","version":1,"mbox":"https://patchwork.libcamera.org/series/4016/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/18984/comments/","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 02D7FBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 Sep 2023 09:36:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 61789628F7;\n\tTue, 12 Sep 2023 11:36:21 +0200 (CEST)","from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com\n\t[IPv6:2a00:1450:4864:20::32a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 68C0B61DF2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Sep 2023 11:36:19 +0200 (CEST)","by mail-wm1-x32a.google.com with SMTP id\n\t5b1f17b1804b1-40078c4855fso57023335e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Sep 2023 02:36:19 -0700 (PDT)","from [192.168.2.39] ([82.66.159.240])\n\tby smtp.gmail.com with ESMTPSA id\n\ty10-20020a05600c364a00b00401b242e2e6sm15578253wmq.47.2023.09.12.02.36.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 12 Sep 2023 02:36:18 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1694511381;\n\tbh=6WoQUjkU6/UoLxK9X+DG9B9lDf407cfBW5oJ9LzwY+4=;\n\th=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=GhTOim+M6t18lt9UI8T9mUGZopCxO6menBWh9nA3v8Ibx7oHB+IYQvwL55PoSwoM0\n\tlLl1r5ZqYJEQcb+E3WOsQWh4z6+JGwc8oVu0JKaK8r7h53Z3KOS6uxq1shIplkCB1D\n\thCptZNNCsRUnZ0DpGHq9WDTqEBs/4Su+WsDDFc5ZhmkJyrEVs1EHwrXkCBuzJ+lCun\n\tK5wAwFneYNhlx9vGKYz1sD+Cpna1UGiwx2Ydd0PFvNsyZycj3SXfjkvJqs3j1fqh97\n\tg1fGNPyyh14ax+AtOtss9FBC52Zc598xIyFTsgeoU84fIwcHnzhVpR0Z2n5PgQuIeS\n\tdx6+6+QzHcjLA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1694511379;\n\tx=1695116179; darn=lists.libcamera.org; \n\th=cc:to:content-transfer-encoding:mime-version:message-id:date\n\t:subject:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=6gJ37YjxryuONu7pc/M52+6Oj1TMA3BWxJdRCMJDgz4=;\n\tb=bUH+xhRbrB2ZtvBkzaPETVIwgaALhs/t2pSmrkumxCwHxTEVZVmMkvjT5V+vErOlsH\n\trzjKhMm2axmAuMqgI1RKo5Q/XRTNNE014aPYlae9p1yTCTPv/2fR4+A86hmVg2I3tpxP\n\t1ssfzESj5FBiyBRR6O8Tv9/l5NnqH1sl0ww7g7roEAnc9U3vDp/DIC16Hy6NY+8h7mt+\n\tvrgACXeKGIogE7Xw/S/1N+6esfgQ01MaDV3je1bEaz34/YJj8E2IDOuyWzo2STzyOrA2\n\t9spy2nHsEJfVhghfR8mN64fJty0seYkmzET8y8ZVKjqTUV3j3QQtpVxlR/ZSdUetqvdG\n\tgm/A=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20230601.gappssmtp.com\n\theader.i=@baylibre-com.20230601.gappssmtp.com header.b=\"bUH+xhRb\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1694511379; x=1695116179;\n\th=cc:to:content-transfer-encoding:mime-version:message-id:date\n\t:subject:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=6gJ37YjxryuONu7pc/M52+6Oj1TMA3BWxJdRCMJDgz4=;\n\tb=cYS6bk6qEU6AvOAyLhzEXa3MKgovw0PN7J2hcLzGHwkQDPfxMA8K+YHD68fp1drCVS\n\t5LyREyLrFLg20+Q/ms55eX2OkfOq4nnbXVOXkMCV7DXfpzdU7vQpvQRNFFT3I5B1sGWy\n\tPYK+y9Nf67X+X2H6XtuOzZVvqecgPmi78pbDY5m36EA3wdWGOliOIk+gUvFYcZsTBRNY\n\tueEQdbHKkkunYu/99loB5WK3czwNd+308Mi/L1+SBjeb6JAiuBw2+4EAPw9/o6s7X59M\n\tpLB7yEFl5jCiZz7f5e9d6QuUubA0UkzU6ria8yflBtxcXjA8UXxKMn8MzsEP+5SOejay\n\tZ9Pg==","X-Gm-Message-State":"AOJu0YxP9IMek2JzXA2lzYh31MkSRFMUpZ9C1Yf7TAjpENgxMvNxTUgs\n\tZtcvEGgSRm+jFayXVm7JLZLmuA==","X-Google-Smtp-Source":"AGHT+IGuNdoCvHEH5m4jh7e0BECI8VTbGmX4YW8yIztMNNDJGK0YZm5yxVFQyV/PG2Row9gO4vEOFQ==","X-Received":"by 2002:a05:600c:3b1f:b0:401:b204:3b85 with SMTP id\n\tm31-20020a05600c3b1f00b00401b2043b85mr9674461wms.36.1694511378475; \n\tTue, 12 Sep 2023 02:36:18 -0700 (PDT)","Date":"Tue, 12 Sep 2023 11:36:09 +0200","Message-Id":"<20230912-gralloc-api-v4-v1-0-0f80402d8e7a@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","X-B4-Tracking":"v=1; b=H4sIAAkxAGUC/x2N0QqDMAwAf0XyvIBri5T9ythDWqMGXJVkiCD+u\n\t3WPx3HcAcYqbPBqDlDexGQpFZ6PBvJEZWSUvjK41vk2uoCj0jwvGWkV3AKy9zEOve9C7qBGiYw\n\txKZU83dmX7Md6i1V5kP1/en/O8wIavZOAeQAAAA==","To":"libcamera-devel@lists.libcamera.org","X-Mailer":"b4 0.12.3","Subject":"[libcamera-devel] [PATCH 0/4] android: switch over to modern\n\tgralloc API via libui","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Mattijs Korpershoek via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Mattijs Korpershoek <mkorpershoek@baylibre.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"gralloc.h is a very old API that has been deprecated at least since\nAndroid P (9).\n\nDevices are encouraged to switch over to HIDL interface named\nandroid.hardware.graphics.allocator@<VERSION>, where <VERSION> can be\n2.0 ,3.0 or 4.0.\n\nThis is mandatory since Android Q (10) [1]\n\nFortunately, Android provides an abstraction on top of\nandroid.hardware.graphics.allocator which is compatible with each\nversion.\nThis abstraction is implemented in libui, which is available in the\nVNDK.\n\nImport all necessary headers from AOSP and switch over the\ngeneric_frame_buffer_allocator to use GraphicBufferAllocator.\n\nThis series has been build-tested on a linux host and functionally\ntested on an AM62x SK EVM with Android 13. (preview and capture).\n\n[1] https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/main/compatibility_matrices/compatibility_matrix.4.xml#195\n\nSigned-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>\n---\nMattijs Korpershoek (4):\n      android: Import libutils/libui headers from vndk v33\n      android: Import GraphicBufferAllocator header from vndk v33\n      android: Stub GraphicBufferAllocator for build tests\n      android: mm: generic: Use GraphicBufferAllocator instead of gralloc.h\n\n .../libs/ui/include/ui/GraphicBufferAllocator.h    |  81 ++++++++\n .../native/libs/ui/include/ui/PixelFormat.h        |  75 +++++++\n include/android/meson.build                        |   2 +\n .../system/core/libutils/include/utils/Compat.h    |  94 +++++++++\n .../system/core/libutils/include/utils/Errors.h    |  78 ++++++++\n .../system/core/libutils/include/utils/Mutex.h     | 219 +++++++++++++++++++++\n .../system/core/libutils/include/utils/Singleton.h | 102 ++++++++++\n .../system/core/libutils/include/utils/Timers.h    | 103 ++++++++++\n src/android/mm/generic_frame_buffer_allocator.cpp  |  58 ++----\n src/android/mm/graphic_buffer_allocator_stub.cpp   |  50 +++++\n src/android/mm/libhardware_stub.c                  |  17 --\n src/android/mm/meson.build                         |   9 +-\n 12 files changed, 825 insertions(+), 63 deletions(-)\n---\nbase-commit: 58e501c71c47e57f02afde1bd296a037038cd6d5\nchange-id: 20230824-gralloc-api-v4-e3388fd364c6\n\nBest regards,"}