X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fvdpau.c;h=051071beb5fa4f745e0cf70a4f95cc954c725b68;hb=c236e6c1e3224dd324b9ee3d3b501bd02ba2f177;hp=975b812cda5f95ccb2766a966af4ec308900b0e8;hpb=0f7958aac29ce976d6fba7d87ae40c1b8d448bbc;p=mesa.git diff --git a/src/mesa/main/vdpau.c b/src/mesa/main/vdpau.c index 975b812cda5..051071beb5f 100644 --- a/src/mesa/main/vdpau.c +++ b/src/mesa/main/vdpau.c @@ -32,10 +32,10 @@ */ #include +#include "util/hash_table.h" +#include "util/set.h" #include "context.h" #include "glformats.h" -#include "hash_table.h" -#include "set.h" #include "texobj.h" #include "teximage.h" #include "vdpau.h" @@ -73,7 +73,8 @@ _mesa_VDPAUInitNV(const GLvoid *vdpDevice, const GLvoid *getProcAddress) ctx->vdpDevice = vdpDevice; ctx->vdpGetProcAddress = getProcAddress; - ctx->vdpSurfaces = _mesa_set_create(NULL, _mesa_key_pointer_equal); + ctx->vdpSurfaces = _mesa_set_create(NULL, _mesa_hash_pointer, + _mesa_key_pointer_equal); } static void @@ -144,11 +145,11 @@ register_surface(struct gl_context *ctx, GLboolean isOutput, surf->output = isOutput; for (i = 0; i < numTextureNames; ++i) { struct gl_texture_object *tex; - tex = _mesa_lookup_texture(ctx, textureNames[i]); + + tex = _mesa_lookup_texture_err(ctx, textureNames[i], + "VDPAURegisterSurfaceNV"); if (tex == NULL) { free(surf); - _mesa_error(ctx, GL_INVALID_OPERATION, - "VDPAURegisterSurfaceNV(texture ID not found)"); return (GLintptr)NULL; } @@ -162,9 +163,10 @@ register_surface(struct gl_context *ctx, GLboolean isOutput, return (GLintptr)NULL; } - if (tex->Target == 0) + if (tex->Target == 0) { tex->Target = target; - else if (tex->Target != target) { + tex->TargetIndex = _mesa_tex_target_to_index(ctx, target); + } else if (tex->Target != target) { _mesa_unlock_texture(ctx, tex); free(surf); _mesa_error(ctx, GL_INVALID_OPERATION, @@ -179,7 +181,7 @@ register_surface(struct gl_context *ctx, GLboolean isOutput, _mesa_reference_texobj(&surf->textures[i], tex); } - _mesa_set_add(ctx->vdpSurfaces, _mesa_hash_pointer(surf), surf); + _mesa_set_add(ctx->vdpSurfaces, surf); return (GLintptr)surf; } @@ -227,7 +229,7 @@ _mesa_VDPAUIsSurfaceNV(GLintptr surface) return false; } - if (!_mesa_set_search(ctx->vdpSurfaces, _mesa_hash_pointer(surf), surf)) { + if (!_mesa_set_search(ctx->vdpSurfaces, surf)) { return false; } @@ -251,7 +253,7 @@ _mesa_VDPAUUnregisterSurfaceNV(GLintptr surface) if (surface == 0) return; - entry = _mesa_set_search(ctx->vdpSurfaces, _mesa_hash_pointer(surf), surf); + entry = _mesa_set_search(ctx->vdpSurfaces, surf); if (!entry) { _mesa_error(ctx, GL_INVALID_VALUE, "VDPAUUnregisterSurfaceNV"); return; @@ -280,7 +282,7 @@ _mesa_VDPAUGetSurfaceivNV(GLintptr surface, GLenum pname, GLsizei bufSize, return; } - if (!_mesa_set_search(ctx->vdpSurfaces, _mesa_hash_pointer(surf), surf)) { + if (!_mesa_set_search(ctx->vdpSurfaces, surf)) { _mesa_error(ctx, GL_INVALID_VALUE, "VDPAUGetSurfaceivNV"); return; } @@ -312,7 +314,7 @@ _mesa_VDPAUSurfaceAccessNV(GLintptr surface, GLenum access) return; } - if (!_mesa_set_search(ctx->vdpSurfaces, _mesa_hash_pointer(surf), surf)) { + if (!_mesa_set_search(ctx->vdpSurfaces, surf)) { _mesa_error(ctx, GL_INVALID_VALUE, "VDPAUSurfaceAccessNV"); return; } @@ -346,7 +348,7 @@ _mesa_VDPAUMapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces) for (i = 0; i < numSurfaces; ++i) { struct vdp_surface *surf = (struct vdp_surface *)surfaces[i]; - if (!_mesa_set_search(ctx->vdpSurfaces, _mesa_hash_pointer(surf), surf)) { + if (!_mesa_set_search(ctx->vdpSurfaces, surf)) { _mesa_error(ctx, GL_INVALID_VALUE, "VDPAUSurfaceAccessNV"); return; } @@ -400,7 +402,7 @@ _mesa_VDPAUUnmapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces) for (i = 0; i < numSurfaces; ++i) { struct vdp_surface *surf = (struct vdp_surface *)surfaces[i]; - if (!_mesa_set_search(ctx->vdpSurfaces, _mesa_hash_pointer(surf), surf)) { + if (!_mesa_set_search(ctx->vdpSurfaces, surf)) { _mesa_error(ctx, GL_INVALID_VALUE, "VDPAUSurfaceAccessNV"); return; } @@ -422,7 +424,7 @@ _mesa_VDPAUUnmapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces) _mesa_lock_texture(ctx, tex); - image = _mesa_select_tex_image(ctx, tex, surf->target, 0); + image = _mesa_select_tex_image(tex, surf->target, 0); ctx->Driver.VDPAUUnmapSurface(ctx, surf->target, surf->access, surf->output, tex, image,