Rev 4104 | Rev 4371 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4104 | Rev 4246 | ||
---|---|---|---|
Line 136... | Line 136... | ||
136 | 136 | ||
137 | drm_gem_object_reference(&obj->base); |
137 | drm_gem_object_reference(&obj->base); |
Line 138... | Line 138... | ||
138 | list_add_tail(&obj->exec_list, &eb->objects); |
138 | list_add_tail(&obj->exec_list, &eb->objects); |
- | 139 | ||
- | 140 | obj->exec_entry = &exec[i]; |
|
- | 141 | ||
- | 142 | if(exec[i].handle == -2) |
|
139 | 143 | continue; |
|
140 | obj->exec_entry = &exec[i]; |
144 | |
141 | if (eb->and < 0) { |
145 | if (eb->and < 0) { |
142 | eb->lut[i] = obj; |
146 | eb->lut[i] = obj; |
143 | } else { |
147 | } else { |
Line 153... | Line 157... | ||
153 | } |
157 | } |
Line 154... | Line 158... | ||
154 | 158 | ||
155 | static struct drm_i915_gem_object * |
159 | static struct drm_i915_gem_object * |
156 | eb_get_object(struct eb_objects *eb, unsigned long handle) |
160 | eb_get_object(struct eb_objects *eb, unsigned long handle) |
- | 161 | { |
|
- | 162 | ||
- | 163 | if(handle == -2) |
|
- | 164 | return get_fb_obj(); |
|
157 | { |
165 | |
158 | if (eb->and < 0) { |
166 | if (eb->and < 0) { |
159 | if (handle >= -eb->and) |
167 | if (handle >= -eb->and) |
160 | return NULL; |
168 | return NULL; |
161 | return eb->lut[handle]; |
169 | return eb->lut[handle]; |
Line 567... | Line 575... | ||
567 | has_fenced_gpu_access && |
575 | has_fenced_gpu_access && |
568 | entry->flags & EXEC_OBJECT_NEEDS_FENCE && |
576 | entry->flags & EXEC_OBJECT_NEEDS_FENCE && |
569 | obj->tiling_mode != I915_TILING_NONE; |
577 | obj->tiling_mode != I915_TILING_NONE; |
570 | need_mappable = need_fence || need_reloc_mappable(obj); |
578 | need_mappable = need_fence || need_reloc_mappable(obj); |
Line -... | Line 579... | ||
- | 579 | ||
- | 580 | WARN_ON((need_mappable || need_fence) && |
|
Line 571... | Line 581... | ||
571 | 581 | !i915_is_ggtt(vm)); |
|
572 | 582 | ||
573 | if ((entry->alignment && |
583 | if ((entry->alignment && |
574 | obj_offset & (entry->alignment - 1)) || |
584 | obj_offset & (entry->alignment - 1)) || |
Line 1097... | Line 1107... | ||
1097 | 1107 | ||
1098 | exec_start = i915_gem_obj_offset(batch_obj, vm) + |
1108 | exec_start = i915_gem_obj_offset(batch_obj, vm) + |
1099 | args->batch_start_offset; |
1109 | args->batch_start_offset; |
1100 | exec_len = args->batch_len; |
1110 | exec_len = args->batch_len; |
- | 1111 | if (cliprects) { |
|
- | 1112 | for (i = 0; i < args->num_cliprects; i++) { |
|
- | 1113 | ret = i915_emit_box(dev, &cliprects[i], |
|
- | 1114 | args->DR1, args->DR4); |
|
- | 1115 | if (ret) |
|
Line -... | Line 1116... | ||
- | 1116 | goto err; |
|
- | 1117 | ||
- | 1118 | ret = ring->dispatch_execbuffer(ring, |
|
- | 1119 | exec_start, exec_len, |
|
- | 1120 | flags); |
|
- | 1121 | if (ret) |
|
1101 | if (cliprects) { |
1122 | goto err; |
1102 | 1123 | } |
|
1103 | } else { |
1124 | } else { |
1104 | ret = ring->dispatch_execbuffer(ring, |
1125 | ret = ring->dispatch_execbuffer(ring, |
1105 | exec_start, exec_len, |
1126 | exec_start, exec_len, |
Line 1121... | Line 1142... | ||
1121 | pre_mutex_err: |
1142 | pre_mutex_err: |
1122 | kfree(cliprects); |
1143 | kfree(cliprects); |
1123 | return ret; |
1144 | return ret; |
1124 | } |
1145 | } |
Line -... | Line 1146... | ||
- | 1146 | ||
- | 1147 | #if 0 |
|
- | 1148 | /* |
|
- | 1149 | * Legacy execbuffer just creates an exec2 list from the original exec object |
|
- | 1150 | * list array and passes it to the real function. |
|
- | 1151 | */ |
|
- | 1152 | int |
|
- | 1153 | i915_gem_execbuffer(struct drm_device *dev, void *data, |
|
- | 1154 | struct drm_file *file) |
|
- | 1155 | { |
|
- | 1156 | struct drm_i915_private *dev_priv = dev->dev_private; |
|
- | 1157 | struct drm_i915_gem_execbuffer *args = data; |
|
- | 1158 | struct drm_i915_gem_execbuffer2 exec2; |
|
- | 1159 | struct drm_i915_gem_exec_object *exec_list = NULL; |
|
- | 1160 | struct drm_i915_gem_exec_object2 *exec2_list = NULL; |
|
- | 1161 | int ret, i; |
|
- | 1162 | ||
- | 1163 | if (args->buffer_count < 1) { |
|
- | 1164 | DRM_DEBUG("execbuf with %d buffers\n", args->buffer_count); |
|
- | 1165 | return -EINVAL; |
|
- | 1166 | } |
|
- | 1167 | ||
- | 1168 | /* Copy in the exec list from userland */ |
|
- | 1169 | exec_list = drm_malloc_ab(sizeof(*exec_list), args->buffer_count); |
|
- | 1170 | exec2_list = drm_malloc_ab(sizeof(*exec2_list), args->buffer_count); |
|
- | 1171 | if (exec_list == NULL || exec2_list == NULL) { |
|
- | 1172 | DRM_DEBUG("Failed to allocate exec list for %d buffers\n", |
|
- | 1173 | args->buffer_count); |
|
- | 1174 | drm_free_large(exec_list); |
|
- | 1175 | drm_free_large(exec2_list); |
|
- | 1176 | return -ENOMEM; |
|
- | 1177 | } |
|
- | 1178 | ret = copy_from_user(exec_list, |
|
- | 1179 | to_user_ptr(args->buffers_ptr), |
|
- | 1180 | sizeof(*exec_list) * args->buffer_count); |
|
- | 1181 | if (ret != 0) { |
|
- | 1182 | DRM_DEBUG("copy %d exec entries failed %d\n", |
|
- | 1183 | args->buffer_count, ret); |
|
- | 1184 | drm_free_large(exec_list); |
|
- | 1185 | drm_free_large(exec2_list); |
|
- | 1186 | return -EFAULT; |
|
- | 1187 | } |
|
- | 1188 | ||
- | 1189 | for (i = 0; i < args->buffer_count; i++) { |
|
- | 1190 | exec2_list[i].handle = exec_list[i].handle; |
|
- | 1191 | exec2_list[i].relocation_count = exec_list[i].relocation_count; |
|
- | 1192 | exec2_list[i].relocs_ptr = exec_list[i].relocs_ptr; |
|
- | 1193 | exec2_list[i].alignment = exec_list[i].alignment; |
|
- | 1194 | exec2_list[i].offset = exec_list[i].offset; |
|
- | 1195 | if (INTEL_INFO(dev)->gen < 4) |
|
- | 1196 | exec2_list[i].flags = EXEC_OBJECT_NEEDS_FENCE; |
|
- | 1197 | else |
|
- | 1198 | exec2_list[i].flags = 0; |
|
- | 1199 | } |
|
- | 1200 | ||
- | 1201 | exec2.buffers_ptr = args->buffers_ptr; |
|
- | 1202 | exec2.buffer_count = args->buffer_count; |
|
- | 1203 | exec2.batch_start_offset = args->batch_start_offset; |
|
- | 1204 | exec2.batch_len = args->batch_len; |
|
- | 1205 | exec2.DR1 = args->DR1; |
|
- | 1206 | exec2.DR4 = args->DR4; |
|
- | 1207 | exec2.num_cliprects = args->num_cliprects; |
|
- | 1208 | exec2.cliprects_ptr = args->cliprects_ptr; |
|
- | 1209 | exec2.flags = I915_EXEC_RENDER; |
|
- | 1210 | i915_execbuffer2_set_context_id(exec2, 0); |
|
- | 1211 | ||
- | 1212 | ret = i915_gem_do_execbuffer(dev, data, file, &exec2, exec2_list, |
|
- | 1213 | &dev_priv->gtt.base); |
|
- | 1214 | if (!ret) { |
|
- | 1215 | /* Copy the new buffer offsets back to the user's exec list. */ |
|
- | 1216 | for (i = 0; i < args->buffer_count; i++) |
|
- | 1217 | exec_list[i].offset = exec2_list[i].offset; |
|
- | 1218 | /* ... and back out to userspace */ |
|
- | 1219 | ret = copy_to_user(to_user_ptr(args->buffers_ptr), |
|
- | 1220 | exec_list, |
|
- | 1221 | sizeof(*exec_list) * args->buffer_count); |
|
- | 1222 | if (ret) { |
|
- | 1223 | ret = -EFAULT; |
|
- | 1224 | DRM_DEBUG("failed to copy %d exec entries " |
|
- | 1225 | "back to user (%d)\n", |
|
- | 1226 | args->buffer_count, ret); |
|
- | 1227 | } |
|
Line -... | Line 1228... | ||
- | 1228 | } |
|
- | 1229 | ||
- | 1230 | drm_free_large(exec_list); |
|
- | 1231 | drm_free_large(exec2_list); |
|
- | 1232 | return ret; |
|
Line 1125... | Line 1233... | ||
1125 | 1233 | } |
|
1126 | 1234 | #endif |
|
1127 | 1235 | ||
1128 | int |
1236 | int |
Line 1173... | Line 1281... | ||
1173 | args->buffer_count, ret); |
1281 | args->buffer_count, ret); |
1174 | } |
1282 | } |
1175 | } |
1283 | } |
Line 1176... | Line 1284... | ||
1176 | 1284 | ||
1177 | kfree(exec2_list); |
- | |
1178 | - | ||
1179 | // LEAVE(); |
- | |
1180 | 1285 | kfree(exec2_list); |
|
1181 | return ret; |
1286 | return ret; |