diff options
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/ati_pcigart.c | 85 | ||||
-rw-r--r-- | linux-core/drmP.h | 3 | ||||
-rw-r--r-- | linux-core/radeon_buffer.c | 7 |
3 files changed, 94 insertions, 1 deletions
diff --git a/linux-core/ati_pcigart.c b/linux-core/ati_pcigart.c index bb30dd74..f3f91129 100644 --- a/linux-core/ati_pcigart.c +++ b/linux-core/ati_pcigart.c @@ -228,3 +228,88 @@ int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info) return ret; } EXPORT_SYMBOL(drm_ati_pcigart_init); + +static int ati_pcigart_needs_unbind_cache_adjust(drm_ttm_backend_t *backend) +{ + return ((backend->flags & DRM_BE_FLAG_BOUND_CACHED) ? 0 : 1); +} + +static int ati_pcigart_populate(drm_ttm_backend_t *backend, + unsigned long num_pages, + struct page **pages) +{ + ati_pcigart_ttm_priv *atipci_priv = (ati_pcigart_ttm_priv *)backend->private; + + return -1; +} + +static int ati_pcigart_bind_ttm(drm_ttm_backend_t *backend, + unsigned long offset, + int cached) +{ + ati_pcigart_ttm_priv *atipci_priv = (ati_pcigart_ttm_priv *)backend->private; + + return -1; +} + +static int ati_pcigart_unbind_ttm(drm_ttm_backend_t *backend) +{ + ati_pcigart_ttm_priv *atipci_priv = (ati_pcigart_ttm_priv *)backend->private; + + return -1; +} + +static void ati_pcigart_clear_ttm(drm_ttm_backend_t *backend) +{ + ati_pcigart_ttm_priv *atipci_priv = (ati_pcigart_ttm_priv *)backend->private; +} + +static void ati_pcigart_destroy_ttm(drm_ttm_backend_t *backend) +{ + ati_pcigart_ttm_priv *atipci_priv; + + if (backend) { + DRM_DEBUG("\n"); + atipci_priv = (ati_pcigart_ttm_priv *)backend->private; + if (atipci_priv) { + drm_ctl_free(atipci_priv, sizeof(*atipci_priv), DRM_MEM_MAPPINGS); + backend->private = NULL; + } + if (backend->flags & DRM_BE_FLAG_NEEDS_FREE) { + drm_ctl_free(backend, sizeof(*backend), DRM_MEM_MAPPINGS); + } + } +} + + +drm_ttm_backend_t *ati_pcigart_init_ttm(struct drm_device *dev, + drm_ttm_backend_t *backend) +{ + drm_ttm_backend_t *atipci_be; + ati_pcigart_ttm_priv *atipci_priv; + + atipci_be = (backend != NULL) ? backend : + drm_ctl_calloc(1, sizeof (*atipci_be), DRM_MEM_MAPPINGS); + + if (!atipci_be) + return NULL; + + atipci_priv = drm_ctl_calloc(1, sizeof(*atipci_priv), DRM_MEM_MAPPINGS); + if (!atipci_priv) { + drm_ctl_free(atipci_be, sizeof(*atipci_be), DRM_MEM_MAPPINGS); + return NULL; + } + + atipci_priv->populated = FALSE; + atipci_be->needs_ub_cache_adjust = ati_pcigart_needs_unbind_cache_adjust; + atipci_be->populate = ati_pcigart_populate; + atipci_be->clear = ati_pcigart_clear_ttm; + atipci_be->bind = ati_pcigart_bind_ttm; + atipci_be->unbind = ati_pcigart_unbind_ttm; + atipci_be->destroy = ati_pcigart_destroy_ttm; + + DRM_FLAG_MASKED(atipci_be->flags, (backend == NULL) ? DRM_BE_FLAG_NEEDS_FREE : 0, DRM_BE_FLAG_NEEDS_FREE); + atipci_be->drm_map_type = _DRM_SCATTER_GATHER; + return atipci_be; +} +EXPORT_SYMBOL(ati_pcigart_init_ttm); diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 648e29bc..b6da6926 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -840,6 +840,9 @@ typedef struct drm_agp_ttm_priv { } drm_agp_ttm_priv; #endif +typedef struct ati_pcigart_ttm_priv { + int populated; +} ati_pcigart_ttm_priv; static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature) diff --git a/linux-core/radeon_buffer.c b/linux-core/radeon_buffer.c index b525ddfa..d5a1456a 100644 --- a/linux-core/radeon_buffer.c +++ b/linux-core/radeon_buffer.c @@ -36,7 +36,12 @@ drm_ttm_backend_t *radeon_create_ttm_backend_entry(drm_device_t * dev) { - return drm_agp_init_ttm(dev, NULL); + drm_radeon_private_t *dev_priv = dev->dev_private; + + if(dev_priv->flags & RADEON_IS_AGP) + return drm_agp_init_ttm(dev, NULL); + else + return ati_pcigart_init_ttm(dev, NULL); } int radeon_fence_types(drm_buffer_object_t *bo, uint32_t * class, uint32_t * type) |