From nobody Tue Dec 16 21:25:04 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F58529AB15 for ; Fri, 14 Nov 2025 03:44:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763091851; cv=none; b=gvIZuT7AEQ4tyXAaIej+ACDkVURhE9y3jSSpEBXf04bixz8tPltm2k9f3jQFm3mT6j86jigPFRmDaxqBgSzrY4dAYCtXL2UiGUU4UVMCaGW+czQOp7uedioLYYwrasXkB6OBkTKbuJ6IevV+SdgOaEVmQtdE+yZLHCyFlmx/8Ug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763091851; c=relaxed/simple; bh=YqIUcEyD1abXObQfCleMF6op/1WYm74ld3lRWdtUPbE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ptLVWR5A+duvgajJ/exbJHlvOQBUSXl9xDPtxzoly1By9a2Ni/E+SjM9Gc1ciDSzXztcEKeybGoW1KAAqUy9L9xyU5JHAMpHxyZ5Q+V48yY2cQGXJhij/XXBdZGQr2KnAFMB5mMaPgwQ6fn/4TcBf/S7znptFcoz1FFSUzPb4Fo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=kMapFMeV; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=V1623CS7; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="kMapFMeV"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="V1623CS7" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5ADMae201629391 for ; Fri, 14 Nov 2025 03:44:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= UwvngIXqhPhDGVGa9A+H4hDveguht1sjcg6NWQaOHXI=; b=kMapFMeVDLZ8yxRe wsNr4dfwnl7GHas/Ea61J/xo3zaqrvtElsP/8ZOea6tEW/xYseThyhKRhNOWm77l x6jLNgyi/XjY4KX1j7t5sNkWejvOJ1NO83jb10Yk8cpkqcGo7blkwiokzObXcnmS DcJxKgyNL0GfRv7BKfCBtRT4Fv9QwCSKNy+HT/fOfADklU88WyrR5/TOgRuzjbjZ lnqO10EdDHeCsVOeTyExfYDylXzJGjY4/E/VGXQzQEXhiGp0T5WdRlPECvyqokFr gIPjbVuwb7pwGkVraSk1bWsMN/xlIhSpOUVDVw5TGXUHVGmvr4UaLeQ8ABg1BwYB 1juEsw== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4adr9d8qm2-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 14 Nov 2025 03:44:07 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8b2657cfcdaso223836885a.3 for ; Thu, 13 Nov 2025 19:44:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1763091846; x=1763696646; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=UwvngIXqhPhDGVGa9A+H4hDveguht1sjcg6NWQaOHXI=; b=V1623CS7JJ/0nSM1M1YdcMKNoascXgJkgLHYdJYhLQ+3QSlB/Mey+jgAymsTxht3cZ 20kJOIc8R9HYoyFONtu4g9bppbkvAi+lHX6XsAVDbP92lj5uhQZ5hrVyc+tZ7ORw2R2y gS7EpMmkYnvVX3sFpivFXMxmnOH6b5Mk/pmHGHic1JhizwKLeV6LL5OEjSbdLdVFnr/i fUYCKR7Xq87Yt4Szsr4knVQSznZqp4hKBALdQWiEsExjvRI+KXDFiITLJZ5Jnxe2Ka0F OkB/8rZ+6Rz9VNF90ImOqqwLxd/Nt3QC/D7mKgLwiR2/XJsZvU7ZMOGzK8Fz9H5abqxG 6LVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763091846; x=1763696646; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=UwvngIXqhPhDGVGa9A+H4hDveguht1sjcg6NWQaOHXI=; b=pa6HPaoP45ttww7PnU5+ipbGfGNCGJm3l1WkNOpg8SaGJgBx2gHK418u2GYGIg9gfj GXJiKY/UuxcmlzHD1WwBEvsozikS07eGlyQVlnPVq4PS+boQkCmZTMp9ADqmVsSoiV75 w1K7GE9nd2kfr8nbRJpwAdT1j1+4hDUx6QKSdus31MYp8SSE56CIWFcd8elLr6s42eZ8 v3A+cPBrYSD9VIgHBCnjFtql5eZdnNhCnfpA7LAaHYW3CBYtUDXc5DtjK1Y1vJ/ukkbh 4xVOFqavXlGxyuCmB07oVvo6SgeSAP9Qu8PPWAeUUe1cLVS7p1dh4fPR/Tz45Wr86zPO 2TBw== X-Forwarded-Encrypted: i=1; AJvYcCX/gc7vLKF17cD/A7Fb7wVuw6VbmJ3dBOP6dKn37cmG/0hqK+X56ZjveKw2Xvty0wp6OhBhSR6axi1T2pE=@vger.kernel.org X-Gm-Message-State: AOJu0YxnHf7NGCKIowxNsXcrQKqcAOVGAbHNRJRant+WxrbYUOmwRPN+ crYOSTtKmxrRccmz41L2WjKUtm8so4KZRoBhPLGvOB3eiVPmQZ+526Y92/FDpB/uqC/rBZN0Tw6 P0LBlVwFr19ED17Tjpe3oc15Wc0rT9W5UDTWAlGJ+KzfoO0BuFoMdJdI7YHov4T56uJM= X-Gm-Gg: ASbGnctVz0Be+92oZFz3EL4GKsQQXvLSpetrRpuoioiDiaWQfHvBs8FW0qlmmFF1O1F Gdgyw9I6qmJrP1jXneTQPpvgorm/NP7ZPWDWmAcRGwn/WkinwXuuGgCwrMZRoYvUPe7OOCTwjqo 9C9yNxZxrfeSlHOoiAhtembuaD/Dya5/+ZclRkUK8TZ1p5LG5QgJa3MQHpPiqiz5z9p4Q0So9lF Aw81EPCDD2Ub6RTZ8nX2hDKGFvXdIcDJVABsVmo/c6ZsRXDJttctUue7jIfoTwvcN5Zmz6Gphb2 h728XhRVKWHtpTu7GsU3AKo4/FLPcvz0g/72ks8ldO/GsRFHjSiRhMEOZIiCkStNLfNl/a8t+X/ BgiKmlg7Qt+fUg7Xpq8/C7ub7S/97cVkhmc/JXC5o8tm/vpPEKro+fXsPztLvVI1DQe7zkmfdek 3j2cZz+oV9Zqkc X-Received: by 2002:a05:620a:1a91:b0:890:57c5:6075 with SMTP id af79cd13be357-8b2c3128698mr240155885a.18.1763091845581; Thu, 13 Nov 2025 19:44:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IG727nOFHjFp8SFCtlQEbNtxp6xMym+/HZtVfrDI0ZgjKow4qdxWBP+7EdInie1+l07PPh6VA== X-Received: by 2002:a05:620a:1a91:b0:890:57c5:6075 with SMTP id af79cd13be357-8b2c3128698mr240152585a.18.1763091844749; Thu, 13 Nov 2025 19:44:04 -0800 (PST) Received: from umbar.lan (2001-14ba-a0c3-3a00-264b-feff-fe8b-be8a.rev.dnainternet.fi. [2001:14ba:a0c3:3a00:264b:feff:fe8b:be8a]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5958040575fsm800713e87.84.2025.11.13.19.44.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Nov 2025 19:44:02 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 14 Nov 2025 05:43:38 +0200 Subject: [PATCH v3 11/12] drm/msm/dpu: rewrite _dpu_format_populate_plane_sizes_ubwc() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251114-dpu-formats-v3-11-cae312379d49@oss.qualcomm.com> References: <20251114-dpu-formats-v3-0-cae312379d49@oss.qualcomm.com> In-Reply-To: <20251114-dpu-formats-v3-0-cae312379d49@oss.qualcomm.com> To: Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter , Jordan Crouse , Jessica Zhang Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=52387; i=dmitry.baryshkov@oss.qualcomm.com; h=from:subject:message-id; bh=YqIUcEyD1abXObQfCleMF6op/1WYm74ld3lRWdtUPbE=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBpFqVmcnmX3qeMj3WB/PsJXJLyH+hJDYZ2koVSe ru9AAAz91aJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCaRalZgAKCRCLPIo+Aiko 1fRRB/4yTUcHT71x05EldYkMREb4mgYIuDPUuGAZlTsTtou0Pgyc6jBJ1DDt+Y4IjGeBdkQF5Mc c/yd30eqkCAruColHVuOP4KQM+2/af/b+fnis3Es2R3VNW5Zu6J7Ue1c89lud+vzeCVgqm8o0iK 6FqxYMyP8p3zCc3eSarhlfI2yDsrkakEaY50K1fgsdcuwU084axqZ4hgb204jIysgZGumuK05vW x3eNUrLrX3URZGX72bLm7Scc8OnOHF68wyeHhj7FkB12FKfB74sB0sssEezxDZGhLYCrLiQRpTu Ko73Rl0iA6fiZZvhTKqmTz6UsOcJ5L+fC2axxeWQRp9Xj4KL X-Developer-Key: i=dmitry.baryshkov@oss.qualcomm.com; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-Proofpoint-GUID: QXUL8rdLAIGytQvfbOonPYefc3r4wOxw X-Authority-Analysis: v=2.4 cv=Rdidyltv c=1 sm=1 tr=0 ts=6916a587 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=6UeiqGixMTsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=6iusXPdm3c8emWAo3PYA:9 a=QEXdDO2ut3YA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-ORIG-GUID: QXUL8rdLAIGytQvfbOonPYefc3r4wOxw X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTE0MDAyNyBTYWx0ZWRfXybLRLqBNaFnz m/ccd3VP6UnAxDZ5SAeodTDiPTlnym6kyuoQh6YgMx/SshgzY1o1zCgoDJkP0YQ80ScqDOXh4d6 XoNPSHdu2ZC7LW2ErPB21Rcmt1nTEjccRuf0/EQbQNXZ5QNUw4PadU9MAuhElbq7isb94cQnG9+ bllmSQEWqfwGNd3YF5rlN5P+aZGeBNsbnOpHMfXS0d5twXWkRL+gnJym+wteGde+W4a0/N2ShpA TH15ygZDKLcC5elULDEUad7iUUFx7R3kl4O1rtwm4IZeHTKtdO4ZisKXiqOWS6GjS2cEUKXANRn FM5dCWozrOJAyrHCBal8B1Yt71je1m94G2z8ZuD841jk2bGhYD1Sw4Raf7z8xoBfb7XUu66z58x qsStZ6qV70FIxxv3+tUIqZ/cj8+KHw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-13_07,2025-11-13_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 adultscore=0 impostorscore=0 bulkscore=0 spamscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2511140027 Drop extra wrapping layer (msm_media_info.h) and inline all VENUS_*() functions, simplifying the code. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 121 ++- drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h | 1155 --------------------= ---- 2 files changed, 57 insertions(+), 1219 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/= msm/disp/dpu1/dpu_formats.c index 191d1f2a0cef7ed69342eceb35df0c3e99a0c373..da1870ce7680899759d09caa010= 50eeb9844a484 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c @@ -7,10 +7,19 @@ #include #include =20 -#include "msm_media_info.h" #include "dpu_kms.h" #include "dpu_formats.h" =20 +#ifndef MSM_MEDIA_ALIGN +#define MSM_MEDIA_ALIGN(__sz, __align) (((__align) & ((__align) - 1)) ?\ + ((((__sz) + (__align) - 1) / (__align)) * (__align)) :\ + (((__sz) + (__align) - 1) & (~((__align) - 1)))) +#endif + +#ifndef MSM_MEDIA_ROUNDUP +#define MSM_MEDIA_ROUNDUP(__sz, __r) (((__sz) + ((__r) - 1)) / (__r)) +#endif + #define DPU_UBWC_PLANE_SIZE_ALIGNMENT 4096 =20 /* @@ -54,90 +63,70 @@ static void _dpu_get_v_h_subsample_rate( } } =20 -static int _dpu_format_get_media_color_ubwc(const struct msm_format *fmt) -{ - static const struct dpu_media_color_map dpu_media_ubwc_map[] =3D { - {DRM_FORMAT_ABGR8888, COLOR_FMT_RGBA8888_UBWC}, - {DRM_FORMAT_ARGB8888, COLOR_FMT_RGBA8888_UBWC}, - {DRM_FORMAT_XBGR8888, COLOR_FMT_RGBA8888_UBWC}, - {DRM_FORMAT_XRGB8888, COLOR_FMT_RGBA8888_UBWC}, - {DRM_FORMAT_ABGR2101010, COLOR_FMT_RGBA1010102_UBWC}, - {DRM_FORMAT_ARGB2101010, COLOR_FMT_RGBA1010102_UBWC}, - {DRM_FORMAT_XRGB2101010, COLOR_FMT_RGBA1010102_UBWC}, - {DRM_FORMAT_XBGR2101010, COLOR_FMT_RGBA1010102_UBWC}, - {DRM_FORMAT_BGR565, COLOR_FMT_RGB565_UBWC}, - }; - int color_fmt =3D -1; - int i; - - if (fmt->pixel_format =3D=3D DRM_FORMAT_NV12 || - fmt->pixel_format =3D=3D DRM_FORMAT_P010) { - if (MSM_FORMAT_IS_DX(fmt)) { - if (fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT) - color_fmt =3D COLOR_FMT_NV12_BPP10_UBWC; - else - color_fmt =3D COLOR_FMT_P010_UBWC; - } else - color_fmt =3D COLOR_FMT_NV12_UBWC; - return color_fmt; - } - - for (i =3D 0; i < ARRAY_SIZE(dpu_media_ubwc_map); ++i) - if (fmt->pixel_format =3D=3D dpu_media_ubwc_map[i].format) { - color_fmt =3D dpu_media_ubwc_map[i].color; - break; - } - return color_fmt; -} - static int _dpu_format_populate_plane_sizes_ubwc( const struct msm_format *fmt, struct drm_framebuffer *fb, struct dpu_hw_fmt_layout *layout) { - int color; bool meta =3D MSM_FORMAT_IS_UBWC(fmt); =20 - color =3D _dpu_format_get_media_color_ubwc(fmt); - if (color < 0) { - DRM_ERROR("UBWC format not supported for fmt: %p4cc\n", - &fmt->pixel_format); - return -EINVAL; - } - if (MSM_FORMAT_IS_YUV(fmt)) { - uint32_t y_sclines, uv_sclines; - uint32_t y_meta_scanlines =3D 0; - uint32_t uv_meta_scanlines =3D 0; + unsigned int stride, sclines; + unsigned int y_tile_width, y_tile_height; + unsigned int y_meta_stride, y_meta_scanlines; + unsigned int uv_meta_stride, uv_meta_scanlines; + + if (MSM_FORMAT_IS_DX(fmt)) { + if (fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT) { + stride =3D MSM_MEDIA_ALIGN(fb->width, 192); + stride =3D MSM_MEDIA_ALIGN(stride * 4 / 3, 256); + y_tile_width =3D 48; + } else { + stride =3D MSM_MEDIA_ALIGN(fb->width * 2, 256); + y_tile_width =3D 32; + } + + sclines =3D MSM_MEDIA_ALIGN(fb->height, 16); + y_tile_height =3D 4; + } else { + stride =3D MSM_MEDIA_ALIGN(fb->width, 128); + y_tile_width =3D 32; + + sclines =3D MSM_MEDIA_ALIGN(fb->height, 32); + y_tile_height =3D 8; + } =20 - layout->plane_pitch[0] =3D VENUS_Y_STRIDE(color, fb->width); - y_sclines =3D VENUS_Y_SCANLINES(color, fb->height); + layout->plane_pitch[0] =3D stride; layout->plane_size[0] =3D MSM_MEDIA_ALIGN(layout->plane_pitch[0] * - y_sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); + sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); =20 - layout->plane_pitch[1] =3D VENUS_UV_STRIDE(color, fb->width); - uv_sclines =3D VENUS_UV_SCANLINES(color, fb->height); + layout->plane_pitch[1] =3D stride; layout->plane_size[1] =3D MSM_MEDIA_ALIGN(layout->plane_pitch[1] * - uv_sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); + sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); =20 if (!meta) return 0; =20 - layout->plane_pitch[2] =3D VENUS_Y_META_STRIDE(color, fb->width); - y_meta_scanlines =3D VENUS_Y_META_SCANLINES(color, fb->height); + y_meta_stride =3D MSM_MEDIA_ROUNDUP(fb->width, y_tile_width); + layout->plane_pitch[2] =3D MSM_MEDIA_ALIGN(y_meta_stride, 64); + + y_meta_scanlines =3D MSM_MEDIA_ROUNDUP(fb->height, y_tile_height); + y_meta_scanlines =3D MSM_MEDIA_ALIGN(y_meta_scanlines, 16); layout->plane_size[2] =3D MSM_MEDIA_ALIGN(layout->plane_pitch[2] * y_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); =20 - layout->plane_pitch[3] =3D VENUS_UV_META_STRIDE(color, fb->width); - uv_meta_scanlines =3D VENUS_UV_META_SCANLINES(color, fb->height); + uv_meta_stride =3D MSM_MEDIA_ROUNDUP((fb->width+1)>>1, y_tile_width / 2); + layout->plane_pitch[3] =3D MSM_MEDIA_ALIGN(uv_meta_stride, 64); + + uv_meta_scanlines =3D MSM_MEDIA_ROUNDUP((fb->height+1)>>1, y_tile_height= ); + uv_meta_scanlines =3D MSM_MEDIA_ALIGN(uv_meta_scanlines, 16); layout->plane_size[3] =3D MSM_MEDIA_ALIGN(layout->plane_pitch[3] * uv_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); - } else { - uint32_t rgb_scanlines, rgb_meta_scanlines; + unsigned int rgb_scanlines, rgb_meta_scanlines, rgb_meta_stride; =20 - layout->plane_pitch[0] =3D VENUS_RGB_STRIDE(color, fb->width); - rgb_scanlines =3D VENUS_RGB_SCANLINES(color, fb->height); + layout->plane_pitch[0] =3D MSM_MEDIA_ALIGN(fb->width * fmt->bpp, 256); + rgb_scanlines =3D MSM_MEDIA_ALIGN(fb->height, 16); layout->plane_size[0] =3D MSM_MEDIA_ALIGN(layout->plane_pitch[0] * rgb_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); =20 @@ -147,8 +136,12 @@ static int _dpu_format_populate_plane_sizes_ubwc( /* uAPI leaves plane[1] empty and plane[2] as meta */ layout->num_planes +=3D 1; =20 - layout->plane_pitch[2] =3D VENUS_RGB_META_STRIDE(color, fb->width); - rgb_meta_scanlines =3D VENUS_RGB_META_SCANLINES(color, fb->height); + rgb_meta_stride =3D MSM_MEDIA_ROUNDUP(fb->width, 16); + layout->plane_pitch[2] =3D MSM_MEDIA_ALIGN(rgb_meta_stride, 64); + + rgb_meta_scanlines =3D MSM_MEDIA_ROUNDUP(fb->height, 4); + rgb_meta_scanlines =3D MSM_MEDIA_ALIGN(rgb_meta_scanlines, 16); + layout->plane_size[2] =3D MSM_MEDIA_ALIGN(layout->plane_pitch[2] * rgb_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h b/drivers/gpu/d= rm/msm/disp/dpu1/msm_media_info.h deleted file mode 100644 index 9fc9dbde8a27c1d7078c3d6b260c8635f27a514f..000000000000000000000000000= 0000000000000 --- a/drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h +++ /dev/null @@ -1,1155 +0,0 @@ -#ifndef __MEDIA_INFO_H__ -#define __MEDIA_INFO_H__ - -#ifndef MSM_MEDIA_ALIGN -#define MSM_MEDIA_ALIGN(__sz, __align) (((__align) & ((__align) - 1)) ?\ - ((((__sz) + (__align) - 1) / (__align)) * (__align)) :\ - (((__sz) + (__align) - 1) & (~((__align) - 1)))) -#endif - -#ifndef MSM_MEDIA_ROUNDUP -#define MSM_MEDIA_ROUNDUP(__sz, __r) (((__sz) + ((__r) - 1)) / (__r)) -#endif - -#ifndef MSM_MEDIA_MAX -#define MSM_MEDIA_MAX(__a, __b) ((__a) > (__b)?(__a):(__b)) -#endif - -enum color_fmts { - /* Venus NV12: - * YUV 4:2:0 image with a plane of 8 bit Y samples followed - * by an interleaved U/V plane containing 8 bit 2x2 subsampled - * colour difference samples. - * - * <-------- Y/UV_Stride --------> - * <------- Width -------> - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * U V U V U V U V U V U V . . . . ^ - * U V U V U V U V U V U V . . . . | - * U V U V U V U V U V U V . . . . | - * U V U V U V U V U V U V . . . . UV_Scanlines - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . . . --> Buffer size alignment - * - * Y_Stride : Width aligned to 128 - * UV_Stride : Width aligned to 128 - * Y_Scanlines: Height aligned to 32 - * UV_Scanlines: Height/2 aligned to 16 - * Extradata: Arbitrary (software-imposed) padding - * Total size =3D align((Y_Stride * Y_Scanlines - * + UV_Stride * UV_Scanlines - * + max(Extradata, Y_Stride * 8), 4096) - */ - COLOR_FMT_NV12, - - /* Venus NV21: - * YUV 4:2:0 image with a plane of 8 bit Y samples followed - * by an interleaved V/U plane containing 8 bit 2x2 subsampled - * colour difference samples. - * - * <-------- Y/UV_Stride --------> - * <------- Width -------> - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * V U V U V U V U V U V U . . . . ^ - * V U V U V U V U V U V U . . . . | - * V U V U V U V U V U V U . . . . | - * V U V U V U V U V U V U . . . . UV_Scanlines - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . . . --> Padding & Buffer size alignment - * - * Y_Stride : Width aligned to 128 - * UV_Stride : Width aligned to 128 - * Y_Scanlines: Height aligned to 32 - * UV_Scanlines: Height/2 aligned to 16 - * Extradata: Arbitrary (software-imposed) padding - * Total size =3D align((Y_Stride * Y_Scanlines - * + UV_Stride * UV_Scanlines - * + max(Extradata, Y_Stride * 8), 4096) - */ - COLOR_FMT_NV21, - /* Venus NV12_MVTB: - * Two YUV 4:2:0 images/views one after the other - * in a top-bottom layout, same as NV12 - * with a plane of 8 bit Y samples followed - * by an interleaved U/V plane containing 8 bit 2x2 subsampled - * colour difference samples. - * - * - * <-------- Y/UV_Stride --------> - * <------- Width -------> - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ ^ - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | | - * . . . . . . . . . . . . . . . . | View_1 - * . . . . . . . . . . . . . . . . | | - * . . . . . . . . . . . . . . . . | | - * . . . . . . . . . . . . . . . . V | - * U V U V U V U V U V U V . . . . ^ | - * U V U V U V U V U V U V . . . . | | - * U V U V U V U V U V U V . . . . | | - * U V U V U V U V U V U V . . . . UV_Scanlines | - * . . . . . . . . . . . . . . . . | | - * . . . . . . . . . . . . . . . . V V - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ ^ - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | | - * . . . . . . . . . . . . . . . . | View_2 - * . . . . . . . . . . . . . . . . | | - * . . . . . . . . . . . . . . . . | | - * . . . . . . . . . . . . . . . . V | - * U V U V U V U V U V U V . . . . ^ | - * U V U V U V U V U V U V . . . . | | - * U V U V U V U V U V U V . . . . | | - * U V U V U V U V U V U V . . . . UV_Scanlines | - * . . . . . . . . . . . . . . . . | | - * . . . . . . . . . . . . . . . . V V - * . . . . . . . . . . . . . . . . --> Buffer size alignment - * - * Y_Stride : Width aligned to 128 - * UV_Stride : Width aligned to 128 - * Y_Scanlines: Height aligned to 32 - * UV_Scanlines: Height/2 aligned to 16 - * View_1 begin at: 0 (zero) - * View_2 begin at: Y_Stride * Y_Scanlines + UV_Stride * UV_Scanlines - * Extradata: Arbitrary (software-imposed) padding - * Total size =3D align((2*(Y_Stride * Y_Scanlines) - * + 2*(UV_Stride * UV_Scanlines) + Extradata), 4096) - */ - COLOR_FMT_NV12_MVTB, - /* - * The buffer can be of 2 types: - * (1) Venus NV12 UBWC Progressive - * (2) Venus NV12 UBWC Interlaced - * - * (1) Venus NV12 UBWC Progressive Buffer Format: - * Compressed Macro-tile format for NV12. - * Contains 4 planes in the following order - - * (A) Y_Meta_Plane - * (B) Y_UBWC_Plane - * (C) UV_Meta_Plane - * (D) UV_UBWC_Plane - * - * Y_Meta_Plane consists of meta information to decode compressed - * tile data in Y_UBWC_Plane. - * Y_UBWC_Plane consists of Y data in compressed macro-tile format. - * UBWC decoder block will use the Y_Meta_Plane data together with - * Y_UBWC_Plane data to produce loss-less uncompressed 8 bit Y samples. - * - * UV_Meta_Plane consists of meta information to decode compressed - * tile data in UV_UBWC_Plane. - * UV_UBWC_Plane consists of UV data in compressed macro-tile format. - * UBWC decoder block will use UV_Meta_Plane data together with - * UV_UBWC_Plane data to produce loss-less uncompressed 8 bit 2x2 - * subsampled color difference samples. - * - * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable - * and randomly accessible. There is no dependency between tiles. - * - * <----- Y_Meta_Stride ----> - * <-------- Width ------> - * M M M M M M M M M M M M . . ^ ^ - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . Height | - * M M M M M M M M M M M M . . | Meta_Y_Scanlines - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . V | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . V - * <--Compressed tile Y Stride---> - * <------- Width -------> - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^ - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Height | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_Scanlines - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . . . V - * <----- UV_Meta_Stride ----> - * M M M M M M M M M M M M . . ^ - * M M M M M M M M M M M M . . | - * M M M M M M M M M M M M . . | - * M M M M M M M M M M M M . . M_UV_Scanlines - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * <--Compressed tile UV Stride---> - * U* V* U* V* U* V* U* V* . . . . ^ - * U* V* U* V* U* V* U* V* . . . . | - * U* V* U* V* U* V* U* V* . . . . | - * U* V* U* V* U* V* U* V* . . . . UV_Scanlines - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * - * Y_Stride =3D align(Width, 128) - * UV_Stride =3D align(Width, 128) - * Y_Scanlines =3D align(Height, 32) - * UV_Scanlines =3D align(Height/2, 16) - * Y_UBWC_Plane_size =3D align(Y_Stride * Y_Scanlines, 4096) - * UV_UBWC_Plane_size =3D align(UV_Stride * UV_Scanlines, 4096) - * Y_Meta_Stride =3D align(roundup(Width, Y_TileWidth), 64) - * Y_Meta_Scanlines =3D align(roundup(Height, Y_TileHeight), 16) - * Y_Meta_Plane_size =3D align(Y_Meta_Stride * Y_Meta_Scanlines, 4096) - * UV_Meta_Stride =3D align(roundup(Width, UV_TileWidth), 64) - * UV_Meta_Scanlines =3D align(roundup(Height, UV_TileHeight), 16) - * UV_Meta_Plane_size =3D align(UV_Meta_Stride * UV_Meta_Scanlines, 4096) - * Extradata =3D 8k - * - * Total size =3D align( Y_UBWC_Plane_size + UV_UBWC_Plane_size + - * Y_Meta_Plane_size + UV_Meta_Plane_size - * + max(Extradata, Y_Stride * 48), 4096) - * - * - * (2) Venus NV12 UBWC Interlaced Buffer Format: - * Compressed Macro-tile format for NV12 interlaced. - * Contains 8 planes in the following order - - * (A) Y_Meta_Top_Field_Plane - * (B) Y_UBWC_Top_Field_Plane - * (C) UV_Meta_Top_Field_Plane - * (D) UV_UBWC_Top_Field_Plane - * (E) Y_Meta_Bottom_Field_Plane - * (F) Y_UBWC_Bottom_Field_Plane - * (G) UV_Meta_Bottom_Field_Plane - * (H) UV_UBWC_Bottom_Field_Plane - * Y_Meta_Top_Field_Plane consists of meta information to decode - * compressed tile data for Y_UBWC_Top_Field_Plane. - * Y_UBWC_Top_Field_Plane consists of Y data in compressed macro-tile - * format for top field of an interlaced frame. - * UBWC decoder block will use the Y_Meta_Top_Field_Plane data together - * with Y_UBWC_Top_Field_Plane data to produce loss-less uncompressed - * 8 bit Y samples for top field of an interlaced frame. - * - * UV_Meta_Top_Field_Plane consists of meta information to decode - * compressed tile data in UV_UBWC_Top_Field_Plane. - * UV_UBWC_Top_Field_Plane consists of UV data in compressed macro-tile - * format for top field of an interlaced frame. - * UBWC decoder block will use UV_Meta_Top_Field_Plane data together - * with UV_UBWC_Top_Field_Plane data to produce loss-less uncompressed - * 8 bit subsampled color difference samples for top field of an - * interlaced frame. - * - * Each tile in Y_UBWC_Top_Field_Plane/UV_UBWC_Top_Field_Plane is - * independently decodable and randomly accessible. There is no - * dependency between tiles. - * - * Y_Meta_Bottom_Field_Plane consists of meta information to decode - * compressed tile data for Y_UBWC_Bottom_Field_Plane. - * Y_UBWC_Bottom_Field_Plane consists of Y data in compressed macro-tile - * format for bottom field of an interlaced frame. - * UBWC decoder block will use the Y_Meta_Bottom_Field_Plane data - * together with Y_UBWC_Bottom_Field_Plane data to produce loss-less - * uncompressed 8 bit Y samples for bottom field of an interlaced frame. - * - * UV_Meta_Bottom_Field_Plane consists of meta information to decode - * compressed tile data in UV_UBWC_Bottom_Field_Plane. - * UV_UBWC_Bottom_Field_Plane consists of UV data in compressed - * macro-tile format for bottom field of an interlaced frame. - * UBWC decoder block will use UV_Meta_Bottom_Field_Plane data together - * with UV_UBWC_Bottom_Field_Plane data to produce loss-less - * uncompressed 8 bit subsampled color difference samples for bottom - * field of an interlaced frame. - * - * Each tile in Y_UBWC_Bottom_Field_Plane/UV_UBWC_Bottom_Field_Plane is - * independently decodable and randomly accessible. There is no - * dependency between tiles. - * - * <-----Y_TF_Meta_Stride----> - * <-------- Width ------> - * M M M M M M M M M M M M . . ^ ^ - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . Half_height | - * M M M M M M M M M M M M . . | Meta_Y_TF_Scanlines - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . V | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . V - * <-Compressed tile Y_TF Stride-> - * <------- Width -------> - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^ - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Half_height | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_TF_Scanlines - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . . . V - * <----UV_TF_Meta_Stride----> - * M M M M M M M M M M M M . . ^ - * M M M M M M M M M M M M . . | - * M M M M M M M M M M M M . . | - * M M M M M M M M M M M M . . M_UV_TF_Scanlines - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * <-Compressed tile UV_TF Stride-> - * U* V* U* V* U* V* U* V* . . . . ^ - * U* V* U* V* U* V* U* V* . . . . | - * U* V* U* V* U* V* U* V* . . . . | - * U* V* U* V* U* V* U* V* . . . . UV_TF_Scanlines - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * <-----Y_BF_Meta_Stride----> - * <-------- Width ------> - * M M M M M M M M M M M M . . ^ ^ - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . Half_height | - * M M M M M M M M M M M M . . | Meta_Y_BF_Scanlines - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . V | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . V - * <-Compressed tile Y_BF Stride-> - * <------- Width -------> - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^ - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Half_height | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_BF_Scanlines - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . . . V - * <----UV_BF_Meta_Stride----> - * M M M M M M M M M M M M . . ^ - * M M M M M M M M M M M M . . | - * M M M M M M M M M M M M . . | - * M M M M M M M M M M M M . . M_UV_BF_Scanlines - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * <-Compressed tile UV_BF Stride-> - * U* V* U* V* U* V* U* V* . . . . ^ - * U* V* U* V* U* V* U* V* . . . . | - * U* V* U* V* U* V* U* V* . . . . | - * U* V* U* V* U* V* U* V* . . . . UV_BF_Scanlines - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * - * Half_height =3D (Height+1)>>1 - * Y_TF_Stride =3D align(Width, 128) - * UV_TF_Stride =3D align(Width, 128) - * Y_TF_Scanlines =3D align(Half_height, 32) - * UV_TF_Scanlines =3D align((Half_height+1)/2, 32) - * Y_UBWC_TF_Plane_size =3D align(Y_TF_Stride * Y_TF_Scanlines, 4096) - * UV_UBWC_TF_Plane_size =3D align(UV_TF_Stride * UV_TF_Scanlines, 4096) - * Y_TF_Meta_Stride =3D align(roundup(Width, Y_TileWidth), 64) - * Y_TF_Meta_Scanlines =3D align(roundup(Half_height, Y_TileHeight), 16) - * Y_TF_Meta_Plane_size =3D - * align(Y_TF_Meta_Stride * Y_TF_Meta_Scanlines, 4096) - * UV_TF_Meta_Stride =3D align(roundup(Width, UV_TileWidth), 64) - * UV_TF_Meta_Scanlines =3D align(roundup(Half_height, UV_TileHeight), 16) - * UV_TF_Meta_Plane_size =3D - * align(UV_TF_Meta_Stride * UV_TF_Meta_Scanlines, 4096) - * Y_BF_Stride =3D align(Width, 128) - * UV_BF_Stride =3D align(Width, 128) - * Y_BF_Scanlines =3D align(Half_height, 32) - * UV_BF_Scanlines =3D align((Half_height+1)/2, 32) - * Y_UBWC_BF_Plane_size =3D align(Y_BF_Stride * Y_BF_Scanlines, 4096) - * UV_UBWC_BF_Plane_size =3D align(UV_BF_Stride * UV_BF_Scanlines, 4096) - * Y_BF_Meta_Stride =3D align(roundup(Width, Y_TileWidth), 64) - * Y_BF_Meta_Scanlines =3D align(roundup(Half_height, Y_TileHeight), 16) - * Y_BF_Meta_Plane_size =3D - * align(Y_BF_Meta_Stride * Y_BF_Meta_Scanlines, 4096) - * UV_BF_Meta_Stride =3D align(roundup(Width, UV_TileWidth), 64) - * UV_BF_Meta_Scanlines =3D align(roundup(Half_height, UV_TileHeight), 16) - * UV_BF_Meta_Plane_size =3D - * align(UV_BF_Meta_Stride * UV_BF_Meta_Scanlines, 4096) - * Extradata =3D 8k - * - * Total size =3D align( Y_UBWC_TF_Plane_size + UV_UBWC_TF_Plane_size + - * Y_TF_Meta_Plane_size + UV_TF_Meta_Plane_size + - * Y_UBWC_BF_Plane_size + UV_UBWC_BF_Plane_size + - * Y_BF_Meta_Plane_size + UV_BF_Meta_Plane_size + - * + max(Extradata, Y_TF_Stride * 48), 4096) - */ - COLOR_FMT_NV12_UBWC, - /* Venus NV12 10-bit UBWC: - * Compressed Macro-tile format for NV12. - * Contains 4 planes in the following order - - * (A) Y_Meta_Plane - * (B) Y_UBWC_Plane - * (C) UV_Meta_Plane - * (D) UV_UBWC_Plane - * - * Y_Meta_Plane consists of meta information to decode compressed - * tile data in Y_UBWC_Plane. - * Y_UBWC_Plane consists of Y data in compressed macro-tile format. - * UBWC decoder block will use the Y_Meta_Plane data together with - * Y_UBWC_Plane data to produce loss-less uncompressed 10 bit Y samples. - * - * UV_Meta_Plane consists of meta information to decode compressed - * tile data in UV_UBWC_Plane. - * UV_UBWC_Plane consists of UV data in compressed macro-tile format. - * UBWC decoder block will use UV_Meta_Plane data together with - * UV_UBWC_Plane data to produce loss-less uncompressed 10 bit 2x2 - * subsampled color difference samples. - * - * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable - * and randomly accessible. There is no dependency between tiles. - * - * <----- Y_Meta_Stride -----> - * <-------- Width ------> - * M M M M M M M M M M M M . . ^ ^ - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . Height | - * M M M M M M M M M M M M . . | Meta_Y_Scanlines - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . V | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . V - * <--Compressed tile Y Stride---> - * <------- Width -------> - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^ - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Height | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_Scanlines - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . . . V - * <----- UV_Meta_Stride ----> - * M M M M M M M M M M M M . . ^ - * M M M M M M M M M M M M . . | - * M M M M M M M M M M M M . . | - * M M M M M M M M M M M M . . M_UV_Scanlines - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * <--Compressed tile UV Stride---> - * U* V* U* V* U* V* U* V* . . . . ^ - * U* V* U* V* U* V* U* V* . . . . | - * U* V* U* V* U* V* U* V* . . . . | - * U* V* U* V* U* V* U* V* . . . . UV_Scanlines - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * - * - * Y_Stride =3D align(Width * 4/3, 128) - * UV_Stride =3D align(Width * 4/3, 128) - * Y_Scanlines =3D align(Height, 32) - * UV_Scanlines =3D align(Height/2, 16) - * Y_UBWC_Plane_Size =3D align(Y_Stride * Y_Scanlines, 4096) - * UV_UBWC_Plane_Size =3D align(UV_Stride * UV_Scanlines, 4096) - * Y_Meta_Stride =3D align(roundup(Width, Y_TileWidth), 64) - * Y_Meta_Scanlines =3D align(roundup(Height, Y_TileHeight), 16) - * Y_Meta_Plane_size =3D align(Y_Meta_Stride * Y_Meta_Scanlines, 4096) - * UV_Meta_Stride =3D align(roundup(Width, UV_TileWidth), 64) - * UV_Meta_Scanlines =3D align(roundup(Height, UV_TileHeight), 16) - * UV_Meta_Plane_size =3D align(UV_Meta_Stride * UV_Meta_Scanlines, 4096) - * Extradata =3D 8k - * - * Total size =3D align(Y_UBWC_Plane_size + UV_UBWC_Plane_size + - * Y_Meta_Plane_size + UV_Meta_Plane_size - * + max(Extradata, Y_Stride * 48), 4096) - */ - COLOR_FMT_NV12_BPP10_UBWC, - /* Venus RGBA8888 format: - * Contains 1 plane in the following order - - * (A) RGBA plane - * - * <-------- RGB_Stride --------> - * <------- Width -------> - * R R R R R R R R R R R R . . . . ^ ^ - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . Height | - * R R R R R R R R R R R R . . . . | RGB_Scanlines - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . V | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * - * RGB_Stride =3D align(Width * 4, 128) - * RGB_Scanlines =3D align(Height, 32) - * RGB_Plane_size =3D align(RGB_Stride * RGB_Scanlines, 4096) - * Extradata =3D 8k - * - * Total size =3D align(RGB_Plane_size + Extradata, 4096) - */ - COLOR_FMT_RGBA8888, - /* Venus RGBA8888 UBWC format: - * Contains 2 planes in the following order - - * (A) Meta plane - * (B) RGBA plane - * - * <--- RGB_Meta_Stride ----> - * <-------- Width ------> - * M M M M M M M M M M M M . . ^ ^ - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . Height | - * M M M M M M M M M M M M . . | Meta_RGB_Scanlines - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . V | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . V - * <-------- RGB_Stride --------> - * <------- Width -------> - * R R R R R R R R R R R R . . . . ^ ^ - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . Height | - * R R R R R R R R R R R R . . . . | RGB_Scanlines - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . V | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . . . V - * - * RGB_Stride =3D align(Width * 4, 128) - * RGB_Scanlines =3D align(Height, 32) - * RGB_Plane_size =3D align(RGB_Stride * RGB_Scanlines, 4096) - * RGB_Meta_Stride =3D align(roundup(Width, RGB_TileWidth), 64) - * RGB_Meta_Scanline =3D align(roundup(Height, RGB_TileHeight), 16) - * RGB_Meta_Plane_size =3D align(RGB_Meta_Stride * - * RGB_Meta_Scanlines, 4096) - * Extradata =3D 8k - * - * Total size =3D align(RGB_Meta_Plane_size + RGB_Plane_size + - * Extradata, 4096) - */ - COLOR_FMT_RGBA8888_UBWC, - /* Venus RGBA1010102 UBWC format: - * Contains 2 planes in the following order - - * (A) Meta plane - * (B) RGBA plane - * - * <--- RGB_Meta_Stride ----> - * <-------- Width ------> - * M M M M M M M M M M M M . . ^ ^ - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . Height | - * M M M M M M M M M M M M . . | Meta_RGB_Scanlines - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . V | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . V - * <-------- RGB_Stride --------> - * <------- Width -------> - * R R R R R R R R R R R R . . . . ^ ^ - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . Height | - * R R R R R R R R R R R R . . . . | RGB_Scanlines - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . V | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . . . V - * - * RGB_Stride =3D align(Width * 4, 256) - * RGB_Scanlines =3D align(Height, 16) - * RGB_Plane_size =3D align(RGB_Stride * RGB_Scanlines, 4096) - * RGB_Meta_Stride =3D align(roundup(Width, RGB_TileWidth), 64) - * RGB_Meta_Scanline =3D align(roundup(Height, RGB_TileHeight), 16) - * RGB_Meta_Plane_size =3D align(RGB_Meta_Stride * - * RGB_Meta_Scanlines, 4096) - * Extradata =3D 8k - * - * Total size =3D align(RGB_Meta_Plane_size + RGB_Plane_size + - * Extradata, 4096) - */ - COLOR_FMT_RGBA1010102_UBWC, - /* Venus RGB565 UBWC format: - * Contains 2 planes in the following order - - * (A) Meta plane - * (B) RGB plane - * - * <--- RGB_Meta_Stride ----> - * <-------- Width ------> - * M M M M M M M M M M M M . . ^ ^ - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . Height | - * M M M M M M M M M M M M . . | Meta_RGB_Scanlines - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . V | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . V - * <-------- RGB_Stride --------> - * <------- Width -------> - * R R R R R R R R R R R R . . . . ^ ^ - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . Height | - * R R R R R R R R R R R R . . . . | RGB_Scanlines - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . | | - * R R R R R R R R R R R R . . . . V | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . . . V - * - * RGB_Stride =3D align(Width * 2, 128) - * RGB_Scanlines =3D align(Height, 16) - * RGB_Plane_size =3D align(RGB_Stride * RGB_Scanlines, 4096) - * RGB_Meta_Stride =3D align(roundup(Width, RGB_TileWidth), 64) - * RGB_Meta_Scanline =3D align(roundup(Height, RGB_TileHeight), 16) - * RGB_Meta_Plane_size =3D align(RGB_Meta_Stride * - * RGB_Meta_Scanlines, 4096) - * Extradata =3D 8k - * - * Total size =3D align(RGB_Meta_Plane_size + RGB_Plane_size + - * Extradata, 4096) - */ - COLOR_FMT_RGB565_UBWC, - /* P010 UBWC: - * Compressed Macro-tile format for NV12. - * Contains 4 planes in the following order - - * (A) Y_Meta_Plane - * (B) Y_UBWC_Plane - * (C) UV_Meta_Plane - * (D) UV_UBWC_Plane - * - * Y_Meta_Plane consists of meta information to decode compressed - * tile data in Y_UBWC_Plane. - * Y_UBWC_Plane consists of Y data in compressed macro-tile format. - * UBWC decoder block will use the Y_Meta_Plane data together with - * Y_UBWC_Plane data to produce loss-less uncompressed 10 bit Y samples. - * - * UV_Meta_Plane consists of meta information to decode compressed - * tile data in UV_UBWC_Plane. - * UV_UBWC_Plane consists of UV data in compressed macro-tile format. - * UBWC decoder block will use UV_Meta_Plane data together with - * UV_UBWC_Plane data to produce loss-less uncompressed 10 bit 2x2 - * subsampled color difference samples. - * - * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable - * and randomly accessible. There is no dependency between tiles. - * - * <----- Y_Meta_Stride -----> - * <-------- Width ------> - * M M M M M M M M M M M M . . ^ ^ - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . Height | - * M M M M M M M M M M M M . . | Meta_Y_Scanlines - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . | | - * M M M M M M M M M M M M . . V | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . V - * <--Compressed tile Y Stride---> - * <------- Width -------> - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^ - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Height | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_Scanlines - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | | - * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * . . . . . . . . . . . . . . . . V - * <----- UV_Meta_Stride ----> - * M M M M M M M M M M M M . . ^ - * M M M M M M M M M M M M . . | - * M M M M M M M M M M M M . . | - * M M M M M M M M M M M M . . M_UV_Scanlines - * . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * <--Compressed tile UV Stride---> - * U* V* U* V* U* V* U* V* . . . . ^ - * U* V* U* V* U* V* U* V* . . . . | - * U* V* U* V* U* V* U* V* . . . . | - * U* V* U* V* U* V* U* V* . . . . UV_Scanlines - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k - * - * - * Y_Stride =3D align(Width * 2, 256) - * UV_Stride =3D align(Width * 2, 256) - * Y_Scanlines =3D align(Height, 16) - * UV_Scanlines =3D align(Height/2, 16) - * Y_UBWC_Plane_Size =3D align(Y_Stride * Y_Scanlines, 4096) - * UV_UBWC_Plane_Size =3D align(UV_Stride * UV_Scanlines, 4096) - * Y_Meta_Stride =3D align(roundup(Width, Y_TileWidth), 64) - * Y_Meta_Scanlines =3D align(roundup(Height, Y_TileHeight), 16) - * Y_Meta_Plane_size =3D align(Y_Meta_Stride * Y_Meta_Scanlines, 4096) - * UV_Meta_Stride =3D align(roundup(Width, UV_TileWidth), 64) - * UV_Meta_Scanlines =3D align(roundup(Height, UV_TileHeight), 16) - * UV_Meta_Plane_size =3D align(UV_Meta_Stride * UV_Meta_Scanlines, 4096) - * Extradata =3D 8k - * - * Total size =3D align(Y_UBWC_Plane_size + UV_UBWC_Plane_size + - * Y_Meta_Plane_size + UV_Meta_Plane_size - * + max(Extradata, Y_Stride * 48), 4096) - */ - COLOR_FMT_P010_UBWC, - /* Venus P010: - * YUV 4:2:0 image with a plane of 10 bit Y samples followed - * by an interleaved U/V plane containing 10 bit 2x2 subsampled - * colour difference samples. - * - * <-------- Y/UV_Stride --------> - * <------- Width -------> - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | - * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * U V U V U V U V U V U V . . . . ^ - * U V U V U V U V U V U V . . . . | - * U V U V U V U V U V U V . . . . | - * U V U V U V U V U V U V . . . . UV_Scanlines - * . . . . . . . . . . . . . . . . | - * . . . . . . . . . . . . . . . . V - * . . . . . . . . . . . . . . . . --> Buffer size alignment - * - * Y_Stride : Width * 2 aligned to 128 - * UV_Stride : Width * 2 aligned to 128 - * Y_Scanlines: Height aligned to 32 - * UV_Scanlines: Height/2 aligned to 16 - * Extradata: Arbitrary (software-imposed) padding - * Total size =3D align((Y_Stride * Y_Scanlines - * + UV_Stride * UV_Scanlines - * + max(Extradata, Y_Stride * 8), 4096) - */ - COLOR_FMT_P010, -}; - -#define COLOR_FMT_RGBA1010102_UBWC COLOR_FMT_RGBA1010102_UBWC -#define COLOR_FMT_RGB565_UBWC COLOR_FMT_RGB565_UBWC -#define COLOR_FMT_P010_UBWC COLOR_FMT_P010_UBWC -#define COLOR_FMT_P010 COLOR_FMT_P010 - -/* - * Function arguments: - * @color_fmt - * @width - * Progressive: width - * Interlaced: width - */ -static unsigned int VENUS_Y_STRIDE(int color_fmt, int width) -{ - unsigned int stride =3D 0; - - if (!width) - return 0; - - switch (color_fmt) { - case COLOR_FMT_NV21: - case COLOR_FMT_NV12: - case COLOR_FMT_NV12_MVTB: - case COLOR_FMT_NV12_UBWC: - stride =3D MSM_MEDIA_ALIGN(width, 128); - break; - case COLOR_FMT_NV12_BPP10_UBWC: - stride =3D MSM_MEDIA_ALIGN(width, 192); - stride =3D MSM_MEDIA_ALIGN(stride * 4 / 3, 256); - break; - case COLOR_FMT_P010_UBWC: - stride =3D MSM_MEDIA_ALIGN(width * 2, 256); - break; - case COLOR_FMT_P010: - stride =3D MSM_MEDIA_ALIGN(width * 2, 128); - break; - } - - return stride; -} - -/* - * Function arguments: - * @color_fmt - * @width - * Progressive: width - * Interlaced: width - */ -static unsigned int VENUS_UV_STRIDE(int color_fmt, int width) -{ - unsigned int stride =3D 0; - - if (!width) - return 0; - - switch (color_fmt) { - case COLOR_FMT_NV21: - case COLOR_FMT_NV12: - case COLOR_FMT_NV12_MVTB: - case COLOR_FMT_NV12_UBWC: - stride =3D MSM_MEDIA_ALIGN(width, 128); - break; - case COLOR_FMT_NV12_BPP10_UBWC: - stride =3D MSM_MEDIA_ALIGN(width, 192); - stride =3D MSM_MEDIA_ALIGN(stride * 4 / 3, 256); - break; - case COLOR_FMT_P010_UBWC: - stride =3D MSM_MEDIA_ALIGN(width * 2, 256); - break; - case COLOR_FMT_P010: - stride =3D MSM_MEDIA_ALIGN(width * 2, 128); - break; - } - - return stride; -} - -/* - * Function arguments: - * @color_fmt - * @height - * Progressive: height - * Interlaced: (height+1)>>1 - */ -static unsigned int VENUS_Y_SCANLINES(int color_fmt, int height) -{ - unsigned int sclines =3D 0; - - if (!height) - return 0; - - switch (color_fmt) { - case COLOR_FMT_NV21: - case COLOR_FMT_NV12: - case COLOR_FMT_NV12_MVTB: - case COLOR_FMT_NV12_UBWC: - case COLOR_FMT_P010: - sclines =3D MSM_MEDIA_ALIGN(height, 32); - break; - case COLOR_FMT_NV12_BPP10_UBWC: - case COLOR_FMT_P010_UBWC: - sclines =3D MSM_MEDIA_ALIGN(height, 16); - break; - } - - return sclines; -} - -/* - * Function arguments: - * @color_fmt - * @height - * Progressive: height - * Interlaced: (height+1)>>1 - */ -static unsigned int VENUS_UV_SCANLINES(int color_fmt, int height) -{ - unsigned int sclines =3D 0; - - if (!height) - return 0; - - switch (color_fmt) { - case COLOR_FMT_NV21: - case COLOR_FMT_NV12: - case COLOR_FMT_NV12_MVTB: - case COLOR_FMT_NV12_BPP10_UBWC: - case COLOR_FMT_P010_UBWC: - case COLOR_FMT_P010: - sclines =3D MSM_MEDIA_ALIGN((height + 1) >> 1, 16); - break; - case COLOR_FMT_NV12_UBWC: - sclines =3D MSM_MEDIA_ALIGN((height + 1) >> 1, 32); - break; - } - - return sclines; -} - -/* - * Function arguments: - * @color_fmt - * @width - * Progressive: width - * Interlaced: width - */ -static unsigned int VENUS_Y_META_STRIDE(int color_fmt, int width) -{ - int y_tile_width =3D 0, y_meta_stride; - - if (!width) - return 0; - - switch (color_fmt) { - case COLOR_FMT_NV12_UBWC: - case COLOR_FMT_P010_UBWC: - y_tile_width =3D 32; - break; - case COLOR_FMT_NV12_BPP10_UBWC: - y_tile_width =3D 48; - break; - default: - return 0; - } - - y_meta_stride =3D MSM_MEDIA_ROUNDUP(width, y_tile_width); - return MSM_MEDIA_ALIGN(y_meta_stride, 64); -} - -/* - * Function arguments: - * @color_fmt - * @height - * Progressive: height - * Interlaced: (height+1)>>1 - */ -static unsigned int VENUS_Y_META_SCANLINES(int color_fmt, int height) -{ - int y_tile_height =3D 0, y_meta_scanlines; - - if (!height) - return 0; - - switch (color_fmt) { - case COLOR_FMT_NV12_UBWC: - y_tile_height =3D 8; - break; - case COLOR_FMT_NV12_BPP10_UBWC: - case COLOR_FMT_P010_UBWC: - y_tile_height =3D 4; - break; - default: - return 0; - } - - y_meta_scanlines =3D MSM_MEDIA_ROUNDUP(height, y_tile_height); - return MSM_MEDIA_ALIGN(y_meta_scanlines, 16); -} - -/* - * Function arguments: - * @color_fmt - * @width - * Progressive: width - * Interlaced: width - */ -static unsigned int VENUS_UV_META_STRIDE(int color_fmt, int width) -{ - int uv_tile_width =3D 0, uv_meta_stride; - - if (!width) - return 0; - - switch (color_fmt) { - case COLOR_FMT_NV12_UBWC: - case COLOR_FMT_P010_UBWC: - uv_tile_width =3D 16; - break; - case COLOR_FMT_NV12_BPP10_UBWC: - uv_tile_width =3D 24; - break; - default: - return 0; - } - - uv_meta_stride =3D MSM_MEDIA_ROUNDUP((width+1)>>1, uv_tile_width); - return MSM_MEDIA_ALIGN(uv_meta_stride, 64); -} - -/* - * Function arguments: - * @color_fmt - * @height - * Progressive: height - * Interlaced: (height+1)>>1 - */ -static unsigned int VENUS_UV_META_SCANLINES(int color_fmt, int height) -{ - int uv_tile_height =3D 0, uv_meta_scanlines; - - if (!height) - return 0; - - switch (color_fmt) { - case COLOR_FMT_NV12_UBWC: - uv_tile_height =3D 8; - break; - case COLOR_FMT_NV12_BPP10_UBWC: - case COLOR_FMT_P010_UBWC: - uv_tile_height =3D 4; - break; - default: - return 0; - } - - uv_meta_scanlines =3D MSM_MEDIA_ROUNDUP((height+1)>>1, uv_tile_height); - return MSM_MEDIA_ALIGN(uv_meta_scanlines, 16); -} - -static unsigned int VENUS_RGB_STRIDE(int color_fmt, int width) -{ - unsigned int alignment =3D 0, bpp =3D 4; - - if (!width) - return 0; - - switch (color_fmt) { - case COLOR_FMT_RGBA8888: - alignment =3D 128; - break; - case COLOR_FMT_RGB565_UBWC: - alignment =3D 256; - bpp =3D 2; - break; - case COLOR_FMT_RGBA8888_UBWC: - case COLOR_FMT_RGBA1010102_UBWC: - alignment =3D 256; - break; - default: - return 0; - } - - return MSM_MEDIA_ALIGN(width * bpp, alignment); -} - -static unsigned int VENUS_RGB_SCANLINES(int color_fmt, int height) -{ - unsigned int alignment =3D 0; - - if (!height) - return 0; - - switch (color_fmt) { - case COLOR_FMT_RGBA8888: - alignment =3D 32; - break; - case COLOR_FMT_RGBA8888_UBWC: - case COLOR_FMT_RGBA1010102_UBWC: - case COLOR_FMT_RGB565_UBWC: - alignment =3D 16; - break; - default: - return 0; - } - - return MSM_MEDIA_ALIGN(height, alignment); -} - -static unsigned int VENUS_RGB_META_STRIDE(int color_fmt, int width) -{ - int rgb_meta_stride; - - if (!width) - return 0; - - switch (color_fmt) { - case COLOR_FMT_RGBA8888_UBWC: - case COLOR_FMT_RGBA1010102_UBWC: - case COLOR_FMT_RGB565_UBWC: - rgb_meta_stride =3D MSM_MEDIA_ROUNDUP(width, 16); - return MSM_MEDIA_ALIGN(rgb_meta_stride, 64); - } - - return 0; -} - -static unsigned int VENUS_RGB_META_SCANLINES(int color_fmt, int height) -{ - int rgb_meta_scanlines; - - if (!height) - return 0; - - switch (color_fmt) { - case COLOR_FMT_RGBA8888_UBWC: - case COLOR_FMT_RGBA1010102_UBWC: - case COLOR_FMT_RGB565_UBWC: - rgb_meta_scanlines =3D MSM_MEDIA_ROUNDUP(height, 4); - return MSM_MEDIA_ALIGN(rgb_meta_scanlines, 16); - } - - return 0; -} - -#endif --=20 2.47.3