On Sun, Oct 20, 2013 at 11:57 AM, Christian König
<deathsim...@vodafone.de> wrote:
> Hi Marek,
>
> I've just send out a v6 of the patch, please take a second look. Most things
> are fixed now, but there are still a couple of open issues:
>
>
>> 3) There should also probably be some checking for
>> GL_ARB_texture_non_power_of_two, but the spec doesn't say what we
>> should do (probably return GL_INVALID_OPERATION).
>
>
> Actually I thing VDPAU hold the answer to this. The specification there
> states that the different surfaces creation function should round up the
> width/height to supported values (which can then be queried later by the
> application). So we always will end up with correct values independent of
> GL_ARB_texture_non_power_of_two.
>
>
>> 6) Registered and mapped VDPAU textures are not allowed to be
>> re-specified by TexImage, TexSubImage, TexImage*Multisample,
>> CopyTexImage, CopyTexSubImage, TexStorage, TexStorage*Multisample, and
>> similar functions. This should be properly handled in those functions
>> and GL errors should be returned.
>
>
> I would rather like to avoid touching those functions, cause they are not
> directly related to the spec and I don't want to risk breaking anything
> there.
>
> Would it valid so set/clear the immutable flag instead (honestly I don't
> have the slightest idea how the frontend handling works in this code)?

Yes, it seems to be sufficient.

>
>
>> 7) The extension spec says that all VDPAU textures should be
>> y-inverted. Is that actually the case here?
>
>
> Uhm, no idea? It does seems to work, but where is that information stored?

It means that a VDPAU surface is upside-down when it's used as an
OpenGL texture. I don't remember whether we need to a blit or whether
OpenGL textures are y-inverted by default (then we don't have to do
anything). If we do the same thing as NVIDIA, it's probably okay.


Please review and squash the attached patch with your version 6, and
feel free to push it.

Marek
From 1ca52d1ae40fd81276f56e8a61fbed3ad819eb41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= <marek.ol...@amd.com>
Date: Sat, 26 Oct 2013 00:39:52 +0200
Subject: [PATCH] squash this with the vdpau patch
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Marek Olšák <marek.ol...@amd.com>
---
 src/mesa/main/vdpau.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/vdpau.c b/src/mesa/main/vdpau.c
index 157df47..7792b4b 100644
--- a/src/mesa/main/vdpau.c
+++ b/src/mesa/main/vdpau.c
@@ -131,7 +131,7 @@ register_surface(struct gl_context *ctx, GLboolean isOutput,
       return (GLintptr)NULL;
    }
 
-   surf = MALLOC_STRUCT( vdp_surface );
+   surf = CALLOC_STRUCT( vdp_surface );
    surf->vdpSurface = vdpSurface;
    surf->target = target;
    surf->access = GL_READ_WRITE;
@@ -144,6 +144,7 @@ register_surface(struct gl_context *ctx, GLboolean isOutput,
       _mesa_lock_texture(ctx, tex);
 
       if (tex->Immutable) {
+        _mesa_unlock_texture(ctx, tex);
          FREE(surf);
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "VDPAURegisterSurfaceNV(texture is immutable)");
@@ -153,15 +154,18 @@ register_surface(struct gl_context *ctx, GLboolean isOutput,
       if (tex->Target == 0)
          tex->Target = target;
       else if (tex->Target != target) {
+        _mesa_unlock_texture(ctx, tex);
          FREE(surf);
          _mesa_error(ctx, GL_INVALID_OPERATION,
                      "VDPAURegisterSurfaceNV(target mismatch)");
          return (GLintptr)NULL;
       }
 
+      /* This will disallow respecifying the storage. */
+      tex->Immutable = GL_TRUE;
       _mesa_unlock_texture(ctx, tex);
 
-      surf->textures[i] = tex;
+      _mesa_reference_texobj(&surf->textures[i], tex);
    }
 
    _mesa_set_add(ctx->vdpSurfaces, _mesa_hash_pointer(surf), surf);
@@ -223,6 +227,7 @@ _mesa_VDPAUUnregisterSurfaceNV(GLintptr surface)
 {
    struct vdp_surface *surf = (struct vdp_surface *)surface;
    struct set_entry *entry;
+   int i;
    GET_CURRENT_CONTEXT(ctx);
 
    if (!ctx->vdpDevice || !ctx->vdpGetProcAddress || !ctx->vdpSurfaces) {
@@ -240,6 +245,13 @@ _mesa_VDPAUUnregisterSurfaceNV(GLintptr surface)
       return;
    }
 
+   for (i = 0; i < MAX_TEXTURES; i++) {
+      if (surf->textures[i]) {
+         surf->textures[i]->Immutable = GL_FALSE;
+         _mesa_reference_texobj(&surf->textures[i], NULL);
+      }
+   }
+
    _mesa_set_remove(ctx->vdpSurfaces, entry);
    FREE(surf);
 }
-- 
1.8.1.2

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

Reply via email to