amdgpu: fix PCI enable/IRQ stubs, SETPLANE error, CRTC_ID property

- Fix redox_pci_enable_device to track enabled state instead of noop.
  redox_pci_set_master now logs bus master enable.

- Fix redox_request_irq to return the IRQ fd instead of open+close.
  redox_free_irq now accepts fd via dev_id and actually closes it.

- SETPLANE now returns EOPNOTSUPP instead of silently succeeding,
  with warning about DC dependency.

- OBJ_SETPROPERTY now accepts CRTC_ID (property 30) as a noop
  (connector routing is managed by SETCRTC).
This commit is contained in:
2026-06-01 07:20:42 +03:00
parent ff8a0e35ca
commit 9044ca8e61
3 changed files with 34 additions and 6 deletions
+27 -5
View File
@@ -289,12 +289,27 @@ void redox_pci_dev_put(struct pci_dev *pdev)
int redox_pci_enable_device(struct pci_dev *pdev)
{
return pdev ? 0 : -ENODEV;
if (!pdev) {
return -ENODEV;
}
if (pdev->enabled) {
return 0;
}
pdev->enabled = true;
printk("PCI device %02x:%02x.%u enabled (memory/IO access via Redox pcid)\n",
pdev->bus_number, pdev->dev_number, pdev->func_number);
return 0;
}
void redox_pci_set_master(struct pci_dev *pdev)
{
(void)pdev;
if (!pdev) {
return;
}
printk("PCI device %02x:%02x.%u set as bus master\n",
pdev->bus_number, pdev->dev_number, pdev->func_number);
}
int redox_pci_request_regions(struct pci_dev *pdev, const char *name)
@@ -460,17 +475,24 @@ int redox_request_irq(unsigned int irq, irq_handler_t handler, unsigned long fla
snprintf(path, sizeof(path), "/scheme/irq/%u", irq);
fd = open(path, O_RDWR);
if (fd < 0) {
pr_err("redox_request_irq: failed to open %s (errno=%d)\n", path, errno);
return -ENOENT;
}
close(fd);
return 0;
printk("redox_request_irq: opened IRQ %u fd=%d\n", irq, fd);
return fd;
}
void redox_free_irq(unsigned int irq, void *dev_id)
{
int fd = (int)(intptr_t)dev_id;
(void)irq;
(void)dev_id;
if (fd > 0) {
close(fd);
printk("redox_free_irq: closed IRQ fd=%d\n", fd);
}
}
void msleep(unsigned int msecs)
@@ -720,10 +720,15 @@ impl GpuDriver for AmdDriver {
}
fn set_property(&self, obj_id: u32, prop_id: u32, value: u64) -> Result<()> {
const CONN_PROP_CRTC_ID: u32 = 30;
const CONN_PROP_DPMS: u32 = 31;
const DRM_MODE_DPMS_ON: i32 = 0;
const DRM_MODE_DPMS_OFF: i32 = 3;
if prop_id == CONN_PROP_CRTC_ID {
return Ok(());
}
if prop_id == CONN_PROP_DPMS {
let crtc_id = {
let connectors = self.connectors.lock().map_err(|_| {
@@ -1700,7 +1700,8 @@ impl DrmScheme {
DRM_IOCTL_MODE_SETPLANE => {
let _req = decode_wire::<DrmSetPlaneWire>(payload)?;
Vec::new()
warn!("redox-drm: SETPLANE not implemented (hardware overlay/cursor planes require DC)");
return Err(Error::new(EOPNOTSUPP));
}
DRM_IOCTL_MODE_ADDFB => {