diff options
-rw-r--r-- | minui/Android.bp | 2 | ||||
-rw-r--r-- | minui/graphics.cpp | 8 | ||||
-rw-r--r-- | minui/graphics_adf.cpp | 200 | ||||
-rw-r--r-- | minui/graphics_adf.h | 76 | ||||
-rw-r--r-- | tools/recovery_l10n/res/values-ar/strings.xml | 4 | ||||
-rw-r--r-- | tools/recovery_l10n/res/values-hy/strings.xml | 2 | ||||
-rw-r--r-- | tools/recovery_l10n/res/values-ur/strings.xml | 4 |
7 files changed, 6 insertions, 290 deletions
diff --git a/minui/Android.bp b/minui/Android.bp index fff3a8ec9..82588167c 100644 --- a/minui/Android.bp +++ b/minui/Android.bp @@ -27,14 +27,12 @@ cc_library { srcs: [ "events.cpp", "graphics.cpp", - "graphics_adf.cpp", "graphics_drm.cpp", "graphics_fbdev.cpp", "resources.cpp", ], whole_static_libs: [ - "libadf", "libdrm", "libsync", ], diff --git a/minui/graphics.cpp b/minui/graphics.cpp index d34da5674..dce1e619a 100644 --- a/minui/graphics.cpp +++ b/minui/graphics.cpp @@ -25,7 +25,6 @@ #include <android-base/properties.h> -#include "graphics_adf.h" #include "graphics_drm.h" #include "graphics_fbdev.h" #include "minui/minui.h" @@ -362,15 +361,10 @@ int gr_init() { ret); } - auto backend = std::unique_ptr<MinuiBackend>{ std::make_unique<MinuiBackendAdf>() }; + auto backend = std::unique_ptr<MinuiBackend>{ std::make_unique<MinuiBackendDrm>() }; gr_draw = backend->Init(); if (!gr_draw) { - backend = std::make_unique<MinuiBackendDrm>(); - gr_draw = backend->Init(); - } - - if (!gr_draw) { backend = std::make_unique<MinuiBackendFbdev>(); gr_draw = backend->Init(); } diff --git a/minui/graphics_adf.cpp b/minui/graphics_adf.cpp deleted file mode 100644 index 10cd60709..000000000 --- a/minui/graphics_adf.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (C) 2014 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. - */ - -#include "graphics_adf.h" - -#include <errno.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/mman.h> -#include <unistd.h> - -#include <adf/adf.h> -#include <sync/sync.h> - -#include "minui/minui.h" - -GRSurfaceAdf::~GRSurfaceAdf() { - if (mmapped_buffer_) { - munmap(mmapped_buffer_, pitch * height); - } - if (fence_fd != -1) { - close(fence_fd); - } - if (fd != -1) { - close(fd); - } -} - -std::unique_ptr<GRSurfaceAdf> GRSurfaceAdf::Create(int intf_fd, const drm_mode_modeinfo* mode, - __u32 format, int* err) { - __u32 offset; - __u32 pitch; - auto fd = adf_interface_simple_buffer_alloc(intf_fd, mode->hdisplay, mode->vdisplay, format, - &offset, &pitch); - - if (fd < 0) { - *err = fd; - return nullptr; - } - - std::unique_ptr<GRSurfaceAdf> surf = std::unique_ptr<GRSurfaceAdf>( - new GRSurfaceAdf(mode->hdisplay, mode->vdisplay, pitch, (format == DRM_FORMAT_RGB565 ? 2 : 4), - offset, pitch, fd)); - - auto mmapped = - mmap(nullptr, surf->pitch * surf->height, PROT_WRITE, MAP_SHARED, surf->fd, surf->offset); - if (mmapped == MAP_FAILED) { - *err = -errno; - return nullptr; - } - surf->mmapped_buffer_ = static_cast<uint8_t*>(mmapped); - return surf; -} - -MinuiBackendAdf::MinuiBackendAdf() : intf_fd(-1), dev(), current_surface(0), n_surfaces(0) {} - -int MinuiBackendAdf::InterfaceInit() { - adf_interface_data intf_data; - if (int err = adf_get_interface_data(intf_fd, &intf_data); err < 0) return err; - - int result = 0; - surfaces[0] = GRSurfaceAdf::Create(intf_fd, &intf_data.current_mode, format, &result); - if (!surfaces[0]) { - fprintf(stderr, "Failed to allocate surface 0: %s\n", strerror(-result)); - goto done; - } - - surfaces[1] = GRSurfaceAdf::Create(intf_fd, &intf_data.current_mode, format, &result); - if (!surfaces[1]) { - fprintf(stderr, "Failed to allocate surface 1: %s\n", strerror(-result)); - n_surfaces = 1; - } else { - n_surfaces = 2; - } - -done: - adf_free_interface_data(&intf_data); - return result; -} - -int MinuiBackendAdf::DeviceInit(adf_device* dev) { - adf_id_t intf_id; - int err = adf_find_simple_post_configuration(dev, &format, 1, &intf_id, &eng_id); - if (err < 0) return err; - - err = adf_device_attach(dev, eng_id, intf_id); - if (err < 0 && err != -EALREADY) return err; - - intf_fd = adf_interface_open(dev, intf_id, O_RDWR | O_CLOEXEC); - if (intf_fd < 0) return intf_fd; - - err = InterfaceInit(); - if (err < 0) { - close(intf_fd); - intf_fd = -1; - } - - return err; -} - -GRSurface* MinuiBackendAdf::Init() { - PixelFormat pixel_format = gr_pixel_format(); - if (pixel_format == PixelFormat::ABGR) { - format = DRM_FORMAT_ABGR8888; - } else if (pixel_format == PixelFormat::BGRA) { - format = DRM_FORMAT_BGRA8888; - } else if (pixel_format == PixelFormat::RGBX) { - format = DRM_FORMAT_RGBX8888; - } else { - format = DRM_FORMAT_RGB565; - } - - adf_id_t* dev_ids = nullptr; - ssize_t n_dev_ids = adf_devices(&dev_ids); - if (n_dev_ids == 0) { - return nullptr; - } else if (n_dev_ids < 0) { - fprintf(stderr, "enumerating adf devices failed: %s\n", strerror(-n_dev_ids)); - return nullptr; - } - - intf_fd = -1; - - for (ssize_t i = 0; i < n_dev_ids && intf_fd < 0; i++) { - int err = adf_device_open(dev_ids[i], O_RDWR, &dev); - if (err < 0) { - fprintf(stderr, "opening adf device %u failed: %s\n", dev_ids[i], strerror(-err)); - continue; - } - - err = DeviceInit(&dev); - if (err < 0) { - fprintf(stderr, "initializing adf device %u failed: %s\n", dev_ids[i], strerror(-err)); - adf_device_close(&dev); - } - } - - free(dev_ids); - - if (intf_fd < 0) return nullptr; - - GRSurface* ret = Flip(); - - Blank(true); - Blank(false); - - return ret; -} - -void MinuiBackendAdf::Sync(GRSurfaceAdf* surf) { - static constexpr unsigned int kWarningTimeout = 3000; - - if (surf == nullptr) return; - - if (surf->fence_fd >= 0) { - int err = sync_wait(surf->fence_fd, kWarningTimeout); - if (err < 0) { - perror("adf sync fence wait error\n"); - } - - close(surf->fence_fd); - surf->fence_fd = -1; - } -} - -GRSurface* MinuiBackendAdf::Flip() { - const auto& surf = surfaces[current_surface]; - - int fence_fd = adf_interface_simple_post(intf_fd, eng_id, surf->width, surf->height, format, - surf->fd, surf->offset, surf->pitch, -1); - if (fence_fd >= 0) surf->fence_fd = fence_fd; - - current_surface = (current_surface + 1) % n_surfaces; - Sync(surfaces[current_surface].get()); - return surfaces[current_surface].get(); -} - -void MinuiBackendAdf::Blank(bool blank) { - adf_interface_blank(intf_fd, blank ? DRM_MODE_DPMS_OFF : DRM_MODE_DPMS_ON); -} - -MinuiBackendAdf::~MinuiBackendAdf() { - adf_device_close(&dev); - if (intf_fd >= 0) close(intf_fd); -} diff --git a/minui/graphics_adf.h b/minui/graphics_adf.h deleted file mode 100644 index 79d8d2acb..000000000 --- a/minui/graphics_adf.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#pragma once - -#include <stddef.h> -#include <stdint.h> -#include <sys/types.h> - -#include <memory> - -#include <adf/adf.h> - -#include "graphics.h" -#include "minui/minui.h" - -class GRSurfaceAdf : public GRSurface { - public: - ~GRSurfaceAdf() override; - - static std::unique_ptr<GRSurfaceAdf> Create(int intf_fd, const drm_mode_modeinfo* mode, - __u32 format, int* err); - - uint8_t* data() override { - return mmapped_buffer_; - } - - private: - friend class MinuiBackendAdf; - - GRSurfaceAdf(size_t width, size_t height, size_t row_bytes, size_t pixel_bytes, __u32 offset, - __u32 pitch, int fd) - : GRSurface(width, height, row_bytes, pixel_bytes), offset(offset), pitch(pitch), fd(fd) {} - - const __u32 offset; - const __u32 pitch; - - int fd; - int fence_fd{ -1 }; - uint8_t* mmapped_buffer_{ nullptr }; -}; - -class MinuiBackendAdf : public MinuiBackend { - public: - MinuiBackendAdf(); - ~MinuiBackendAdf() override; - GRSurface* Init() override; - GRSurface* Flip() override; - void Blank(bool) override; - - private: - int InterfaceInit(); - int DeviceInit(adf_device* dev); - void Sync(GRSurfaceAdf* surf); - - int intf_fd; - adf_id_t eng_id; - __u32 format; - adf_device dev; - size_t current_surface; - size_t n_surfaces; - std::unique_ptr<GRSurfaceAdf> surfaces[2]; -}; diff --git a/tools/recovery_l10n/res/values-ar/strings.xml b/tools/recovery_l10n/res/values-ar/strings.xml index 69191287d..a9cd2d133 100644 --- a/tools/recovery_l10n/res/values-ar/strings.xml +++ b/tools/recovery_l10n/res/values-ar/strings.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="recovery_installing" msgid="2013591905463558223">"جارٍ تثبيت إعادة تحميل النظام"</string> + <string name="recovery_installing" msgid="2013591905463558223">"جارٍ تثبيت تحديث النظام"</string> <string name="recovery_erasing" msgid="7334826894904037088">"جارٍ محو البيانات"</string> <string name="recovery_no_command" msgid="4465476568623024327">"ليس هناك أي أمر"</string> <string name="recovery_error" msgid="5748178989622716736">"خطأ!"</string> - <string name="recovery_installing_security" msgid="9184031299717114342">"جارٍ تثبيت إعادة تحميل الأمان"</string> + <string name="recovery_installing_security" msgid="9184031299717114342">"جارٍ تثبيت تحديث الأمان"</string> <string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"يتعذَّر تحميل نظام Android، حيث قد تكون بياناتك تالفة. وإذا استمر ظهور هذه الرسالة، قد يتعيَّن عليك إجراء إعادة الضبط على الإعدادات الأصلية ومحو جميع بيانات المستخدم المُخزَّنة على هذا الجهاز."</string> <string name="recovery_try_again" msgid="7168248750158873496">"إعادة المحاولة"</string> <string name="recovery_factory_data_reset" msgid="7321351565602894783">"إعادة الضبط على الإعدادات الأصلية"</string> diff --git a/tools/recovery_l10n/res/values-hy/strings.xml b/tools/recovery_l10n/res/values-hy/strings.xml index 35a0ab113..76c28a707 100644 --- a/tools/recovery_l10n/res/values-hy/strings.xml +++ b/tools/recovery_l10n/res/values-hy/strings.xml @@ -9,6 +9,6 @@ <string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"Չհաջողվեց բեռնել Android համակարգը։ Հնարավոր է՝ ձեր տվյալները վնասված են։ Եթե նորից տեսնեք այս հաղորդագրությունը, փորձեք վերակայել սարքի կարգավորումները և ջնջել օգտատիրոջ բոլոր տվյալները։"</string> <string name="recovery_try_again" msgid="7168248750158873496">"Նորից փորձել"</string> <string name="recovery_factory_data_reset" msgid="7321351565602894783">"Վերակայել բոլոր տվյալները"</string> - <string name="recovery_wipe_data_confirmation" msgid="5439823343348043954">"Մաքրե՞լ օգտատիրոջ բոլոր տվյալները։\n\n ԱՅՍ ԳՈՐԾՈՂՈՒԹՅՈՒՆԸ ՀՆԱՐԱՎՈՐ ՉԻ ԼԻՆԻ ՀԵՏԱՐԿԵԼ"</string> + <string name="recovery_wipe_data_confirmation" msgid="5439823343348043954">"Ջնջե՞լ օգտատիրոջ բոլոր տվյալները։\n\n ԱՅՍ ԳՈՐԾՈՂՈՒԹՅՈՒՆԸ ՀՆԱՐԱՎՈՐ ՉԻ ԼԻՆԻ ՀԵՏԱՐԿԵԼ"</string> <string name="recovery_cancel_wipe_data" msgid="66987687653647384">"Չեղարկել"</string> </resources> diff --git a/tools/recovery_l10n/res/values-ur/strings.xml b/tools/recovery_l10n/res/values-ur/strings.xml index da03f1972..13dc6b37d 100644 --- a/tools/recovery_l10n/res/values-ur/strings.xml +++ b/tools/recovery_l10n/res/values-ur/strings.xml @@ -6,9 +6,9 @@ <string name="recovery_no_command" msgid="4465476568623024327">"کوئی کمانڈ نہیں ہے"</string> <string name="recovery_error" msgid="5748178989622716736">"خرابی!"</string> <string name="recovery_installing_security" msgid="9184031299717114342">"سیکیورٹی اپ ڈیٹ انسٹال ہو رہی ہے"</string> - <string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"Android سسٹم لوڈ نہیں کیا جا سکتا۔ آپ کا ڈیٹا خراب ہو سکتا ہے۔ اگر آپ کو مستقل یہ پیغام موصول ہوتا ہے تو آپ کو فیکٹری ڈیٹا کی دوبارہ ترتیب انجام دینے اور اس آلہ پر اسٹور کردہ سبھی صارف ڈیٹا کو مٹانے کی ضرورت پڑ سکتی ہے۔"</string> + <string name="recovery_wipe_data_menu_header" msgid="550255032058254478">"Android سسٹم لوڈ نہیں کیا جا سکتا۔ آپ کا ڈیٹا خراب ہو سکتا ہے۔ اگر آپ کو مستقل یہ پیغام موصول ہوتا ہے تو آپ کو فیکٹری ڈیٹا ری سیٹ انجام دینے اور اس آلہ پر اسٹور کردہ سبھی صارف ڈیٹا کو مٹانے کی ضرورت پڑ سکتی ہے۔"</string> <string name="recovery_try_again" msgid="7168248750158873496">"دوبارہ کوشش کریں"</string> - <string name="recovery_factory_data_reset" msgid="7321351565602894783">"فیکٹری ڈیٹا کی دوبارہ ترتیب"</string> + <string name="recovery_factory_data_reset" msgid="7321351565602894783">"فیکٹری ڈیٹا ری سیٹ"</string> <string name="recovery_wipe_data_confirmation" msgid="5439823343348043954">"سبھی صارف ڈیٹا صاف کریں؟\n\n اسے کالعدم نہیں کیا جا سکتا!"</string> <string name="recovery_cancel_wipe_data" msgid="66987687653647384">"منسوخ کریں"</string> </resources> |