[vlc-commits] [Git][videolan/vlc][master] 8 commits: drm/fourcc: remove fourcc mapped to RGB without masks

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Sep 28 06:13:44 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
1bec49f6 by Steve Lhomme at 2023-09-28T05:56:47+00:00
drm/fourcc: remove fourcc mapped to RGB without masks

They won't be used from rgb_fourcc_list in that case

- - - - -
ba10eedf by Steve Lhomme at 2023-09-28T05:56:47+00:00
drm/fourcc: disable 15-bit shifted one bit left

We don't have any way to convert them back to anything useful.

- - - - -
1c6b4470 by Steve Lhomme at 2023-09-28T05:56:47+00:00
drm/fourcc: remove empty rgb_fourcc_list

- - - - -
21eae7ea by Steve Lhomme at 2023-09-28T05:56:47+00:00
vout/drm: use vlc_fourcc_drm to get the mapped chroma

So we can remove vlc_video_format_drm().

- - - - -
c3ec37df by Steve Lhomme at 2023-09-28T05:56:47+00:00
vout/drm: remove unused vlc_video_format_drm()

- - - - -
f72e39f2 by Steve Lhomme at 2023-09-28T05:56:47+00:00
vout/drm: use vlc_drm_fourcc() instead of vlc_drm_format()

They return the same thing.

- - - - -
f13bface by Steve Lhomme at 2023-09-28T05:56:47+00:00
vout/drm: remove unused vlc_drm_format()

- - - - -
de4685a6 by Steve Lhomme at 2023-09-28T05:56:47+00:00
vout/drm: remove comment

DRM_FORMAT_RGBA8888 haa a VLC mapping since c6a3c197e01539d633d44c103ede0fb92fa98ae9

- - - - -


4 changed files:

- modules/video_output/drm/buffers.c
- modules/video_output/drm/display.c
- modules/video_output/drm/fourcc.c
- modules/video_output/drm/vlc_drm.h


Changes:

