~ubuntu-branches/ubuntu/natty/mesa/natty-proposed

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/intel/intel_tex_subimage.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Hooker, Robert Hooker, Christopher James Halse Rogers
  • Date: 2010-09-14 08:55:40 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100914085540-m4fpl0hdjlfd4jgz
Tags: 7.9~git20100909-0ubuntu1
[ Robert Hooker ]
* New upstream git snapshot up to commit 94118fe2d4b1e5 (LP: #631413)
* New features include ATI HD5xxx series support in r600, and a vastly
  improved glsl compiler.
* Remove pre-generated .pc's, use the ones generated at build time
  instead.
* Remove all references to mesa-utils now that its no longer shipped
  with the mesa source.
* Disable the experimental ARB_fragment_shader option by default on
  i915, it exposes incomplete functionality that breaks KDE compositing
  among other things. It can be enabled via driconf still. (LP: #628930).

[ Christopher James Halse Rogers ]
* debian/patches/04_osmesa_version.diff:
  - Refresh for new upstream
* Bugs fixed in this release:
  - Fixes severe rendering corruption in Unity on radeon (LP: #628727,
    LP: #596292, LP: #599741, LP: #630315, LP: #613694, LP: #599741).
  - Also fixes rendering in gnome-shell (LP: #578619).
  - Flickering in OpenGL apps on radeon (LP: #626943, LP: #610541).
  - Provides preliminary support for new intel chips (LP: #601052).
* debian/rules:
  - Update configure flags to match upstream reshuffling.
  - Explicitly remove gallium DRI drivers that we don't want to ship.
* Update debian/gbp.conf for this Maverick-specific packaging
* libegl1-mesa-dri-x11,kms: There are no longer separate kms or x11 drivers
  for EGL, libegl1-mesa-drivers now contains a single driver that provides
  both backends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include "intel_context.h"
36
36
#include "intel_tex.h"
37
37
#include "intel_mipmap_tree.h"
 
38
#include "intel_blit.h"
38
39
 
39
40
#define FILE_DEBUG_FLAG DEBUG_TEXTURE
40
41
 
54
55
   struct intel_context *intel = intel_context(ctx);
55
56
   struct intel_texture_image *intelImage = intel_texture_image(texImage);
56
57
   GLuint dstRowStride = 0;
57
 
   
 
58
   drm_intel_bo *temp_bo = NULL, *dst_bo = NULL;
 
59
   unsigned int blit_x = 0, blit_y = 0;
 
60
 
58
61
   DBG("%s target %s level %d offset %d,%d %dx%d\n", __FUNCTION__,
59
62
       _mesa_lookup_enum_by_nr(target),
60
63
       level, xoffset, yoffset, width, height);
61
64
 
62
 
   intelFlush(ctx);
 
65
   intel_flush(ctx);
63
66
 
64
67
   if (compressed)
65
68
      pixels = _mesa_validate_pbo_compressed_teximage(ctx, imageSize,
77
80
   /* Map buffer if necessary.  Need to lock to prevent other contexts
78
81
    * from uploading the buffer under us.
79
82
    */
80
 
   if (intelImage->mt) 
81
 
      texImage->Data = intel_miptree_image_map(intel,
82
 
                                               intelImage->mt,
83
 
                                               intelImage->face,
84
 
                                               intelImage->level,
85
 
                                               &dstRowStride,
86
 
                                               texImage->ImageOffsets);
87
 
   else {
 
83
   if (intelImage->mt) {
 
84
      dst_bo = intel_region_buffer(intel, intelImage->mt->region,
 
85
                                   INTEL_WRITE_PART);
 
86
 
 
87
      if (!compressed &&
 
88
          intelImage->mt->region->tiling != I915_TILING_Y &&
 
89
          intel->gen < 6 && target == GL_TEXTURE_2D &&
 
90
          drm_intel_bo_busy(dst_bo))
 
91
      {
 
92
         unsigned long pitch;
 
93
         uint32_t tiling_mode = I915_TILING_NONE;
 
94
         temp_bo = drm_intel_bo_alloc_tiled(intel->bufmgr,
 
95
                                            "subimage blit bo",
 
96
                                            width, height,
 
97
                                            intelImage->mt->cpp,
 
98
                                            &tiling_mode,
 
99
                                            &pitch,
 
100
                                            0);
 
101
         drm_intel_gem_bo_map_gtt(temp_bo);
 
102
         texImage->Data = temp_bo->virtual;
 
103
         texImage->ImageOffsets[0] = 0;
 
104
         dstRowStride = pitch;
 
105
 
 
106
         intel_miptree_get_image_offset(intelImage->mt, level,
 
107
                                        intelImage->face, 0,
 
108
                                        &blit_x, &blit_y);
 
109
         blit_x += xoffset;
 
110
         blit_y += yoffset;
 
111
         xoffset = 0;
 
112
         yoffset = 0;
 
113
      } else {
 
114
         texImage->Data = intel_miptree_image_map(intel,
 
115
                                                  intelImage->mt,
 
116
                                                  intelImage->face,
 
117
                                                  intelImage->level,
 
118
                                                  &dstRowStride,
 
119
                                                  texImage->ImageOffsets);
 
120
      }
 
121
   } else {
88
122
      if (_mesa_is_format_compressed(texImage->TexFormat)) {
89
123
         dstRowStride =
90
124
            _mesa_format_row_stride(texImage->TexFormat, width);
121
155
                          format, type, pixels, packing)) {
122
156
         _mesa_error(ctx, GL_OUT_OF_MEMORY, "intelTexSubImage");
123
157
      }
 
158
 
 
159
      if (temp_bo) {
 
160
         GLboolean ret;
 
161
         unsigned int dst_pitch = intelImage->mt->region->pitch *
 
162
            intelImage->mt->cpp;
 
163
 
 
164
         drm_intel_gem_bo_unmap_gtt(temp_bo);
 
165
         texImage->Data = NULL;
 
166
 
 
167
         ret = intelEmitCopyBlit(intel,
 
168
                                 intelImage->mt->cpp,
 
169
                                 dstRowStride / intelImage->mt->cpp,
 
170
                                 temp_bo, 0, GL_FALSE,
 
171
                                 dst_pitch / intelImage->mt->cpp, dst_bo, 0,
 
172
                                 intelImage->mt->region->tiling,
 
173
                                 0, 0, blit_x, blit_y, width, height,
 
174
                                 GL_COPY);
 
175
         assert(ret);
 
176
      }
124
177
   }
125
178
 
126
179
   _mesa_unmap_teximage_pbo(ctx, packing);
127
180
 
128
 
   if (intelImage->mt) {
 
181
   if (temp_bo) {
 
182
      drm_intel_bo_unreference(temp_bo);
 
183
      temp_bo = NULL;
 
184
   } else if (intelImage->mt) {
129
185
      intel_miptree_image_unmap(intel, intelImage->mt);
130
186
      texImage->Data = NULL;
131
187
   }