1848b8605Smrg/**************************************************************************
2848b8605Smrg *
3848b8605Smrg * Copyright 2003 VMware, Inc.
4848b8605Smrg * All Rights Reserved.
5848b8605Smrg *
6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a
7848b8605Smrg * copy of this software and associated documentation files (the
8848b8605Smrg * "Software"), to deal in the Software without restriction, including
9848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish,
10848b8605Smrg * distribute, sub license, and/or sell copies of the Software, and to
11848b8605Smrg * permit persons to whom the Software is furnished to do so, subject to
12848b8605Smrg * the following conditions:
13848b8605Smrg *
14848b8605Smrg * The above copyright notice and this permission notice (including the
15848b8605Smrg * next paragraph) shall be included in all copies or substantial portions
16848b8605Smrg * of the Software.
17848b8605Smrg *
18848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21848b8605Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22848b8605Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23848b8605Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24848b8605Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25848b8605Smrg *
26848b8605Smrg **************************************************************************/
27848b8605Smrg
28848b8605Smrg#include "i915_surface.h"
29848b8605Smrg#include "i915_resource.h"
30848b8605Smrg#include "i915_state.h"
31848b8605Smrg#include "i915_blit.h"
32848b8605Smrg#include "i915_reg.h"
33848b8605Smrg#include "i915_screen.h"
34848b8605Smrg#include "pipe/p_defines.h"
35848b8605Smrg#include "util/u_inlines.h"
36848b8605Smrg#include "util/u_math.h"
37848b8605Smrg#include "util/u_format.h"
38848b8605Smrg#include "util/u_memory.h"
39848b8605Smrg#include "util/u_pack_color.h"
40848b8605Smrg#include "util/u_surface.h"
41848b8605Smrg
42848b8605Smrgstatic struct pipe_surface *
43848b8605Smrgi915_create_surface_custom(struct pipe_context *ctx,
44848b8605Smrg                           struct pipe_resource *pt,
45848b8605Smrg                           const struct pipe_surface *surf_tmpl,
46848b8605Smrg                           unsigned width0,
47848b8605Smrg                           unsigned height0);
48848b8605Smrg/*
49848b8605Smrg * surface functions using the render engine
50848b8605Smrg */
51848b8605Smrg
52848b8605Smrgstatic void
53848b8605Smrgi915_util_blitter_save_states(struct i915_context *i915)
54848b8605Smrg{
55848b8605Smrg   util_blitter_save_blend(i915->blitter, (void *)i915->blend);
56848b8605Smrg   util_blitter_save_depth_stencil_alpha(i915->blitter, (void *)i915->depth_stencil);
57848b8605Smrg   util_blitter_save_stencil_ref(i915->blitter, &i915->stencil_ref);
58848b8605Smrg   util_blitter_save_rasterizer(i915->blitter, (void *)i915->rasterizer);
59848b8605Smrg   util_blitter_save_fragment_shader(i915->blitter, i915->fs);
60848b8605Smrg   util_blitter_save_vertex_shader(i915->blitter, i915->vs);
61848b8605Smrg   util_blitter_save_viewport(i915->blitter, &i915->viewport);
62848b8605Smrg   util_blitter_save_scissor(i915->blitter, &i915->scissor);
63848b8605Smrg   util_blitter_save_vertex_elements(i915->blitter, i915->velems);
64848b8605Smrg   util_blitter_save_vertex_buffer_slot(i915->blitter,
65848b8605Smrg                                    i915->vertex_buffers);
66848b8605Smrg
67848b8605Smrg   util_blitter_save_framebuffer(i915->blitter, &i915->framebuffer);
68848b8605Smrg
69848b8605Smrg   util_blitter_save_fragment_sampler_states(i915->blitter,
70848b8605Smrg                                             i915->num_samplers,
71848b8605Smrg                                             (void**)i915->fragment_sampler);
72848b8605Smrg   util_blitter_save_fragment_sampler_views(i915->blitter,
73848b8605Smrg                                            i915->num_fragment_sampler_views,
74848b8605Smrg                                            i915->fragment_sampler_views);
75848b8605Smrg}
76b8e80941Smrg
77848b8605Smrgstatic void
78848b8605Smrgi915_surface_copy_render(struct pipe_context *pipe,
79848b8605Smrg                         struct pipe_resource *dst, unsigned dst_level,
80848b8605Smrg                         unsigned dstx, unsigned dsty, unsigned dstz,
81848b8605Smrg                         struct pipe_resource *src, unsigned src_level,
82848b8605Smrg                         const struct pipe_box *src_box)
83848b8605Smrg{
84848b8605Smrg   struct i915_context *i915 = i915_context(pipe);
85848b8605Smrg   unsigned src_width0 = src->width0;
86848b8605Smrg   unsigned src_height0 = src->height0;
87848b8605Smrg   unsigned dst_width0 = dst->width0;
88848b8605Smrg   unsigned dst_height0 = dst->height0;
89848b8605Smrg   struct pipe_box dstbox;
90848b8605Smrg   struct pipe_sampler_view src_templ, *src_view;
91848b8605Smrg   struct pipe_surface dst_templ, *dst_view;
92b8e80941Smrg   const struct util_format_description *desc;
93b8e80941Smrg
94b8e80941Smrg   /* Fallback for buffers. */
95b8e80941Smrg   if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER)
96b8e80941Smrg      goto fallback;
97848b8605Smrg
98b8e80941Smrg   /* Fallback for depth&stencil. XXX: see if we can use a proxy format */
99b8e80941Smrg   desc = util_format_description(src->format);
100b8e80941Smrg   if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS)
101b8e80941Smrg      goto fallback;
102b8e80941Smrg
103b8e80941Smrg   desc = util_format_description(dst->format);
104b8e80941Smrg   if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS)
105848b8605Smrg      goto fallback;
106848b8605Smrg
107848b8605Smrg   util_blitter_default_dst_texture(&dst_templ, dst, dst_level, dstz);
108b8e80941Smrg   util_blitter_default_src_texture(i915->blitter, &src_templ, src, src_level);
109848b8605Smrg
110848b8605Smrg   if (!util_blitter_is_copy_supported(i915->blitter, dst, src))
111848b8605Smrg      goto fallback;
112848b8605Smrg
113848b8605Smrg   i915_util_blitter_save_states(i915);
114848b8605Smrg
115848b8605Smrg   dst_view = i915_create_surface_custom(pipe, dst, &dst_templ, dst_width0, dst_height0);
116848b8605Smrg   src_view = i915_create_sampler_view_custom(pipe, src, &src_templ, src_width0, src_height0);
117848b8605Smrg
118848b8605Smrg   u_box_3d(dstx, dsty, dstz, abs(src_box->width), abs(src_box->height),
119848b8605Smrg            abs(src_box->depth), &dstbox);
120848b8605Smrg
121848b8605Smrg   util_blitter_blit_generic(i915->blitter, dst_view, &dstbox,
122848b8605Smrg                             src_view, src_box, src_width0, src_height0,
123b8e80941Smrg                             PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL,
124b8e80941Smrg                             FALSE);
125848b8605Smrg   return;
126848b8605Smrg
127848b8605Smrgfallback:
128848b8605Smrg   util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz,
129848b8605Smrg                             src, src_level, src_box);
130b8e80941Smrg}
131848b8605Smrg
132848b8605Smrgstatic void
133848b8605Smrgi915_clear_render_target_render(struct pipe_context *pipe,
134848b8605Smrg                                struct pipe_surface *dst,
135848b8605Smrg                                const union pipe_color_union *color,
136848b8605Smrg                                unsigned dstx, unsigned dsty,
137b8e80941Smrg                                unsigned width, unsigned height,
138b8e80941Smrg                                bool render_condition_enabled)
139848b8605Smrg{
140848b8605Smrg   struct i915_context *i915 = i915_context(pipe);
141848b8605Smrg   struct pipe_framebuffer_state fb_state;
142848b8605Smrg
143848b8605Smrg   util_blitter_save_framebuffer(i915->blitter, &i915->framebuffer);
144848b8605Smrg
145848b8605Smrg   fb_state.width = dst->width;
146848b8605Smrg   fb_state.height = dst->height;
147848b8605Smrg   fb_state.nr_cbufs = 1;
148848b8605Smrg   fb_state.cbufs[0] = dst;
149848b8605Smrg   fb_state.zsbuf = NULL;
150848b8605Smrg   pipe->set_framebuffer_state(pipe, &fb_state);
151848b8605Smrg
152848b8605Smrg   if (i915->dirty)
153848b8605Smrg      i915_update_derived(i915);
154848b8605Smrg
155848b8605Smrg   i915_clear_emit(pipe, PIPE_CLEAR_COLOR, color, 0.0, 0x0,
156848b8605Smrg                   dstx, dsty, width, height);
157848b8605Smrg
158848b8605Smrg   pipe->set_framebuffer_state(pipe, &i915->blitter->saved_fb_state);
159848b8605Smrg   util_unreference_framebuffer_state(&i915->blitter->saved_fb_state);
160848b8605Smrg   i915->blitter->saved_fb_state.nr_cbufs = ~0;
161848b8605Smrg}
162848b8605Smrg
163848b8605Smrgstatic void
164848b8605Smrgi915_clear_depth_stencil_render(struct pipe_context *pipe,
165848b8605Smrg                                struct pipe_surface *dst,
166848b8605Smrg                                unsigned clear_flags,
167848b8605Smrg                                double depth,
168848b8605Smrg                                unsigned stencil,
169848b8605Smrg                                unsigned dstx, unsigned dsty,
170b8e80941Smrg                                unsigned width, unsigned height,
171b8e80941Smrg                                bool render_condition_enabled)
172848b8605Smrg{
173848b8605Smrg   struct i915_context *i915 = i915_context(pipe);
174848b8605Smrg   struct pipe_framebuffer_state fb_state;
175848b8605Smrg
176848b8605Smrg   util_blitter_save_framebuffer(i915->blitter, &i915->framebuffer);
177848b8605Smrg
178848b8605Smrg   fb_state.width = dst->width;
179848b8605Smrg   fb_state.height = dst->height;
180848b8605Smrg   fb_state.nr_cbufs = 0;
181848b8605Smrg   fb_state.zsbuf = dst;
182848b8605Smrg   pipe->set_framebuffer_state(pipe, &fb_state);
183848b8605Smrg
184848b8605Smrg   if (i915->dirty)
185848b8605Smrg      i915_update_derived(i915);
186848b8605Smrg
187848b8605Smrg   i915_clear_emit(pipe, clear_flags & PIPE_CLEAR_DEPTHSTENCIL,
188848b8605Smrg                   NULL, depth, stencil,
189848b8605Smrg                   dstx, dsty, width, height);
190848b8605Smrg
191848b8605Smrg   pipe->set_framebuffer_state(pipe, &i915->blitter->saved_fb_state);
192848b8605Smrg   util_unreference_framebuffer_state(&i915->blitter->saved_fb_state);
193848b8605Smrg   i915->blitter->saved_fb_state.nr_cbufs = ~0;
194848b8605Smrg}
195848b8605Smrg
196848b8605Smrg/*
197848b8605Smrg * surface functions using the blitter
198848b8605Smrg */
199848b8605Smrg
200848b8605Smrg/* Assumes all values are within bounds -- no checking at this level -
201848b8605Smrg * do it higher up if required.
202848b8605Smrg */
203848b8605Smrgstatic void
204848b8605Smrgi915_surface_copy_blitter(struct pipe_context *pipe,
205848b8605Smrg                          struct pipe_resource *dst, unsigned dst_level,
206848b8605Smrg                          unsigned dstx, unsigned dsty, unsigned dstz,
207848b8605Smrg                          struct pipe_resource *src, unsigned src_level,
208848b8605Smrg                          const struct pipe_box *src_box)
209848b8605Smrg{
210848b8605Smrg   struct i915_texture *dst_tex = i915_texture(dst);
211848b8605Smrg   struct i915_texture *src_tex = i915_texture(src);
212848b8605Smrg   struct pipe_resource *dpt = &dst_tex->b.b;
213848b8605Smrg   struct pipe_resource *spt = &src_tex->b.b;
214848b8605Smrg   unsigned dst_offset, src_offset;  /* in bytes */
215848b8605Smrg
216848b8605Smrg   /* Fallback for buffers. */
217848b8605Smrg   if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
218848b8605Smrg      util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz,
219848b8605Smrg                                src, src_level, src_box);
220848b8605Smrg      return;
221848b8605Smrg   }
222848b8605Smrg
223848b8605Smrg   /* XXX cannot copy 3d regions at this time */
224848b8605Smrg   assert(src_box->depth == 1);
225848b8605Smrg   if (dst->target != PIPE_TEXTURE_CUBE &&
226848b8605Smrg       dst->target != PIPE_TEXTURE_3D)
227848b8605Smrg      assert(dstz == 0);
228848b8605Smrg   dst_offset = i915_texture_offset(dst_tex, dst_level, dstz);
229848b8605Smrg
230848b8605Smrg   if (src->target != PIPE_TEXTURE_CUBE &&
231848b8605Smrg       src->target != PIPE_TEXTURE_3D)
232848b8605Smrg      assert(src_box->z == 0);
233848b8605Smrg   src_offset = i915_texture_offset(src_tex, src_level, src_box->z);
234848b8605Smrg
235848b8605Smrg   assert( util_format_get_blocksize(dpt->format) == util_format_get_blocksize(spt->format) );
236848b8605Smrg   assert( util_format_get_blockwidth(dpt->format) == util_format_get_blockwidth(spt->format) );
237848b8605Smrg   assert( util_format_get_blockheight(dpt->format) == util_format_get_blockheight(spt->format) );
238848b8605Smrg   assert( util_format_get_blockwidth(dpt->format) == 1 );
239848b8605Smrg   assert( util_format_get_blockheight(dpt->format) == 1 );
240848b8605Smrg
241848b8605Smrg   i915_copy_blit( i915_context(pipe),
242848b8605Smrg                   util_format_get_blocksize(dpt->format),
243848b8605Smrg                   (unsigned short) src_tex->stride, src_tex->buffer, src_offset,
244848b8605Smrg                   (unsigned short) dst_tex->stride, dst_tex->buffer, dst_offset,
245848b8605Smrg                   (short) src_box->x, (short) src_box->y, (short) dstx, (short) dsty,
246848b8605Smrg                   (short) src_box->width, (short) src_box->height );
247848b8605Smrg}
248848b8605Smrg
249848b8605Smrgstatic void
250848b8605Smrgi915_blit(struct pipe_context *pipe, const struct pipe_blit_info *blit_info)
251848b8605Smrg{
252848b8605Smrg   struct i915_context *i915 = i915_context(pipe);
253848b8605Smrg   struct pipe_blit_info info = *blit_info;
254848b8605Smrg
255848b8605Smrg   if (util_try_blit_via_copy_region(pipe, &info)) {
256848b8605Smrg      return; /* done */
257848b8605Smrg   }
258848b8605Smrg
259848b8605Smrg   if (info.mask & PIPE_MASK_S) {
260848b8605Smrg      debug_printf("i915: cannot blit stencil, skipping\n");
261848b8605Smrg      info.mask &= ~PIPE_MASK_S;
262848b8605Smrg   }
263848b8605Smrg
264848b8605Smrg   if (!util_blitter_is_blit_supported(i915->blitter, &info)) {
265848b8605Smrg      debug_printf("i915: blit unsupported %s -> %s\n",
266848b8605Smrg                   util_format_short_name(info.src.resource->format),
267848b8605Smrg                   util_format_short_name(info.dst.resource->format));
268848b8605Smrg      return;
269848b8605Smrg   }
270848b8605Smrg
271848b8605Smrg   i915_util_blitter_save_states(i915);
272848b8605Smrg
273848b8605Smrg   util_blitter_blit(i915->blitter, &info);
274848b8605Smrg}
275848b8605Smrg
276848b8605Smrgstatic void
277848b8605Smrgi915_flush_resource(struct pipe_context *ctx, struct pipe_resource *resource)
278848b8605Smrg{
279848b8605Smrg}
280848b8605Smrg
281848b8605Smrgstatic void
282848b8605Smrgi915_clear_render_target_blitter(struct pipe_context *pipe,
283848b8605Smrg                                 struct pipe_surface *dst,
284848b8605Smrg                                 const union pipe_color_union *color,
285848b8605Smrg                                 unsigned dstx, unsigned dsty,
286b8e80941Smrg                                 unsigned width, unsigned height,
287b8e80941Smrg                                 bool render_condition_enabled)
288848b8605Smrg{
289848b8605Smrg   struct i915_texture *tex = i915_texture(dst->texture);
290848b8605Smrg   struct pipe_resource *pt = &tex->b.b;
291848b8605Smrg   union util_color uc;
292848b8605Smrg   unsigned offset = i915_texture_offset(tex, dst->u.tex.level, dst->u.tex.first_layer);
293848b8605Smrg
294848b8605Smrg   assert(util_format_get_blockwidth(pt->format) == 1);
295848b8605Smrg   assert(util_format_get_blockheight(pt->format) == 1);
296848b8605Smrg
297848b8605Smrg   util_pack_color(color->f, dst->format, &uc);
298848b8605Smrg   i915_fill_blit( i915_context(pipe),
299848b8605Smrg                   util_format_get_blocksize(pt->format),
300848b8605Smrg                   XY_COLOR_BLT_WRITE_ALPHA | XY_COLOR_BLT_WRITE_RGB,
301848b8605Smrg                   (unsigned short) tex->stride,
302848b8605Smrg                   tex->buffer, offset,
303848b8605Smrg                   (short) dstx, (short) dsty,
304848b8605Smrg                   (short) width, (short) height,
305848b8605Smrg                   uc.ui[0] );
306848b8605Smrg}
307848b8605Smrg
308848b8605Smrgstatic void
309848b8605Smrgi915_clear_depth_stencil_blitter(struct pipe_context *pipe,
310848b8605Smrg                                 struct pipe_surface *dst,
311848b8605Smrg                                 unsigned clear_flags,
312848b8605Smrg                                 double depth,
313848b8605Smrg                                 unsigned stencil,
314848b8605Smrg                                 unsigned dstx, unsigned dsty,
315b8e80941Smrg                                 unsigned width, unsigned height,
316b8e80941Smrg                                 bool render_condition_enabled)
317848b8605Smrg{
318848b8605Smrg   struct i915_texture *tex = i915_texture(dst->texture);
319848b8605Smrg   struct pipe_resource *pt = &tex->b.b;
320848b8605Smrg   unsigned packedds;
321848b8605Smrg   unsigned mask = 0;
322848b8605Smrg   unsigned offset = i915_texture_offset(tex, dst->u.tex.level, dst->u.tex.first_layer);
323848b8605Smrg
324848b8605Smrg   assert(util_format_get_blockwidth(pt->format) == 1);
325848b8605Smrg   assert(util_format_get_blockheight(pt->format) == 1);
326848b8605Smrg
327848b8605Smrg   packedds = util_pack_z_stencil(dst->format, depth, stencil);
328848b8605Smrg
329848b8605Smrg   if (clear_flags & PIPE_CLEAR_DEPTH)
330848b8605Smrg      mask |= XY_COLOR_BLT_WRITE_RGB;
331848b8605Smrg   /* XXX presumably this does read-modify-write
332848b8605Smrg      (otherwise this won't work anyway). Hence will only want to
333848b8605Smrg      do it if really have stencil and it isn't cleared */
334848b8605Smrg   if ((clear_flags & PIPE_CLEAR_STENCIL) ||
335848b8605Smrg       (dst->format != PIPE_FORMAT_Z24_UNORM_S8_UINT))
336848b8605Smrg      mask |= XY_COLOR_BLT_WRITE_ALPHA;
337848b8605Smrg
338848b8605Smrg   i915_fill_blit( i915_context(pipe),
339848b8605Smrg                   util_format_get_blocksize(pt->format),
340848b8605Smrg                   mask,
341848b8605Smrg                   (unsigned short) tex->stride,
342848b8605Smrg                   tex->buffer, offset,
343848b8605Smrg                   (short) dstx, (short) dsty,
344848b8605Smrg                   (short) width, (short) height,
345848b8605Smrg                   packedds );
346848b8605Smrg}
347848b8605Smrg
348848b8605Smrg/*
349848b8605Smrg * Screen surface functions
350848b8605Smrg */
351848b8605Smrg
352848b8605Smrg
353848b8605Smrgstatic struct pipe_surface *
354848b8605Smrgi915_create_surface_custom(struct pipe_context *ctx,
355848b8605Smrg                           struct pipe_resource *pt,
356848b8605Smrg                           const struct pipe_surface *surf_tmpl,
357848b8605Smrg                           unsigned width0,
358848b8605Smrg                           unsigned height0)
359848b8605Smrg{
360848b8605Smrg   struct pipe_surface *ps;
361848b8605Smrg
362848b8605Smrg   assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer);
363848b8605Smrg   if (pt->target != PIPE_TEXTURE_CUBE &&
364848b8605Smrg       pt->target != PIPE_TEXTURE_3D)
365848b8605Smrg      assert(surf_tmpl->u.tex.first_layer == 0);
366848b8605Smrg
367848b8605Smrg   ps = CALLOC_STRUCT(pipe_surface);
368848b8605Smrg   if (ps) {
369848b8605Smrg      /* could subclass pipe_surface and store offset as it used to do */
370848b8605Smrg      pipe_reference_init(&ps->reference, 1);
371848b8605Smrg      pipe_resource_reference(&ps->texture, pt);
372848b8605Smrg      ps->format = surf_tmpl->format;
373848b8605Smrg      ps->width = u_minify(width0, surf_tmpl->u.tex.level);
374848b8605Smrg      ps->height = u_minify(height0, surf_tmpl->u.tex.level);
375848b8605Smrg      ps->u.tex.level = surf_tmpl->u.tex.level;
376848b8605Smrg      ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
377848b8605Smrg      ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
378848b8605Smrg      ps->context = ctx;
379848b8605Smrg   }
380848b8605Smrg   return ps;
381848b8605Smrg}
382848b8605Smrg
383848b8605Smrgstatic struct pipe_surface *
384848b8605Smrgi915_create_surface(struct pipe_context *ctx,
385848b8605Smrg                    struct pipe_resource *pt,
386848b8605Smrg                    const struct pipe_surface *surf_tmpl)
387848b8605Smrg{
388848b8605Smrg   return i915_create_surface_custom(ctx, pt, surf_tmpl,
389848b8605Smrg                                     pt->width0, pt->height0);
390848b8605Smrg}
391848b8605Smrg
392848b8605Smrgstatic void
393848b8605Smrgi915_surface_destroy(struct pipe_context *ctx,
394848b8605Smrg                     struct pipe_surface *surf)
395848b8605Smrg{
396848b8605Smrg   pipe_resource_reference(&surf->texture, NULL);
397848b8605Smrg   FREE(surf);
398848b8605Smrg}
399848b8605Smrg
400848b8605Smrg
401848b8605Smrgvoid
402848b8605Smrgi915_init_surface_functions(struct i915_context *i915)
403848b8605Smrg{
404848b8605Smrg   if (i915_screen(i915->base.screen)->debug.use_blitter) {
405848b8605Smrg      i915->base.resource_copy_region = i915_surface_copy_blitter;
406848b8605Smrg      i915->base.clear_render_target = i915_clear_render_target_blitter;
407848b8605Smrg      i915->base.clear_depth_stencil = i915_clear_depth_stencil_blitter;
408848b8605Smrg   } else {
409848b8605Smrg      i915->base.resource_copy_region = i915_surface_copy_render;
410848b8605Smrg      i915->base.clear_render_target = i915_clear_render_target_render;
411848b8605Smrg      i915->base.clear_depth_stencil = i915_clear_depth_stencil_render;
412848b8605Smrg   }
413848b8605Smrg   i915->base.blit = i915_blit;
414848b8605Smrg   i915->base.flush_resource = i915_flush_resource;
415848b8605Smrg   i915->base.create_surface = i915_create_surface;
416848b8605Smrg   i915->base.surface_destroy = i915_surface_destroy;
417848b8605Smrg}
418