drivers/gpu/drm/meson/meson_osd_afbcd.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/meson/meson_osd_afbcd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/meson/meson_osd_afbcd.c- Extension
.c- Size
- 11217 bytes
- Lines
- 403
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hdrm/drm_print.hdrm/drm_fourcc.hmeson_drv.hmeson_registers.hmeson_viu.hmeson_rdma.hmeson_osd_afbcd.h
Detected Declarations
function Copyrightfunction meson_gxm_afbcd_supported_fmtfunction meson_gxm_afbcd_resetfunction meson_gxm_afbcd_initfunction meson_gxm_afbcd_exitfunction meson_gxm_afbcd_enablefunction meson_gxm_afbcd_disablefunction meson_gxm_afbcd_setupfunction meson_g12a_afbcd_pixel_fmtfunction meson_g12a_afbcd_bppfunction meson_g12a_afbcd_fmt_to_blk_modefunction meson_g12a_afbcd_supported_fmtfunction meson_g12a_afbcd_resetfunction meson_g12a_afbcd_initfunction meson_g12a_afbcd_exitfunction meson_g12a_afbcd_enablefunction meson_g12a_afbcd_disablefunction meson_g12a_afbcd_setup
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2019 BayLibre, SAS
* Author: Neil Armstrong <narmstrong@baylibre.com>
*/
#include <linux/bitfield.h>
#include <drm/drm_print.h>
#include <drm/drm_fourcc.h>
#include "meson_drv.h"
#include "meson_registers.h"
#include "meson_viu.h"
#include "meson_rdma.h"
#include "meson_osd_afbcd.h"
/*
* DOC: Driver for the ARM FrameBuffer Compression Decoders
*
* The Amlogic GXM and G12A SoC families embeds an AFBC Decoder,
* to decode compressed buffers generated by the ARM Mali GPU.
*
* For the GXM Family, Amlogic designed their own Decoder, named in
* the vendor source as "MESON_AFBC", and a single decoder is available
* for the 2 OSD planes.
* This decoder is compatible with the AFBC 1.0 specifications and the
* Mali T820 GPU capabilities.
* It supports :
* - basic AFBC buffer for RGB32 only, thus YTR feature is mandatory
* - SPARSE layout and SPLIT layout
* - only 16x16 superblock
*
* The decoder reads the data from the SDRAM, decodes and sends the
* decoded pixel stream to the OSD1 Plane pixel composer.
*
* For the G12A Family, Amlogic integrated an ARM AFBC Decoder, named
* in the vendor source as "MALI_AFBC", and the decoder can decode up
* to 4 surfaces, one for each of the 4 available OSDs.
* This decoder is compatible with the AFBC 1.2 specifications for the
* Mali G31 and G52 GPUs.
* Is supports :
* - basic AFBC buffer for multiple RGB and YUV pixel formats
* - SPARSE layout and SPLIT layout
* - 16x16 and 32x8 "wideblk" superblocks
* - Tiled header
*
* The ARM AFBC Decoder independent from the VPU Pixel Pipeline, so
* the ARM AFBC Decoder reads the data from the SDRAM then decodes
* into a private internal physical address where the OSD1 Plane pixel
* composer unpacks the decoded data.
*/
/* Amlogic AFBC Decoder for GXM Family */
#define OSD1_AFBCD_RGB32 0x15
static int meson_gxm_afbcd_pixel_fmt(u64 modifier, uint32_t format)
{
switch (format) {
case DRM_FORMAT_XBGR8888:
case DRM_FORMAT_ABGR8888:
return OSD1_AFBCD_RGB32;
/* TOFIX support mode formats */
default:
DRM_DEBUG("unsupported afbc format[%08x]\n", format);
return -EINVAL;
}
}
static bool meson_gxm_afbcd_supported_fmt(u64 modifier, uint32_t format)
{
if (modifier & AFBC_FORMAT_MOD_BLOCK_SIZE_32x8)
return false;
if (!(modifier & AFBC_FORMAT_MOD_YTR))
return false;
return meson_gxm_afbcd_pixel_fmt(modifier, format) >= 0;
}
static int meson_gxm_afbcd_reset(struct meson_drm *priv)
{
writel_relaxed(VIU_SW_RESET_OSD1_AFBCD,
priv->io_base + _REG(VIU_SW_RESET));
writel_relaxed(0, priv->io_base + _REG(VIU_SW_RESET));
return 0;
}
Annotation
- Immediate include surface: `linux/bitfield.h`, `drm/drm_print.h`, `drm/drm_fourcc.h`, `meson_drv.h`, `meson_registers.h`, `meson_viu.h`, `meson_rdma.h`, `meson_osd_afbcd.h`.
- Detected declarations: `function Copyright`, `function meson_gxm_afbcd_supported_fmt`, `function meson_gxm_afbcd_reset`, `function meson_gxm_afbcd_init`, `function meson_gxm_afbcd_exit`, `function meson_gxm_afbcd_enable`, `function meson_gxm_afbcd_disable`, `function meson_gxm_afbcd_setup`, `function meson_g12a_afbcd_pixel_fmt`, `function meson_g12a_afbcd_bpp`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.