LCOV - code coverage report
Current view: top level - drivers/gpu/drm/tests - drm_format_test.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 222 0.0 %
Date: 2023-08-24 13:40:31 Functions: 0 18 0.0 %

          Line data    Source code
       1             : // SPDX-License-Identifier: GPL-2.0
       2             : /*
       3             :  * Test cases for the drm_format functions
       4             :  *
       5             :  * Copyright (c) 2022 MaĆ­ra Canal <mairacanal@riseup.net>
       6             :  */
       7             : 
       8             : #include <kunit/test.h>
       9             : 
      10             : #include <drm/drm_fourcc.h>
      11             : 
      12           0 : static void drm_test_format_block_width_invalid(struct kunit *test)
      13             : {
      14           0 :         const struct drm_format_info *info = NULL;
      15             : 
      16           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 0), 0);
      17           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, -1), 0);
      18           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 1), 0);
      19           0 : }
      20             : 
      21           0 : static void drm_test_format_block_width_one_plane(struct kunit *test)
      22             : {
      23           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_XRGB4444);
      24             : 
      25           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
      26             : 
      27           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 0), 1);
      28           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 1), 0);
      29           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, -1), 0);
      30           0 : }
      31             : 
      32           0 : static void drm_test_format_block_width_two_plane(struct kunit *test)
      33             : {
      34           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_NV12);
      35             : 
      36           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
      37             : 
      38           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 0), 1);
      39           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 1), 1);
      40           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 2), 0);
      41           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, -1), 0);
      42           0 : }
      43             : 
      44           0 : static void drm_test_format_block_width_three_plane(struct kunit *test)
      45             : {
      46           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_YUV422);
      47             : 
      48           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
      49             : 
      50           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 0), 1);
      51           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 1), 1);
      52           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 2), 1);
      53           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 3), 0);
      54           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, -1), 0);
      55           0 : }
      56             : 
      57           0 : static void drm_test_format_block_width_tiled(struct kunit *test)
      58             : {
      59           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_X0L0);
      60             : 
      61           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
      62             : 
      63           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 0), 2);
      64           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 1), 0);
      65           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, -1), 0);
      66           0 : }
      67             : 
      68           0 : static void drm_test_format_block_height_invalid(struct kunit *test)
      69             : {
      70           0 :         const struct drm_format_info *info = NULL;
      71             : 
      72           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, 0), 0);
      73           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, -1), 0);
      74           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, 1), 0);
      75           0 : }
      76             : 
      77           0 : static void drm_test_format_block_height_one_plane(struct kunit *test)
      78             : {
      79           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_XRGB4444);
      80             : 
      81           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
      82             : 
      83           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, 0), 1);
      84           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, -1), 0);
      85           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, 1), 0);
      86           0 : }
      87             : 
      88           0 : static void drm_test_format_block_height_two_plane(struct kunit *test)
      89             : {
      90           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_NV12);
      91             : 
      92           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
      93             : 
      94           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, 0), 1);
      95           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, 1), 1);
      96           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, 2), 0);
      97           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, -1), 0);
      98           0 : }
      99             : 
     100           0 : static void drm_test_format_block_height_three_plane(struct kunit *test)
     101             : {
     102           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_YUV422);
     103             : 
     104           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
     105             : 
     106           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, 0), 1);
     107           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, 1), 1);
     108           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, 2), 1);
     109           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, 3), 0);
     110           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, -1), 0);
     111           0 : }
     112             : 
     113           0 : static void drm_test_format_block_height_tiled(struct kunit *test)
     114             : {
     115           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_X0L0);
     116             : 
     117           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
     118             : 
     119           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, 0), 2);
     120           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, 1), 0);
     121           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_block_height(info, -1), 0);
     122           0 : }
     123             : 
     124           0 : static void drm_test_format_min_pitch_invalid(struct kunit *test)
     125             : {
     126           0 :         const struct drm_format_info *info = NULL;
     127             : 
     128           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 0), 0);
     129           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, -1, 0), 0);
     130           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 0), 0);
     131           0 : }
     132             : 
     133           0 : static void drm_test_format_min_pitch_one_plane_8bpp(struct kunit *test)
     134             : {
     135           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_RGB332);
     136             : 
     137           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
     138             : 
     139           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 0), 0);
     140           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, -1, 0), 0);
     141           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 0), 0);
     142             : 
     143           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1), 1);
     144           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 2), 2);
     145           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 640), 640);
     146           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1024), 1024);
     147           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1920), 1920);
     148           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 4096), 4096);
     149           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 671), 671);
     150           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, UINT_MAX),
     151             :                         (uint64_t)UINT_MAX);
     152           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, (UINT_MAX - 1)),
     153             :                         (uint64_t)(UINT_MAX - 1));
     154           0 : }
     155             : 
     156           0 : static void drm_test_format_min_pitch_one_plane_16bpp(struct kunit *test)
     157             : {
     158           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_XRGB4444);
     159             : 
     160           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
     161             : 
     162           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 0), 0);
     163           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, -1, 0), 0);
     164           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 0), 0);
     165             : 
     166           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1), 2);
     167           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 2), 4);
     168           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 640), 1280);
     169           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1024), 2048);
     170           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1920), 3840);
     171           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 4096), 8192);
     172           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 671), 1342);
     173           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, UINT_MAX),
     174             :                         (uint64_t)UINT_MAX * 2);
     175           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, (UINT_MAX - 1)),
     176             :                         (uint64_t)(UINT_MAX - 1) * 2);
     177           0 : }
     178             : 
     179           0 : static void drm_test_format_min_pitch_one_plane_24bpp(struct kunit *test)
     180             : {
     181           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_RGB888);
     182             : 
     183           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
     184             : 
     185           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 0), 0);
     186           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, -1, 0), 0);
     187           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 0), 0);
     188             : 
     189           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1), 3);
     190           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 2), 6);
     191           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 640), 1920);
     192           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1024), 3072);
     193           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1920), 5760);
     194           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 4096), 12288);
     195           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 671), 2013);
     196           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, UINT_MAX),
     197             :                         (uint64_t)UINT_MAX * 3);
     198           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, UINT_MAX - 1),
     199             :                         (uint64_t)(UINT_MAX - 1) * 3);
     200           0 : }
     201             : 
     202           0 : static void drm_test_format_min_pitch_one_plane_32bpp(struct kunit *test)
     203             : {
     204           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_ABGR8888);
     205             : 
     206           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
     207             : 
     208           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 0), 0);
     209           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, -1, 0), 0);
     210           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 0), 0);
     211             : 
     212           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1), 4);
     213           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 2), 8);
     214           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 640), 2560);
     215           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1024), 4096);
     216           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1920), 7680);
     217           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 4096), 16384);
     218           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 671), 2684);
     219           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, UINT_MAX),
     220             :                         (uint64_t)UINT_MAX * 4);
     221           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, UINT_MAX - 1),
     222             :                         (uint64_t)(UINT_MAX - 1) * 4);
     223           0 : }
     224             : 
     225           0 : static void drm_test_format_min_pitch_two_plane(struct kunit *test)
     226             : {
     227           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_NV12);
     228             : 
     229           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
     230             : 
     231           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 0), 0);
     232           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 0), 0);
     233           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, -1, 0), 0);
     234           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 2, 0), 0);
     235             : 
     236           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1), 1);
     237           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 1), 2);
     238           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 2), 2);
     239           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 1), 2);
     240           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 640), 640);
     241           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 320), 640);
     242           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1024), 1024);
     243           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 512), 1024);
     244           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1920), 1920);
     245           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 960), 1920);
     246           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 4096), 4096);
     247           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 2048), 4096);
     248           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 671), 671);
     249           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 336), 672);
     250           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, UINT_MAX),
     251             :                         (uint64_t)UINT_MAX);
     252           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, UINT_MAX / 2 + 1),
     253             :                         (uint64_t)UINT_MAX + 1);
     254           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, (UINT_MAX - 1)),
     255             :                         (uint64_t)(UINT_MAX - 1));
     256           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, (UINT_MAX - 1) /  2),
     257             :                         (uint64_t)(UINT_MAX - 1));
     258           0 : }
     259             : 
     260           0 : static void drm_test_format_min_pitch_three_plane_8bpp(struct kunit *test)
     261             : {
     262           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_YUV422);
     263             : 
     264           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
     265             : 
     266           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 0), 0);
     267           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 0), 0);
     268           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 2, 0), 0);
     269           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, -1, 0), 0);
     270           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 3, 0), 0);
     271             : 
     272           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1), 1);
     273           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 1), 1);
     274           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 2, 1), 1);
     275           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 2), 2);
     276           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 2), 2);
     277           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 2, 2), 2);
     278           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 640), 640);
     279           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 320), 320);
     280           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 2, 320), 320);
     281           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1024), 1024);
     282           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 512), 512);
     283           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 2, 512), 512);
     284           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1920), 1920);
     285           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 960), 960);
     286           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 2, 960), 960);
     287           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 4096), 4096);
     288           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 2048), 2048);
     289           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 2, 2048), 2048);
     290           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 671), 671);
     291           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 336), 336);
     292           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 2, 336), 336);
     293           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, UINT_MAX),
     294             :                         (uint64_t)UINT_MAX);
     295           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, UINT_MAX / 2 + 1),
     296             :                         (uint64_t)UINT_MAX / 2 + 1);
     297           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 2, UINT_MAX / 2 + 1),
     298             :                         (uint64_t)UINT_MAX / 2 + 1);
     299           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, (UINT_MAX - 1) / 2),
     300             :                         (uint64_t)(UINT_MAX - 1) / 2);
     301           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, (UINT_MAX - 1) / 2),
     302             :                         (uint64_t)(UINT_MAX - 1) / 2);
     303           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 2, (UINT_MAX - 1) / 2),
     304             :                         (uint64_t)(UINT_MAX - 1) / 2);
     305           0 : }
     306             : 
     307           0 : static void drm_test_format_min_pitch_tiled(struct kunit *test)
     308             : {
     309           0 :         const struct drm_format_info *info = drm_format_info(DRM_FORMAT_X0L2);
     310             : 
     311           0 :         KUNIT_ASSERT_NOT_NULL(test, info);
     312             : 
     313           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 0), 0);
     314           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, -1, 0), 0);
     315           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 1, 0), 0);
     316             : 
     317           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1), 2);
     318           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 2), 4);
     319           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 640), 1280);
     320           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1024), 2048);
     321           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 1920), 3840);
     322           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 4096), 8192);
     323           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, 671), 1342);
     324           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, UINT_MAX),
     325             :                         (uint64_t)UINT_MAX * 2);
     326           0 :         KUNIT_EXPECT_EQ(test, drm_format_info_min_pitch(info, 0, UINT_MAX - 1),
     327             :                         (uint64_t)(UINT_MAX - 1) * 2);
     328           0 : }
     329             : 
     330             : static struct kunit_case drm_format_tests[] = {
     331             :         KUNIT_CASE(drm_test_format_block_width_invalid),
     332             :         KUNIT_CASE(drm_test_format_block_width_one_plane),
     333             :         KUNIT_CASE(drm_test_format_block_width_two_plane),
     334             :         KUNIT_CASE(drm_test_format_block_width_three_plane),
     335             :         KUNIT_CASE(drm_test_format_block_width_tiled),
     336             :         KUNIT_CASE(drm_test_format_block_height_invalid),
     337             :         KUNIT_CASE(drm_test_format_block_height_one_plane),
     338             :         KUNIT_CASE(drm_test_format_block_height_two_plane),
     339             :         KUNIT_CASE(drm_test_format_block_height_three_plane),
     340             :         KUNIT_CASE(drm_test_format_block_height_tiled),
     341             :         KUNIT_CASE(drm_test_format_min_pitch_invalid),
     342             :         KUNIT_CASE(drm_test_format_min_pitch_one_plane_8bpp),
     343             :         KUNIT_CASE(drm_test_format_min_pitch_one_plane_16bpp),
     344             :         KUNIT_CASE(drm_test_format_min_pitch_one_plane_24bpp),
     345             :         KUNIT_CASE(drm_test_format_min_pitch_one_plane_32bpp),
     346             :         KUNIT_CASE(drm_test_format_min_pitch_two_plane),
     347             :         KUNIT_CASE(drm_test_format_min_pitch_three_plane_8bpp),
     348             :         KUNIT_CASE(drm_test_format_min_pitch_tiled),
     349             :         {}
     350             : };
     351             : 
     352             : static struct kunit_suite drm_format_test_suite = {
     353             :         .name = "drm_format",
     354             :         .test_cases = drm_format_tests,
     355             : };
     356             : 
     357             : kunit_test_suite(drm_format_test_suite);
     358             : 
     359             : MODULE_LICENSE("GPL");

Generated by: LCOV version 1.14