summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2018-04-09 11:30:41 +0200
committerThierry Reding <treding@nvidia.com>2019-08-23 18:08:32 +0200
commit4632b0ecbbfdc53b0101523a108611c419a31d8d (patch)
treef67614b88240801a354cf4eec967c26debb56f70
parent5cca91591c681d674d7dfbb988a22ac97a6ceeca (diff)
WIP: tegra: Add video encode/decode support
-rw-r--r--src/gallium/drivers/tegra/tegra_context.c16
-rw-r--r--src/gallium/drivers/tegra/tegra_screen.c43
-rw-r--r--src/gallium/targets/va/meson.build5
-rw-r--r--src/gallium/targets/vdpau/meson.build5
4 files changed, 60 insertions, 9 deletions
diff --git a/src/gallium/drivers/tegra/tegra_context.c b/src/gallium/drivers/tegra/tegra_context.c
index e91baf0be343..f9a1c55a7c98 100644
--- a/src/gallium/drivers/tegra/tegra_context.c
+++ b/src/gallium/drivers/tegra/tegra_context.c
@@ -986,8 +986,14 @@ tegra_create_video_codec(struct pipe_context *pcontext,
const struct pipe_video_codec *template)
{
struct tegra_context *context = to_tegra_context(pcontext);
+ struct pipe_video_codec *codec = NULL;
- return context->gpu->create_video_codec(context->gpu, template);
+ printf("> %s(pcontext=%p, template=%p)\n", __func__, pcontext, template);
+
+ codec = context->gpu->create_video_codec(context->gpu, template);
+
+ printf("< %s() = %p\n", __func__, codec);
+ return codec;
}
static struct pipe_video_buffer *
@@ -995,8 +1001,14 @@ tegra_create_video_buffer(struct pipe_context *pcontext,
const struct pipe_video_buffer *template)
{
struct tegra_context *context = to_tegra_context(pcontext);
+ struct pipe_video_buffer *buffer = NULL;
+
+ printf("> %s(pcontext=%p, template=%p)\n", __func__, pcontext, template);
+
+ buffer = context->gpu->create_video_buffer(context->gpu, template);
- return context->gpu->create_video_buffer(context->gpu, template);
+ printf("< %s() = %p\n", __func__, buffer);
+ return buffer;
}
static void *
diff --git a/src/gallium/drivers/tegra/tegra_screen.c b/src/gallium/drivers/tegra/tegra_screen.c
index 9ec3f6fe1d42..ef495cd5c14b 100644
--- a/src/gallium/drivers/tegra/tegra_screen.c
+++ b/src/gallium/drivers/tegra/tegra_screen.c
@@ -36,6 +36,9 @@
#include "pipe/p_state.h"
#include "util/u_debug.h"
#include "util/u_inlines.h"
+#include "util/u_video.h"
+
+#include "vl/vl_decoder.h"
#include "state_tracker/drm_driver.h"
@@ -102,10 +105,44 @@ tegra_screen_get_video_param(struct pipe_screen *pscreen,
enum pipe_video_entrypoint entrypoint,
enum pipe_video_cap param)
{
- struct tegra_screen *screen = to_tegra_screen(pscreen);
+ switch (param) {
+ case PIPE_VIDEO_CAP_SUPPORTED:
+ if (u_reduce_video_profile(profile) == PIPE_VIDEO_FORMAT_JPEG)
+ return 1;
+
+ return 0;
+
+ case PIPE_VIDEO_CAP_NPOT_TEXTURES:
+ return 1;
+
+ case PIPE_VIDEO_CAP_MAX_WIDTH:
+ return 4096;
+
+ case PIPE_VIDEO_CAP_MAX_HEIGHT:
+ return 4096;
+
+ case PIPE_VIDEO_CAP_PREFERED_FORMAT:
+ return PIPE_FORMAT_NV12;
- return screen->gpu->get_video_param(screen->gpu, profile, entrypoint,
- param);
+ case PIPE_VIDEO_CAP_PREFERS_INTERLACED:
+ return 0;
+
+ case PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE:
+ return 1;
+
+ case PIPE_VIDEO_CAP_SUPPORTS_INTERLACED:
+ return 0;
+
+ case PIPE_VIDEO_CAP_MAX_LEVEL:
+ return vl_level_supported(pscreen, profile);
+
+ case PIPE_VIDEO_CAP_STACKED_FRAMES:
+ return 0;
+
+ default:
+ debug_printf("unknown video parameter: %d\n", param);
+ return 0;
+ }
}
static int
diff --git a/src/gallium/targets/va/meson.build b/src/gallium/targets/va/meson.build
index ed8e0167a001..ff821c4a0d12 100644
--- a/src/gallium/targets/va/meson.build
+++ b/src/gallium/targets/va/meson.build
@@ -46,7 +46,7 @@ libva_gallium = shared_library(
libpipe_loader_static, libws_null, libwsw, libswdri, libswkmsdri,
],
dependencies : [
- dep_libdrm, driver_r600, driver_radeonsi, driver_nouveau,
+ dep_libdrm, driver_r600, driver_radeonsi, driver_nouveau, driver_tegra,
idep_mesautil,
],
link_depends : va_link_depends,
@@ -58,7 +58,8 @@ libva_gallium = shared_library(
foreach d : [[with_gallium_r600, 'r600'],
[with_gallium_radeonsi, 'radeonsi'],
- [with_gallium_nouveau, 'nouveau']]
+ [with_gallium_nouveau, 'nouveau'],
+ [with_gallium_tegra, 'tegra']]
if d[0]
va_drivers += '@0@_drv_video.so'.format(d[1])
endif
diff --git a/src/gallium/targets/vdpau/meson.build b/src/gallium/targets/vdpau/meson.build
index ed672e355ba2..adbae0a01e49 100644
--- a/src/gallium/targets/vdpau/meson.build
+++ b/src/gallium/targets/vdpau/meson.build
@@ -52,7 +52,7 @@ libvdpau_gallium = shared_library(
],
dependencies : [
idep_mesautil,
- driver_r300, driver_r600, driver_radeonsi, driver_nouveau,
+ driver_r300, driver_r600, driver_radeonsi, driver_nouveau, driver_tegra,
],
link_depends : vdpau_link_depends,
soversion : '@0@.@1@.0'.format(VDPAU_MAJOR, VDPAU_MINOR),
@@ -64,7 +64,8 @@ libvdpau_gallium = shared_library(
foreach d : [[with_gallium_r300, 'r300'],
[with_gallium_r600, 'r600'],
[with_gallium_radeonsi, 'radeonsi'],
- [with_gallium_nouveau, 'nouveau']]
+ [with_gallium_nouveau, 'nouveau'],
+ [with_gallium_tegra, 'tegra']]
if d[0]
vdpau_drivers += 'libvdpau_@0@.so.@1@.@2@.0'.format(d[1], VDPAU_MAJOR, VDPAU_MINOR)
endif