summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2015-08-13 15:08:22 -0700
committerBrian Paul <[email protected]>2015-09-02 13:22:42 -0600
commitb2fd41ce465e16a178d51000b843b5228640b670 (patch)
tree848b85a71e86ed7dded7ca6aa77c09eadd393fd9 /src/gallium
parent9390cb84593bda516e8c1521c87a08475574d1be (diff)
svga: fix backed surface view regression
Commit b9ba8492 removes an unneeded pipe_surface_release() from st_render_texture() and exposes a bug in the backed surface view creation. Currently a backed surface view for a conflicted surface view is created at framebuffer emit time. But if shader sampler views are changed but framebuffer surface views remain unchanged, emit_framebuffer() will not be called and conflicted surface views will not be detected. To fix this, also check for conflicted surface views when setting sampler views. If there is any conflicted surface views, enable the framebuffer dirty bit so that the framebuffer emit code has a chance to create a backed surface view for the conflicted surface view. Fix cinebench-r11-test regression. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/svga/svga_pipe_sampler.c28
-rw-r--r--src/gallium/drivers/svga/svga_sampler_view.h4
-rw-r--r--src/gallium/drivers/svga/svga_state_sampler.c17
-rw-r--r--src/gallium/drivers/svga/svga_surface.c14
4 files changed, 46 insertions, 17 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index bb18f5a8247..ab84ed39602 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -35,6 +35,8 @@
#include "svga_cmd.h"
#include "svga_debug.h"
#include "svga_resource_texture.h"
+#include "svga_surface.h"
+#include "svga_sampler_view.h"
static inline unsigned
@@ -445,7 +447,31 @@ svga_set_sampler_views(struct pipe_context *pipe,
svga->dirty |= SVGA_NEW_TEXTURE_FLAGS;
svga->curr.tex_flags.flag_1d = flag_1d;
svga->curr.tex_flags.flag_srgb = flag_srgb;
- }
+ }
+
+ /* Check if any of the sampler view resources collide with the framebuffer
+ * color buffers or depth stencil resource. If so, enable the NEW_FRAME_BUFFER
+ * dirty bit so that emit_framebuffer can be invoked to create backed view
+ * for the conflicted surface view.
+ */
+ for (i = 0; i < svga->curr.framebuffer.nr_cbufs; i++) {
+ struct svga_surface *s = svga_surface(svga->curr.framebuffer.cbufs[i]);
+ if (s) {
+ if (svga_check_sampler_view_resource_collision(svga, s->handle, shader)) {
+ svga->dirty |= SVGA_NEW_FRAME_BUFFER;
+ break;
+ }
+ }
+ }
+
+ if (svga->curr.framebuffer.zsbuf) {
+ struct svga_surface *s = svga_surface(svga->curr.framebuffer.zsbuf);
+ if (s) {
+ if (svga_check_sampler_view_resource_collision(svga, s->handle, shader)) {
+ svga->dirty |= SVGA_NEW_FRAME_BUFFER;
+ }
+ }
+ }
}
diff --git a/src/gallium/drivers/svga/svga_sampler_view.h b/src/gallium/drivers/svga/svga_sampler_view.h
index acd7ae0ca24..4ca7fb781a9 100644
--- a/src/gallium/drivers/svga/svga_sampler_view.h
+++ b/src/gallium/drivers/svga/svga_sampler_view.h
@@ -100,6 +100,6 @@ svga_sampler_view_reference(struct svga_sampler_view **ptr, struct svga_sampler_
boolean
svga_check_sampler_view_resource_collision(struct svga_context *svga,
- struct svga_winsys_surface *res);
-
+ struct svga_winsys_surface *res,
+ unsigned shader);
#endif
diff --git a/src/gallium/drivers/svga/svga_state_sampler.c b/src/gallium/drivers/svga/svga_state_sampler.c
index 1c6913e4a26..611d2c6102f 100644
--- a/src/gallium/drivers/svga/svga_state_sampler.c
+++ b/src/gallium/drivers/svga/svga_state_sampler.c
@@ -63,23 +63,22 @@ svga_resource_handle(struct pipe_resource *res)
*/
boolean
svga_check_sampler_view_resource_collision(struct svga_context *svga,
- struct svga_winsys_surface *res)
+ struct svga_winsys_surface *res,
+ unsigned shader)
{
struct pipe_screen *screen = svga->pipe.screen;
- unsigned shader, i;
+ unsigned i;
if (svga_screen(screen)->debug.no_surface_view) {
return FALSE;
}
- for (shader = PIPE_SHADER_VERTEX; shader <= PIPE_SHADER_GEOMETRY; shader++) {
- for (i = 0; i < svga->curr.num_sampler_views[shader]; i++) {
- struct svga_pipe_sampler_view *sv =
- svga_pipe_sampler_view(svga->curr.sampler_views[shader][i]);
+ for (i = 0; i < svga->curr.num_sampler_views[shader]; i++) {
+ struct svga_pipe_sampler_view *sv =
+ svga_pipe_sampler_view(svga->curr.sampler_views[shader][i]);
- if (sv && res == svga_resource_handle(sv->base.texture)) {
- return TRUE;
- }
+ if (sv && res == svga_resource_handle(sv->base.texture)) {
+ return TRUE;
}
}
diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c
index 79981dcf5ff..4b0f9417c32 100644
--- a/src/gallium/drivers/svga/svga_surface.c
+++ b/src/gallium/drivers/svga/svga_surface.c
@@ -377,6 +377,7 @@ svga_validate_surface_view(struct svga_context *svga, struct svga_surface *s)
{
enum pipe_error ret = PIPE_OK;
int try;
+ unsigned shader;
assert(svga_have_vgpu10(svga));
@@ -388,11 +389,14 @@ svga_validate_surface_view(struct svga_context *svga, struct svga_surface *s)
* associated resource. We will then use the cloned surface view for
* render target.
*/
- if (svga_check_sampler_view_resource_collision(svga, s->handle)) {
- SVGA_DBG(DEBUG_VIEWS,
- "same resource used in shaderResource and renderTarget 0x%x\n",
- s->handle);
- s = create_backed_surface_view(svga, s);
+ for (shader = PIPE_SHADER_VERTEX; shader <= PIPE_SHADER_GEOMETRY; shader++) {
+ if (svga_check_sampler_view_resource_collision(svga, s->handle, shader)) {
+ SVGA_DBG(DEBUG_VIEWS,
+ "same resource used in shaderResource and renderTarget 0x%x\n",
+ s->handle);
+ s = create_backed_surface_view(svga, s);
+ break;
+ }
}
if (s->view_id == SVGA3D_INVALID_ID) {