mirror of https://gitee.com/openkylin/linux.git
mgag200- Fix hw with broken 'startadd' support (Thomas)
mst- Avoid skipping payloads in payload deletion loop (Wayne) omap- Fix dma_addr refcounting (Tomi) Cc: Wayne Lin <Wayne.Lin@amd.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Thomas Zimmermann <tzimmermann@suse.de> -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEHF6rntfJ3enn8gh8cywAJXLcr3kFAl3oI3gACgkQcywAJXLc r3nPiwf/fIV+EHiCZvnSZfEH9+RTX5LObSf5ngsGNSIspFwTHhJzX5rPOw7as8Vr 4aceiIJ8/T797V6h53+zHbax945kCIl+kLxUTIisM+EaFHVWjrcUeYm2M+z4ZfZh QxMwRuMzPjIIOgRqMzWz7Tr447ypcGG/LmGpTGgjbnybTFJZQp2or3hO5BX+5tpB jtNB6sTbiBpdfAmojGHvIpXIc6/0hj+q4slqO4+UkpQGFQdQ5FhUuIjyCibZ0X0a JNlvGAYSpbANviXNdakLatwlEFBA/kRKZoaNVrpO1oFHvIsU8fAAoagKkfjgbmjf coLv6MoT6rv8uzx0ifhiG12TnHNDWg== =trVZ -----END PGP SIGNATURE----- Merge tag 'drm-misc-next-fixes-2019-12-04' of git://anongit.freedesktop.org/drm/drm-misc into drm-next mgag200- Fix hw with broken 'startadd' support (Thomas) mst- Avoid skipping payloads in payload deletion loop (Wayne) omap- Fix dma_addr refcounting (Tomi) Cc: Wayne Lin <Wayne.Lin@amd.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Dave Airlie <airlied@redhat.com> From: Sean Paul <sean@poorly.run> Link: https://patchwork.freedesktop.org/patch/msgid/20191204212255.GA256395@art_vandelay
This commit is contained in:
commit
b53bd16fec
|
@ -95,6 +95,7 @@ config DRM_KMS_FB_HELPER
|
||||||
|
|
||||||
config DRM_DEBUG_DP_MST_TOPOLOGY_REFS
|
config DRM_DEBUG_DP_MST_TOPOLOGY_REFS
|
||||||
bool "Enable refcount backtrace history in the DP MST helpers"
|
bool "Enable refcount backtrace history in the DP MST helpers"
|
||||||
|
depends on STACKTRACE_SUPPORT
|
||||||
select STACKDEPOT
|
select STACKDEPOT
|
||||||
depends on DRM_KMS_HELPER
|
depends on DRM_KMS_HELPER
|
||||||
depends on DEBUG_KERNEL
|
depends on DEBUG_KERNEL
|
||||||
|
|
|
@ -3176,9 +3176,11 @@ int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr)
|
||||||
drm_dp_mst_topology_put_port(port);
|
drm_dp_mst_topology_put_port(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < mgr->max_payloads; i++) {
|
for (i = 0; i < mgr->max_payloads; /* do nothing */) {
|
||||||
if (mgr->payloads[i].payload_state != DP_PAYLOAD_DELETE_LOCAL)
|
if (mgr->payloads[i].payload_state != DP_PAYLOAD_DELETE_LOCAL) {
|
||||||
|
i++;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
DRM_DEBUG_KMS("removing payload %d\n", i);
|
DRM_DEBUG_KMS("removing payload %d\n", i);
|
||||||
for (j = i; j < mgr->max_payloads - 1; j++) {
|
for (j = i; j < mgr->max_payloads - 1; j++) {
|
||||||
|
|
|
@ -30,6 +30,8 @@ module_param_named(modeset, mgag200_modeset, int, 0400);
|
||||||
static struct drm_driver driver;
|
static struct drm_driver driver;
|
||||||
|
|
||||||
static const struct pci_device_id pciidlist[] = {
|
static const struct pci_device_id pciidlist[] = {
|
||||||
|
{ PCI_VENDOR_ID_MATROX, 0x522, PCI_VENDOR_ID_SUN, 0x4852, 0, 0,
|
||||||
|
G200_SE_A | MGAG200_FLAG_HW_BUG_NO_STARTADD},
|
||||||
{ PCI_VENDOR_ID_MATROX, 0x522, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_SE_A },
|
{ PCI_VENDOR_ID_MATROX, 0x522, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_SE_A },
|
||||||
{ PCI_VENDOR_ID_MATROX, 0x524, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_SE_B },
|
{ PCI_VENDOR_ID_MATROX, 0x524, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_SE_B },
|
||||||
{ PCI_VENDOR_ID_MATROX, 0x530, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_EV },
|
{ PCI_VENDOR_ID_MATROX, 0x530, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_EV },
|
||||||
|
@ -60,6 +62,35 @@ static void mga_pci_remove(struct pci_dev *pdev)
|
||||||
|
|
||||||
DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
|
DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
|
||||||
|
|
||||||
|
static bool mgag200_pin_bo_at_0(const struct mga_device *mdev)
|
||||||
|
{
|
||||||
|
return mdev->flags & MGAG200_FLAG_HW_BUG_NO_STARTADD;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mgag200_driver_dumb_create(struct drm_file *file,
|
||||||
|
struct drm_device *dev,
|
||||||
|
struct drm_mode_create_dumb *args)
|
||||||
|
{
|
||||||
|
struct mga_device *mdev = dev->dev_private;
|
||||||
|
unsigned long pg_align;
|
||||||
|
|
||||||
|
if (WARN_ONCE(!dev->vram_mm, "VRAM MM not initialized"))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
pg_align = 0ul;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Aligning scanout buffers to the size of the video ram forces
|
||||||
|
* placement at offset 0. Works around a bug where HW does not
|
||||||
|
* respect 'startadd' field.
|
||||||
|
*/
|
||||||
|
if (mgag200_pin_bo_at_0(mdev))
|
||||||
|
pg_align = PFN_UP(mdev->mc.vram_size);
|
||||||
|
|
||||||
|
return drm_gem_vram_fill_create_dumb(file, dev, &dev->vram_mm->bdev,
|
||||||
|
pg_align, false, args);
|
||||||
|
}
|
||||||
|
|
||||||
static struct drm_driver driver = {
|
static struct drm_driver driver = {
|
||||||
.driver_features = DRIVER_GEM | DRIVER_MODESET,
|
.driver_features = DRIVER_GEM | DRIVER_MODESET,
|
||||||
.load = mgag200_driver_load,
|
.load = mgag200_driver_load,
|
||||||
|
@ -71,7 +102,10 @@ static struct drm_driver driver = {
|
||||||
.major = DRIVER_MAJOR,
|
.major = DRIVER_MAJOR,
|
||||||
.minor = DRIVER_MINOR,
|
.minor = DRIVER_MINOR,
|
||||||
.patchlevel = DRIVER_PATCHLEVEL,
|
.patchlevel = DRIVER_PATCHLEVEL,
|
||||||
DRM_GEM_VRAM_DRIVER
|
.debugfs_init = drm_vram_mm_debugfs_init,
|
||||||
|
.dumb_create = mgag200_driver_dumb_create,
|
||||||
|
.dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset,
|
||||||
|
.gem_prime_mmap = drm_gem_prime_mmap,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct pci_driver mgag200_pci_driver = {
|
static struct pci_driver mgag200_pci_driver = {
|
||||||
|
|
|
@ -150,6 +150,12 @@ enum mga_type {
|
||||||
G200_EW3,
|
G200_EW3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* HW does not handle 'startadd' field correct. */
|
||||||
|
#define MGAG200_FLAG_HW_BUG_NO_STARTADD (1ul << 8)
|
||||||
|
|
||||||
|
#define MGAG200_TYPE_MASK (0x000000ff)
|
||||||
|
#define MGAG200_FLAG_MASK (0x00ffff00)
|
||||||
|
|
||||||
#define IS_G200_SE(mdev) (mdev->type == G200_SE_A || mdev->type == G200_SE_B)
|
#define IS_G200_SE(mdev) (mdev->type == G200_SE_A || mdev->type == G200_SE_B)
|
||||||
|
|
||||||
struct mga_device {
|
struct mga_device {
|
||||||
|
@ -181,6 +187,18 @@ struct mga_device {
|
||||||
u32 unique_rev_id;
|
u32 unique_rev_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline enum mga_type
|
||||||
|
mgag200_type_from_driver_data(kernel_ulong_t driver_data)
|
||||||
|
{
|
||||||
|
return (enum mga_type)(driver_data & MGAG200_TYPE_MASK);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long
|
||||||
|
mgag200_flags_from_driver_data(kernel_ulong_t driver_data)
|
||||||
|
{
|
||||||
|
return driver_data & MGAG200_FLAG_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
/* mgag200_mode.c */
|
/* mgag200_mode.c */
|
||||||
int mgag200_modeset_init(struct mga_device *mdev);
|
int mgag200_modeset_init(struct mga_device *mdev);
|
||||||
void mgag200_modeset_fini(struct mga_device *mdev);
|
void mgag200_modeset_fini(struct mga_device *mdev);
|
||||||
|
|
|
@ -94,7 +94,8 @@ static int mgag200_device_init(struct drm_device *dev,
|
||||||
struct mga_device *mdev = dev->dev_private;
|
struct mga_device *mdev = dev->dev_private;
|
||||||
int ret, option;
|
int ret, option;
|
||||||
|
|
||||||
mdev->type = flags;
|
mdev->flags = mgag200_flags_from_driver_data(flags);
|
||||||
|
mdev->type = mgag200_type_from_driver_data(flags);
|
||||||
|
|
||||||
/* Hardcode the number of CRTCs to 1 */
|
/* Hardcode the number of CRTCs to 1 */
|
||||||
mdev->num_crtc = 1;
|
mdev->num_crtc = 1;
|
||||||
|
|
|
@ -843,9 +843,13 @@ int omap_gem_pin(struct drm_gem_object *obj, dma_addr_t *dma_addr)
|
||||||
*/
|
*/
|
||||||
static void omap_gem_unpin_locked(struct drm_gem_object *obj)
|
static void omap_gem_unpin_locked(struct drm_gem_object *obj)
|
||||||
{
|
{
|
||||||
|
struct omap_drm_private *priv = obj->dev->dev_private;
|
||||||
struct omap_gem_object *omap_obj = to_omap_bo(obj);
|
struct omap_gem_object *omap_obj = to_omap_bo(obj);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (omap_gem_is_contiguous(omap_obj) || !priv->has_dmm)
|
||||||
|
return;
|
||||||
|
|
||||||
if (refcount_dec_and_test(&omap_obj->dma_addr_cnt)) {
|
if (refcount_dec_and_test(&omap_obj->dma_addr_cnt)) {
|
||||||
ret = tiler_unpin(omap_obj->block);
|
ret = tiler_unpin(omap_obj->block);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
Loading…
Reference in New Issue