42,6 → 42,7 |
#include <drm_mm.h> |
#include "radeon_object.h" |
|
|
struct fb_info *framebuffer_alloc(size_t size, void *dev); |
|
struct radeon_fb_device { |
103,7 → 104,7 |
} |
EXPORT_SYMBOL(radeonfb_resize); |
|
static int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tiled) |
int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tiled) |
{ |
int aligned = width; |
int align_large = (ASIC_IS_AVIVO(rdev)) || tiled; |
436,106 → 437,6 |
#undef BYTES_PER_LONG |
} |
|
static char *manufacturer_name(unsigned char *x) |
{ |
static char name[4]; |
|
name[0] = ((x[0] & 0x7C) >> 2) + '@'; |
name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@'; |
name[2] = (x[1] & 0x1F) + '@'; |
name[3] = 0; |
|
return name; |
} |
|
void set_crtc(struct drm_crtc *crtc); |
|
bool set_mode(struct drm_device *dev, int width, int height) |
{ |
struct drm_connector *connector; |
|
bool ret = false; |
|
ENTER(); |
|
list_for_each_entry(connector, &dev->mode_config.connector_list, head) |
{ |
struct drm_display_mode *mode; |
|
struct drm_encoder *encoder; |
struct drm_crtc *crtc; |
|
if( connector->status != connector_status_connected) |
continue; |
|
encoder = connector->encoder; |
if( encoder == NULL) |
continue; |
|
crtc = encoder->crtc; |
|
if(crtc == NULL) |
continue; |
|
list_for_each_entry(mode, &connector->modes, head) |
{ |
char *con_name, *enc_name; |
|
struct drm_framebuffer *fb; |
|
if (drm_mode_width(mode) == width && |
drm_mode_height(mode) == height) |
{ |
char con_edid[128]; |
|
fb = list_first_entry(&dev->mode_config.fb_kernel_list, |
struct drm_framebuffer, filp_head); |
|
memcpy(con_edid, connector->edid_blob_ptr->data, 128); |
|
dbgprintf("Manufacturer: %s Model %x Serial Number %u\n", |
manufacturer_name(con_edid + 0x08), |
(unsigned short)(con_edid[0x0A] + (con_edid[0x0B] << 8)), |
(unsigned int)(con_edid[0x0C] + (con_edid[0x0D] << 8) |
+ (con_edid[0x0E] << 16) + (con_edid[0x0F] << 24))); |
|
|
con_name = drm_get_connector_name(connector); |
enc_name = drm_get_encoder_name(encoder); |
|
dbgprintf("set mode %d %d connector %s encoder %s\n", |
width, height, con_name, enc_name); |
|
fb->width = width; |
fb->height = height; |
fb->pitch = radeon_align_pitch(dev->dev_private, width, 32, false) * ((32 + 1) / 8); |
|
crtc->fb = fb; |
crtc->enabled = true; |
set_crtc(crtc); |
|
ret = drm_crtc_helper_set_mode(crtc, mode, 0, 0, fb); |
|
sysSetScreen(fb->width, fb->height, fb->pitch); |
|
if (ret == true) |
{ |
dbgprintf("new mode %d %d pitch %d\n",fb->width, fb->height, fb->pitch); |
} |
else |
{ |
DRM_ERROR("failed to set mode %d_%d on crtc %p\n", |
fb->width, fb->height, crtc); |
}; |
|
LEAVE(); |
|
return ret; |
}; |
} |
}; |
LEAVE(); |
return ret; |
}; |
|
|