Am 25.04.2017 um 15:17 schrieb Ilia Mirkin:
[SNIP]
Is there a patch I should test?

Patch is attached, but only compile tested.

Basically if OpenGL/VDPAU interop worked before with Kodi/MPV it should still keep working.

Christian.


   -ilia


>From a01c07d52dc283fb97d36d54e6c9b706160973b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koe...@amd.com>
Date: Tue, 25 Apr 2017 16:04:42 +0200
Subject: [PATCH] st/vdpau: drop old OpenGL VDPAU interop
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Replaced by the DMA-buf based interop.

Signed-off-by: Christian König <christian.koe...@amd.com>
---
 src/gallium/include/state_tracker/vdpau_interop.h | 54 -------------------
 src/gallium/state_trackers/vdpau/ftab.c           |  4 +-
 src/gallium/state_trackers/vdpau/output.c         | 15 ------
 src/gallium/state_trackers/vdpau/surface.c        | 18 -------
 src/gallium/state_trackers/vdpau/vdpau_private.h  |  3 --
 src/mesa/state_tracker/st_vdpau.c                 | 64 +----------------------
 6 files changed, 4 insertions(+), 154 deletions(-)
 delete mode 100644 src/gallium/include/state_tracker/vdpau_interop.h

diff --git a/src/gallium/include/state_tracker/vdpau_interop.h b/src/gallium/include/state_tracker/vdpau_interop.h
deleted file mode 100644
index 04d455a..0000000
--- a/src/gallium/include/state_tracker/vdpau_interop.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2013 Advanced Micro Devices, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/*
- * Authors:
- *      Christian König <christian.koe...@amd.com>
- *
- */
-
-#ifndef _VDPAU_INTEROP_H_
-#define _VDPAU_INTEROP_H_
-
-/* driver specific functions for NV_vdpau_interop */
-#ifndef VDP_FUNC_ID_BASE_DRIVER
-#define VDP_FUNC_ID_BASE_DRIVER 0x2000
-#endif
-
-/* Older implementation relying on passing pipe_video_buffer and
- * pipe_resources around. Deprecated and shouldn't be used for new things.
- */
-#define VDP_FUNC_ID_VIDEO_SURFACE_GALLIUM (VDP_FUNC_ID_BASE_DRIVER + 0)
-#define VDP_FUNC_ID_OUTPUT_SURFACE_GALLIUM (VDP_FUNC_ID_BASE_DRIVER + 1)
-
-struct pipe_resource;
-struct pipe_video_buffer;
-
-typedef struct pipe_video_buffer *VdpVideoSurfaceGallium(uint32_t surface);
-typedef struct pipe_resource *VdpOutputSurfaceGallium(uint32_t surface);
-
-#endif /* _VDPAU_INTEROP_H_ */
diff --git a/src/gallium/state_trackers/vdpau/ftab.c b/src/gallium/state_trackers/vdpau/ftab.c
index 3178622..a50344f 100644
--- a/src/gallium/state_trackers/vdpau/ftab.c
+++ b/src/gallium/state_trackers/vdpau/ftab.c
@@ -109,8 +109,8 @@ static void* ftab_winsys[1] =
 
 static void* ftab_driver[4] =
 {
-   &vlVdpVideoSurfaceGallium, /* VDP_FUNC_ID_SURFACE_GALLIUM */
-   &vlVdpOutputSurfaceGallium, /* VDP_FUNC_ID_OUTPUT_SURFACE_GALLIUM */
+   NULL, /* VDP_FUNC_ID_SURFACE_GALLIUM */
+   NULL, /* VDP_FUNC_ID_OUTPUT_SURFACE_GALLIUM */
    &vlVdpVideoSurfaceDMABuf, /* VDP_FUNC_ID_VIDEO_SURFACE_DMA_BUF */
    &vlVdpOutputSurfaceDMABuf /* VDP_FUNC_ID_OUTPUT_SURFACE_DMA_BUF */
 };
diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c
index 8ef8268..bde8c5d 100644
--- a/src/gallium/state_trackers/vdpau/output.c
+++ b/src/gallium/state_trackers/vdpau/output.c
@@ -772,21 +772,6 @@ vlVdpOutputSurfaceRenderBitmapSurface(VdpOutputSurface destination_surface,
    return VDP_STATUS_OK;
 }
 
