From 76255024cadbe8c40462953f8193d2d78cd3b0ac Mon Sep 17 00:00:00 2001 From: Gary Bisson Date: Tue, 20 Jan 2026 12:36:59 +0100 Subject: drm/mediatek: mtk_dsi: enable hs clock during pre-enable Some bridges, such as the TI SN65DSI83, require the HS clock to be running in order to lock its PLL during its own pre-enable function. Without this change, the bridge gives the following error: sn65dsi83 14-002c: failed to lock PLL, ret=-110 sn65dsi83 14-002c: Unexpected link status 0x01 sn65dsi83 14-002c: reset the pipe Move the necessary functions from enable to pre-enable. Signed-off-by: Gary Bisson Reviewed-by: CK Hu Tested-by: Chen-Yu Tsai # Chromebooks Tested-by: AngeloGioacchino Del Regno Reviewed-by: AngeloGioacchino Del Regno Link: https://patchwork.kernel.org/project/dri-devel/patch/20260120-mtkdsi-v1-1-b0f4094f3ac3@gmail.com/ Signed-off-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_dsi.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'drivers/gpu/drm/mediatek') diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 17c67f02016b..a7c184b45bfa 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -673,6 +673,21 @@ static s32 mtk_dsi_switch_to_cmd_mode(struct mtk_dsi *dsi, u8 irq_flag, u32 t) } } +static void mtk_dsi_lane_ready(struct mtk_dsi *dsi) +{ + if (!dsi->lanes_ready) { + dsi->lanes_ready = true; + mtk_dsi_rxtx_control(dsi); + usleep_range(30, 100); + mtk_dsi_reset_dphy(dsi); + mtk_dsi_clk_ulp_mode_leave(dsi); + mtk_dsi_lane0_ulp_mode_leave(dsi); + mtk_dsi_clk_hs_mode(dsi, 0); + usleep_range(1000, 3000); + /* The reaction time after pulling up the mipi signal for dsi_rx */ + } +} + static int mtk_dsi_poweron(struct mtk_dsi *dsi) { struct device *dev = dsi->host.dev; @@ -725,6 +740,8 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi) mtk_dsi_set_vm_cmd(dsi); mtk_dsi_config_vdo_timing(dsi); mtk_dsi_set_interrupt_enable(dsi); + mtk_dsi_lane_ready(dsi); + mtk_dsi_clk_hs_mode(dsi, 1); return 0; err_disable_engine_clk: @@ -770,30 +787,12 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) dsi->lanes_ready = false; } -static void mtk_dsi_lane_ready(struct mtk_dsi *dsi) -{ - if (!dsi->lanes_ready) { - dsi->lanes_ready = true; - mtk_dsi_rxtx_control(dsi); - usleep_range(30, 100); - mtk_dsi_reset_dphy(dsi); - mtk_dsi_clk_ulp_mode_leave(dsi); - mtk_dsi_lane0_ulp_mode_leave(dsi); - mtk_dsi_clk_hs_mode(dsi, 0); - usleep_range(1000, 3000); - /* The reaction time after pulling up the mipi signal for dsi_rx */ - } -} - static void mtk_output_dsi_enable(struct mtk_dsi *dsi) { if (dsi->enabled) return; - mtk_dsi_lane_ready(dsi); mtk_dsi_set_mode(dsi); - mtk_dsi_clk_hs_mode(dsi, 1); - mtk_dsi_start(dsi); dsi->enabled = true; -- cgit v1.2.3 From 86d5f60dea00a56ed3da9612028f930d78336adf Mon Sep 17 00:00:00 2001 From: Luca Leonardo Scorcia Date: Thu, 12 Feb 2026 19:22:47 +0000 Subject: drm/mediatek: Remove all conflicting aperture devices during probe If a device has a framebuffer available it might be already used as display by simple-framebuffer or simpledrm when mediatek-drm is probed. This is actually helpful when porting to a new device as framebuffers are simple to setup in device trees and fbcon can be used to monitor the kernel boot process. When drm-mediatek loads a new fb device is initialized, however fbcon remains attached to the initial framebuffer which is no longer connected to the actual display - the early fb is never removed. We can gracefully transition from framebuffer handling to drm-managed display by calling aperture_remove_all_conflicting_devices before registering mediatek-drm. This takes care of unloading other fb devices/drivers and disconnects fbcon which then automatically reconnects to mediatekdrmfb as soon as it's available. The function is invoked just before drm_dev_register() to kick out the existing framebuffer as late as possible to reduce the time the screen is unresponsive. Signed-off-by: Luca Leonardo Scorcia Reviewed-by: CK Hu Link: https://patchwork.kernel.org/project/dri-devel/patch/20260212192605.263160-1-l.scorcia@gmail.com/ Signed-off-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/gpu/drm/mediatek') diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index a94c51a83261..02effd9fc698 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -4,6 +4,7 @@ * Author: YT SHEN */ +#include #include #include #include @@ -670,6 +671,10 @@ static int mtk_drm_bind(struct device *dev) if (ret < 0) goto err_free; + ret = aperture_remove_all_conflicting_devices(DRIVER_NAME); + if (ret < 0) + dev_err(dev, "Error %d while removing conflicting aperture devices", ret); + ret = drm_dev_register(drm, 0); if (ret < 0) goto err_deinit; -- cgit v1.2.3 From e1c3bc324407e82a616228ff70027408b2e26f91 Mon Sep 17 00:00:00 2001 From: Val Packett Date: Mon, 23 Feb 2026 16:22:50 +0000 Subject: drm/mediatek: ovl: Add specific entry for mt8167 While this configuration is otherwise identical to mt8173, according to Android kernel sources, this SoC does need smi_id_en. Signed-off-by: Val Packett Signed-off-by: Luca Leonardo Scorcia Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: CK Hu Link: https://patchwork.kernel.org/project/dri-devel/patch/5f880f1334aa93184afee3e36132ca42628821fb.1771863641.git.l.scorcia@gmail.com/ Signed-off-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers/gpu/drm/mediatek') diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c index e0236353d499..97a899e4bd99 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c @@ -671,6 +671,16 @@ static const struct mtk_disp_ovl_data mt2701_ovl_driver_data = { .num_formats = ARRAY_SIZE(mt8173_formats), }; +static const struct mtk_disp_ovl_data mt8167_ovl_driver_data = { + .addr = DISP_REG_OVL_ADDR_MT8173, + .gmc_bits = 8, + .layer_nr = 4, + .fmt_rgb565_is_0 = true, + .smi_id_en = true, + .formats = mt8173_formats, + .num_formats = ARRAY_SIZE(mt8173_formats), +}; + static const struct mtk_disp_ovl_data mt8173_ovl_driver_data = { .addr = DISP_REG_OVL_ADDR_MT8173, .gmc_bits = 8, @@ -742,6 +752,8 @@ static const struct mtk_disp_ovl_data mt8195_ovl_driver_data = { static const struct of_device_id mtk_disp_ovl_driver_dt_match[] = { { .compatible = "mediatek,mt2701-disp-ovl", .data = &mt2701_ovl_driver_data}, + { .compatible = "mediatek,mt8167-disp-ovl", + .data = &mt8167_ovl_driver_data}, { .compatible = "mediatek,mt8173-disp-ovl", .data = &mt8173_ovl_driver_data}, { .compatible = "mediatek,mt8183-disp-ovl", -- cgit v1.2.3 From e21b1a91430d5ff626a35f72951ed80268e26de6 Mon Sep 17 00:00:00 2001 From: Chen-Yu Tsai Date: Wed, 11 Mar 2026 17:49:27 +0800 Subject: drm/mediatek: Set dedicated DMA device and drop custom GEM callbacks In commit 9b54a32c7c6a ("drm/mediatek: mtk_gem: Partial refactor and use drm_gem_dma_object") the MediaTek DRM driver was refactored to use drm_gem_dma_object, but custom callbacks were still needed to deal with using the first device of the pipeline as the DMA device, instead of the MMSYS device that the DRM driver binds to. Turns out there is already partial support for dedicated DMA devices in the DRM subsystem for PRIME imports. The preceding patches add support for dedicated DMA devices to the GEM DMA helpers. This allows us to just set the dedicated DMA device for the DRM device, and drop all the custom GEM callbacks. Also drop the .dma_dev field from the driver private data as it is no longer needed. There are slight differences in the mmap helper: the VM_DONTDUMP and VM_IO flags are no longer set. Both were lifted from drm_gem_mmap_obj(). VM_IO probably doesn't make sense since the buffer is allocated using dma_alloc_attrs(). Reviewed-by: Thomas Zimmermann Acked-by: Chun-Kuang Hu Reviewed-by: AngeloGioacchino Del Regno Link: https://patch.msgid.link/20260311094929.3393338-4-wenst@chromium.org Signed-off-by: Chen-Yu Tsai --- drivers/gpu/drm/mediatek/Makefile | 1 - drivers/gpu/drm/mediatek/mtk_crtc.c | 1 - drivers/gpu/drm/mediatek/mtk_drm_drv.c | 21 +-- drivers/gpu/drm/mediatek/mtk_drm_drv.h | 1 - drivers/gpu/drm/mediatek/mtk_gem.c | 231 --------------------------------- drivers/gpu/drm/mediatek/mtk_gem.h | 17 --- 6 files changed, 3 insertions(+), 269 deletions(-) delete mode 100644 drivers/gpu/drm/mediatek/mtk_gem.c delete mode 100644 drivers/gpu/drm/mediatek/mtk_gem.h (limited to 'drivers/gpu/drm/mediatek') diff --git a/drivers/gpu/drm/mediatek/Makefile b/drivers/gpu/drm/mediatek/Makefile index e0ac49b07d50..952d294642fb 100644 --- a/drivers/gpu/drm/mediatek/Makefile +++ b/drivers/gpu/drm/mediatek/Makefile @@ -14,7 +14,6 @@ mediatek-drm-y := mtk_crtc.o \ mtk_dsi.o \ mtk_dpi.o \ mtk_ethdr.o \ - mtk_gem.o \ mtk_mdp_rdma.o \ mtk_padding.o \ mtk_plane.o diff --git a/drivers/gpu/drm/mediatek/mtk_crtc.c b/drivers/gpu/drm/mediatek/mtk_crtc.c index 351d58c50b84..fcb16f3f7b23 100644 --- a/drivers/gpu/drm/mediatek/mtk_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_crtc.c @@ -23,7 +23,6 @@ #include "mtk_crtc.h" #include "mtk_ddp_comp.h" #include "mtk_drm_drv.h" -#include "mtk_gem.h" #include "mtk_plane.h" /* diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index a94c51a83261..6f6db2e1980e 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -29,7 +30,6 @@ #include "mtk_ddp_comp.h" #include "mtk_disp_drv.h" #include "mtk_drm_drv.h" -#include "mtk_gem.h" #define DRIVER_NAME "mediatek" #define DRIVER_DESC "Mediatek SoC DRM" @@ -565,8 +565,7 @@ static int mtk_drm_kms_init(struct drm_device *drm) goto err_component_unbind; } - for (i = 0; i < private->data->mmsys_dev_num; i++) - private->all_drm_private[i]->dma_dev = dma_dev; + drm_dev_set_dma_dev(drm, dma_dev); /* * Configure the DMA segment size to make sure we get contiguous IOVA @@ -600,26 +599,12 @@ static void mtk_drm_kms_deinit(struct drm_device *drm) DEFINE_DRM_GEM_FOPS(mtk_drm_fops); -/* - * We need to override this because the device used to import the memory is - * not dev->dev, as drm_gem_prime_import() expects. - */ -static struct drm_gem_object *mtk_gem_prime_import(struct drm_device *dev, - struct dma_buf *dma_buf) -{ - struct mtk_drm_private *private = dev->dev_private; - - return drm_gem_prime_import_dev(dev, dma_buf, private->dma_dev); -} - static const struct drm_driver mtk_drm_driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC, - .dumb_create = mtk_gem_dumb_create, + DRM_GEM_DMA_DRIVER_OPS, DRM_FBDEV_DMA_DRIVER_OPS, - .gem_prime_import = mtk_gem_prime_import, - .gem_prime_import_sg_table = mtk_gem_prime_import_sg_table, .fops = &mtk_drm_fops, .name = DRIVER_NAME, diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h index 675cdc90a440..1fc3df4b5485 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h @@ -54,7 +54,6 @@ struct mtk_mmsys_driver_data { struct mtk_drm_private { struct drm_device *drm; - struct device *dma_dev; bool mtk_drm_bound; bool drm_master; struct device *dev; diff --git a/drivers/gpu/drm/mediatek/mtk_gem.c b/drivers/gpu/drm/mediatek/mtk_gem.c deleted file mode 100644 index f059a1452220..000000000000 --- a/drivers/gpu/drm/mediatek/mtk_gem.c +++ /dev/null @@ -1,231 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (c) 2015 MediaTek Inc. - * Copyright (c) 2025 Collabora Ltd. - * AngeloGioacchino Del Regno - */ - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "mtk_drm_drv.h" -#include "mtk_gem.h" - -static int mtk_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma); - -static void mtk_gem_free_object(struct drm_gem_object *obj) -{ - struct drm_gem_dma_object *dma_obj = to_drm_gem_dma_obj(obj); - struct mtk_drm_private *priv = obj->dev->dev_private; - - if (dma_obj->sgt) - drm_prime_gem_destroy(obj, dma_obj->sgt); - else - dma_free_wc(priv->dma_dev, dma_obj->base.size, - dma_obj->vaddr, dma_obj->dma_addr); - - /* release file pointer to gem object. */ - drm_gem_object_release(obj); - - kfree(dma_obj); -} - -/* - * Allocate a sg_table for this GEM object. - * Note: Both the table's contents, and the sg_table itself must be freed by - * the caller. - * Returns a pointer to the newly allocated sg_table, or an ERR_PTR() error. - */ -static struct sg_table *mtk_gem_prime_get_sg_table(struct drm_gem_object *obj) -{ - struct drm_gem_dma_object *dma_obj = to_drm_gem_dma_obj(obj); - struct mtk_drm_private *priv = obj->dev->dev_private; - struct sg_table *sgt; - int ret; - - sgt = kzalloc_obj(*sgt); - if (!sgt) - return ERR_PTR(-ENOMEM); - - ret = dma_get_sgtable(priv->dma_dev, sgt, dma_obj->vaddr, - dma_obj->dma_addr, obj->size); - if (ret) { - DRM_ERROR("failed to allocate sgt, %d\n", ret); - kfree(sgt); - return ERR_PTR(ret); - } - - return sgt; -} - -static const struct drm_gem_object_funcs mtk_gem_object_funcs = { - .free = mtk_gem_free_object, - .print_info = drm_gem_dma_object_print_info, - .get_sg_table = mtk_gem_prime_get_sg_table, - .vmap = drm_gem_dma_object_vmap, - .mmap = mtk_gem_object_mmap, - .vm_ops = &drm_gem_dma_vm_ops, -}; - -static struct drm_gem_dma_object *mtk_gem_init(struct drm_device *dev, - unsigned long size, bool private) -{ - struct drm_gem_dma_object *dma_obj; - int ret; - - size = round_up(size, PAGE_SIZE); - - if (size == 0) - return ERR_PTR(-EINVAL); - - dma_obj = kzalloc_obj(*dma_obj); - if (!dma_obj) - return ERR_PTR(-ENOMEM); - - dma_obj->base.funcs = &mtk_gem_object_funcs; - - if (private) { - ret = 0; - drm_gem_private_object_init(dev, &dma_obj->base, size); - } else { - ret = drm_gem_object_init(dev, &dma_obj->base, size); - } - if (ret) { - DRM_ERROR("failed to initialize gem object\n"); - kfree(dma_obj); - return ERR_PTR(ret); - } - - return dma_obj; -} - -static struct drm_gem_dma_object *mtk_gem_create(struct drm_device *dev, size_t size) -{ - struct mtk_drm_private *priv = dev->dev_private; - struct drm_gem_dma_object *dma_obj; - struct drm_gem_object *obj; - int ret; - - dma_obj = mtk_gem_init(dev, size, false); - if (IS_ERR(dma_obj)) - return ERR_CAST(dma_obj); - - obj = &dma_obj->base; - - dma_obj->vaddr = dma_alloc_wc(priv->dma_dev, obj->size, - &dma_obj->dma_addr, - GFP_KERNEL | __GFP_NOWARN); - if (!dma_obj->vaddr) { - DRM_ERROR("failed to allocate %zx byte dma buffer", obj->size); - ret = -ENOMEM; - goto err_gem_free; - } - - DRM_DEBUG_DRIVER("vaddr = %p dma_addr = %pad size = %zu\n", - dma_obj->vaddr, &dma_obj->dma_addr, - size); - - return dma_obj; - -err_gem_free: - drm_gem_object_release(obj); - kfree(dma_obj); - return ERR_PTR(ret); -} - -int mtk_gem_dumb_create(struct drm_file *file_priv, struct drm_device *dev, - struct drm_mode_create_dumb *args) -{ - struct drm_gem_dma_object *dma_obj; - int ret; - - args->pitch = DIV_ROUND_UP(args->width * args->bpp, 8); - - /* - * Multiply 2 variables of different types, - * for example: args->size = args->spacing * args->height; - * may cause coverity issue with unintentional overflow. - */ - args->size = args->pitch; - args->size *= args->height; - - dma_obj = mtk_gem_create(dev, args->size); - if (IS_ERR(dma_obj)) - return PTR_ERR(dma_obj); - - /* - * allocate a id of idr table where the obj is registered - * and handle has the id what user can see. - */ - ret = drm_gem_handle_create(file_priv, &dma_obj->base, &args->handle); - if (ret) - goto err_handle_create; - - /* drop reference from allocate - handle holds it now. */ - drm_gem_object_put(&dma_obj->base); - - return 0; - -err_handle_create: - mtk_gem_free_object(&dma_obj->base); - return ret; -} - -static int mtk_gem_object_mmap(struct drm_gem_object *obj, - struct vm_area_struct *vma) - -{ - struct drm_gem_dma_object *dma_obj = to_drm_gem_dma_obj(obj); - struct mtk_drm_private *priv = obj->dev->dev_private; - int ret; - - /* - * Set vm_pgoff (used as a fake buffer offset by DRM) to 0 and map the - * whole buffer from the start. - */ - vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node); - - /* - * dma_alloc_attrs() allocated a struct page table for mtk_gem, so clear - * VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap(). - */ - vm_flags_mod(vma, VM_IO | VM_DONTEXPAND | VM_DONTDUMP, VM_PFNMAP); - - vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); - vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); - - ret = dma_mmap_wc(priv->dma_dev, vma, dma_obj->vaddr, - dma_obj->dma_addr, obj->size); - if (ret) - drm_gem_vm_close(vma); - - return ret; -} - -struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev, - struct dma_buf_attachment *attach, struct sg_table *sgt) -{ - struct drm_gem_dma_object *dma_obj; - - /* check if the entries in the sg_table are contiguous */ - if (drm_prime_get_contiguous_size(sgt) < attach->dmabuf->size) { - DRM_ERROR("sg_table is not contiguous"); - return ERR_PTR(-EINVAL); - } - - dma_obj = mtk_gem_init(dev, attach->dmabuf->size, true); - if (IS_ERR(dma_obj)) - return ERR_CAST(dma_obj); - - dma_obj->dma_addr = sg_dma_address(sgt->sgl); - dma_obj->sgt = sgt; - - return &dma_obj->base; -} diff --git a/drivers/gpu/drm/mediatek/mtk_gem.h b/drivers/gpu/drm/mediatek/mtk_gem.h deleted file mode 100644 index afebc3a970a8..000000000000 --- a/drivers/gpu/drm/mediatek/mtk_gem.h +++ /dev/null @@ -1,17 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2015 MediaTek Inc. - */ - -#ifndef _MTK_GEM_H_ -#define _MTK_GEM_H_ - -#include -#include - -int mtk_gem_dumb_create(struct drm_file *file_priv, struct drm_device *dev, - struct drm_mode_create_dumb *args); -struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev, - struct dma_buf_attachment *attach, struct sg_table *sg); - -#endif -- cgit v1.2.3 From ae56d616106286afad0de7226c29e11fe6492f63 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Thu, 5 Mar 2026 10:05:03 +0100 Subject: drm/mediatek: dp: Convert to drm_output_color_format Now that we introduced a new drm_output_color_format enum to represent what DRM_COLOR_FORMAT_* bits were representing, we can switch to the new enum. The main difference is that while DRM_COLOR_FORMAT_ was a bitmask, drm_output_color_format is a proper enum. However, the enum was done is such a way than DRM_COLOR_FORMAT_X = BIT(DRM_OUTPUT_COLOR_FORMAT_X) so the transitition is easier. The only thing we need to consider is if the original code meant to use that value as a bitmask, in which case we do need to keep the bit shift, or as a discriminant in which case we don't. Reviewed-by: Philipp Zabel Acked-by: Jani Nikula Acked-by: Chun-Kuang Hu Link: https://lore.kernel.org/r/20260305-drm-rework-color-formats-v3-11-f3935f6db579@kernel.org Signed-off-by: Maxime Ripard --- drivers/gpu/drm/mediatek/mtk_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/drm/mediatek') diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c index 08c4d64b87b9..c52cc7c2e200 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -2454,7 +2454,7 @@ mtk_dp_bridge_mode_valid(struct drm_bridge *bridge, const struct drm_display_mode *mode) { struct mtk_dp *mtk_dp = mtk_dp_from_bridge(bridge); - u32 bpp = info->color_formats & DRM_COLOR_FORMAT_YCBCR422 ? 16 : 24; + u32 bpp = info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422) ? 16 : 24; u32 lane_count_min = mtk_dp->train_info.lane_count; u32 rate = drm_dp_bw_code_to_link_rate(mtk_dp->train_info.link_rate) * lane_count_min; @@ -2521,7 +2521,7 @@ static u32 *mtk_dp_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, */ if (((rate * 97 / 100) < (mode->clock * 24 / 8)) && ((rate * 97 / 100) > (mode->clock * 16 / 8)) && - (display_info->color_formats & DRM_COLOR_FORMAT_YCBCR422)) { + (display_info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422))) { input_fmts = kcalloc(1, sizeof(*input_fmts), GFP_KERNEL); if (!input_fmts) return NULL; -- cgit v1.2.3 From 00cf406a0abe7cdf61d899d218520f6bc0414979 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Thu, 5 Mar 2026 10:05:06 +0100 Subject: drm/display: hdmi: Use drm_output_color_format instead of hdmi_colorspace The hdmi_colorspace enum was defined to represent the colorspace value of the HDMI infoframes. It was later used by some HDMI drivers to express the output format they should be setting up. During the introduction of the HDMI helpers, it then was used to represent it in the drm_connector_hdmi_state structure. However, it's always been somewhat redundant with the DRM_COLOR_FORMAT_* defines, and now with the drm_output_color_format enum. Let's consolidate around drm_output_color_format in drm_connector_hdmi_state to facilitate the current effort to provide a global output format selection mechanism. Acked-by: Jani Nikula Reviewed-by: Nicolas Frattaroli Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20260305-drm-rework-color-formats-v3-14-f3935f6db579@kernel.org Signed-off-by: Maxime Ripard --- drivers/gpu/drm/bridge/inno-hdmi.c | 6 +- drivers/gpu/drm/bridge/ite-it6263.c | 2 +- drivers/gpu/drm/display/drm_bridge_connector.c | 4 +- drivers/gpu/drm/display/drm_hdmi_helper.c | 7 +- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 52 ++++-- drivers/gpu/drm/drm_bridge.c | 2 +- drivers/gpu/drm/drm_connector.c | 16 +- drivers/gpu/drm/mediatek/mtk_hdmi_v2.c | 8 +- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 2 +- drivers/gpu/drm/tests/drm_connector_test.c | 80 ++++----- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 182 ++++++++++----------- drivers/gpu/drm/vc4/vc4_hdmi.c | 18 +- drivers/gpu/drm/vc4/vc4_hdmi.h | 2 +- include/drm/bridge/dw_hdmi_qp.h | 2 +- include/drm/display/drm_hdmi_helper.h | 3 +- include/drm/drm_bridge.h | 5 +- include/drm/drm_connector.h | 9 +- 17 files changed, 213 insertions(+), 187 deletions(-) (limited to 'drivers/gpu/drm/mediatek') diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c index a26b99b101c4..87422d15d9a2 100644 --- a/drivers/gpu/drm/bridge/inno-hdmi.c +++ b/drivers/gpu/drm/bridge/inno-hdmi.c @@ -653,7 +653,7 @@ static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi, v_VIDEO_INPUT_CSP(0); hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL2, value); - if (conn_state->hdmi.output_format == HDMI_COLORSPACE_RGB) { + if (conn_state->hdmi.output_format == DRM_OUTPUT_COLOR_FORMAT_RGB444) { if (conn_state->hdmi.is_limited_range) { csc_mode = CSC_RGB_0_255_TO_RGB_16_235_8BIT; auto_csc = AUTO_CSC_DISABLE; @@ -672,14 +672,14 @@ static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi, } } else { if (colorimetry == HDMI_COLORIMETRY_ITU_601) { - if (conn_state->hdmi.output_format == HDMI_COLORSPACE_YUV444) { + if (conn_state->hdmi.output_format == DRM_OUTPUT_COLOR_FORMAT_YCBCR444) { csc_mode = CSC_RGB_0_255_TO_ITU601_16_235_8BIT; auto_csc = AUTO_CSC_DISABLE; c0_c2_change = C0_C2_CHANGE_DISABLE; csc_enable = v_CSC_ENABLE; } } else { - if (conn_state->hdmi.output_format == HDMI_COLORSPACE_YUV444) { + if (conn_state->hdmi.output_format == DRM_OUTPUT_COLOR_FORMAT_YCBCR444) { csc_mode = CSC_RGB_0_255_TO_ITU709_16_235_8BIT; auto_csc = AUTO_CSC_DISABLE; c0_c2_change = C0_C2_CHANGE_DISABLE; diff --git a/drivers/gpu/drm/bridge/ite-it6263.c b/drivers/gpu/drm/bridge/ite-it6263.c index e77681047bb2..4f3ebb7af4d4 100644 --- a/drivers/gpu/drm/bridge/ite-it6263.c +++ b/drivers/gpu/drm/bridge/ite-it6263.c @@ -666,7 +666,7 @@ it6263_bridge_mode_valid(struct drm_bridge *bridge, { unsigned long long rate; - rate = drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(mode, 8, DRM_OUTPUT_COLOR_FORMAT_RGB444); if (rate == 0) return MODE_NOCLOCK; diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c index f686aa5c0ed9..39cc18f78eda 100644 --- a/drivers/gpu/drm/display/drm_bridge_connector.c +++ b/drivers/gpu/drm/display/drm_bridge_connector.c @@ -789,7 +789,7 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, struct drm_connector *connector; struct i2c_adapter *ddc = NULL; struct drm_bridge *panel_bridge __free(drm_bridge_put) = NULL; - unsigned int supported_formats = BIT(HDMI_COLORSPACE_RGB); + unsigned int supported_formats = BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444); unsigned int max_bpc = 8; bool support_hdcp = false; int connector_type; @@ -960,7 +960,7 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, if (bridge_connector->bridge_hdmi) { if (!connector->ycbcr_420_allowed) - supported_formats &= ~BIT(HDMI_COLORSPACE_YUV420); + supported_formats &= ~BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420); bridge_connector->hdmi_funcs = drm_bridge_connector_hdmi_funcs; diff --git a/drivers/gpu/drm/display/drm_hdmi_helper.c b/drivers/gpu/drm/display/drm_hdmi_helper.c index a237dc55805d..5cb0b033b171 100644 --- a/drivers/gpu/drm/display/drm_hdmi_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_helper.c @@ -210,7 +210,8 @@ EXPORT_SYMBOL(drm_hdmi_avi_infoframe_content_type); */ unsigned long long drm_hdmi_compute_mode_clock(const struct drm_display_mode *mode, - unsigned int bpc, enum hdmi_colorspace fmt) + unsigned int bpc, + enum drm_output_color_format fmt) { unsigned long long clock = mode->clock * 1000ULL; unsigned int vic = drm_match_cea_mode(mode); @@ -222,7 +223,7 @@ drm_hdmi_compute_mode_clock(const struct drm_display_mode *mode, if (vic == 1 && bpc != 8) return 0; - if (fmt == HDMI_COLORSPACE_YUV422) { + if (fmt == DRM_OUTPUT_COLOR_FORMAT_YCBCR422) { /* * HDMI 1.0 Spec, section 6.5 - Pixel Encoding states that * YUV422 sends 24 bits over three channels, with Cb and Cr @@ -248,7 +249,7 @@ drm_hdmi_compute_mode_clock(const struct drm_display_mode *mode, * specifies that YUV420 encoding is carried at a TMDS Character Rate * equal to half the pixel clock rate. */ - if (fmt == HDMI_COLORSPACE_YUV420) + if (fmt == DRM_OUTPUT_COLOR_FORMAT_YCBCR420) clock = clock / 2; if (mode->flags & DRM_MODE_FLAG_DBLCLK) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c index f2aec6f65e7a..9f3b696aceeb 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -326,6 +326,25 @@ void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector *connector, } EXPORT_SYMBOL(__drm_atomic_helper_connector_hdmi_reset); +static enum hdmi_colorspace +output_color_format_to_hdmi_colorspace(const struct drm_connector *connector, + enum drm_output_color_format fmt) +{ + switch (fmt) { + case DRM_OUTPUT_COLOR_FORMAT_YCBCR420: + return HDMI_COLORSPACE_YUV420; + case DRM_OUTPUT_COLOR_FORMAT_YCBCR422: + return HDMI_COLORSPACE_YUV422; + case DRM_OUTPUT_COLOR_FORMAT_YCBCR444: + return HDMI_COLORSPACE_YUV444; + default: + drm_warn(connector->dev, "Unsupported output color format. Defaulting to RGB."); + fallthrough; + case DRM_OUTPUT_COLOR_FORMAT_RGB444: + return HDMI_COLORSPACE_RGB; + } +} + static const struct drm_display_mode * connector_state_get_mode(const struct drm_connector_state *conn_state) { @@ -360,7 +379,7 @@ static bool hdmi_is_limited_range(const struct drm_connector *connector, * i915 just assumes limited range for YCbCr output, so let's * just do the same. */ - if (conn_state->hdmi.output_format != HDMI_COLORSPACE_RGB) + if (conn_state->hdmi.output_format != DRM_OUTPUT_COLOR_FORMAT_RGB444) return true; if (conn_state->hdmi.broadcast_rgb == DRM_HDMI_BROADCAST_RGB_FULL) @@ -379,7 +398,8 @@ static bool sink_supports_format_bpc(const struct drm_connector *connector, const struct drm_display_info *info, const struct drm_display_mode *mode, - unsigned int format, unsigned int bpc) + enum drm_output_color_format format, + unsigned int bpc) { struct drm_device *dev = connector->dev; u8 vic = drm_match_cea_mode(mode); @@ -400,7 +420,7 @@ sink_supports_format_bpc(const struct drm_connector *connector, } if (!info->is_hdmi && - (format != HDMI_COLORSPACE_RGB || bpc != 8)) { + (format != DRM_OUTPUT_COLOR_FORMAT_RGB444 || bpc != 8)) { drm_dbg_kms(dev, "DVI Monitors require an RGB output at 8 bpc\n"); return false; } @@ -411,13 +431,13 @@ sink_supports_format_bpc(const struct drm_connector *connector, return false; } - if (drm_mode_is_420_only(info, mode) && format != HDMI_COLORSPACE_YUV420) { + if (drm_mode_is_420_only(info, mode) && format != DRM_OUTPUT_COLOR_FORMAT_YCBCR420) { drm_dbg_kms(dev, "Mode can be only supported in YUV420 format.\n"); return false; } switch (format) { - case HDMI_COLORSPACE_RGB: + case DRM_OUTPUT_COLOR_FORMAT_RGB444: drm_dbg_kms(dev, "RGB Format, checking the constraints.\n"); /* @@ -445,7 +465,7 @@ sink_supports_format_bpc(const struct drm_connector *connector, return true; - case HDMI_COLORSPACE_YUV420: + case DRM_OUTPUT_COLOR_FORMAT_YCBCR420: drm_dbg_kms(dev, "YUV420 format, checking the constraints.\n"); if (!(info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420))) { @@ -477,7 +497,7 @@ sink_supports_format_bpc(const struct drm_connector *connector, return true; - case HDMI_COLORSPACE_YUV422: + case DRM_OUTPUT_COLOR_FORMAT_YCBCR422: drm_dbg_kms(dev, "YUV422 format, checking the constraints.\n"); if (!(info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422))) { @@ -500,7 +520,7 @@ sink_supports_format_bpc(const struct drm_connector *connector, return true; - case HDMI_COLORSPACE_YUV444: + case DRM_OUTPUT_COLOR_FORMAT_YCBCR444: drm_dbg_kms(dev, "YUV444 format, checking the constraints.\n"); if (!(info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444))) { @@ -553,7 +573,7 @@ static int hdmi_compute_clock(const struct drm_connector *connector, struct drm_connector_state *conn_state, const struct drm_display_mode *mode, - unsigned int bpc, enum hdmi_colorspace fmt) + unsigned int bpc, enum drm_output_color_format fmt) { enum drm_mode_status status; unsigned long long clock; @@ -575,7 +595,7 @@ static bool hdmi_try_format_bpc(const struct drm_connector *connector, struct drm_connector_state *conn_state, const struct drm_display_mode *mode, - unsigned int bpc, enum hdmi_colorspace fmt) + unsigned int bpc, enum drm_output_color_format fmt) { const struct drm_display_info *info = &connector->display_info; struct drm_device *dev = connector->dev; @@ -611,7 +631,7 @@ static int hdmi_compute_format_bpc(const struct drm_connector *connector, struct drm_connector_state *conn_state, const struct drm_display_mode *mode, - unsigned int max_bpc, enum hdmi_colorspace fmt) + unsigned int max_bpc, enum drm_output_color_format fmt) { struct drm_device *dev = connector->dev; unsigned int bpc; @@ -652,12 +672,12 @@ hdmi_compute_config(const struct drm_connector *connector, int ret; ret = hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc, - HDMI_COLORSPACE_RGB); + DRM_OUTPUT_COLOR_FORMAT_RGB444); if (ret) { if (connector->ycbcr_420_allowed) { ret = hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc, - HDMI_COLORSPACE_YUV420); + DRM_OUTPUT_COLOR_FORMAT_YCBCR420); if (ret) drm_dbg_kms(connector->dev, "YUV420 output format doesn't work.\n"); @@ -691,7 +711,9 @@ static int hdmi_generate_avi_infoframe(const struct drm_connector *connector, if (ret) return ret; - frame->colorspace = conn_state->hdmi.output_format; + frame->colorspace = + output_color_format_to_hdmi_colorspace(connector, + conn_state->hdmi.output_format); /* * FIXME: drm_hdmi_avi_infoframe_quant_range() doesn't handle @@ -889,7 +911,7 @@ drm_hdmi_connector_mode_valid(struct drm_connector *connector, { unsigned long long clock; - clock = drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); + clock = drm_hdmi_compute_mode_clock(mode, 8, DRM_OUTPUT_COLOR_FORMAT_RGB444); if (!clock) return MODE_ERROR; diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 30d957675d87..1c2903c6e44b 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -421,7 +421,7 @@ void drm_bridge_add(struct drm_bridge *bridge) if (bridge->ops & DRM_BRIDGE_OP_HDMI) bridge->ycbcr_420_allowed = !!(bridge->supported_formats & - BIT(HDMI_COLORSPACE_YUV420)); + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420)); mutex_lock(&bridge_lock); list_add_tail(&bridge->list, &bridge_list); diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index e70699c59c43..47dc53c4a738 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -552,7 +552,7 @@ EXPORT_SYMBOL(drmm_connector_init); * @hdmi_funcs: HDMI-related callbacks for this connector * @connector_type: user visible type of the connector * @ddc: optional pointer to the associated ddc adapter - * @supported_formats: Bitmask of @hdmi_colorspace listing supported output formats + * @supported_formats: Bitmask of @drm_output_color_format listing supported output formats * @max_bpc: Maximum bits per char the HDMI connector supports * * Initialises a preallocated HDMI connector. Connectors can be @@ -591,10 +591,10 @@ int drmm_connector_hdmi_init(struct drm_device *dev, connector_type == DRM_MODE_CONNECTOR_HDMIB)) return -EINVAL; - if (!supported_formats || !(supported_formats & BIT(HDMI_COLORSPACE_RGB))) + if (!supported_formats || !(supported_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444))) return -EINVAL; - if (connector->ycbcr_420_allowed != !!(supported_formats & BIT(HDMI_COLORSPACE_YUV420))) + if (connector->ycbcr_420_allowed != !!(supported_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420))) return -EINVAL; if (!(max_bpc == 8 || max_bpc == 10 || max_bpc == 12)) @@ -1431,10 +1431,10 @@ drm_hdmi_connector_get_broadcast_rgb_name(enum drm_hdmi_broadcast_rgb broadcast_ EXPORT_SYMBOL(drm_hdmi_connector_get_broadcast_rgb_name); static const char * const output_format_str[] = { - [HDMI_COLORSPACE_RGB] = "RGB", - [HDMI_COLORSPACE_YUV420] = "YUV 4:2:0", - [HDMI_COLORSPACE_YUV422] = "YUV 4:2:2", - [HDMI_COLORSPACE_YUV444] = "YUV 4:4:4", + [DRM_OUTPUT_COLOR_FORMAT_RGB444] = "RGB", + [DRM_OUTPUT_COLOR_FORMAT_YCBCR420] = "YUV 4:2:0", + [DRM_OUTPUT_COLOR_FORMAT_YCBCR422] = "YUV 4:2:2", + [DRM_OUTPUT_COLOR_FORMAT_YCBCR444] = "YUV 4:4:4", }; /* @@ -1445,7 +1445,7 @@ static const char * const output_format_str[] = { * valid. */ const char * -drm_hdmi_connector_get_output_format_name(enum hdmi_colorspace fmt) +drm_hdmi_connector_get_output_format_name(enum drm_output_color_format fmt) { if (fmt >= ARRAY_SIZE(output_format_str)) return NULL; diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c index 279ca896b0a2..b5c738380dc2 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c @@ -747,12 +747,12 @@ static void mtk_hdmi_v2_change_video_resolution(struct mtk_hdmi *hdmi, switch (conn_state->hdmi.output_format) { default: - case HDMI_COLORSPACE_RGB: - case HDMI_COLORSPACE_YUV444: + case DRM_OUTPUT_COLOR_FORMAT_RGB444: + case DRM_OUTPUT_COLOR_FORMAT_YCBCR444: /* Disable YUV420 downsampling for RGB and YUV444 */ mtk_hdmi_yuv420_downsampling(hdmi, false); break; - case HDMI_COLORSPACE_YUV422: + case DRM_OUTPUT_COLOR_FORMAT_YCBCR422: /* * YUV420 downsampling is special and needs a bit of setup * so we disable everything there before doing anything else. @@ -763,7 +763,7 @@ static void mtk_hdmi_v2_change_video_resolution(struct mtk_hdmi *hdmi, regmap_set_bits(hdmi->regs, VID_DOWNSAMPLE_CONFIG, C444_C422_CONFIG_ENABLE); break; - case HDMI_COLORSPACE_YUV420: + case DRM_OUTPUT_COLOR_FORMAT_YCBCR420: mtk_hdmi_yuv420_downsampling(hdmi, true); break; } diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index a50f260c73e4..dd2a78defdb4 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -661,7 +661,7 @@ static int sun4i_hdmi_bind(struct device *dev, struct device *master, &sun4i_hdmi_hdmi_connector_funcs, DRM_MODE_CONNECTOR_HDMIA, hdmi->ddc_i2c, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); if (ret) { dev_err(dev, diff --git a/drivers/gpu/drm/tests/drm_connector_test.c b/drivers/gpu/drm/tests/drm_connector_test.c index 86860ad0861c..beb1d50a6646 100644 --- a/drivers/gpu/drm/tests/drm_connector_test.c +++ b/drivers/gpu/drm/tests/drm_connector_test.c @@ -675,7 +675,7 @@ static void drm_test_connector_hdmi_init_valid(struct kunit *test) &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_EQ(test, ret, 0); } @@ -695,7 +695,7 @@ static void drm_test_connector_hdmi_init_null_ddc(struct kunit *test) &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, NULL, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_EQ(test, ret, 0); } @@ -715,7 +715,7 @@ static void drm_test_connector_hdmi_init_null_vendor(struct kunit *test) &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_LT(test, ret, 0); } @@ -735,7 +735,7 @@ static void drm_test_connector_hdmi_init_null_product(struct kunit *test) &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_LT(test, ret, 0); } @@ -761,7 +761,7 @@ static void drm_test_connector_hdmi_init_product_valid(struct kunit *test) &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_EQ(test, ret, 0); KUNIT_EXPECT_MEMEQ(test, @@ -794,7 +794,7 @@ static void drm_test_connector_hdmi_init_product_length_exact(struct kunit *test &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_EQ(test, ret, 0); KUNIT_EXPECT_MEMEQ(test, @@ -821,7 +821,7 @@ static void drm_test_connector_hdmi_init_product_length_too_long(struct kunit *t &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_LT(test, ret, 0); } @@ -847,7 +847,7 @@ static void drm_test_connector_hdmi_init_vendor_valid(struct kunit *test) &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_EQ(test, ret, 0); KUNIT_EXPECT_MEMEQ(test, @@ -879,7 +879,7 @@ static void drm_test_connector_hdmi_init_vendor_length_exact(struct kunit *test) &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_EQ(test, ret, 0); KUNIT_EXPECT_MEMEQ(test, @@ -906,7 +906,7 @@ static void drm_test_connector_hdmi_init_vendor_length_too_long(struct kunit *te &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_LT(test, ret, 0); } @@ -926,7 +926,7 @@ static void drm_test_connector_hdmi_init_bpc_invalid(struct kunit *test) &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 9); KUNIT_EXPECT_LT(test, ret, 0); } @@ -946,7 +946,7 @@ static void drm_test_connector_hdmi_init_bpc_null(struct kunit *test) &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 0); KUNIT_EXPECT_LT(test, ret, 0); } @@ -971,7 +971,7 @@ static void drm_test_connector_hdmi_init_bpc_8(struct kunit *test) &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_EQ(test, ret, 0); @@ -1012,7 +1012,7 @@ static void drm_test_connector_hdmi_init_bpc_10(struct kunit *test) &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 10); KUNIT_EXPECT_EQ(test, ret, 0); @@ -1053,7 +1053,7 @@ static void drm_test_connector_hdmi_init_bpc_12(struct kunit *test) &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 12); KUNIT_EXPECT_EQ(test, ret, 0); @@ -1109,7 +1109,7 @@ static void drm_test_connector_hdmi_init_formats_no_rgb(struct kunit *test) &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_YUV422), + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422), 8); KUNIT_EXPECT_LT(test, ret, 0); } @@ -1122,17 +1122,17 @@ struct drm_connector_hdmi_init_formats_yuv420_allowed_test { #define YUV420_ALLOWED_TEST(_formats, _allowed, _result) \ { \ - .supported_formats = BIT(HDMI_COLORSPACE_RGB) | (_formats), \ + .supported_formats = BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) | (_formats), \ .yuv420_allowed = _allowed, \ .expected_result = _result, \ } static const struct drm_connector_hdmi_init_formats_yuv420_allowed_test drm_connector_hdmi_init_formats_yuv420_allowed_tests[] = { - YUV420_ALLOWED_TEST(BIT(HDMI_COLORSPACE_YUV420), true, 0), - YUV420_ALLOWED_TEST(BIT(HDMI_COLORSPACE_YUV420), false, -EINVAL), - YUV420_ALLOWED_TEST(BIT(HDMI_COLORSPACE_YUV422), true, -EINVAL), - YUV420_ALLOWED_TEST(BIT(HDMI_COLORSPACE_YUV422), false, 0), + YUV420_ALLOWED_TEST(BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420), true, 0), + YUV420_ALLOWED_TEST(BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420), false, -EINVAL), + YUV420_ALLOWED_TEST(BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422), true, -EINVAL), + YUV420_ALLOWED_TEST(BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422), false, 0), }; static void @@ -1188,7 +1188,7 @@ static void drm_test_connector_hdmi_init_type_valid(struct kunit *test) &dummy_hdmi_funcs, connector_type, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_EQ(test, ret, 0); } @@ -1223,7 +1223,7 @@ static void drm_test_connector_hdmi_init_type_invalid(struct kunit *test) &dummy_hdmi_funcs, connector_type, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_LT(test, ret, 0); } @@ -1432,10 +1432,10 @@ static void drm_test_drm_hdmi_connector_get_output_format_name(struct kunit *tes static const struct drm_hdmi_connector_get_output_format_name_test drm_hdmi_connector_get_output_format_name_valid_tests[] = { - OUTPUT_FORMAT_TEST(HDMI_COLORSPACE_RGB, "RGB"), - OUTPUT_FORMAT_TEST(HDMI_COLORSPACE_YUV420, "YUV 4:2:0"), - OUTPUT_FORMAT_TEST(HDMI_COLORSPACE_YUV422, "YUV 4:2:2"), - OUTPUT_FORMAT_TEST(HDMI_COLORSPACE_YUV444, "YUV 4:4:4"), + OUTPUT_FORMAT_TEST(DRM_OUTPUT_COLOR_FORMAT_RGB444, "RGB"), + OUTPUT_FORMAT_TEST(DRM_OUTPUT_COLOR_FORMAT_YCBCR420, "YUV 4:2:0"), + OUTPUT_FORMAT_TEST(DRM_OUTPUT_COLOR_FORMAT_YCBCR422, "YUV 4:2:2"), + OUTPUT_FORMAT_TEST(DRM_OUTPUT_COLOR_FORMAT_YCBCR444, "YUV 4:4:4"), }; static void @@ -1500,7 +1500,7 @@ static void drm_test_drm_connector_attach_broadcast_rgb_property_hdmi_connector( &dummy_hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, &priv->ddc, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_EXPECT_EQ(test, ret, 0); @@ -1540,7 +1540,7 @@ static void drm_test_drm_hdmi_compute_mode_clock_rgb(struct kunit *test) KUNIT_ASSERT_FALSE(test, mode->flags & DRM_MODE_FLAG_DBLCLK); - rate = drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(mode, 8, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_GT(test, rate, 0); KUNIT_EXPECT_EQ(test, mode->clock * 1000ULL, rate); } @@ -1561,7 +1561,7 @@ static void drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc(struct kunit *test) KUNIT_ASSERT_FALSE(test, mode->flags & DRM_MODE_FLAG_DBLCLK); - rate = drm_hdmi_compute_mode_clock(mode, 10, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(mode, 10, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_GT(test, rate, 0); KUNIT_EXPECT_EQ(test, mode->clock * 1250, rate); } @@ -1580,7 +1580,7 @@ static void drm_test_drm_hdmi_compute_mode_clock_rgb_10bpc_vic_1(struct kunit *t mode = drm_kunit_display_mode_from_cea_vic(test, drm, 1); KUNIT_ASSERT_NOT_NULL(test, mode); - rate = drm_hdmi_compute_mode_clock(mode, 10, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(mode, 10, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_EXPECT_EQ(test, rate, 0); } @@ -1600,7 +1600,7 @@ static void drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc(struct kunit *test) KUNIT_ASSERT_FALSE(test, mode->flags & DRM_MODE_FLAG_DBLCLK); - rate = drm_hdmi_compute_mode_clock(mode, 12, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(mode, 12, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_GT(test, rate, 0); KUNIT_EXPECT_EQ(test, mode->clock * 1500, rate); } @@ -1619,7 +1619,7 @@ static void drm_test_drm_hdmi_compute_mode_clock_rgb_12bpc_vic_1(struct kunit *t mode = drm_kunit_display_mode_from_cea_vic(test, drm, 1); KUNIT_ASSERT_NOT_NULL(test, mode); - rate = drm_hdmi_compute_mode_clock(mode, 12, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(mode, 12, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_EXPECT_EQ(test, rate, 0); } @@ -1639,7 +1639,7 @@ static void drm_test_drm_hdmi_compute_mode_clock_rgb_double(struct kunit *test) KUNIT_ASSERT_TRUE(test, mode->flags & DRM_MODE_FLAG_DBLCLK); - rate = drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(mode, 8, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_GT(test, rate, 0); KUNIT_EXPECT_EQ(test, (mode->clock * 1000ULL) * 2, rate); } @@ -1662,7 +1662,7 @@ static void drm_test_connector_hdmi_compute_mode_clock_yuv420_valid(struct kunit KUNIT_ASSERT_FALSE(test, mode->flags & DRM_MODE_FLAG_DBLCLK); - rate = drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_YUV420); + rate = drm_hdmi_compute_mode_clock(mode, 8, DRM_OUTPUT_COLOR_FORMAT_YCBCR420); KUNIT_ASSERT_GT(test, rate, 0); KUNIT_EXPECT_EQ(test, (mode->clock * 1000ULL) / 2, rate); } @@ -1699,7 +1699,7 @@ static void drm_test_connector_hdmi_compute_mode_clock_yuv420_10_bpc(struct kuni KUNIT_ASSERT_FALSE(test, mode->flags & DRM_MODE_FLAG_DBLCLK); - rate = drm_hdmi_compute_mode_clock(mode, 10, HDMI_COLORSPACE_YUV420); + rate = drm_hdmi_compute_mode_clock(mode, 10, DRM_OUTPUT_COLOR_FORMAT_YCBCR420); KUNIT_ASSERT_GT(test, rate, 0); KUNIT_EXPECT_EQ(test, mode->clock * 625, rate); @@ -1724,7 +1724,7 @@ static void drm_test_connector_hdmi_compute_mode_clock_yuv420_12_bpc(struct kuni KUNIT_ASSERT_FALSE(test, mode->flags & DRM_MODE_FLAG_DBLCLK); - rate = drm_hdmi_compute_mode_clock(mode, 12, HDMI_COLORSPACE_YUV420); + rate = drm_hdmi_compute_mode_clock(mode, 12, DRM_OUTPUT_COLOR_FORMAT_YCBCR420); KUNIT_ASSERT_GT(test, rate, 0); KUNIT_EXPECT_EQ(test, mode->clock * 750, rate); @@ -1747,7 +1747,7 @@ static void drm_test_connector_hdmi_compute_mode_clock_yuv422_8_bpc(struct kunit KUNIT_ASSERT_FALSE(test, mode->flags & DRM_MODE_FLAG_DBLCLK); - rate = drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_YUV422); + rate = drm_hdmi_compute_mode_clock(mode, 8, DRM_OUTPUT_COLOR_FORMAT_YCBCR422); KUNIT_ASSERT_GT(test, rate, 0); KUNIT_EXPECT_EQ(test, mode->clock * 1000, rate); } @@ -1769,7 +1769,7 @@ static void drm_test_connector_hdmi_compute_mode_clock_yuv422_10_bpc(struct kuni KUNIT_ASSERT_FALSE(test, mode->flags & DRM_MODE_FLAG_DBLCLK); - rate = drm_hdmi_compute_mode_clock(mode, 10, HDMI_COLORSPACE_YUV422); + rate = drm_hdmi_compute_mode_clock(mode, 10, DRM_OUTPUT_COLOR_FORMAT_YCBCR422); KUNIT_ASSERT_GT(test, rate, 0); KUNIT_EXPECT_EQ(test, mode->clock * 1000, rate); } @@ -1791,7 +1791,7 @@ static void drm_test_connector_hdmi_compute_mode_clock_yuv422_12_bpc(struct kuni KUNIT_ASSERT_FALSE(test, mode->flags & DRM_MODE_FLAG_DBLCLK); - rate = drm_hdmi_compute_mode_clock(mode, 12, HDMI_COLORSPACE_YUV422); + rate = drm_hdmi_compute_mode_clock(mode, 12, DRM_OUTPUT_COLOR_FORMAT_YCBCR422); KUNIT_ASSERT_GT(test, rate, 0); KUNIT_EXPECT_EQ(test, mode->clock * 1000, rate); } diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c index 4bdcea3c7435..a4357efaa983 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -239,7 +239,7 @@ __connector_hdmi_init(struct kunit *test, enc->possible_crtcs = drm_crtc_mask(priv->crtc); conn = &priv->connector; - conn->ycbcr_420_allowed = !!(formats & BIT(HDMI_COLORSPACE_YUV420)); + conn->ycbcr_420_allowed = !!(formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420)); ret = drmm_connector_hdmi_init(drm, conn, "Vendor", "Product", @@ -300,7 +300,7 @@ static void drm_test_check_broadcast_rgb_crtc_mode_changed(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -375,7 +375,7 @@ static void drm_test_check_broadcast_rgb_crtc_mode_not_changed(struct kunit *tes int ret; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -450,7 +450,7 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -517,7 +517,7 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode_vic_1(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -584,7 +584,7 @@ static void drm_test_check_broadcast_rgb_full_cea_mode(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -653,7 +653,7 @@ static void drm_test_check_broadcast_rgb_full_cea_mode_vic_1(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -722,7 +722,7 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -791,7 +791,7 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode_vic_1(struct kunit *te int ret; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -863,8 +863,8 @@ static void drm_test_check_broadcast_rgb_cea_mode_yuv420(struct kunit *test) broadcast_rgb = *(enum drm_hdmi_broadcast_rgb *)test->param_value; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV420), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420), 8, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_yuv_4k_yuv420_dc_max_200mhz); @@ -918,7 +918,7 @@ retry_conn_state: KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state); KUNIT_ASSERT_EQ(test, conn_state->hdmi.broadcast_rgb, broadcast_rgb); - KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_YUV420); + KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_YCBCR420); KUNIT_EXPECT_TRUE(test, conn_state->hdmi.is_limited_range); @@ -963,7 +963,7 @@ static void drm_test_check_output_bpc_crtc_mode_changed(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 10, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz); @@ -1045,7 +1045,7 @@ static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 10, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz); @@ -1122,9 +1122,9 @@ static void drm_test_check_output_bpc_dvi(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV422) | - BIT(HDMI_COLORSPACE_YUV444), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444), 12, &dummy_connector_hdmi_funcs, test_edid_dvi_1080p); @@ -1157,7 +1157,7 @@ retry_conn_enable: KUNIT_ASSERT_NOT_NULL(test, conn_state); KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 8); - KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444); drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); @@ -1179,7 +1179,7 @@ static void drm_test_check_tmds_char_rate_rgb_8bpc(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_max_200mhz); @@ -1210,7 +1210,7 @@ retry_conn_enable: KUNIT_ASSERT_NOT_NULL(test, conn_state); KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_bpc, 8); - KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); + KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_EXPECT_EQ(test, conn_state->hdmi.tmds_char_rate, preferred->clock * 1000); drm_modeset_drop_locks(&ctx); @@ -1234,7 +1234,7 @@ static void drm_test_check_tmds_char_rate_rgb_10bpc(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 10, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz); @@ -1265,7 +1265,7 @@ retry_conn_enable: KUNIT_ASSERT_NOT_NULL(test, conn_state); KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_bpc, 10); - KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); + KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_EXPECT_EQ(test, conn_state->hdmi.tmds_char_rate, preferred->clock * 1250); drm_modeset_drop_locks(&ctx); @@ -1289,7 +1289,7 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 12, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz); @@ -1320,7 +1320,7 @@ retry_conn_enable: KUNIT_ASSERT_NOT_NULL(test, conn_state); KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_bpc, 12); - KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); + KUNIT_ASSERT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_EXPECT_EQ(test, conn_state->hdmi.tmds_char_rate, preferred->clock * 1500); drm_modeset_drop_locks(&ctx); @@ -1348,7 +1348,7 @@ static void drm_test_check_hdmi_funcs_reject_rate(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1416,7 +1416,7 @@ static void drm_test_check_max_tmds_rate_bpc_fallback_rgb(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 12, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz); @@ -1433,10 +1433,10 @@ static void drm_test_check_max_tmds_rate_bpc_fallback_rgb(struct kunit *test) KUNIT_ASSERT_NOT_NULL(test, preferred); KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK); - rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(preferred, 12, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000); - rate = drm_hdmi_compute_mode_clock(preferred, 10, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(preferred, 10, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); drm_modeset_acquire_init(&ctx, 0); @@ -1457,7 +1457,7 @@ retry_conn_enable: KUNIT_ASSERT_NOT_NULL(test, conn_state); KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 10); - KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_EXPECT_EQ(test, conn_state->hdmi.tmds_char_rate, preferred->clock * 1250); drm_modeset_drop_locks(&ctx); @@ -1490,8 +1490,8 @@ static void drm_test_check_max_tmds_rate_bpc_fallback_yuv420(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV420), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420), 12, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_yuv_4k_yuv420_dc_max_200mhz); @@ -1509,10 +1509,10 @@ static void drm_test_check_max_tmds_rate_bpc_fallback_yuv420(struct kunit *test) KUNIT_ASSERT_NOT_NULL(test, yuv420_only_mode); KUNIT_ASSERT_TRUE(test, drm_mode_is_420_only(info, yuv420_only_mode)); - rate = drm_hdmi_compute_mode_clock(yuv420_only_mode, 12, HDMI_COLORSPACE_YUV420); + rate = drm_hdmi_compute_mode_clock(yuv420_only_mode, 12, DRM_OUTPUT_COLOR_FORMAT_YCBCR420); KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000); - rate = drm_hdmi_compute_mode_clock(yuv420_only_mode, 10, HDMI_COLORSPACE_YUV420); + rate = drm_hdmi_compute_mode_clock(yuv420_only_mode, 10, DRM_OUTPUT_COLOR_FORMAT_YCBCR420); KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); drm_modeset_acquire_init(&ctx, 0); @@ -1531,7 +1531,7 @@ retry_conn_enable: KUNIT_ASSERT_NOT_NULL(test, conn_state); KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 10); - KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_YUV420); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_YCBCR420); KUNIT_EXPECT_EQ(test, conn_state->hdmi.tmds_char_rate, yuv420_only_mode->clock * 625); drm_modeset_drop_locks(&ctx); @@ -1565,9 +1565,9 @@ static void drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422(struct kunit int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV422) | - BIT(HDMI_COLORSPACE_YUV444), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444), 12, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz); @@ -1584,13 +1584,13 @@ static void drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422(struct kunit KUNIT_ASSERT_NOT_NULL(test, preferred); KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK); - rate = drm_hdmi_compute_mode_clock(preferred, 10, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(preferred, 10, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); - rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(preferred, 12, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000); - rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_YUV422); + rate = drm_hdmi_compute_mode_clock(preferred, 12, DRM_OUTPUT_COLOR_FORMAT_YCBCR422); KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); drm_modeset_acquire_init(&ctx, 0); @@ -1611,7 +1611,7 @@ retry_conn_enable: KUNIT_ASSERT_NOT_NULL(test, conn_state); KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 10); - KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444); drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); @@ -1644,8 +1644,8 @@ static void drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv420(struct kunit int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV420), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR420), 12, &dummy_connector_hdmi_funcs, test_edid_hdmi_4k_rgb_yuv420_dc_max_340mhz); @@ -1664,13 +1664,13 @@ static void drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv420(struct kunit KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK); KUNIT_ASSERT_TRUE(test, drm_mode_is_420_also(info, preferred)); - rate = drm_hdmi_compute_mode_clock(preferred, 8, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(preferred, 8, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); - rate = drm_hdmi_compute_mode_clock(preferred, 10, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(preferred, 10, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000); - rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_YUV420); + rate = drm_hdmi_compute_mode_clock(preferred, 12, DRM_OUTPUT_COLOR_FORMAT_YCBCR420); KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); drm_modeset_acquire_init(&ctx, 0); @@ -1689,7 +1689,7 @@ retry_conn_enable: KUNIT_ASSERT_NOT_NULL(test, conn_state); KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 8); - KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444); drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); @@ -1715,7 +1715,7 @@ static void drm_test_check_driver_unsupported_fallback_yuv420(struct kunit *test int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 12, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_yuv_4k_yuv420_dc_max_200mhz); @@ -1750,7 +1750,7 @@ retry_conn_enable: conn_state = conn->state; KUNIT_ASSERT_NOT_NULL(test, conn_state); - KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444); state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); @@ -1800,9 +1800,9 @@ static void drm_test_check_output_bpc_format_vic_1(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV422) | - BIT(HDMI_COLORSPACE_YUV444), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444), 12, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz); @@ -1847,7 +1847,7 @@ retry_conn_enable: KUNIT_ASSERT_NOT_NULL(test, conn_state); KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 8); - KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444); drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); @@ -1871,7 +1871,7 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 12, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz); @@ -1896,10 +1896,10 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test) * But since the driver only supports RGB, we should fallback to * a lower bpc with RGB. */ - rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(preferred, 12, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000); - rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_YUV422); + rate = drm_hdmi_compute_mode_clock(preferred, 12, DRM_OUTPUT_COLOR_FORMAT_YCBCR422); KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); drm_modeset_acquire_init(&ctx, 0); @@ -1920,7 +1920,7 @@ retry_conn_enable: KUNIT_ASSERT_NOT_NULL(test, conn_state); KUNIT_EXPECT_LT(test, conn_state->hdmi.output_bpc, 12); - KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444); drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); @@ -1944,9 +1944,9 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV422) | - BIT(HDMI_COLORSPACE_YUV444), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444), 12, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_max_200mhz); @@ -1971,10 +1971,10 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test * But since the display only supports RGB, we should fallback to * a lower bpc with RGB. */ - rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(preferred, 12, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_GT(test, rate, info->max_tmds_clock * 1000); - rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_YUV422); + rate = drm_hdmi_compute_mode_clock(preferred, 12, DRM_OUTPUT_COLOR_FORMAT_YCBCR422); KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); drm_modeset_acquire_init(&ctx, 0); @@ -1995,7 +1995,7 @@ retry_conn_enable: KUNIT_ASSERT_NOT_NULL(test, conn_state); KUNIT_EXPECT_LT(test, conn_state->hdmi.output_bpc, 12); - KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444); drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); @@ -2020,7 +2020,7 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz); @@ -2040,7 +2040,7 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test * We're making sure that we have headroom on the TMDS character * clock to actually use 12bpc. */ - rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(preferred, 12, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); drm_modeset_acquire_init(&ctx, 0); @@ -2061,7 +2061,7 @@ retry_conn_enable: KUNIT_ASSERT_NOT_NULL(test, conn_state); KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 8); - KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444); drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); @@ -2086,9 +2086,9 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV422) | - BIT(HDMI_COLORSPACE_YUV444), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444), 12, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_max_340mhz); @@ -2108,7 +2108,7 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes * We're making sure that we have headroom on the TMDS character * clock to actually use 12bpc. */ - rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_RGB); + rate = drm_hdmi_compute_mode_clock(preferred, 12, DRM_OUTPUT_COLOR_FORMAT_RGB444); KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000); drm_modeset_acquire_init(&ctx, 0); @@ -2129,7 +2129,7 @@ retry_conn_enable: KUNIT_ASSERT_NOT_NULL(test, conn_state); KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_bpc, 8); - KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB); + KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, DRM_OUTPUT_COLOR_FORMAT_RGB444); drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); @@ -2150,7 +2150,7 @@ static void drm_test_check_disable_connector(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -2255,7 +2255,7 @@ static void drm_test_check_broadcast_rgb_value(struct kunit *test) struct drm_connector *conn; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -2277,7 +2277,7 @@ static void drm_test_check_bpc_8_value(struct kunit *test) struct drm_connector *conn; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -2301,7 +2301,7 @@ static void drm_test_check_bpc_10_value(struct kunit *test) struct drm_connector *conn; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 10); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -2325,7 +2325,7 @@ static void drm_test_check_bpc_12_value(struct kunit *test) struct drm_connector *conn; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 12); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -2347,9 +2347,9 @@ static void drm_test_check_format_value(struct kunit *test) struct drm_connector *conn; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV422) | - BIT(HDMI_COLORSPACE_YUV444), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -2369,9 +2369,9 @@ static void drm_test_check_tmds_char_value(struct kunit *test) struct drm_connector *conn; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV422) | - BIT(HDMI_COLORSPACE_YUV444), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444), 12); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -2407,7 +2407,7 @@ static void drm_test_check_mode_valid(struct kunit *test) struct drm_display_mode *preferred; priv = drm_kunit_helper_connector_hdmi_init(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -2431,7 +2431,7 @@ static void drm_test_check_mode_valid_reject_rate(struct kunit *test) struct drm_display_mode *preferred; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8, &reject_100mhz_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_max_200mhz); @@ -2463,7 +2463,7 @@ static void drm_test_check_mode_valid_reject(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8, &reject_connector_hdmi_funcs, no_edid); @@ -2493,7 +2493,7 @@ static void drm_test_check_mode_valid_reject_max_clock(struct kunit *test) struct drm_display_mode *preferred; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_max_100mhz); @@ -2540,7 +2540,7 @@ static void drm_test_check_infoframes(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8, &dummy_connector_hdmi_funcs, test_edid_hdmi_1080p_rgb_max_200mhz); @@ -2643,7 +2643,7 @@ static void drm_test_check_reject_avi_infoframe(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8, &reject_avi_infoframe_hdmi_funcs, test_edid_hdmi_1080p_rgb_max_200mhz); @@ -2747,7 +2747,7 @@ static void drm_test_check_reject_hdr_infoframe_bpc_8(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8, &reject_hdr_infoframe_hdmi_funcs, test_edid_hdmi_1080p_rgb_max_200mhz_hdr); @@ -2861,7 +2861,7 @@ static void drm_test_check_reject_hdr_infoframe_bpc_10(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 10, &reject_hdr_infoframe_hdmi_funcs, test_edid_hdmi_1080p_rgb_max_200mhz_hdr); @@ -2996,7 +2996,7 @@ static void drm_test_check_reject_audio_infoframe(struct kunit *test) int ret; priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test, - BIT(HDMI_COLORSPACE_RGB), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8, &reject_audio_infoframe_hdmi_funcs, test_edid_hdmi_1080p_rgb_max_200mhz); diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 9898e5451a07..a99f53dadb28 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -133,7 +133,7 @@ static bool vc4_hdmi_supports_scrambling(struct vc4_hdmi *vc4_hdmi) static bool vc4_hdmi_mode_needs_scrambling(const struct drm_display_mode *mode, unsigned int bpc, - enum hdmi_colorspace fmt) + enum drm_output_color_format fmt) { unsigned long long clock = drm_hdmi_compute_mode_clock(mode, bpc, fmt); @@ -444,7 +444,7 @@ static int vc4_hdmi_connector_get_modes(struct drm_connector *connector) const struct drm_display_mode *mode; list_for_each_entry(mode, &connector->probed_modes, head) { - if (vc4_hdmi_mode_needs_scrambling(mode, 8, HDMI_COLORSPACE_RGB)) { + if (vc4_hdmi_mode_needs_scrambling(mode, 8, DRM_OUTPUT_COLOR_FORMAT_RGB444)) { drm_warn_once(drm, "The core clock cannot reach frequencies high enough to support 4k @ 60Hz."); drm_warn_once(drm, "Please change your config.txt file to add hdmi_enable_4kp60."); } @@ -547,9 +547,9 @@ static int vc4_hdmi_connector_init(struct drm_device *dev, &vc4_hdmi_hdmi_connector_funcs, DRM_MODE_CONNECTOR_HDMIA, vc4_hdmi->ddc, - BIT(HDMI_COLORSPACE_RGB) | - BIT(HDMI_COLORSPACE_YUV422) | - BIT(HDMI_COLORSPACE_YUV444), + BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422) | + BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444), max_bpc); if (ret) return ret; @@ -1214,13 +1214,13 @@ static void vc5_hdmi_csc_setup(struct vc4_hdmi *vc4_hdmi, spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); switch (state->hdmi.output_format) { - case HDMI_COLORSPACE_YUV444: + case DRM_OUTPUT_COLOR_FORMAT_YCBCR444: csc = vc5_hdmi_find_yuv_csc_coeffs(vc4_hdmi, state->colorspace, !!lim_range); vc5_hdmi_set_csc_coeffs_swap(vc4_hdmi, csc); break; - case HDMI_COLORSPACE_YUV422: + case DRM_OUTPUT_COLOR_FORMAT_YCBCR422: csc = vc5_hdmi_find_yuv_csc_coeffs(vc4_hdmi, state->colorspace, !!lim_range); csc_ctl |= VC4_SET_FIELD(VC5_MT_CP_CSC_CTL_FILTER_MODE_444_TO_422_STANDARD, @@ -1237,7 +1237,7 @@ static void vc5_hdmi_csc_setup(struct vc4_hdmi *vc4_hdmi, vc5_hdmi_set_csc_coeffs(vc4_hdmi, csc); break; - case HDMI_COLORSPACE_RGB: + case DRM_OUTPUT_COLOR_FORMAT_RGB444: if_xbar = 0x354021; vc5_hdmi_set_csc_coeffs(vc4_hdmi, vc5_hdmi_csc_full_rgb_to_rgb[lim_range]); @@ -1394,7 +1394,7 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, * YCC422 is always 36-bit and not considered deep colour so * doesn't signal in GCP. */ - if (state->hdmi.output_format == HDMI_COLORSPACE_YUV422) { + if (state->hdmi.output_format == DRM_OUTPUT_COLOR_FORMAT_YCBCR422) { gcp = 0; } diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h index 8d069718df00..29d461d4ee49 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h @@ -210,7 +210,7 @@ struct vc4_hdmi { * @drm_connector_state.hdmi.output_format for use outside of * KMS hooks. Protected by @mutex. */ - enum hdmi_colorspace output_format; + enum drm_output_color_format output_format; /** * @hdmi_jack: Represents the connection state of the HDMI plug, for diff --git a/include/drm/bridge/dw_hdmi_qp.h b/include/drm/bridge/dw_hdmi_qp.h index 3af12f82da2c..6ea9c561cfef 100644 --- a/include/drm/bridge/dw_hdmi_qp.h +++ b/include/drm/bridge/dw_hdmi_qp.h @@ -25,7 +25,7 @@ struct dw_hdmi_qp_plat_data { int main_irq; int cec_irq; unsigned long ref_clk_rate; - /* Supported output formats: bitmask of @hdmi_colorspace */ + /* Supported output formats: bitmask of @drm_output_color_format */ unsigned int supported_formats; /* Maximum bits per color channel: 8, 10 or 12 */ unsigned int max_bpc; diff --git a/include/drm/display/drm_hdmi_helper.h b/include/drm/display/drm_hdmi_helper.h index 09145c9ee9fc..9c31ed90516b 100644 --- a/include/drm/display/drm_hdmi_helper.h +++ b/include/drm/display/drm_hdmi_helper.h @@ -8,6 +8,7 @@ struct drm_connector; struct drm_connector_state; struct drm_display_mode; +enum drm_output_color_format; void drm_hdmi_avi_infoframe_colorimetry(struct hdmi_avi_infoframe *frame, @@ -26,7 +27,7 @@ void drm_hdmi_avi_infoframe_content_type(struct hdmi_avi_infoframe *frame, unsigned long long drm_hdmi_compute_mode_clock(const struct drm_display_mode *mode, - unsigned int bpc, enum hdmi_colorspace fmt); + unsigned int bpc, enum drm_output_color_format fmt); void drm_hdmi_acr_get_n_cts(unsigned long long tmds_char_rate, diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 66ab89cf48aa..a8d67bd9ee50 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -1188,8 +1188,9 @@ struct drm_bridge { const char *product; /** - * @supported_formats: Bitmask of @hdmi_colorspace listing supported - * output formats. This is only relevant if @DRM_BRIDGE_OP_HDMI is set. + * @supported_formats: Bitmask of @drm_output_color_format listing + * supported output formats. This is only relevant if + * @DRM_BRIDGE_OP_HDMI is set. */ unsigned int supported_formats; diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 562f6da90fac..af8b92d2d5b7 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -402,8 +402,6 @@ enum drm_hdmi_broadcast_rgb { const char * drm_hdmi_connector_get_broadcast_rgb_name(enum drm_hdmi_broadcast_rgb broadcast_rgb); -const char * -drm_hdmi_connector_get_output_format_name(enum hdmi_colorspace fmt); /** * struct drm_monitor_range_info - Panel's Monitor range in EDID for @@ -581,6 +579,9 @@ enum drm_output_color_format { DRM_OUTPUT_COLOR_FORMAT_YCBCR420, }; +const char * +drm_hdmi_connector_get_output_format_name(enum drm_output_color_format fmt); + /** * enum drm_bus_flags - bus_flags info for &drm_display_info * @@ -1012,7 +1013,7 @@ struct drm_connector_hdmi_state { /** * @output_format: Pixel format to output in. */ - enum hdmi_colorspace output_format; + enum drm_output_color_format output_format; /** * @tmds_char_rate: TMDS Character Rate, in Hz. @@ -1900,7 +1901,7 @@ struct drm_connector_hdmi { unsigned char product[DRM_CONNECTOR_HDMI_PRODUCT_LEN] __nonstring; /** - * @supported_formats: Bitmask of @hdmi_colorspace + * @supported_formats: Bitmask of @drm_output_color_format * supported by the controller. */ unsigned long supported_formats; -- cgit v1.2.3