~ubuntu-branches/ubuntu/precise/mesa/precise-updates

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/r200/r200_blit.c

  • Committer: Package Import Robot
  • Author(s): Robert Hooker
  • Date: 2012-02-02 12:05:48 UTC
  • mfrom: (1.7.1) (3.3.27 sid)
  • Revision ID: package-import@ubuntu.com-20120202120548-nvkma85jq0h4coix
Tags: 8.0~rc2-0ubuntu4
Drop drisearchdir handling, it is no longer needed with multiarch
and dri-alternates being removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
}
39
39
 
40
40
/* common formats supported as both textures and render targets */
41
 
unsigned r200_check_blit(gl_format mesa_format)
 
41
unsigned r200_check_blit(gl_format mesa_format, uint32_t dst_pitch)
42
42
{
43
43
    /* XXX others?  BE/LE? */
44
44
    switch (mesa_format) {
58
58
            return 0;
59
59
    }
60
60
 
 
61
    /* Rendering to small buffer doesn't work.
 
62
     * Looks like a hw limitation.
 
63
     */
 
64
    if (dst_pitch < 32)
 
65
            return 0;
 
66
 
61
67
    /* ??? */
62
68
    if (_mesa_get_format_bits(mesa_format, GL_DEPTH_BITS) > 0)
63
69
            return 0;
143
149
            break;
144
150
    }
145
151
 
 
152
    if (bo->flags & RADEON_BO_FLAGS_MACRO_TILE)
 
153
        offset |= R200_TXO_MACRO_TILE;
 
154
    if (bo->flags & RADEON_BO_FLAGS_MICRO_TILE)
 
155
        offset |= R200_TXO_MICRO_TILE;
 
156
 
146
157
    switch (dst_mesa_format) {
147
158
    case MESA_FORMAT_ARGB8888:
148
159
    case MESA_FORMAT_XRGB8888:
278
289
    OUT_BATCH_REGVAL(R200_PP_TXPITCH_0, pitch * _mesa_get_format_bytes(src_mesa_format) - 32);
279
290
 
280
291
    OUT_BATCH_REGSEQ(R200_PP_TXOFFSET_0, 1);
281
 
    OUT_BATCH_RELOC(0, bo, 0, RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0);
 
292
    OUT_BATCH_RELOC(offset, bo, offset, RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0);
282
293
 
283
294
    END_BATCH();
284
295
}
321
332
            break;
322
333
    }
323
334
 
 
335
    if (bo->flags & RADEON_BO_FLAGS_MACRO_TILE)
 
336
        dst_pitch |= R200_COLOR_TILE_ENABLE;
 
337
    if (bo->flags & RADEON_BO_FLAGS_MICRO_TILE)
 
338
        dst_pitch |= R200_COLOR_MICROTILE_ENABLE;
 
339
 
324
340
    BEGIN_BATCH_NO_AUTOSTATE(22);
325
341
    OUT_BATCH_REGVAL(R200_RE_AUX_SCISSOR_CNTL, 0);
326
342
    OUT_BATCH_REGVAL(R200_RE_CNTL, 0);
332
348
    OUT_BATCH_REGVAL(RADEON_RB3D_CNTL, dst_format);
333
349
 
334
350
    OUT_BATCH_REGSEQ(RADEON_RB3D_COLOROFFSET, 1);
335
 
    OUT_BATCH_RELOC(0, bo, 0, 0, RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0);
 
351
    OUT_BATCH_RELOC(offset, bo, offset, 0, RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0);
336
352
    OUT_BATCH_REGSEQ(RADEON_RB3D_COLORPITCH, 1);
337
353
    OUT_BATCH_RELOC(dst_pitch, bo, dst_pitch, 0, RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0);
338
354
 
467
483
{
468
484
    struct r200_context *r200 = R200_CONTEXT(ctx);
469
485
 
470
 
    if (!r200_check_blit(dst_mesaformat))
 
486
    if (!r200_check_blit(dst_mesaformat, dst_pitch))
471
487
        return GL_FALSE;
472
488
 
473
489
    /* Make sure that colorbuffer has even width - hw limitation */
474
490
    if (dst_pitch % 2 > 0)
475
491
        ++dst_pitch;
476
492
 
477
 
    /* Rendering to small buffer doesn't work.
478
 
     * Looks like a hw limitation.
479
 
     */
480
 
    if (dst_pitch < 32)
481
 
        return GL_FALSE;
482
 
 
483
493
    /* Need to clamp the region size to make sure
484
494
     * we don't read outside of the source buffer
485
495
     * or write outside of the destination buffer.