aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorPekka Paalanen <pq@iki.fi>2009-08-16 18:18:38 -0400
committerDave Airlie <airlied@linux.ie>2009-08-19 02:07:00 -0400
commita0724fcf829e5afb66159ef68cb16a805ea11b42 (patch)
treef407795b0b6e38b8cbdf141de4135810c6a5ceab /include/drm
parent949ef70e2d1a5c12178875f513df34fc85d91a38 (diff)
drm/ttm: optimize bo_kmap_type values
A micro-optimization on the function ttm_kmap_obj_virtual(). By defining the values of enum ttm_bo_kmap_obj::bo_kmap_type to have a bit indicating iomem, size of the function ttm_kmap_obj_virtual() will be reduced by 16 bytes on x86_64 (gcc 4.1.2). ttm_kmap_obj_virtual() may be heavily used, when buffer objects are accessed via wrappers, that work for both kinds of memory addresses: iomem cookies and kernel virtual. Signed-off-by: Pekka Paalanen <pq@iki.fi> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/ttm/ttm_bo_api.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index cd22ab4b495c..99dc521aa1a9 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -245,14 +245,15 @@ struct ttm_buffer_object {
245 * premapped region. 245 * premapped region.
246 */ 246 */
247 247
248#define TTM_BO_MAP_IOMEM_MASK 0x80
248struct ttm_bo_kmap_obj { 249struct ttm_bo_kmap_obj {
249 void *virtual; 250 void *virtual;
250 struct page *page; 251 struct page *page;
251 enum { 252 enum {
252 ttm_bo_map_iomap, 253 ttm_bo_map_iomap = 1 | TTM_BO_MAP_IOMEM_MASK,
253 ttm_bo_map_vmap, 254 ttm_bo_map_vmap = 2,
254 ttm_bo_map_kmap, 255 ttm_bo_map_kmap = 3,
255 ttm_bo_map_premapped, 256 ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK,
256 } bo_kmap_type; 257 } bo_kmap_type;
257}; 258};
258 259
@@ -522,8 +523,7 @@ extern int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type);
522static inline void *ttm_kmap_obj_virtual(struct ttm_bo_kmap_obj *map, 523static inline void *ttm_kmap_obj_virtual(struct ttm_bo_kmap_obj *map,
523 bool *is_iomem) 524 bool *is_iomem)
524{ 525{
525 *is_iomem = (map->bo_kmap_type == ttm_bo_map_iomap || 526 *is_iomem = !!(map->bo_kmap_type & TTM_BO_MAP_IOMEM_MASK);
526 map->bo_kmap_type == ttm_bo_map_premapped);
527 return map->virtual; 527 return map->virtual;
528} 528}
529 529