27 Mart 2025'ten itibaren AOSP'yi derlemek ve AOSP'ye katkıda bulunmak için aosp-main
yerine android-latest-release
kullanmanızı öneririz. Daha fazla bilgi için AOSP'de yapılan değişiklikler başlıklı makaleyi inceleyin.
Grafik mimarisi
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Yüzeyler, SurfaceHolder, EGLSurface, SurfaceView, GLSurfaceView, SurfaceTexture, TextureView, SurfaceFlinger ve Vulkan hakkında her geliştiricinin bilmesi gerekenler.
Bu sayfada, Android sistem düzeyinde grafik mimarisinin temel unsurları ve bunların uygulama çerçevesi ve multimedya sistemi tarafından nasıl kullanıldığı açıklanmaktadır. Buradaki odak, grafik verilerinin arabelleklerinin sistemde nasıl hareket ettiğidir.
SurfaceView ve TextureView'ın neden bu şekilde davrandığını veya yüzeylerin EGLSurface ile nasıl etkileşime girdiğini merak ettiyseniz doğru yerdesiniz.
Android cihazlara ve uygulama geliştirmeye aşina olmanız beklenir.
Uygulama çerçevesi hakkında ayrıntılı bilgiye sahip olmanız gerekmez ve çok az sayıda API çağrısından bahsedilir ancak materyal, herkese açık diğer dokümanlarla örtüşmez. Amacımız, uygulama tasarlarken bilinçli seçimler yapmanıza yardımcı olmak için çıkış için bir çerçeve oluşturmayla ilgili önemli etkinliklerle ilgili ayrıntılar sunmaktır. Bunu başarmak için, kullanıcı arayüzü sınıflarının nasıl kullanılabileceğinden ziyade nasıl çalıştığıyla ilgili ayrıntıları alttan yukarıya doğru çalışarak açıklarız.
Bu bölümde, arka plan materyalinden HAL ayrıntılarına ve kullanım alanlarına kadar her şeyi kapsayan çeşitli sayfalar yer alır. Android grafik arabelleklerinin açıklanmasıyla başlayan bu makalede, derleme ve görüntüleme mekanizması açıklandıktan sonra, derleyiciye veri sağlayan üst düzey mekanizmalara geçilir. İlginizi çeken bir konuya atlamak yerine sayfaları aşağıda listelenen sırayla okumanızı öneririz.
Düşük düzey bileşenler
- BufferQueue ve gralloc. BufferQueue, grafik veri arabellekleri oluşturan bir öğeyi (üretici) verileri görüntüleme veya daha fazla işleme için kabul eden bir öğeye (tüketici) bağlar. Arabellek ayrıştırmaları, tedarikçiye özel bir HAL arayüzü aracılığıyla uygulanan gralloc bellek ayırıcısı aracılığıyla gerçekleştirilir.
- SurfaceFlinger, Donanım Bestecisi ve sanal ekranlar. SurfaceFlinger, birden fazla kaynaktan gelen veri arabelleklerini kabul eder, bunları birleştirir ve ekrana gönderir. Donanım Oluşturucu HAL (HWC), mevcut donanımla arabelleklerin birleştirilmesinin en verimli yolunu belirler ve sanal ekranlar, birleştirilmiş çıkışı sistemde kullanılabilir hale getirir (ekranı kaydeder veya ekranı bir ağ üzerinden gönderir).
- Surface, canvas ve SurfaceHolder. Yüzey, genellikle SurfaceFlinger tarafından kullanılan bir arabellek kuyruğu oluşturur. Bir yüzeye oluşturulurken sonuç, tüketiciye gönderilen bir arabelleğe gönderilir. Tuval API'leri, doğrudan bir yüzeyde (OpenGL ES'e düşük düzeyde alternatif) çizim yapmak için yazılım uygulaması (donanım hızlandırma desteğiyle) sağlar. Görünümle ilgili her şey bir SurfaceHolder içerir. Bu SurfaceHolder'ın API'leri, boyut ve biçim gibi yüzey parametrelerinin alınmasını ve ayarlanmasını sağlar.
- EGLSurface ve OpenGL ES. OpenGL ES (GLES), işletim sistemi üzerinden pencere oluşturabilen ve pencerelere erişebilen bir kitaplık olan EGL ile birlikte kullanılmak üzere tasarlanmış bir grafik oluşturma API'si tanımlar (dokunmuş poligonlar çizmek için GLES çağrılarını, oluşturmayı ekrana yerleştirmek için EGL çağrılarını kullanın). Bu sayfada, yerel koddan EGL pencere yüzeyi oluşturmak için kullanılan Java Surface sınıfının C/C++ eşdeğeri olan ANativeWindow da ele alınmaktadır.
- Vulkan. Vulkan, yüksek performanslı 3D grafikler için düşük maliyetli, platformlar arası bir API'dir. OpenGL ES gibi Vulkan da uygulamalarda yüksek kaliteli, gerçek zamanlı grafikler oluşturmak için araçlar sağlar. Vulkan'ın avantajları arasında CPU yükü azaltma ve SPIR-V Binary Intermediate dili desteği yer alır.
Üst düzey bileşenler
- SurfaceView ve GLSurfaceView. SurfaceView, bir yüzeyi ve görünümü birleştirir. SurfaceView'ın görünüm bileşenleri uygulama tarafından değil, SurfaceFlinger tarafından birleştirilir. Bu sayede, ayrı bir iş parçacığında/işlemde oluşturma ve uygulama kullanıcı arayüzü oluşturma işlemlerinden izolasyon sağlanır.
GLSurfaceView, EGL bağlamlarını, iş parçacığı arası iletişimi ve etkinlik yaşam döngüsü ile etkileşimi yönetmek için yardımcı sınıflar sağlar (ancak GLES kullanmak için gerekli değildir).
- SurfaceTexture.
SurfaceTexture, bir yüzey ve GLES dokusunu birleştirerek uygulamanızın tüketicisi olduğu bir BufferQueue oluşturur. Bir üretici yeni bir arabellek sıraya eklediğinde uygulamanızı bilgilendirir. Uygulamanız da daha önce tutulan arabelleği serbest bırakır, yeni arabelleği sıradan alır ve arabelleği harici bir doku olarak GLES'e sunmak için EGL çağrıları yapar. Android 7.0, güvenli doku video oynatma desteğini ekleyerek korunan video içeriğinin GPU'da son işlenmesini sağladı.
- TextureView.
TextureView, bir görünümü SurfaceTexture ile birleştirir. TextureView, bir SurfaceTexture'yi sarar ve geri çağırmalara yanıt verme ve yeni arabellekler edinme sorumluluğunu üstlenir. TextureView, çizim yaparken veri kaynağı olarak en son alınan arabelleğin içeriğini kullanır ve görünüm durumunun belirttiği yerde ve şekilde oluşturur. Görünüm oluşturma işlemi her zaman GLES ile gerçekleştirilir. Bu, içeriklerdeki güncellemelerin diğer görüntüleme öğelerinin de yeniden çizilmesine neden olabileceği anlamına gelir.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-07-27 UTC."],[],[],null,["# Graphics architecture\n\n*What every developer should know about surfaces, SurfaceHolder,\nEGLSurface, SurfaceView, GLSurfaceView, SurfaceTexture, TextureView,\nSurfaceFlinger, and Vulkan.*\n\nThis page describes essential elements of the Android system-level graphics\narchitecture and how they are used by the app framework and multimedia\nsystem. The focus is on how buffers of graphical data move through the system.\nIf you've ever wondered why SurfaceView and TextureView behave the way they do,\nor how surfaces and EGLSurface interact, you're in the correct place.\n\nSome familiarity with Android devices and app development is assumed.\nYou don't need detailed knowledge of the app framework and very few API calls\nare mentioned, but the material doesn't overlap with other public\ndocumentation. The goal is to provide details on the significant events\ninvolved in rendering a frame for output to help you make informed choices\nwhen designing an app. To achieve this, we work from the bottom up,\ndescribing how the UI classes work rather than how they can be used.\n\nThis section includes several pages covering everything from background\nmaterial to HAL details to use cases. It starts with an explanation of Android\ngraphics buffers, describes the composition and display mechanism, then proceeds\nto the higher-level mechanisms that supply the compositor with data. We\nrecommend reading pages in the order listed below rather than skipping to a\ntopic that sounds interesting.\n\nLow-level components\n--------------------\n\n- [BufferQueue and\n gralloc](/docs/core/graphics/arch-bq-gralloc). BufferQueue connects something that generates buffers of graphical data (the *producer* ) to something that accepts the data for display or further processing (the *consumer* ). Buffer allocations are performed through the *gralloc* memory allocator implemented through a vendor-specific HAL interface.\n- [SurfaceFlinger,\n Hardware Composer, and virtual displays](/docs/core/graphics/arch-sf-hwc). SurfaceFlinger accepts buffers of data from multiple sources, composites them, and sends them to the display. The Hardware Composer HAL (HWC) determines the most efficient way to composite buffers with the available hardware, and virtual displays make composited output available within the system (recording the screen or sending the screen over a network).\n- [Surface, canvas, and\n SurfaceHolder](/docs/core/graphics/arch-sh). A surface produces a buffer queue that is often consumed by SurfaceFlinger. When rendering onto a surface, the result ends up in a buffer that gets shipped to the consumer. Canvas APIs provide a software implementation (with hardware-acceleration support) for drawing directly on a surface (low-level alternative to OpenGL ES). Anything having to do with a view involves a SurfaceHolder, whose APIs enable getting and setting surface parameters such as size and format.\n- [EGLSurface and\n OpenGL ES](/docs/core/graphics/arch-egl-opengl). [OpenGL ES (GLES)](https://www.khronos.org/opengles/) defines a graphics-rendering API designed to be combined with [EGL](https://www.khronos.org/egl), a library that can create and access windows through the operating system (to draw textured polygons, use GLES calls; to put rendering on the screen, use EGL calls). This page also covers ANativeWindow, the C/C++ equivalent of the Java Surface class used to create an EGL window surface from native code.\n- [Vulkan](/docs/core/graphics/arch-vulkan). Vulkan is a low-overhead, cross-platform API for high-performance 3D graphics. Like OpenGL ES, Vulkan provides tools for creating high-quality, real-time graphics in apps. Vulkan advantages include reductions in CPU overhead and support for the [SPIR-V Binary Intermediate](https://www.khronos.org/spir) language.\n\nHigh-level components\n---------------------\n\n- [SurfaceView and\n GLSurfaceView](/docs/core/graphics/arch-sv-glsv). SurfaceView combines a surface and a view. SurfaceView's view components are composited by SurfaceFlinger (and not the app), enabling rendering from a separate thread/process and isolation from app UI rendering. GLSurfaceView provides helper classes to manage EGL contexts, interthread communication, and interaction with the activity lifecycle (but isn't required to use GLES).\n- [SurfaceTexture](/docs/core/graphics/arch-st). SurfaceTexture combines a surface and GLES texture to create a BufferQueue for which your app is the consumer. When a producer queues a new buffer, it notifies your app, which in turn releases the previously-held buffer, acquires the new buffer from the queue, and makes EGL calls to make the buffer available to GLES as an external texture. Android 7.0 added support for secure texture video playback enabling GPU post-processing of protected video content.\n- [TextureView](/docs/core/graphics/arch-tv). TextureView combines a view with a SurfaceTexture. TextureView wraps a SurfaceTexture and takes responsibility for responding to callbacks and acquiring new buffers. When drawing, TextureView uses the contents of the most recently received buffer as its data source, rendering wherever and however the view state indicates it should. View composition is always performed with GLES, meaning updates to contents may cause other view elements to redraw as well."]]