Skip to content

Commit

Permalink
added limit to maximum surface count
Browse files Browse the repository at this point in the history
  • Loading branch information
elFarto committed Dec 17, 2023
1 parent 2bfe044 commit 5dd4fd6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/vabackend.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,12 @@ static VAStatus nvCreateContext(
num_render_targets = 16;
}

int surfaceCount = drv->surfaceCount != 0 ? drv->surfaceCount : num_render_targets;
if (surfaceCount > 32) {
LOG("Application requested %d surface(s), limiting to 32. This may cause issues.", surfaceCount);
surfaceCount = 32;
}

CUVIDDECODECREATEINFO vdci = {
.ulWidth = vdci.ulMaxWidth = vdci.ulTargetWidth = picture_width,
.ulHeight = vdci.ulMaxHeight = vdci.ulTargetHeight = picture_height,
Expand All @@ -1032,7 +1038,7 @@ static VAStatus nvCreateContext(
//it isn't particually efficient to do this, but it is simple
.ulNumOutputSurfaces = 1,
//just allocate as many surfaces as have been created since we can never have as much information as the decode to guess correctly
.ulNumDecodeSurfaces = drv->surfaceCount != 0 ? drv->surfaceCount : num_render_targets,
.ulNumDecodeSurfaces = surfaceCount,

};

Expand Down

0 comments on commit 5dd4fd6

Please sign in to comment.