gallium: Add PIPE_FORMAT_P010 support
authorThong Thai <thong.thai@amd.com>
Wed, 18 Dec 2019 16:26:34 +0000 (11:26 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 3 Jan 2020 16:30:22 +0000 (16:30 +0000)
Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3153>

src/gallium/auxiliary/vl/vl_video_buffer.c
src/gallium/include/pipe/p_format.h
src/gallium/state_trackers/va/va_private.h
src/mesa/state_tracker/st_atom_sampler.c
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_program.h
src/mesa/state_tracker/st_sampler_view.c

index 25322242b52e6e655ab6d511f51f4d55682d2769..bcb19fdad2a29f0f2306a223f9ac1eebe8b5d9c3 100644 (file)
@@ -80,6 +80,7 @@ vl_video_buffer_plane_order(enum pipe_format format)
    case PIPE_FORMAT_B8G8R8A8_UNORM:
    case PIPE_FORMAT_YUYV:
    case PIPE_FORMAT_UYVY:
+   case PIPE_FORMAT_P010:
    case PIPE_FORMAT_P016:
       return const_resource_plane_order_YUV;
 
index c1e8bc0f0d75cb136b30425614cb536c892238ce..46bb8c97a00a8952b53472df2a230ab0c10dc403 100644 (file)
@@ -450,6 +450,7 @@ enum pipe_format {
    PIPE_FORMAT_FXT1_RGB,
    PIPE_FORMAT_FXT1_RGBA,
 
+   PIPE_FORMAT_P010,
    PIPE_FORMAT_P016,
 
    PIPE_FORMAT_R10G10B10X2_UNORM,
index b2b997d4799064fd90c8e1cd0bcc286dde6ca1fc..bed1189b9d1fda80dcf54523c31e621b95b46c9a 100644 (file)
@@ -96,6 +96,7 @@ VaFourccToPipeFormat(unsigned format)
    case VA_FOURCC('N','V','1','2'):
       return PIPE_FORMAT_NV12;
    case VA_FOURCC('P','0','1','0'):
+      return PIPE_FORMAT_P010;
    case VA_FOURCC('P','0','1','6'):
       return PIPE_FORMAT_P016;
    case VA_FOURCC('I','4','2','0'):
@@ -126,6 +127,8 @@ PipeFormatToVaFourcc(enum pipe_format p_format)
    switch (p_format) {
    case PIPE_FORMAT_NV12:
       return VA_FOURCC('N','V','1','2');
+   case PIPE_FORMAT_P010:
+      return VA_FOURCC('P','0','1','0');
    case PIPE_FORMAT_P016:
       return VA_FOURCC('P','0','1','6');
    case PIPE_FORMAT_IYUV:
index 86113c93c4988a7f7faf21f8d97345f28164da87..c0f43befa4ded9ce3974b3122e4a9be245ff77e2 100644 (file)
@@ -309,6 +309,7 @@ update_shader_samplers(struct st_context *st,
 
       switch (st_get_view_format(stObj)) {
       case PIPE_FORMAT_NV12:
+      case PIPE_FORMAT_P010:
       case PIPE_FORMAT_P016:
       case PIPE_FORMAT_YUYV:
       case PIPE_FORMAT_UYVY:
index 070e5609157023b852d64204b2cff6d44e0cf601..ef54bc5a77f39541767036d73f3b48e2b44f9b82 100644 (file)
@@ -191,6 +191,7 @@ update_textures(struct st_context *st,
          sampler_views[extra] =
                st->pipe->create_sampler_view(st->pipe, stObj->pt->next, &tmpl);
          break;
+      case PIPE_FORMAT_P010:
       case PIPE_FORMAT_P016:
          /* we need one additional R16G16 view: */
          tmpl.format = PIPE_FORMAT_RG1616_UNORM;
index e5c6ac0a96afe7bfbafdbae99f2613194906b702..69ad595143f86053e73d20460e73103161f39343 100644 (file)
@@ -74,6 +74,7 @@ st_get_external_sampler_key(struct st_context *st, struct gl_program *prog)
 
       switch (st_get_view_format(stObj)) {
       case PIPE_FORMAT_NV12:
+      case PIPE_FORMAT_P010:
       case PIPE_FORMAT_P016:
          key.lower_nv12 |= (1 << unit);
          break;
index ed84b0932665d66b36c25e218e28bb8f442e953f..8c0277fe42ae4807b96f401b7319ff1589d1e87b 100644 (file)
@@ -495,6 +495,7 @@ get_sampler_view_format(struct st_context *st,
    case PIPE_FORMAT_IYUV:
       format = PIPE_FORMAT_R8_UNORM;
       break;
+   case PIPE_FORMAT_P010:
    case PIPE_FORMAT_P016:
       format = PIPE_FORMAT_R16_UNORM;
       break;