projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mesa/get: Make GetFloat/GetDouble of TYPE_INT_N not normalize things.
[mesa.git]
/
src
/
mesa
/
main
/
vdpau.c
diff --git
a/src/mesa/main/vdpau.c
b/src/mesa/main/vdpau.c
index 3597576076f3d36abb9d01dbe2dfbd467bda6c90..44be3a37443b95adb057061a892a6970198dacfe 100644
(file)
--- a/
src/mesa/main/vdpau.c
+++ b/
src/mesa/main/vdpau.c
@@
-32,10
+32,10
@@
*/
#include <stdbool.h>
*/
#include <stdbool.h>
+#include "util/hash_table.h"
+#include "util/set.h"
#include "context.h"
#include "glformats.h"
#include "context.h"
#include "glformats.h"
-#include "hash_table.h"
-#include "set.h"
#include "texobj.h"
#include "teximage.h"
#include "vdpau.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->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
}
static void
@@
-88,7
+89,7
@@
unregister_surface(struct set_entry *entry)
}
_mesa_set_remove(ctx->vdpSurfaces, entry);
}
_mesa_set_remove(ctx->vdpSurfaces, entry);
-
FREE
(surf);
+
free
(surf);
}
void GLAPIENTRY
}
void GLAPIENTRY
@@
-132,6
+133,11
@@
register_surface(struct gl_context *ctx, GLboolean isOutput,
}
surf = CALLOC_STRUCT( vdp_surface );
}
surf = CALLOC_STRUCT( vdp_surface );
+ if (surf == NULL) {
+ _mesa_error_no_memory("VDPAURegisterSurfaceNV");
+ return (GLintptr)NULL;
+ }
+
surf->vdpSurface = vdpSurface;
surf->target = target;
surf->access = GL_READ_WRITE;
surf->vdpSurface = vdpSurface;
surf->target = target;
surf->access = GL_READ_WRITE;
@@
-140,22
+146,29
@@
register_surface(struct gl_context *ctx, GLboolean isOutput,
for (i = 0; i < numTextureNames; ++i) {
struct gl_texture_object *tex;
tex = _mesa_lookup_texture(ctx, textureNames[i]);
for (i = 0; i < numTextureNames; ++i) {
struct gl_texture_object *tex;
tex = _mesa_lookup_texture(ctx, textureNames[i]);
+ if (tex == NULL) {
+ free(surf);
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "VDPAURegisterSurfaceNV(texture ID not found)");
+ return (GLintptr)NULL;
+ }
_mesa_lock_texture(ctx, tex);
if (tex->Immutable) {
_mesa_unlock_texture(ctx, tex);
_mesa_lock_texture(ctx, tex);
if (tex->Immutable) {
_mesa_unlock_texture(ctx, tex);
-
FREE
(surf);
+
free
(surf);
_mesa_error(ctx, GL_INVALID_OPERATION,
"VDPAURegisterSurfaceNV(texture is immutable)");
return (GLintptr)NULL;
}
_mesa_error(ctx, GL_INVALID_OPERATION,
"VDPAURegisterSurfaceNV(texture is immutable)");
return (GLintptr)NULL;
}
- if (tex->Target == 0)
+ if (tex->Target == 0)
{
tex->Target = target;
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);
_mesa_unlock_texture(ctx, tex);
-
FREE
(surf);
+
free
(surf);
_mesa_error(ctx, GL_INVALID_OPERATION,
"VDPAURegisterSurfaceNV(target mismatch)");
return (GLintptr)NULL;
_mesa_error(ctx, GL_INVALID_OPERATION,
"VDPAURegisterSurfaceNV(target mismatch)");
return (GLintptr)NULL;
@@
-168,7
+181,7
@@
register_surface(struct gl_context *ctx, GLboolean isOutput,
_mesa_reference_texobj(&surf->textures[i], tex);
}
_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;
}
return (GLintptr)surf;
}
@@
-205,7
+218,7
@@
_mesa_VDPAURegisterOutputSurfaceNV(const GLvoid *vdpSurface, GLenum target,
numTextureNames, textureNames);
}
numTextureNames, textureNames);
}
-
void
GLAPIENTRY
+
GLboolean
GLAPIENTRY
_mesa_VDPAUIsSurfaceNV(GLintptr surface)
{
struct vdp_surface *surf = (struct vdp_surface *)surface;
_mesa_VDPAUIsSurfaceNV(GLintptr surface)
{
struct vdp_surface *surf = (struct vdp_surface *)surface;
@@
-213,13
+226,14
@@
_mesa_VDPAUIsSurfaceNV(GLintptr surface)
if (!ctx->vdpDevice || !ctx->vdpGetProcAddress || !ctx->vdpSurfaces) {
_mesa_error(ctx, GL_INVALID_OPERATION, "VDPAUIsSurfaceNV");
if (!ctx->vdpDevice || !ctx->vdpGetProcAddress || !ctx->vdpSurfaces) {
_mesa_error(ctx, GL_INVALID_OPERATION, "VDPAUIsSurfaceNV");
- return;
+ return
false
;
}
}
- if (!_mesa_set_search(ctx->vdpSurfaces, _mesa_hash_pointer(surf), surf)) {
- _mesa_error(ctx, GL_INVALID_VALUE, "VDPAUIsSurfaceNV");
- return;
+ if (!_mesa_set_search(ctx->vdpSurfaces, surf)) {
+ return false;
}
}
+
+ return true;
}
void GLAPIENTRY
}
void GLAPIENTRY
@@
-239,7
+253,7
@@
_mesa_VDPAUUnregisterSurfaceNV(GLintptr surface)
if (surface == 0)
return;
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;
if (!entry) {
_mesa_error(ctx, GL_INVALID_VALUE, "VDPAUUnregisterSurfaceNV");
return;
@@
-253,7
+267,7
@@
_mesa_VDPAUUnregisterSurfaceNV(GLintptr surface)
}
_mesa_set_remove(ctx->vdpSurfaces, entry);
}
_mesa_set_remove(ctx->vdpSurfaces, entry);
-
FREE
(surf);
+
free
(surf);
}
void GLAPIENTRY
}
void GLAPIENTRY
@@
-268,7
+282,7
@@
_mesa_VDPAUGetSurfaceivNV(GLintptr surface, GLenum pname, GLsizei bufSize,
return;
}
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;
}
_mesa_error(ctx, GL_INVALID_VALUE, "VDPAUGetSurfaceivNV");
return;
}
@@
-300,7
+314,7
@@
_mesa_VDPAUSurfaceAccessNV(GLintptr surface, GLenum access)
return;
}
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;
}
_mesa_error(ctx, GL_INVALID_VALUE, "VDPAUSurfaceAccessNV");
return;
}
@@
-334,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];
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;
}
_mesa_error(ctx, GL_INVALID_VALUE, "VDPAUSurfaceAccessNV");
return;
}
@@
-388,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];
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;
}
_mesa_error(ctx, GL_INVALID_VALUE, "VDPAUSurfaceAccessNV");
return;
}
@@
-410,7
+424,7
@@
_mesa_VDPAUUnmapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces)
_mesa_lock_texture(ctx, tex);
_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,
ctx->Driver.VDPAUUnmapSurface(ctx, surf->target, surf->access,
surf->output, tex, image,