mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: drm/radeon/kms: rs600: use correct mask for SW interrupt gpu/drm/radeon/radeon_irq.c: move a dereference below a NULL test drm/radeon/radeon_device.c: move a dereference below a NULL test drm/radeon/radeon_fence.c: move a dereference below the NULL test drm/radeon/radeon_connectors.c: add a NULL test before dereference drm/radeon/kms: fix memory leak drm/kms: Fix &&/|| confusion in drm_fb_helper_connector_parse_command_line() drm/edid: Fix CVT width/height decode drm/edid: Skip empty CVT codepoints drm: remove address mask param for drm_pci_alloc() drm/radeon/kms: add missing breaks in i2c and ss lookups drm/radeon/kms: add primary dac adj values table drm/radeon/kms: fallback to default connector table
This commit is contained in:
commit
2c1f1895ef
17 changed files with 87 additions and 44 deletions
|
@ -39,8 +39,7 @@ static int drm_ati_alloc_pcigart_table(struct drm_device *dev,
|
|||
struct drm_ati_pcigart_info *gart_info)
|
||||
{
|
||||
gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size,
|
||||
PAGE_SIZE,
|
||||
gart_info->table_mask);
|
||||
PAGE_SIZE);
|
||||
if (gart_info->table_handle == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -112,6 +111,13 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
|
|||
if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
|
||||
DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n");
|
||||
|
||||
if (pci_set_dma_mask(dev->pdev, gart_info->table_mask)) {
|
||||
DRM_ERROR("fail to set dma mask to 0x%Lx\n",
|
||||
gart_info->table_mask);
|
||||
ret = 1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = drm_ati_alloc_pcigart_table(dev, gart_info);
|
||||
if (ret) {
|
||||
DRM_ERROR("cannot allocate PCI GART page!\n");
|
||||
|
|
|
@ -326,7 +326,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
|
|||
* As we're limiting the address to 2^32-1 (or less),
|
||||
* casting it down to 32 bits is no problem, but we
|
||||
* need to point to a 64bit variable first. */
|
||||
dmah = drm_pci_alloc(dev, map->size, map->size, 0xffffffffUL);
|
||||
dmah = drm_pci_alloc(dev, map->size, map->size);
|
||||
if (!dmah) {
|
||||
kfree(map);
|
||||
return -ENOMEM;
|
||||
|
@ -885,7 +885,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
|
|||
|
||||
while (entry->buf_count < count) {
|
||||
|
||||
dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000, 0xfffffffful);
|
||||
dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000);
|
||||
|
||||
if (!dmah) {
|
||||
/* Set count correctly so we free the proper amount. */
|
||||
|
|
|
@ -911,23 +911,27 @@ static int drm_cvt_modes(struct drm_connector *connector,
|
|||
struct drm_device *dev = connector->dev;
|
||||
struct cvt_timing *cvt;
|
||||
const int rates[] = { 60, 85, 75, 60, 50 };
|
||||
const u8 empty[3] = { 0, 0, 0 };
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
int uninitialized_var(width), height;
|
||||
cvt = &(timing->data.other_data.data.cvt[i]);
|
||||
|
||||
height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 8) + 1) * 2;
|
||||
switch (cvt->code[1] & 0xc0) {
|
||||
if (!memcmp(cvt->code, empty, 3))
|
||||
continue;
|
||||
|
||||
height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 4) + 1) * 2;
|
||||
switch (cvt->code[1] & 0x0c) {
|
||||
case 0x00:
|
||||
width = height * 4 / 3;
|
||||
break;
|
||||
case 0x40:
|
||||
case 0x04:
|
||||
width = height * 16 / 9;
|
||||
break;
|
||||
case 0x80:
|
||||
case 0x08:
|
||||
width = height * 16 / 10;
|
||||
break;
|
||||
case 0xc0:
|
||||
case 0x0c:
|
||||
width = height * 15 / 9;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ static bool drm_fb_helper_connector_parse_command_line(struct drm_connector *con
|
|||
force = DRM_FORCE_ON;
|
||||
break;
|
||||
case 'D':
|
||||
if ((connector->connector_type != DRM_MODE_CONNECTOR_DVII) ||
|
||||
if ((connector->connector_type != DRM_MODE_CONNECTOR_DVII) &&
|
||||
(connector->connector_type != DRM_MODE_CONNECTOR_HDMIB))
|
||||
force = DRM_FORCE_ON;
|
||||
else
|
||||
|
|
|
@ -47,8 +47,7 @@
|
|||
/**
|
||||
* \brief Allocate a PCI consistent memory block, for DMA.
|
||||
*/
|
||||
drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align,
|
||||
dma_addr_t maxaddr)
|
||||
drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align)
|
||||
{
|
||||
drm_dma_handle_t *dmah;
|
||||
#if 1
|
||||
|
@ -63,11 +62,6 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali
|
|||
if (align > size)
|
||||
return NULL;
|
||||
|
||||
if (pci_set_dma_mask(dev->pdev, maxaddr) != 0) {
|
||||
DRM_ERROR("Setting pci dma mask failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL);
|
||||
if (!dmah)
|
||||
return NULL;
|
||||
|
|
|
@ -123,7 +123,7 @@ static int i915_init_phys_hws(struct drm_device *dev)
|
|||
drm_i915_private_t *dev_priv = dev->dev_private;
|
||||
/* Program Hardware Status Page */
|
||||
dev_priv->status_page_dmah =
|
||||
drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff);
|
||||
drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE);
|
||||
|
||||
if (!dev_priv->status_page_dmah) {
|
||||
DRM_ERROR("Can not allocate hardware status page\n");
|
||||
|
|
|
@ -4839,7 +4839,7 @@ int i915_gem_init_phys_object(struct drm_device *dev,
|
|||
|
||||
phys_obj->id = id;
|
||||
|
||||
phys_obj->handle = drm_pci_alloc(dev, size, 0, 0xffffffff);
|
||||
phys_obj->handle = drm_pci_alloc(dev, size, 0);
|
||||
if (!phys_obj->handle) {
|
||||
ret = -ENOMEM;
|
||||
goto kfree_obj;
|
||||
|
|
|
@ -114,6 +114,7 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev
|
|||
i2c.i2c_id = gpio->sucI2cId.ucAccess;
|
||||
|
||||
i2c.valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1026,6 +1027,7 @@ static struct radeon_atom_ss *radeon_atombios_get_ss_info(struct
|
|||
ss->delay = ss_info->asSS_Info[i].ucSS_Delay;
|
||||
ss->range = ss_info->asSS_Info[i].ucSS_Range;
|
||||
ss->refdiv = ss_info->asSS_Info[i].ucRecommendedRef_Div;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -595,6 +595,34 @@ bool radeon_combios_get_clock_info(struct drm_device *dev)
|
|||
return false;
|
||||
}
|
||||
|
||||
static const uint32_t default_primarydac_adj[CHIP_LAST] = {
|
||||
0x00000808, /* r100 */
|
||||
0x00000808, /* rv100 */
|
||||
0x00000808, /* rs100 */
|
||||
0x00000808, /* rv200 */
|
||||
0x00000808, /* rs200 */
|
||||
0x00000808, /* r200 */
|
||||
0x00000808, /* rv250 */
|
||||
0x00000000, /* rs300 */
|
||||
0x00000808, /* rv280 */
|
||||
0x00000808, /* r300 */
|
||||
0x00000808, /* r350 */
|
||||
0x00000808, /* rv350 */
|
||||
0x00000808, /* rv380 */
|
||||
0x00000808, /* r420 */
|
||||
0x00000808, /* r423 */
|
||||
0x00000808, /* rv410 */
|
||||
0x00000000, /* rs400 */
|
||||
0x00000000, /* rs480 */
|
||||
};
|
||||
|
||||
static void radeon_legacy_get_primary_dac_info_from_table(struct radeon_device *rdev,
|
||||
struct radeon_encoder_primary_dac *p_dac)
|
||||
{
|
||||
p_dac->ps2_pdac_adj = default_primarydac_adj[rdev->family];
|
||||
return;
|
||||
}
|
||||
|
||||
struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
|
||||
radeon_encoder
|
||||
*encoder)
|
||||
|
@ -604,20 +632,20 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
|
|||
uint16_t dac_info;
|
||||
uint8_t rev, bg, dac;
|
||||
struct radeon_encoder_primary_dac *p_dac = NULL;
|
||||
int found = 0;
|
||||
|
||||
p_dac = kzalloc(sizeof(struct radeon_encoder_primary_dac),
|
||||
GFP_KERNEL);
|
||||
|
||||
if (!p_dac)
|
||||
return NULL;
|
||||
|
||||
if (rdev->bios == NULL)
|
||||
return NULL;
|
||||
goto out;
|
||||
|
||||
/* check CRT table */
|
||||
dac_info = combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE);
|
||||
if (dac_info) {
|
||||
p_dac =
|
||||
kzalloc(sizeof(struct radeon_encoder_primary_dac),
|
||||
GFP_KERNEL);
|
||||
|
||||
if (!p_dac)
|
||||
return NULL;
|
||||
|
||||
rev = RBIOS8(dac_info) & 0x3;
|
||||
if (rev < 2) {
|
||||
bg = RBIOS8(dac_info + 0x2) & 0xf;
|
||||
|
@ -628,9 +656,13 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
|
|||
dac = RBIOS8(dac_info + 0x3) & 0xf;
|
||||
p_dac->ps2_pdac_adj = (bg << 8) | (dac);
|
||||
}
|
||||
|
||||
found = 1;
|
||||
}
|
||||
|
||||
out:
|
||||
if (!found) /* fallback to defaults */
|
||||
radeon_legacy_get_primary_dac_info_from_table(rdev, p_dac);
|
||||
|
||||
return p_dac;
|
||||
}
|
||||
|
||||
|
|
|
@ -615,7 +615,7 @@ static enum drm_connector_status radeon_vga_detect(struct drm_connector *connect
|
|||
ret = connector_status_connected;
|
||||
}
|
||||
} else {
|
||||
if (radeon_connector->dac_load_detect) {
|
||||
if (radeon_connector->dac_load_detect && encoder) {
|
||||
encoder_funcs = encoder->helper_private;
|
||||
ret = encoder_funcs->detect(encoder, connector);
|
||||
}
|
||||
|
|
|
@ -2145,6 +2145,7 @@ int radeon_master_create(struct drm_device *dev, struct drm_master *master)
|
|||
&master_priv->sarea);
|
||||
if (ret) {
|
||||
DRM_ERROR("SAREA setup failed\n");
|
||||
kfree(master_priv);
|
||||
return ret;
|
||||
}
|
||||
master_priv->sarea_priv = master_priv->sarea->handle + sizeof(struct drm_sarea);
|
||||
|
|
|
@ -733,16 +733,18 @@ void radeon_device_fini(struct radeon_device *rdev)
|
|||
*/
|
||||
int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
|
||||
{
|
||||
struct radeon_device *rdev = dev->dev_private;
|
||||
struct radeon_device *rdev;
|
||||
struct drm_crtc *crtc;
|
||||
int r;
|
||||
|
||||
if (dev == NULL || rdev == NULL) {
|
||||
if (dev == NULL || dev->dev_private == NULL) {
|
||||
return -ENODEV;
|
||||
}
|
||||
if (state.event == PM_EVENT_PRETHAW) {
|
||||
return 0;
|
||||
}
|
||||
rdev = dev->dev_private;
|
||||
|
||||
/* unpin the front buffers */
|
||||
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
|
||||
struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb);
|
||||
|
|
|
@ -329,8 +329,11 @@ static bool radeon_setup_enc_conn(struct drm_device *dev)
|
|||
ret = radeon_get_atom_connector_info_from_object_table(dev);
|
||||
else
|
||||
ret = radeon_get_atom_connector_info_from_supported_devices_table(dev);
|
||||
} else
|
||||
} else {
|
||||
ret = radeon_get_legacy_connector_info_from_bios(dev);
|
||||
if (ret == false)
|
||||
ret = radeon_get_legacy_connector_info_from_table(dev);
|
||||
}
|
||||
} else {
|
||||
if (!ASIC_IS_AVIVO(rdev))
|
||||
ret = radeon_get_legacy_connector_info_from_table(dev);
|
||||
|
|
|
@ -140,16 +140,15 @@ int radeon_fence_create(struct radeon_device *rdev, struct radeon_fence **fence)
|
|||
|
||||
bool radeon_fence_signaled(struct radeon_fence *fence)
|
||||
{
|
||||
struct radeon_device *rdev = fence->rdev;
|
||||
unsigned long irq_flags;
|
||||
bool signaled = false;
|
||||
|
||||
if (rdev->gpu_lockup) {
|
||||
if (!fence)
|
||||
return true;
|
||||
}
|
||||
if (fence == NULL) {
|
||||
|
||||
if (fence->rdev->gpu_lockup)
|
||||
return true;
|
||||
}
|
||||
|
||||
write_lock_irqsave(&fence->rdev->fence_drv.lock, irq_flags);
|
||||
signaled = fence->signaled;
|
||||
/* if we are shuting down report all fence as signaled */
|
||||
|
|
|
@ -289,16 +289,16 @@ int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_pr
|
|||
drm_radeon_irq_emit_t *emit = data;
|
||||
int result;
|
||||
|
||||
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||
return -EINVAL;
|
||||
|
||||
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
||||
|
||||
if (!dev_priv) {
|
||||
DRM_ERROR("called with no initialization\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||
return -EINVAL;
|
||||
|
||||
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
||||
|
||||
result = radeon_emit_irq(dev);
|
||||
|
||||
if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) {
|
||||
|
|
|
@ -396,7 +396,7 @@ int rs600_irq_process(struct radeon_device *rdev)
|
|||
}
|
||||
while (status || r500_disp_int) {
|
||||
/* SW interrupt */
|
||||
if (G_000040_SW_INT_EN(status))
|
||||
if (G_000044_SW_INT(status))
|
||||
radeon_fence_process(rdev);
|
||||
/* Vertical blank interrupts */
|
||||
if (G_007EDC_LB_D1_VBLANK_INTERRUPT(r500_disp_int))
|
||||
|
|
|
@ -1408,7 +1408,7 @@ extern int drm_ati_pcigart_cleanup(struct drm_device *dev,
|
|||
struct drm_ati_pcigart_info * gart_info);
|
||||
|
||||
extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
|
||||
size_t align, dma_addr_t maxaddr);
|
||||
size_t align);
|
||||
extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
|
||||
extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
|
||||
|
||||
|
|
Loading…
Reference in a new issue