Rev 4358 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4358 | Rev 4401 | ||
---|---|---|---|
Line 69... | Line 69... | ||
69 | static void |
69 | static void |
70 | calculate_tiles(struct fd_context *ctx) |
70 | calculate_tiles(struct fd_context *ctx) |
71 | { |
71 | { |
72 | struct fd_gmem_stateobj *gmem = &ctx->gmem; |
72 | struct fd_gmem_stateobj *gmem = &ctx->gmem; |
73 | struct pipe_scissor_state *scissor = &ctx->max_scissor; |
73 | struct pipe_scissor_state *scissor = &ctx->max_scissor; |
74 | uint32_t cpp = util_format_get_blocksize(ctx->framebuffer.cbufs[0]->format); |
74 | struct pipe_framebuffer_state *pfb = &ctx->framebuffer; |
75 | uint32_t gmem_size = ctx->screen->gmemsize_bytes; |
75 | uint32_t gmem_size = ctx->screen->gmemsize_bytes; |
76 | uint32_t minx, miny, width, height; |
76 | uint32_t minx, miny, width, height; |
77 | uint32_t nbins_x = 1, nbins_y = 1; |
77 | uint32_t nbins_x = 1, nbins_y = 1; |
78 | uint32_t bin_w, bin_h; |
78 | uint32_t bin_w, bin_h; |
79 | uint32_t max_width = 992; |
79 | uint32_t max_width = 992; |
- | 80 | uint32_t cpp = 4; |
|
- | 81 | ||
- | 82 | if (pfb->cbufs[0]) |
|
- | 83 | cpp = util_format_get_blocksize(pfb->cbufs[0]->format); |
|
Line 80... | Line 84... | ||
80 | 84 | ||
81 | if ((gmem->cpp == cpp) && |
85 | if ((gmem->cpp == cpp) && |
82 | !memcmp(&gmem->scissor, scissor, sizeof(gmem->scissor))) { |
86 | !memcmp(&gmem->scissor, scissor, sizeof(gmem->scissor))) { |
83 | /* everything is up-to-date */ |
87 | /* everything is up-to-date */ |
84 | return; |
88 | return; |
Line -... | Line 89... | ||
- | 89 | } |
|
- | 90 | ||
- | 91 | if (fd_mesa_debug & FD_DBG_DSCIS) { |
|
- | 92 | minx = 0; |
|
- | 93 | miny = 0; |
|
- | 94 | width = pfb->width; |
|
85 | } |
95 | height = pfb->height; |
86 | 96 | } else { |
|
87 | minx = scissor->minx & ~31; /* round down to multiple of 32 */ |
97 | minx = scissor->minx & ~31; /* round down to multiple of 32 */ |
88 | miny = scissor->miny & ~31; |
98 | miny = scissor->miny & ~31; |
- | 99 | width = scissor->maxx - minx; |
|
Line 89... | Line 100... | ||
89 | width = scissor->maxx - minx; |
100 | height = scissor->maxy - miny; |
90 | height = scissor->maxy - miny; |
101 | } |
91 | 102 | ||
92 | // TODO we probably could optimize this a bit if we know that |
103 | // TODO we probably could optimize this a bit if we know that |
Line 130... | Line 141... | ||
130 | 141 | ||
131 | static void |
142 | static void |
132 | render_tiles(struct fd_context *ctx) |
143 | render_tiles(struct fd_context *ctx) |
133 | { |
144 | { |
134 | struct fd_gmem_stateobj *gmem = &ctx->gmem; |
145 | struct fd_gmem_stateobj *gmem = &ctx->gmem; |
135 | uint32_t i, yoff = 0; |
- | |
136 | - | ||
Line 137... | Line 146... | ||
137 | yoff= gmem->miny; |
146 | uint32_t i, yoff = gmem->miny; |
Line 138... | Line 147... | ||
138 | 147 | ||
139 | ctx->emit_tile_init(ctx); |
148 | ctx->emit_tile_init(ctx); |
140 | 149 | ||
Line 141... | Line 150... | ||
141 | for (i = 0; i < gmem->nbins_y; i++) { |
150 | for (i = 0; i < gmem->nbins_y; i++) { |
142 | uint32_t j, xoff = gmem->minx; |
151 | uint32_t j, xoff = gmem->minx; |
Line 143... | Line 152... | ||
143 | uint32_t bh = gmem->bin_h; |
152 | uint32_t bh = gmem->bin_h; |
144 | 153 | ||
Line 145... | Line 154... | ||
145 | /* clip bin height: */ |
154 | /* clip bin height: */ |
146 | bh = MIN2(bh, gmem->height - yoff); |
155 | bh = MIN2(bh, gmem->miny + gmem->height - yoff); |
Line 147... | Line 156... | ||
147 | 156 | ||
148 | for (j = 0; j < gmem->nbins_x; j++) { |
157 | for (j = 0; j < gmem->nbins_x; j++) { |
Line 149... | Line 158... | ||
149 | uint32_t bw = gmem->bin_w; |
158 | uint32_t bw = gmem->bin_w; |
Line 203... | Line 212... | ||
203 | /* mark the end of the clear/draw cmds before emitting per-tile cmds: */ |
212 | /* mark the end of the clear/draw cmds before emitting per-tile cmds: */ |
204 | fd_ringmarker_mark(ctx->draw_end); |
213 | fd_ringmarker_mark(ctx->draw_end); |
Line 205... | Line 214... | ||
205 | 214 | ||
206 | if (sysmem) { |
215 | if (sysmem) { |
207 | DBG("rendering sysmem (%s/%s)", |
216 | DBG("rendering sysmem (%s/%s)", |
208 | util_format_name(pfb->cbufs[0]->format), |
217 | util_format_short_name(pipe_surface_format(pfb->cbufs[0])), |
209 | pfb->zsbuf ? util_format_name(pfb->zsbuf->format) : "none"); |
218 | util_format_short_name(pipe_surface_format(pfb->zsbuf))); |
210 | render_sysmem(ctx); |
219 | render_sysmem(ctx); |
211 | } else { |
220 | } else { |
212 | struct fd_gmem_stateobj *gmem = &ctx->gmem; |
- | |
213 | DBG("rendering %dx%d tiles (%s/%s)", gmem->nbins_x, gmem->nbins_y, |
- | |
214 | util_format_name(pfb->cbufs[0]->format), |
- | |
215 | pfb->zsbuf ? util_format_name(pfb->zsbuf->format) : "none"); |
221 | struct fd_gmem_stateobj *gmem = &ctx->gmem; |
- | 222 | calculate_tiles(ctx); |
|
- | 223 | DBG("rendering %dx%d tiles (%s/%s)", gmem->nbins_x, gmem->nbins_y, |
|
- | 224 | util_format_short_name(pipe_surface_format(pfb->cbufs[0])), |
|
216 | calculate_tiles(ctx); |
225 | util_format_short_name(pipe_surface_format(pfb->zsbuf))); |
217 | render_tiles(ctx); |
226 | render_tiles(ctx); |
Line 218... | Line 227... | ||
218 | } |
227 | } |
219 | 228 | ||
Line 223... | Line 232... | ||
223 | /* mark start for next draw cmds: */ |
232 | /* mark start for next draw cmds: */ |
224 | fd_ringmarker_mark(ctx->draw_start); |
233 | fd_ringmarker_mark(ctx->draw_start); |
Line 225... | Line 234... | ||
225 | 234 | ||
226 | /* update timestamps on render targets: */ |
235 | /* update timestamps on render targets: */ |
- | 236 | timestamp = fd_ringbuffer_timestamp(ctx->ring); |
|
227 | timestamp = fd_ringbuffer_timestamp(ctx->ring); |
237 | if (pfb->cbufs[0]) |
228 | fd_resource(pfb->cbufs[0]->texture)->timestamp = timestamp; |
238 | fd_resource(pfb->cbufs[0]->texture)->timestamp = timestamp; |
229 | if (pfb->zsbuf) |
239 | if (pfb->zsbuf) |
Line 230... | Line 240... | ||
230 | fd_resource(pfb->zsbuf->texture)->timestamp = timestamp; |
240 | fd_resource(pfb->zsbuf->texture)->timestamp = timestamp; |