From patchwork Tue Mar 6 23:19:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 130834 Delivered-To: patches@linaro.org Received: by 10.46.66.2 with SMTP id p2csp4518788lja; Tue, 6 Mar 2018 15:19:23 -0800 (PST) X-Received: by 2002:a17:902:724b:: with SMTP id c11-v6mr18283826pll.352.1520378363418; Tue, 06 Mar 2018 15:19:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520378363; cv=none; d=google.com; s=arc-20160816; b=Y7iDvwfADTU+387hjGB+vWELp6+zk1TcdCdMIEakE9Y4JS/tppxsYX9zZYze7UeT8e 7qA2zX6ZoZmblwYJ2JRJg8cnYwfj4ajQtSdFvN9ln1Jp2Lkr9bJXUCUHT2HGMSexMHC4 uwUdmeqMR1rqysrdypZBdsf3qLIrBgY3P8ErSjK2khtc1xghwzaMjvPq11IfRfJMxB95 RhxBo18gVD0SDJjY20WNYnVb4Yew3kA/uy5Ar5Z5MIhmiUk9oYeo0G9FmAU28zK2z/sc oLSuGAYtgZ/4xzLNukGwgtUDQ2HhfqEN6hIe7dOEp4VPLmMh33aPuVc0x8gm7CIQKers TPrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=I554ZL9nCS+8m0+oNk99HF8zP0qiQ3pmDXt+nup4it4=; b=hR6MEdBjH+F9ycrMB6pQZy/XZ07LvHrZFTkrqKdmFmEs8UBVsSQJnC9OC/0RjZlrxs 7AJpTnZihAJX94m4oedS/+xvqDuYPGEBqeU7DmQllevuFoqIskPD63mTnBqONWYVyNIh fxUsCsouursrbsbLzmTEUA8VQgvDHr0KD/DTpdDF3aVKoXzSHxuCkiCa2y6SXIBtt3c4 PSAMUYfRtLJ4SKCbv0nJuAq4ntme1KpUxDEst6Jd27ceDuMiWQbgf2h9WgCozLeYFmYM i9ZbJPKctJoWX5Kzzfg+6bwAIcqbxkuCWZwhmzSQ8dVXt7IMfz8STCCx+LnCcXQAn+FN JCPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ie59jY4k; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id l4sor3553717pgr.230.2018.03.06.15.19.23 for (Google Transport Security); Tue, 06 Mar 2018 15:19:23 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ie59jY4k; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=I554ZL9nCS+8m0+oNk99HF8zP0qiQ3pmDXt+nup4it4=; b=Ie59jY4kvKET/hgDtoyg6cSW4bDYs+jDYFc8KLECgyvMEh31nJAQI+0RWuBF6wE8V8 b29+Fth6xwcrBdfwFlzcPlYTZ2LRy87LmiiM7N0yOramto20A+r0HX2w0A0pggDv2hmX fS0toj/h9bkFoZDMw4r7eNl51GtiR0ZTeXHRA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=I554ZL9nCS+8m0+oNk99HF8zP0qiQ3pmDXt+nup4it4=; b=JE3ir4kdfZxtabZQWnSLXmp8EMOLbikKKok7Lna0+YzJU5X5f+Cl81L37O5gdjT/2H A29RfTch3tc2nvMtzBh+eWdWc/mtZBqdRi2xIKPPHPQ7lJ71mVWn4Qgvc8eNMckpeqDZ VKbF7Zh/XXxVe255QG/ZAnO/kkGQcy3ycsWzvPvlciMtKh06Xs/9Zdd5VNRkLNiczAJy QzhzINh9ktD5KzqRAU8S6VjEG6BqkNPd4TWvAdMF14+1SULxstXqAck91eoOtVznZXt5 p0VziMnkTlUOu6eBFLOkuvVlirUiZLZ5b/14/s7IjIUcdDR0xZud2IDiAoHLxzci0r9O G5RQ== X-Gm-Message-State: APf1xPAezoW09BODt9Yus8udBazttZUT34z/RNQg/cylYYthc1tC2/Cd dprbwLSrQQ9kvCH0EUxh6lRBp7cj X-Google-Smtp-Source: AG47ELtqTZSuhZq5QsT8baX7s17Pf5EY20yboYj/q0oL6l9b/ckrGZQH0Hif1zIcACzVzPeTOiKhcg== X-Received: by 10.99.47.132 with SMTP id v126mr16654173pgv.42.1520378362704; Tue, 06 Mar 2018 15:19:22 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:600:5100:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id b4sm30854413pfa.3.2018.03.06.15.19.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Mar 2018 15:19:21 -0800 (PST) From: John Stultz To: dri-devel Cc: John Stultz , Marissa Wall , Sean Paul , Dmitry Shmidt , Robert Foss , Matt Szczesiak , Liviu Dudau , David Hanna , Rob Herring , Alexandru-Cosmin Gheorghe Subject: [RFC][PATCH 1/2] drm_hwcomposer: Error out on YUV layer as it would fail for single planes Date: Tue, 6 Mar 2018 15:19:11 -0800 Message-Id: <1520378352-31260-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 As suggested by Alexandru-Cosmin Gheorghe: ConvertHALFormatToDrm logic would work only for 1 plane formats, and probably gets rejected by drmModeAddFb2, but to save debugging time maybe it worth removing DRM_FORMAT_YVU420 from ConvertHALFormatToDrm and checking it's return code. So this patch tries to do this. Cc: Marissa Wall Cc: Sean Paul Cc: Dmitry Shmidt Cc: Robert Foss Cc: Matt Szczesiak Cc: Liviu Dudau Cc: David Hanna Cc: Rob Herring Cc: Alexandru-Cosmin Gheorghe Signed-off-by: John Stultz --- platformdrmgeneric.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/platformdrmgeneric.cpp b/platformdrmgeneric.cpp index 741d42b..33f1ea0 100644 --- a/platformdrmgeneric.cpp +++ b/platformdrmgeneric.cpp @@ -76,8 +76,6 @@ uint32_t DrmGenericImporter::ConvertHalFormatToDrm(uint32_t hal_format) { return DRM_FORMAT_ABGR8888; case HAL_PIXEL_FORMAT_RGB_565: return DRM_FORMAT_BGR565; - case HAL_PIXEL_FORMAT_YV12: - return DRM_FORMAT_YVU420; default: ALOGE("Cannot convert hal format to drm format %u", hal_format); return -EINVAL; @@ -88,10 +86,15 @@ EGLImageKHR DrmGenericImporter::ImportImage(EGLDisplay egl_display, buffer_handl gralloc_drm_handle_t *gr_handle = gralloc_drm_handle(handle); if (!gr_handle) return NULL; + + EGLint fmt = ConvertHalFormatToDrm(gr_handle->format); + if (fmt < 0) + return NULL; + EGLint attr[] = { EGL_WIDTH, gr_handle->width, EGL_HEIGHT, gr_handle->height, - EGL_LINUX_DRM_FOURCC_EXT, (EGLint)ConvertHalFormatToDrm(gr_handle->format), + EGL_LINUX_DRM_FOURCC_EXT, fmt, EGL_DMA_BUF_PLANE0_FD_EXT, gr_handle->prime_fd, EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0, EGL_DMA_BUF_PLANE0_PITCH_EXT, gr_handle->stride, @@ -112,10 +115,14 @@ int DrmGenericImporter::ImportBuffer(buffer_handle_t handle, hwc_drm_bo_t *bo) { return ret; } + uint32_t fmt = ConvertHalFormatToDrm(gr_handle->format); + if (fmt < 0) + return fmt; + memset(bo, 0, sizeof(hwc_drm_bo_t)); bo->width = gr_handle->width; bo->height = gr_handle->height; - bo->format = ConvertHalFormatToDrm(gr_handle->format); + bo->format = fmt; bo->usage = gr_handle->usage; bo->pitches[0] = gr_handle->stride; bo->gem_handles[0] = gem_handle; From patchwork Tue Mar 6 23:19:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 130835 Delivered-To: patches@linaro.org Received: by 10.46.66.2 with SMTP id p2csp4518817lja; Tue, 6 Mar 2018 15:19:26 -0800 (PST) X-Received: by 10.98.214.10 with SMTP id r10mr20529878pfg.8.1520378365921; Tue, 06 Mar 2018 15:19:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520378365; cv=none; d=google.com; s=arc-20160816; b=eDHs86Zh6dvFiJOATDBARu0+z+7KeBJIAnga4/69t7sqeyv1oO6IvwPNjQBsUNBYaf +SF43uhU9nIps7LCAC8l3SnPbNvtdF3zz2RS6nMn528kbHDQ7AXDGwnV2wfok4IgYtZv h+HHPqtExUgbaLKz96OEDqw0kPMvaDFiqN5mfvqA8c0f1BvdCKI8cLIIOn7OBOqyZ/Pc RIIifo/A9F0Bv8dCWRK/tZZ25+3iW/Vaqrz1fpZRmtsNilvVPj09T2SJkstVqKIMYZVG LsjsDusSpJoq4OsmIMtk5Fw6X1az6CU2RejJHXPBNpk8CbnkSRJYG5evVOpmj4IbwtEQ HAOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=l3FJUcF99eeGsyw7I9x1eekOGrjbdmKmwwz/3Mzo2Ok=; b=o52fRGJbH+iF6a/agcQAPiZG7UZiwVg0L+MImPFUlCTz4M0H0V0Nyu0s+/5UI55zhR Ko9yRjrRrWCtJJwd4FpYY9xg9KwtFy3ai5SbMyXVIBstf3VGvS4ujJMTL3I2soBldZAq ValSOknpl1QAzfgKRyihl0ktHjxN1uLq4MxDEBsxTrlUH02CMYzg50ag7NSNz0ec3X// 7+gxhO5zWZmm9Gf4pzbRSbZa7rkpfF+O+h8YjLdnSPFq+XYp43oitXPqNEWg13g2JhkN ezBTRKct1DNutXHaoSsukfzeWZzZCVQJ3TJTBwefZ32o8+qda36x8IKNJAotaGZUJC23 B+yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gOENtKYp; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id o32-v6sor5092541pld.0.2018.03.06.15.19.25 for (Google Transport Security); Tue, 06 Mar 2018 15:19:25 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gOENtKYp; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=l3FJUcF99eeGsyw7I9x1eekOGrjbdmKmwwz/3Mzo2Ok=; b=gOENtKYp+yTUMAxHLxP33rFql4zGIiYJrkGIQufmqtTdcjAggo9+ThhKzla2GMRTiQ Inic9w+S8a0fVlntC4M62rxQrMebPzWFR8z/Wqyxs5ZmVYxxTWC0eESbevaxuqweW31X m2//M13BPakcZ0MNw+F7UXOdYVlQ5W8ZJyOhA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=l3FJUcF99eeGsyw7I9x1eekOGrjbdmKmwwz/3Mzo2Ok=; b=DyPnNwUFTuxrJe2yYGaCLGeRBkw7TlZIBg6c19nARe1xl1Ph97OrI+yR/BffSsEU3g JIrCdN8M8UsaNY2o1ezATux56KwD2JII6nydbNkJXhRgm/+3eP4TGHGABBEAYBKxsgvJ LqjK6O3QNaNotXA2qRj8uW4xeGN5dMhhLfhR+wnBGr/rtJRlbcn8RhPe181q21U4BZPT 3k3oT6v2tQIpYKnHmIthGKbe6klInhewY6qGF6VY0VaKsVvlju2J87lrv5hwujzzL5Vu 95qBDtRi3xdhNc9Yo1CEClFAsozRyo17vBU7d44j82F67l2EWnhC4mVstuEyvznjCCfh T74Q== X-Gm-Message-State: APf1xPBGScvP1PEYHrYg8YU1wKrvlkj+mqFBwx2dotVbk83sURtgaqn8 birGxZDLHehQHuQnxnF3CSGFj8Kg X-Google-Smtp-Source: AG47ELu3dpS2UnmE9dEniS4j9muw4L2PbV7eptR+A5BefKpz0T5cYegxg0/vFsPAC4OqB2odKimDBQ== X-Received: by 2002:a17:902:7509:: with SMTP id i9-v6mr18746800pll.220.1520378365356; Tue, 06 Mar 2018 15:19:25 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:600:5100:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id b4sm30854413pfa.3.2018.03.06.15.19.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Mar 2018 15:19:24 -0800 (PST) From: John Stultz To: dri-devel Cc: John Stultz , Marissa Wall , Sean Paul , Dmitry Shmidt , Robert Foss , Matt Szczesiak , Liviu Dudau , David Hanna , Rob Herring , Alexandru-Cosmin Gheorghe Subject: [RFC][PATCH 2/2 v4] drm_hwcomposer: Add platformhisi buffer importer for hikey and hikey960 Date: Tue, 6 Mar 2018 15:19:12 -0800 Message-Id: <1520378352-31260-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520378352-31260-1-git-send-email-john.stultz@linaro.org> References: <1520378352-31260-1-git-send-email-john.stultz@linaro.org> This allows for importing buffers allocated from the hikey and hikey960 gralloc implelementations. Cc: Marissa Wall Cc: Sean Paul Cc: Dmitry Shmidt Cc: Robert Foss Cc: Matt Szczesiak Cc: Liviu Dudau Cc: David Hanna Cc: Rob Herring Cc: Alexandru-Cosmin Gheorghe Signed-off-by: John Stultz --- v2: * Make platformhisi and the generic importer exclusive in the build * Fixup vendor check v3: * Unify format conversions * Subclass the platformdrmgeneric importer implementation to reduce code duplication * Rework to avoid board specific logic (tweak gralloc to be consistent between the two) v4: * Minor cleanups as suggested by Alexandru-Cosmin Gheorghe --- Android.mk | 13 +++++ platformdrmgeneric.h | 2 +- platformhisi.cpp | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++ platformhisi.h | 48 ++++++++++++++++++ 4 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 platformhisi.cpp create mode 100644 platformhisi.h -- 2.7.4 diff --git a/Android.mk b/Android.mk index ee5b8bf..f37e4c3 100644 --- a/Android.mk +++ b/Android.mk @@ -74,7 +74,20 @@ LOCAL_CPPFLAGS += \ -DHWC2_USE_CPP11 \ -DHWC2_INCLUDE_STRINGIFICATION + +ifeq ($(TARGET_PRODUCT),hikey960) +LOCAL_CPPFLAGS += -DUSE_HISI_IMPORTER +LOCAL_SRC_FILES += platformhisi.cpp +LOCAL_C_INCLUDES += device/linaro/hikey/gralloc960/ +else +ifeq ($(TARGET_PRODUCT),hikey) +LOCAL_CPPFLAGS += -DUSE_HISI_IMPORTER +LOCAL_SRC_FILES += platformhisi.cpp +LOCAL_C_INCLUDES += device/linaro/hikey/gralloc/ +else LOCAL_CPPFLAGS += -DUSE_DRM_GENERIC_IMPORTER +endif +endif LOCAL_MODULE := hwcomposer.drm LOCAL_MODULE_TAGS := optional diff --git a/platformdrmgeneric.h b/platformdrmgeneric.h index 8376580..fbe059b 100644 --- a/platformdrmgeneric.h +++ b/platformdrmgeneric.h @@ -35,8 +35,8 @@ class DrmGenericImporter : public Importer { int ImportBuffer(buffer_handle_t handle, hwc_drm_bo_t *bo) override; int ReleaseBuffer(hwc_drm_bo_t *bo) override; - private: uint32_t ConvertHalFormatToDrm(uint32_t hal_format); + private: DrmResources *drm_; diff --git a/platformhisi.cpp b/platformhisi.cpp new file mode 100644 index 0000000..16c5e6f --- /dev/null +++ b/platformhisi.cpp @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "hwc-platform-hisi" + +#include "drmresources.h" +#include "platform.h" +#include "platformhisi.h" + + +#include +#include +#include +#include +#include + +#include +#include +#include "gralloc_priv.h" + + +namespace android { + +Importer *Importer::CreateInstance(DrmResources *drm) { + HisiImporter *importer = new HisiImporter(drm); + if (!importer) + return NULL; + + int ret = importer->Init(); + if (ret) { + ALOGE("Failed to initialize the hisi importer %d", ret); + delete importer; + return NULL; + } + return importer; +} + +HisiImporter::HisiImporter(DrmResources *drm) : DrmGenericImporter(drm), drm_(drm) { +} + +HisiImporter::~HisiImporter() { +} + +int HisiImporter::Init() { + int ret = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, + (const hw_module_t **)&gralloc_); + if (ret) { + ALOGE("Failed to open gralloc module %d", ret); + return ret; + } + + if (strcasecmp(gralloc_->common.author, "ARM Ltd.")) + ALOGW("Using non-ARM gralloc module: %s/%s\n", gralloc_->common.name, + gralloc_->common.author); + + return 0; +} + +EGLImageKHR HisiImporter::ImportImage(EGLDisplay egl_display, buffer_handle_t handle) { + private_handle_t const *hnd = reinterpret_cast < private_handle_t const *>(handle); + if (!hnd) + return NULL; + + EGLint fmt = ConvertHalFormatToDrm(hnd->req_format); + if (fmt < 0) + return NULL; + + EGLint attr[] = { + EGL_WIDTH, hnd->width, + EGL_HEIGHT, hnd->height, + EGL_LINUX_DRM_FOURCC_EXT, fmt, + EGL_DMA_BUF_PLANE0_FD_EXT, hnd->share_fd, + EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0, + EGL_DMA_BUF_PLANE0_PITCH_EXT, hnd->byte_stride, + EGL_NONE, + }; + return eglCreateImageKHR(egl_display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, NULL, attr); +} + +int HisiImporter::ImportBuffer(buffer_handle_t handle, hwc_drm_bo_t *bo) { + private_handle_t const *hnd = reinterpret_cast < private_handle_t const *>(handle); + if (!hnd) + return -EINVAL; + + uint32_t gem_handle; + int ret = drmPrimeFDToHandle(drm_->fd(), hnd->share_fd, &gem_handle); + if (ret) { + ALOGE("failed to import prime fd %d ret=%d", hnd->share_fd, ret); + return ret; + } + + EGLint fmt = ConvertHalFormatToDrm(hnd->req_format); + if (fmt < 0) + return fmt; + + memset(bo, 0, sizeof(hwc_drm_bo_t)); + bo->width = hnd->width; + bo->height = hnd->height; + bo->format = fmt; + bo->usage = hnd->usage; + bo->pitches[0] = hnd->byte_stride; + bo->gem_handles[0] = gem_handle; + bo->offsets[0] = 0; + + ret = drmModeAddFB2(drm_->fd(), bo->width, bo->height, bo->format, + bo->gem_handles, bo->pitches, bo->offsets, &bo->fb_id, 0); + if (ret) { + ALOGE("could not create drm fb %d", ret); + return ret; + } + + return ret; +} + +std::unique_ptr Planner::CreateInstance(DrmResources *) { + std::unique_ptr planner(new Planner); + planner->AddStage(); + return planner; +} +} + + diff --git a/platformhisi.h b/platformhisi.h new file mode 100644 index 0000000..46f4595 --- /dev/null +++ b/platformhisi.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_PLATFORM_HISI_H_ +#define ANDROID_PLATFORM_HISI_H_ + +#include "drmresources.h" +#include "platform.h" +#include "platformdrmgeneric.h" + +#include + +#include + +namespace android { + +class HisiImporter : public DrmGenericImporter { + public: + HisiImporter(DrmResources *drm); + ~HisiImporter() override; + + int Init(); + + EGLImageKHR ImportImage(EGLDisplay egl_display, buffer_handle_t handle) override; + int ImportBuffer(buffer_handle_t handle, hwc_drm_bo_t *bo) override; + + private: + + DrmResources *drm_; + + const gralloc_module_t *gralloc_; +}; +} + +#endif