summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/relnotes/12.1.0.html2
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_context.h2
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_screen.c3
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_screen.h2
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_state.c17
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_state_validate.c27
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_stateobj.h6
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_surface.c22
8 files changed, 75 insertions, 6 deletions
diff --git a/docs/relnotes/12.1.0.html b/docs/relnotes/12.1.0.html
index a33460223c6..096f55186f8 100644
--- a/docs/relnotes/12.1.0.html
+++ b/docs/relnotes/12.1.0.html
@@ -46,7 +46,7 @@ Note: some of the new features are only available with certain drivers.
<ul>
<li>GL_ARB_shader_group_vote on nvc0</li>
<li>GL_ARB_ES3_1_compatibility on i965</li>
-<li>GL_EXT_window_rectangles on nvc0</li>
+<li>GL_EXT_window_rectangles on nv50, nvc0</li>
</ul>
<h2>Bug fixes</h2>
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.h b/src/gallium/drivers/nouveau/nv50/nv50_context.h
index d5de255b332..cb94c8edc54 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_context.h
+++ b/src/gallium/drivers/nouveau/nv50/nv50_context.h
@@ -47,6 +47,7 @@
#define NV50_NEW_3D_SAMPLERS (1 << 20)
#define NV50_NEW_3D_STRMOUT (1 << 21)
#define NV50_NEW_3D_MIN_SAMPLES (1 << 22)
+#define NV50_NEW_3D_WINDOW_RECTS (1 << 23)
#define NV50_NEW_3D_CONTEXT (1 << 31)
#define NV50_NEW_CP_PROGRAM (1 << 0)
@@ -168,6 +169,7 @@ struct nv50_context {
struct pipe_viewport_state viewports[NV50_MAX_VIEWPORTS];
unsigned viewports_dirty;
struct pipe_clip_state clip;
+ struct nv50_window_rect_stateobj window_rect;
unsigned sample_mask;
unsigned min_samples;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index d1719d30720..042148e7455 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -141,6 +141,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return PIPE_ENDIAN_LITTLE;
case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
return (class_3d >= NVA3_3D_CLASS) ? 4 : 0;
+ case PIPE_CAP_MAX_WINDOW_RECTANGLES:
+ return NV50_MAX_WINDOW_RECTANGLES;
/* supported caps */
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
@@ -250,7 +252,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
case PIPE_CAP_TGSI_VOTE:
- case PIPE_CAP_MAX_WINDOW_RECTANGLES:
return 0;
case PIPE_CAP_VENDOR_ID:
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.h b/src/gallium/drivers/nouveau/nv50/nv50_screen.h
index 5bb7a516686..370d8f52f21 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.h
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.h
@@ -23,6 +23,8 @@ struct nv50_context;
#define NV50_MAX_VIEWPORTS 16
+#define NV50_MAX_WINDOW_RECTANGLES 8
+
#define NV50_MAX_GLOBALS 16
#define ONE_TEMP_SIZE (4/*vector*/ * sizeof(float))
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c
index 3231aba20c1..9f5b5cb57f4 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c
@@ -1002,6 +1002,22 @@ nv50_set_viewport_states(struct pipe_context *pipe,
}
static void
+nv50_set_window_rectangles(struct pipe_context *pipe,
+ boolean include,
+ unsigned num_rectangles,
+ const struct pipe_scissor_state *rectangles)
+{
+ struct nv50_context *nv50 = nv50_context(pipe);
+
+ nv50->window_rect.inclusive = include;
+ nv50->window_rect.rects = MIN2(num_rectangles, NV50_MAX_WINDOW_RECTANGLES);
+ memcpy(nv50->window_rect.rect, rectangles,
+ sizeof(struct pipe_scissor_state) * nv50->window_rect.rects);
+
+ nv50->dirty_3d |= NV50_NEW_3D_WINDOW_RECTS;
+}
+
+static void
nv50_set_vertex_buffers(struct pipe_context *pipe,
unsigned start_slot, unsigned count,
const struct pipe_vertex_buffer *vb)
@@ -1299,6 +1315,7 @@ nv50_init_state_functions(struct nv50_context *nv50)
pipe->set_polygon_stipple = nv50_set_polygon_stipple;
pipe->set_scissor_states = nv50_set_scissor_states;
pipe->set_viewport_states = nv50_set_viewport_states;
+ pipe->set_window_rectangles = nv50_set_window_rectangles;
pipe->create_vertex_elements_state = nv50_vertex_state_create;
pipe->delete_vertex_elements_state = nv50_vertex_state_delete;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
index 65f7338f43e..3a374a24867 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state_validate.c
@@ -278,6 +278,32 @@ nv50_validate_viewport(struct nv50_context *nv50)
nv50->viewports_dirty = 0;
}
+static void
+nv50_validate_window_rects(struct nv50_context *nv50)
+{
+ struct nouveau_pushbuf *push = nv50->base.pushbuf;
+ bool enable = nv50->window_rect.rects > 0 || nv50->window_rect.inclusive;
+ int i;
+
+ BEGIN_NV04(push, NV50_3D(CLIP_RECTS_EN), 1);
+ PUSH_DATA (push, enable);
+ if (!enable)
+ return;
+
+ BEGIN_NV04(push, NV50_3D(CLIP_RECTS_MODE), 1);
+ PUSH_DATA (push, !nv50->window_rect.inclusive);
+ BEGIN_NV04(push, NV50_3D(CLIP_RECT_HORIZ(0)), NV50_MAX_WINDOW_RECTANGLES * 2);
+ for (i = 0; i < nv50->window_rect.rects; i++) {
+ struct pipe_scissor_state *s = &nv50->window_rect.rect[i];
+ PUSH_DATA(push, (s->maxx << 16) | s->minx);
+ PUSH_DATA(push, (s->maxy << 16) | s->miny);
+ }
+ for (; i < NV50_MAX_WINDOW_RECTANGLES; i++) {
+ PUSH_DATA(push, 0);
+ PUSH_DATA(push, 0);
+ }
+}
+
static inline void
nv50_check_program_ucps(struct nv50_context *nv50,
struct nv50_program *vp, uint8_t mask)
@@ -492,6 +518,7 @@ validate_list_3d[] = {
{ nv50_validate_scissor, NV50_NEW_3D_SCISSOR },
#endif
{ nv50_validate_viewport, NV50_NEW_3D_VIEWPORT },
+ { nv50_validate_window_rects, NV50_NEW_3D_WINDOW_RECTS },
{ nv50_vertprog_validate, NV50_NEW_3D_VERTPROG },
{ nv50_gmtyprog_validate, NV50_NEW_3D_GMTYPROG },
{ nv50_fragprog_validate, NV50_NEW_3D_FRAGPROG | NV50_NEW_3D_RASTERIZER |
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_stateobj.h b/src/gallium/drivers/nouveau/nv50/nv50_stateobj.h
index 4b1d00c7155..b8fa0f623f8 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_stateobj.h
+++ b/src/gallium/drivers/nouveau/nv50/nv50_stateobj.h
@@ -62,6 +62,12 @@ struct nv50_vertex_stateobj {
struct nv50_vertex_element element[0];
};
+struct nv50_window_rect_stateobj {
+ bool inclusive;
+ unsigned rects;
+ struct pipe_scissor_state rect[PIPE_MAX_WINDOW_RECTANGLES];
+};
+
struct nv50_so_target {
struct pipe_stream_output_target pipe;
struct pipe_query *pq;
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
index 61dec3f7be5..fbb5129908b 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
@@ -825,6 +825,7 @@ struct nv50_blitctx
enum pipe_texture_target target;
struct {
struct pipe_framebuffer_state fb;
+ struct nv50_window_rect_stateobj window_rect;
struct nv50_rasterizer_stateobj *rast;
struct nv50_program *vp;
struct nv50_program *gp;
@@ -1210,7 +1211,8 @@ nv50_blitctx_prepare_state(struct nv50_blitctx *blit)
}
static void
-nv50_blitctx_pre_blit(struct nv50_blitctx *ctx)
+nv50_blitctx_pre_blit(struct nv50_blitctx *ctx,
+ const struct pipe_blit_info *info)
{
struct nv50_context *nv50 = ctx->nv50;
struct nv50_blitter *blitter = nv50->screen->blitter;
@@ -1229,6 +1231,7 @@ nv50_blitctx_pre_blit(struct nv50_blitctx *ctx)
ctx->saved.fp = nv50->fragprog;
ctx->saved.min_samples = nv50->min_samples;
+ ctx->saved.window_rect = nv50->window_rect;
nv50->rast = &ctx->rast;
@@ -1236,6 +1239,13 @@ nv50_blitctx_pre_blit(struct nv50_blitctx *ctx)
nv50->gmtyprog = NULL;
nv50->fragprog = ctx->fp;
+ nv50->window_rect.rects =
+ MIN2(info->num_window_rectangles, NV50_MAX_WINDOW_RECTANGLES);
+ nv50->window_rect.inclusive = info->window_rectangle_include;
+ if (nv50->window_rect.rects)
+ memcpy(nv50->window_rect.rect, info->window_rectangles,
+ sizeof(struct pipe_scissor_state) * nv50->window_rect.rects);
+
for (s = 0; s < 3; ++s) {
ctx->saved.num_textures[s] = nv50->num_textures[s];
ctx->saved.num_samplers[s] = nv50->num_samplers[s];
@@ -1261,7 +1271,7 @@ nv50_blitctx_pre_blit(struct nv50_blitctx *ctx)
nv50->dirty_3d =
NV50_NEW_3D_FRAMEBUFFER | NV50_NEW_3D_MIN_SAMPLES |
NV50_NEW_3D_VERTPROG | NV50_NEW_3D_FRAGPROG | NV50_NEW_3D_GMTYPROG |
- NV50_NEW_3D_TEXTURES | NV50_NEW_3D_SAMPLERS;
+ NV50_NEW_3D_TEXTURES | NV50_NEW_3D_SAMPLERS | NV50_NEW_3D_WINDOW_RECTS;
}
static void
@@ -1285,6 +1295,7 @@ nv50_blitctx_post_blit(struct nv50_blitctx *blit)
nv50->fragprog = blit->saved.fp;
nv50->min_samples = blit->saved.min_samples;
+ nv50->window_rect = blit->saved.window_rect;
pipe_sampler_view_reference(&nv50->textures[2][0], NULL);
pipe_sampler_view_reference(&nv50->textures[2][1], NULL);
@@ -1308,7 +1319,7 @@ nv50_blitctx_post_blit(struct nv50_blitctx *blit)
nv50->dirty_3d = blit->saved.dirty_3d |
(NV50_NEW_3D_FRAMEBUFFER | NV50_NEW_3D_SCISSOR | NV50_NEW_3D_SAMPLE_MASK |
NV50_NEW_3D_RASTERIZER | NV50_NEW_3D_ZSA | NV50_NEW_3D_BLEND |
- NV50_NEW_3D_TEXTURES | NV50_NEW_3D_SAMPLERS |
+ NV50_NEW_3D_TEXTURES | NV50_NEW_3D_SAMPLERS | NV50_NEW_3D_WINDOW_RECTS |
NV50_NEW_3D_VERTPROG | NV50_NEW_3D_GMTYPROG | NV50_NEW_3D_FRAGPROG);
nv50->scissors_dirty |= 1;
@@ -1336,7 +1347,7 @@ nv50_blit_3d(struct nv50_context *nv50, const struct pipe_blit_info *info)
blit->render_condition_enable = info->render_condition_enable;
nv50_blit_select_fp(blit, info);
- nv50_blitctx_pre_blit(blit);
+ nv50_blitctx_pre_blit(blit, info);
nv50_blit_set_dst(blit, dst, info->dst.level, -1, info->dst.format);
nv50_blit_set_src(blit, src, info->src.level, -1, info->src.format,
@@ -1688,6 +1699,9 @@ nv50_blit(struct pipe_context *pipe, const struct pipe_blit_info *info)
info->dst.resource->nr_samples <= 1)
eng3d = true;
+ if (info->num_window_rectangles > 0 || info->window_rectangle_include)
+ eng3d = true;
+
/* FIXME: can't make this work with eng2d anymore */
if ((info->src.resource->nr_samples | 1) !=
(info->dst.resource->nr_samples | 1))