-struct pipe_resource *vlVdpOutputSurfaceGallium(VdpOutputSurface surface)
-{
-   vlVdpOutputSurface *vlsurface;
-
-   vlsurface = vlGetDataHTAB(surface);
-   if (!vlsurface || !vlsurface->surface)
-      return NULL;
-
-   mtx_lock(&vlsurface->device->mutex);
-   vlsurface->device->context->flush(vlsurface->device->context, NULL, 0);
-   mtx_unlock(&vlsurface->device->mutex);
-
-   return vlsurface->surface->texture;
-}
-
 VdpStatus vlVdpOutputSurfaceDMABuf(VdpOutputSurface surface,
                                    struct VdpSurfaceDMABufDesc *result)
 {
diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c
index 884ae30..a18972b 100644
--- a/src/gallium/state_trackers/vdpau/surface.c
+++ b/src/gallium/state_trackers/vdpau/surface.c
@@ -459,24 +459,6 @@ vlVdpVideoSurfaceClear(vlVdpSurface *vlsurf)
 /**
  * Interop to mesa state tracker
  */
-struct pipe_video_buffer *vlVdpVideoSurfaceGallium(VdpVideoSurface surface)
-{
-   vlVdpSurface *p_surf = vlGetDataHTAB(surface);
-   if (!p_surf)
-      return NULL;
-
-   mtx_lock(&p_surf->device->mutex);
-   if (p_surf->video_buffer == NULL) {
-      struct pipe_context *pipe = p_surf->device->context;
-
-      /* try to create a video buffer if we don't already have one */
-      p_surf->video_buffer = pipe->create_video_buffer(pipe, &p_surf->templat);
-   }
-   mtx_unlock(&p_surf->device->mutex);
-
-   return p_surf->video_buffer;
-}
-
 VdpStatus vlVdpVideoSurfaceDMABuf(VdpVideoSurface surface,
                                   VdpVideoSurfacePlane plane,
                                   struct VdpSurfaceDMABufDesc *result)
diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h
index b36c0c4..2e1decf 100644
--- a/src/gallium/state_trackers/vdpau/vdpau_private.h
+++ b/src/gallium/state_trackers/vdpau/vdpau_private.h
@@ -36,7 +36,6 @@
 #include "pipe/p_compiler.h"
 #include "pipe/p_video_codec.h"
 
-#include "state_tracker/vdpau_interop.h"
 #include "state_tracker/vdpau_dmabuf.h"
 #include "state_tracker/vdpau_funcs.h"
 
@@ -527,8 +526,6 @@ VdpPresentationQueueTargetCreateX11 vlVdpPresentationQueueTargetCreateX11;
 
 
 /* interop to mesa state tracker */
-VdpVideoSurfaceGallium vlVdpVideoSurfaceGallium;
-VdpOutputSurfaceGallium vlVdpOutputSurfaceGallium;
 VdpVideoSurfaceDMABuf vlVdpVideoSurfaceDMABuf;
 VdpOutputSurfaceDMABuf vlVdpOutputSurfaceDMABuf;
 
diff --git a/src/mesa/state_tracker/st_vdpau.c b/src/mesa/state_tracker/st_vdpau.c
index 0273815..119c137 100644
--- a/src/mesa/state_tracker/st_vdpau.c
+++ b/src/mesa/state_tracker/st_vdpau.c
@@ -50,61 +50,11 @@
 
 #ifdef HAVE_ST_VDPAU
 
-#include "state_tracker/vdpau_interop.h"
 #include "state_tracker/vdpau_dmabuf.h"
 #include "state_tracker/vdpau_funcs.h"
 #include "state_tracker/drm_driver.h"
 
 static struct pipe_resource *
-st_vdpau_video_surface_gallium(struct gl_context *ctx, const void *vdpSurface,
-                               GLuint index)
-{
-   int (*getProcAddr)(uint32_t device, uint32_t id, void **ptr);
-   uint32_t device = (uintptr_t)ctx->vdpDevice;
-   struct pipe_sampler_view *sv;
-   VdpVideoSurfaceGallium *f;
-
-   struct pipe_video_buffer *buffer;
-   struct pipe_sampler_view **samplers;
-   struct pipe_resource *res = NULL;
-
-   getProcAddr = (void *)ctx->vdpGetProcAddress;
-   if (getProcAddr(device, VDP_FUNC_ID_VIDEO_SURFACE_GALLIUM, (void**)&f))
-      return NULL;
-
-   buffer = f((uintptr_t)vdpSurface);
-   if (!buffer)
-      return NULL;
-
-   samplers = buffer->get_sampler_view_planes(buffer);
-   if (!samplers)
-      return NULL;
-
-   sv = samplers[index >> 1];
-   if (!sv)
-      return NULL;
-
-   pipe_resource_reference(&res, sv->texture);
-   return res;
-}
-
-static struct pipe_resource *
-st_vdpau_output_surface_gallium(struct gl_context *ctx, const void *vdpSurface)
-{
-   int (*getProcAddr)(uint32_t device, uint32_t id, void **ptr);
-   uint32_t device = (uintptr_t)ctx->vdpDevice;
-   struct pipe_resource *res = NULL;
-   VdpOutputSurfaceGallium *f;
-
-   getProcAddr = (void *)ctx->vdpGetProcAddress;
-   if (getProcAddr(device, VDP_FUNC_ID_OUTPUT_SURFACE_GALLIUM, (void**)&f))
-      return NULL;
-
-   pipe_resource_reference(&res, f((uintptr_t)vdpSurface));
-   return res;
-}
-
-static struct pipe_resource *
 st_vdpau_resource_from_description(struct gl_context *ctx,
                                    const struct VdpSurfaceDMABufDesc *desc)
 {
@@ -192,21 +142,11 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
    mesa_format texFormat;
    uint layer_override = 0;
 
-   if (output) {
+   if (output)
       res = st_vdpau_output_surface_dma_buf(ctx, vdpSurface);
-
-      if (!res)
-         res = st_vdpau_output_surface_gallium(ctx, vdpSurface);
-
-   } else {
+   else
       res = st_vdpau_video_surface_dma_buf(ctx, vdpSurface, index);
 
-      if (!res) {
-         res = st_vdpau_video_surface_gallium(ctx, vdpSurface, index);
-         layer_override = index & 1;
-      }
-   }
-
    if (!res) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "VDPAUMapSurfacesNV");
       return;
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to