Rev 2175 | Rev 3120 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2175 | Rev 2997 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | 31 | ||
Line 32... | Line 32... | ||
32 | rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
32 | rdev = (struct radeon_device *)rdisplay->ddev->dev_private; |
Line 33... | Line 33... | ||
33 | 33 | ||
34 | r = radeon_bo_create(rdev, CURSOR_WIDTH*CURSOR_HEIGHT*4, |
34 | r = radeon_bo_create(rdev, CURSOR_WIDTH*CURSOR_HEIGHT*4, |
Line 35... | Line 35... | ||
35 | PAGE_SIZE, false, RADEON_GEM_DOMAIN_VRAM, &cursor->robj); |
35 | PAGE_SIZE, false, RADEON_GEM_DOMAIN_VRAM, NULL, &cursor->robj); |
36 | 36 | ||
Line 37... | Line 37... | ||
37 | if (unlikely(r != 0)) |
37 | if (unlikely(r != 0)) |
Line 292... | Line 292... | ||
292 | kfree(info); |
292 | kfree(info); |
293 | }><>><>>>><>><>><>><>><>><>><>><>>>>> |
293 | } |
294 | 294 | ||
Line -... | Line 295... | ||
- | 295 | ||
- | 296 | /* 23 bits of float fractional data */ |
|
- | 297 | #define I2F_FRAC_BITS 23 |
|
- | 298 | #define I2F_MASK ((1 << I2F_FRAC_BITS) - 1) |
|
- | 299 | ||
- | 300 | /* |
|
- | 301 | * Converts unsigned integer into 32-bit IEEE floating point representation. |
|
- | 302 | * Will be exact from 0 to 2^24. Above that, we round towards zero |
|
- | 303 | * as the fractional bits will not fit in a float. (It would be better to |
|
- | 304 | * round towards even as the fpu does, but that is slower.) |
|
- | 305 | */ |
|
- | 306 | __pure uint32_t int2float(uint32_t x) |
|
- | 307 | { |
|
- | 308 | uint32_t msb, exponent, fraction; |
|
- | 309 | ||
- | 310 | /* Zero is special */ |
|
- | 311 | if (!x) return 0; |
|
- | 312 | ||
- | 313 | /* Get location of the most significant bit */ |
|
- | 314 | msb = __fls(x); |
|
- | 315 | ||
- | 316 | /* |
|
- | 317 | * Use a rotate instead of a shift because that works both leftwards |
|
- | 318 | * and rightwards due to the mod(32) behaviour. This means we don't |
|
- | 319 | * need to check to see if we are above 2^24 or not. |
|
- | 320 | */ |
|
- | 321 | fraction = ror32(x, (msb - I2F_FRAC_BITS) & 0x1f) & I2F_MASK; |
|
- | 322 | exponent = (127 + msb) << I2F_FRAC_BITS; |
|
- | 323 | ||
- | 324 | return fraction + exponent; |
|
- | 325 | }><>><>><>><>>>><>><>><>><>><>><>><>><>>>>> |