sync with OpenBSD -current

This commit is contained in:
purplerain 2024-01-18 08:29:14 +00:00
parent ee68147dcd
commit 1cefe29c7e
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
1651 changed files with 283292 additions and 68089 deletions

View file

@ -38,9 +38,7 @@
#include <linux/pci.h>
#include <drm/drm_aperture.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_file.h>
#include <drm/drm_gem.h>
#include <drm/drm_ioctl.h>
@ -115,61 +113,32 @@
#define KMS_DRIVER_MAJOR 2
#define KMS_DRIVER_MINOR 50
#define KMS_DRIVER_PATCHLEVEL 0
int radeon_suspend_kms(struct drm_device *dev, bool suspend,
bool fbcon, bool freeze);
int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int crtc,
unsigned int flags, int *vpos, int *hpos,
ktime_t *stime, ktime_t *etime,
const struct drm_display_mode *mode);
extern bool radeon_is_px(struct drm_device *dev);
int radeon_mode_dumb_mmap(struct drm_file *filp,
struct drm_device *dev,
uint32_t handle, uint64_t *offset_p);
int radeon_mode_dumb_create(struct drm_file *file_priv,
struct drm_device *dev,
struct drm_mode_create_dumb *args);
/* atpx handler */
#if defined(CONFIG_VGA_SWITCHEROO)
void radeon_register_atpx_handler(void);
void radeon_unregister_atpx_handler(void);
bool radeon_has_atpx_dgpu_power_cntl(void);
bool radeon_is_atpx_hybrid(void);
#else
#ifdef notyet
static inline void radeon_register_atpx_handler(void) {}
static inline void radeon_unregister_atpx_handler(void) {}
static inline bool radeon_has_atpx_dgpu_power_cntl(void) { return false; }
static inline bool radeon_is_atpx_hybrid(void) { return false; }
#endif
#endif
int radeon_no_wb;
int radeon_modeset = -1;
int radeon_dynclks = -1;
int radeon_r4xx_atom = 0;
int radeon_r4xx_atom;
int radeon_agpmode = -1;
int radeon_vram_limit = 0;
int radeon_vram_limit;
int radeon_gart_size = -1; /* auto */
int radeon_benchmarking = 0;
int radeon_testing = 0;
int radeon_connector_table = 0;
int radeon_benchmarking;
int radeon_testing;
int radeon_connector_table;
int radeon_tv = 1;
int radeon_audio = -1;
int radeon_disp_priority = 0;
int radeon_hw_i2c = 0;
int radeon_disp_priority;
int radeon_hw_i2c;
int radeon_pcie_gen2 = -1;
int radeon_msi = -1;
int radeon_lockup_timeout = 10000;
int radeon_fastfb = 0;
int radeon_fastfb;
int radeon_dpm = -1;
int radeon_aspm = -1;
int radeon_runtime_pm = -1;
int radeon_hard_reset = 0;
int radeon_hard_reset;
int radeon_vm_size = 8;
int radeon_vm_block_size = -1;
int radeon_deep_color = 0;
int radeon_deep_color;
int radeon_use_pflipirq = 2;
int radeon_bapm = -1;
int radeon_backlight = -1;
@ -346,6 +315,8 @@ static int radeon_pci_probe(struct pci_dev *pdev,
if (ret)
goto err_agp;
radeon_fbdev_setup(dev->dev_private);
return 0;
err_agp:
@ -387,6 +358,7 @@ radeon_pci_shutdown(struct pci_dev *pdev)
static int radeon_pmops_suspend(struct device *dev)
{
struct drm_device *drm_dev = dev_get_drvdata(dev);
return radeon_suspend_kms(drm_dev, true, true, false);
}
@ -407,12 +379,14 @@ static int radeon_pmops_resume(struct device *dev)
static int radeon_pmops_freeze(struct device *dev)
{
struct drm_device *drm_dev = dev_get_drvdata(dev);
return radeon_suspend_kms(drm_dev, false, true, true);
}
static int radeon_pmops_thaw(struct device *dev)
{
struct drm_device *drm_dev = dev_get_drvdata(dev);
return radeon_resume_kms(drm_dev, false, true);
}
@ -497,6 +471,7 @@ long radeon_drm_ioctl(struct file *filp,
struct drm_file *file_priv = filp->private_data;
struct drm_device *dev;
long ret;
dev = file_priv->minor->dev;
ret = pm_runtime_get_sync(dev->dev);
if (ret < 0) {
@ -583,8 +558,6 @@ static const struct drm_ioctl_desc radeon_ioctls_kms[] = {
DRM_IOCTL_DEF_DRV(RADEON_GEM_CREATE, radeon_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(RADEON_GEM_MMAP, radeon_gem_mmap_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(RADEON_GEM_SET_DOMAIN, radeon_gem_set_domain_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(RADEON_GEM_PREAD, radeon_gem_pread_ioctl, DRM_AUTH),
DRM_IOCTL_DEF_DRV(RADEON_GEM_PWRITE, radeon_gem_pwrite_ioctl, DRM_AUTH),
DRM_IOCTL_DEF_DRV(RADEON_GEM_WAIT_IDLE, radeon_gem_wait_idle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(RADEON_CS, radeon_cs_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(RADEON_INFO, radeon_info_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
@ -607,7 +580,6 @@ static const struct drm_driver kms_driver = {
.mmap = drm_gem_mmap,
#endif
.postclose = radeon_driver_postclose_kms,
.lastclose = radeon_driver_lastclose_kms,
#ifdef notyet
.unload = radeon_driver_unload_kms,
#endif
@ -622,12 +594,9 @@ static const struct drm_driver kms_driver = {
.fops = &radeon_driver_kms_fops,
#endif
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
#ifdef notyet
.gem_prime_import_sg_table = radeon_gem_prime_import_sg_table,
#endif
.gem_prime_mmap = drm_gem_prime_mmap,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
@ -685,6 +654,7 @@ static inline bool radeon_has_atpx(void) { return false; }
#endif
#include <drm/drm_drv.h>
#include <drm/drm_fb_helper.h>
#include "vga.h"
#if NVGA > 0
@ -905,7 +875,7 @@ radeondrm_doswitch(void *v)
#else
radeondrm_setpal(rdev, ri);
#endif
drm_fb_helper_restore_fbdev_mode_unlocked((void *)rdev->mode_info.rfbdev);
drm_fb_helper_restore_fbdev_mode_unlocked(rdev->ddev->fb_helper);
if (rdev->switchcb)
(rdev->switchcb)(rdev->switchcbarg, 0, 0);
@ -916,13 +886,13 @@ radeondrm_enter_ddb(void *v, void *cookie)
{
struct rasops_info *ri = v;
struct radeon_device *rdev = ri->ri_hw;
struct drm_fb_helper *fb_helper = (void *)rdev->mode_info.rfbdev;
struct drm_fb_helper *fb_helper = rdev->ddev->fb_helper;
if (cookie == ri->ri_active)
return;
rasops_show_screen(ri, cookie, 0, NULL, NULL);
drm_fb_helper_debug_enter(fb_helper->fbdev);
drm_fb_helper_debug_enter(fb_helper->info);
}
#ifdef __sparc64__
@ -1303,6 +1273,13 @@ radeondrm_attachhook(struct device *self)
task_set(&rdev->switchtask, radeondrm_doswitch, ri);
/*
* in linux via radeon_pci_probe -> drm_get_pci_dev -> drm_dev_register
*/
drm_dev_register(rdev->ddev, rdev->flags);
radeon_fbdev_setup(rdev);
if (ri->ri_bits == NULL)
return;
@ -1351,11 +1328,6 @@ radeondrm_attachhook(struct device *self)
config_found_sm(&rdev->self, &aa, wsemuldisplaydevprint,
wsemuldisplaydevsubmatch);
/*
* in linux via radeon_pci_probe -> drm_get_pci_dev -> drm_dev_register
*/
drm_dev_register(rdev->ddev, rdev->flags);
}
}