=====================================
modules/video_output/drm/buffers.c
=====================================
@@ -148,7 +148,7 @@ error:  drmDestroyDumb(fd, creq.handle);
 picture_t *vlc_drm_dumb_alloc_fb(struct vlc_logger *log, int fd,
                                  const video_format_t *restrict fmt)
 {
-    uint32_t pixfmt = vlc_drm_format(fmt);
+    uint32_t pixfmt = vlc_drm_fourcc(fmt->i_chroma);
     if (pixfmt == DRM_FORMAT_INVALID)
         return NULL;
 


=====================================
modules/video_output/drm/display.c
=====================================
@@ -212,13 +212,15 @@ static int Open(vout_display_t *vd,
             (char *)&drm_fourcc, drm_fourcc);
 
     video_format_ApplyRotation(&fmt, vd->source);
-    if (!vlc_video_format_drm(&fmt, drm_fourcc)) {
+    vlc_fourcc_t vlc_fourcc = vlc_fourcc_drm(drm_fourcc);
+    if (vlc_fourcc == 0) {
         /* This can only occur if $vlc-drm-chroma is unknown. */
         assert(chroma != NULL);
         msg_Err(vd, "unknown DRM pixel format %4.4s (0x%08"PRIXFAST32")",
                 (char *)&drm_fourcc, drm_fourcc);
         return -ENOTSUP;
     }
+    fmt.i_chroma = vlc_fourcc;
 
     for (size_t i = 0; i < ARRAY_SIZE(sys->buffers); i++) {
         sys->buffers[i] = vlc_drm_dumb_alloc_fb(vd->obj.logger, fd, &fmt);


=====================================
modules/video_output/drm/fourcc.c
=====================================
@@ -49,7 +49,6 @@
    DRM_FORMAT_ABGR1555
    DRM_FORMAT_RGBA5551
    DRM_FORMAT_BGRA5551
-   DRM_FORMAT_RGBA8888 (VLC_CODEC_ABGR, not defined)
    DRM_FORMAT_XRGB2101010
    DRM_FORMAT_XBGR2101010
    DRM_FORMAT_RGBX1010102
@@ -109,52 +108,6 @@
 
  */
 
-/* RGB (no alpha) formats.
- * For historical reasons, VLC uses same FourCC with different masks. */
-static const struct {
-    uint32_t drm_fourcc;
-    vlc_fourcc_t vlc_fourcc;
-    uint32_t red; /**< Little endian red mask */
-    uint32_t green; /**< Little endian green mask */
-    uint32_t blue; /**< Little endian blue mask */
-} rgb_fourcc_list[] = {
-#ifdef WORDS_BIGENDIAN
-    /* 24-bit RGB */
-    { DRM_FORMAT_RGB888,   VLC_CODEC_RGB24M, 0x0000FF, 0x00FF00, 0xFF0000 },
-    { DRM_FORMAT_BGR888,   VLC_CODEC_RGB24M, 0xFF0000, 0x00FF00, 0x0000FF },
-    /* 32-bit-padded 24-bit RGB */
-    { DRM_FORMAT_XRGB8888, VLC_CODEC_RGB32,
-                                          0x0000FF00, 0x00FF0000, 0xFF000000 },
-    { DRM_FORMAT_XBGR8888, VLC_CODEC_RGB32,
-                                          0xFF000000, 0x00FF0000, 0x0000FF00 },
-    { DRM_FORMAT_RGBX8888, VLC_CODEC_RGB32,
-                                          0x000000FF, 0x0000FF00, 0x00FF0000 },
-    { DRM_FORMAT_BGRX8888, VLC_CODEC_RGB32,
-                                          0x00FF0000, 0x0000FF00, 0x000000FF },
-#else
-    /* 16-bit-padded 15-bit RGB */
-    { DRM_FORMAT_XRGB1555, VLC_CODEC_RGB15, 0x7C00, 0x03E0, 0x001F },
-    { DRM_FORMAT_XBGR1555, VLC_CODEC_RGB15, 0x001F, 0x03E0, 0x7C00 },
-    { DRM_FORMAT_RGBX5551, VLC_CODEC_RGB15, 0xF800, 0x07C0, 0x003E },
-    { DRM_FORMAT_BGRX5551, VLC_CODEC_RGB15, 0x003E, 0x07C0, 0xF800 },
-    /* 16-bit RGB */
-    { DRM_FORMAT_RGB565,   VLC_CODEC_RGB16, 0xF800, 0x07E0, 0x001F },
-    { DRM_FORMAT_BGR565,   VLC_CODEC_RGB16, 0x001F, 0x07E0, 0xF800 },
-    /* 24-bit RGB */
-    { DRM_FORMAT_RGB888,   VLC_CODEC_RGB24M, 0xFF0000, 0x00FF00, 0x0000FF },
-    { DRM_FORMAT_BGR888,   VLC_CODEC_RGB24M, 0x0000FF, 0x00FF00, 0xFF0000 },
-    /* 32-bit-padded 24-bit RGB */
-    { DRM_FORMAT_XRGB8888, VLC_CODEC_RGB32,
-                                          0x00FF0000, 0x0000FF00, 0x000000FF },
-    { DRM_FORMAT_XBGR8888, VLC_CODEC_RGB32,
-                                          0x000000FF, 0x0000FF00, 0x00FF0000 },
-    { DRM_FORMAT_RGBX8888, VLC_CODEC_RGB32,
-                                          0xFF000000, 0x00FF0000, 0x0000FF00 },
-    { DRM_FORMAT_BGRX8888, VLC_CODEC_RGB32,
-                                          0x0000FF00, 0x00FF0000, 0xFF000000 },
-#endif
-};
-
 static const struct {
     uint32_t drm_fourcc;
     vlc_fourcc_t vlc_fourcc;
@@ -235,53 +188,11 @@ uint_fast32_t vlc_drm_fourcc(vlc_fourcc_t vlc_fourcc)
     return DRM_FORMAT_INVALID;
 }
 
-uint_fast32_t vlc_drm_format(const video_format_t *restrict fmt)
-{
-    uint_fast32_t drm_fourcc = vlc_drm_fourcc(fmt->i_chroma);
-    if (drm_fourcc != DRM_FORMAT_INVALID)
-        return drm_fourcc;
-
-    for (size_t i = 0; i < ARRAY_SIZE(rgb_fourcc_list); i++)
-        if (rgb_fourcc_list[i].vlc_fourcc == fmt->i_chroma
-         && rgb_fourcc_list[i].red == fmt->i_rmask
-         && rgb_fourcc_list[i].green == fmt->i_gmask
-         && rgb_fourcc_list[i].blue == fmt->i_bmask)
-            return rgb_fourcc_list[i].drm_fourcc;
-
-    return DRM_FORMAT_INVALID;
-}
-
 vlc_fourcc_t vlc_fourcc_drm(uint_fast32_t drm_fourcc)
 {
     for (size_t i = 0; i < ARRAY_SIZE(fourcc_list); i++)
         if (fourcc_list[i].drm_fourcc == drm_fourcc)
             return fourcc_list[i].vlc_fourcc;
 
-    for (size_t i = 0; i < ARRAY_SIZE(rgb_fourcc_list); i++)
-        if (rgb_fourcc_list[i].drm_fourcc == drm_fourcc)
-            return rgb_fourcc_list[i].vlc_fourcc;
-
     return 0;
 }
-
-bool vlc_video_format_drm(video_format_t *restrict fmt,
-                          uint_fast32_t drm_fourcc)
-{
-    for (size_t i = 0; i < ARRAY_SIZE(fourcc_list); i++)
-        if (fourcc_list[i].drm_fourcc == drm_fourcc) {
-            fmt->i_chroma = fourcc_list[i].vlc_fourcc;
-            fmt->i_rmask = fmt->i_gmask = fmt->i_bmask = 0;
-            return true;
-        }
-
-    for (size_t i = 0; i < ARRAY_SIZE(rgb_fourcc_list); i++)
-        if (rgb_fourcc_list[i].drm_fourcc == drm_fourcc) {
-            fmt->i_chroma = rgb_fourcc_list[i].vlc_fourcc;
-            fmt->i_rmask = rgb_fourcc_list[i].red;
-            fmt->i_gmask = rgb_fourcc_list[i].green;
-            fmt->i_bmask = rgb_fourcc_list[i].blue;
-            return true;
-        }
-
-    return false;
-}


=====================================
modules/video_output/drm/vlc_drm.h
=====================================
@@ -38,23 +38,9 @@ struct video_format_t;
  * \param vlc_fourcc VLC video format FourCC
  * \return the corresponding DRM pixel format FourCC or
  *         DRM_FORMAT_INVALID if not found.
- * \warning This function cannot handle RGB formats. Use vlc_drm_format().
  */
 uint_fast32_t vlc_drm_fourcc(vlc_fourcc_t vlc_fourcc);
 
-/**
- * Converts a VLC video format to DRM.
- *
- * This returns the DRM pixel format FourCC for the supplied VLC video format.
- * Unlike vlc_drm_fourcc(), this function can handle RGB formats, but it
- * requires a complete VLC format structure.
- *
- * \param fmt VLC video format
- * \return the corresponding DRM pixel format FourCC or
- *         DRM_FORMAT_INVALID if not found.
- */
-uint_fast32_t vlc_drm_format(const struct video_format_t *fmt);
-
 /**
  * Converts a DRM pixel format to VLC.
  *
@@ -63,17 +49,6 @@ uint_fast32_t vlc_drm_format(const struct video_format_t *fmt);
  */
 vlc_fourcc_t vlc_fourcc_drm(uint_fast32_t drm_fourcc);
 
-/**
- * Converts a DRM pixel format to a VLC video format.
- *
- * \param [in,out] fmt VLC video format
- * \param drm_fourcc DRM pixel format identifier
- * \retval true the conversion succeeded (i.e. DRM format is recognised)
- * \retval false the conversion failed (i.e. DRM format is unknown)
- */
-bool vlc_video_format_drm(video_format_t *restrict fmt,
-                          uint_fast32_t drm_fourcc);
-
 /**
  * Allocates a DRM dumb buffer.
  *



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/96767510e0bcc3abd9e33d956fd02db6a7ec121d...de4685a6d86d4bc841750918f2c86a84ad8f6029

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/96767510e0bcc3abd9e33d956fd02db6a7ec121d...de4685a6d86d4bc841750918f2c86a84ad8f6029
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list