8d723d640520ad733236c4d6fea7245a3ba4747b
[mesa.git] / src / mesa / drivers / dri / i965 / brw_blorp_blit_eu.cpp
1 /*
2 * Copyright © 2013 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #include "glsl/ralloc.h"
25 #include "brw_blorp_blit_eu.h"
26
27 brw_blorp_eu_emitter::brw_blorp_eu_emitter(struct brw_context *brw)
28 : mem_ctx(ralloc_context(NULL))
29 {
30 brw_init_compile(brw, &func, mem_ctx);
31
32 /*
33 * By default everything is emitted as 16-wide with only a few expections
34 * handled explicitly either here in the compiler or by one of the specific
35 * code emission calls.
36 * It should be also noted that here in this file any alterations of the
37 * compression control settings are only used to affect the execution size
38 * of the instructions. The instruction template used to initialise all the
39 * instructions is effectively not altered -- the value stays at zero
40 * representing either GEN6_COMPRESSION_1Q or GEN6_COMPRESSION_1H depending
41 * on the context.
42 * If any other settings are used in the instruction headers, they are set
43 * elsewhere by the individual code emission calls.
44 */
45 brw_set_compression_control(&func, BRW_COMPRESSION_COMPRESSED);
46 }
47
48 brw_blorp_eu_emitter::~brw_blorp_eu_emitter()
49 {
50 ralloc_free(mem_ctx);
51 }
52
53 const unsigned *
54 brw_blorp_eu_emitter::get_program(unsigned *program_size, FILE *dump_file)
55 {
56 brw_set_uip_jip(&func);
57
58 if (unlikely(INTEL_DEBUG & DEBUG_BLORP)) {
59 printf("Native code for BLORP blit:\n");
60 brw_dump_compile(&func, dump_file, 0, func.next_insn_offset);
61 printf("\n");
62 }
63
64 return brw_get_program(&func, program_size);
65 }