Add new controller for RGB Fusion 2 Blackwell GPUs

This commit is contained in:
Paulo 2025-04-21 19:16:34 +00:00 committed by Adam Honse
parent 4e5fd41be7
commit 9e6a2eb94c
6 changed files with 506 additions and 0 deletions

View file

@ -0,0 +1,100 @@
/*---------------------------------------------------------*\
| GigabyteRGBFusion2BlackwellGPUController.cpp |
| |
| Driver for Gigabyte RGB Fusion 2 Blackwell GPU |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#include <chrono>
#include <thread>
#include "GigabyteRGBFusion2BlackwellGPUController.h"
#include "GigabyteRGBFusion2BlackwellGPUDefinitions.h"
#include "LogManager.h"
using namespace std::chrono_literals;
RGBFusion2BlackwellGPUController::RGBFusion2BlackwellGPUController(i2c_smbus_interface* bus, rgb_fusion_dev_id dev)
{
this->bus = bus;
this->dev = dev;
}
RGBFusion2BlackwellGPUController::~RGBFusion2BlackwellGPUController()
{
}
std::string RGBFusion2BlackwellGPUController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
return_string.append(addr);
return("I2C: " + return_string);
}
void RGBFusion2BlackwellGPUController::SaveConfig()
{
uint8_t data_pkt[64] = { 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
bus->i2c_write_block(dev, sizeof(data_pkt), data_pkt);
}
void RGBFusion2BlackwellGPUController::SetMode(uint8_t zone, uint8_t mode, fusion2_config zone_config, uint8_t mystery_flag)
{
if (zone < RGB_FUSION_2_BLACKWELL_GPU_NUMBER_OF_ZONES)
{
this->zone_color[zone] = zone_config.colors[0];
}
uint8_t zone_pkt[64] = {RGB_FUSION2_BLACKWELL_GPU_REG_COLOR, mystery_flag, mode, zone_config.speed, zone_config.brightness, RGBGetRValue(this->zone_color[zone]), RGBGetGValue(this->zone_color[zone]), RGBGetBValue(this->zone_color[zone]), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
bus->i2c_write_block(dev, sizeof(zone_pkt), zone_pkt);
}
void RGBFusion2BlackwellGPUController::SetZone(uint8_t zone, uint8_t mode, fusion2_config zone_config)
{
std::string mode_name;
uint8_t mystery_flag = 0x01;
switch(mode)
{
case RGB_FUSION2_BLACKWELL_GPU_MODE_STATIC:
{
SetMode(zone, mode, zone_config, mystery_flag);
}
break;
case RGB_FUSION2_BLACKWELL_GPU_MODE_BREATHING:
{
zone_config.brightness = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX;
SetMode(zone, mode, zone_config, mystery_flag);
}
break;
case RGB_FUSION2_BLACKWELL_GPU_MODE_FLASHING:
{
SetMode(zone, mode, zone_config, mystery_flag);
}
break;
case RGB_FUSION2_BLACKWELL_GPU_MODE_DUAL_FLASHING:
{
SetMode(zone, mode, zone_config, mystery_flag);
}
break;
case RGB_FUSION2_BLACKWELL_GPU_MODE_COLOR_CYCLE:
{
SetMode(zone, mode, zone_config, mystery_flag);
}
break;
default:
{
LOG_TRACE("[%s] Mode %02d not found", "fusion2 blackwell gpu", mode);
}
break;
}
}

View file

@ -0,0 +1,74 @@
/*---------------------------------------------------------*\
| GigabyteRGBFusion2BlackwellGPUController.h |
| |
| Driver for Gigabyte RGB Fusion 2 Blackwell GPU |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#pragma once
#include <string>
#include "i2c_smbus.h"
#include "RGBController.h"
#include "GigabyteRGBFusion2BlackwellGPUDefinitions.h"
typedef unsigned char rgb_fusion_dev_id;
struct fusion2_config
{
uint8_t brightness;
RGBColor colors[8];
uint8_t numberOfColors;
uint8_t speed;
uint8_t direction;
};
enum
{
RGB_FUSION2_BLACKWELL_GPU_REG_COLOR = 0x12,
RGB_FUSION2_BLACKWELL_GPU_REG_MODE = 0x16 // Used for 'Intelligent' mode
};
enum
{
RGB_FUSION2_BLACKWELL_GPU_MODE_STATIC = 0x01,
RGB_FUSION2_BLACKWELL_GPU_MODE_BREATHING = 0x02,
RGB_FUSION2_BLACKWELL_GPU_MODE_FLASHING = 0x03,
RGB_FUSION2_BLACKWELL_GPU_MODE_DUAL_FLASHING = 0x04,
RGB_FUSION2_BLACKWELL_GPU_MODE_COLOR_CYCLE = 0x05
};
enum
{
RGB_FUSION2_BLACKWELL_GPU_SPEED_SLOWEST = 0x01,
RGB_FUSION2_BLACKWELL_GPU_SPEED_NORMAL = 0x03,
RGB_FUSION2_BLACKWELL_GPU_SPEED_FASTEST = 0x06
};
enum
{
RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MIN = 0x01,
RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX = 0x0A
};
class RGBFusion2BlackwellGPUController
{
public:
RGBFusion2BlackwellGPUController(i2c_smbus_interface* bus, rgb_fusion_dev_id dev);
~RGBFusion2BlackwellGPUController();
RGBColor zone_color[RGB_FUSION_2_BLACKWELL_GPU_NUMBER_OF_ZONES];
std::string GetDeviceLocation();
void SaveConfig();
void SetZone(uint8_t zone, uint8_t mode, fusion2_config zone_config);
void SetMode(uint8_t zone, uint8_t mode, fusion2_config zone_config, uint8_t mystery_flag);
private:
i2c_smbus_interface* bus;
rgb_fusion_dev_id dev;
};

View file

@ -0,0 +1,100 @@
/*---------------------------------------------------------*\
| GigabyteRGBFusion2BlackwellGPUControllerDetect.cpp |
| |
| Detector for Gigabyte RGB Fusion 2 Blackwell GPU |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#include <stdio.h>
#include "Detector.h"
#include "GigabyteRGBFusion2BlackwellGPUController.h"
#include "LogManager.h"
#include "RGBController_GigabyteRGBFusion2BlackwellGPU.h"
#include "i2c_smbus.h"
#include "pci_ids.h"
#define GIGABYTEGPU_CONTROLLER_NAME3 "Gigabyte RGB Fusion2 Blackwell GPU"
/******************************************************************************************\
* *
* TestForGigabyteRGBFusion2BlackwellGPUController *
* *
* Tests the given address to see if an RGB Fusion2 controller exists there. First *
* does a quick write to test for a response *
* *
\******************************************************************************************/
bool TestForGigabyteRGBFusion2BlackwellGPUController(i2c_smbus_interface* bus, unsigned char address)
{
bool pass = false;
int res, pktsz;
const int read_sz = 4;
const int write_sz = 64; //0x40
uint8_t data_pkt[write_sz] = { 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint8_t data_readpkt[read_sz] = {};
res = bus->i2c_write_block(address, write_sz, data_pkt);
pass = true;
pktsz = read_sz;
res = bus->i2c_read_block(address, &pktsz, data_readpkt);
//What we have seen returned so far...
//GeForce RTX 5070 Ti EAGLE OC 16G 0x01 0x01 0x01 0x00
if(res < 0 || data_readpkt[0] != 0x01 || data_readpkt[1] != 0x01 || data_readpkt[2] != 0x01)
{
// Assemble C-string with respons for debugging
std::string text = "";
for(int idx = 0; idx < read_sz; ++idx)
{
char str[6];
snprintf(str, 6, " 0x%02X", data_readpkt[idx]);
text.append(str);
}
LOG_DEBUG("[%s] at address 0x%02X invalid. Expected 0x01 0x01 0x01 [0x*] but received:%s", GIGABYTEGPU_CONTROLLER_NAME3, address, text.c_str());
pass = false;
}
return(pass);
} /* TestForRGBFusion2BlackwellGPUController() */
/*******************************************************************************************\
* *
* DetectRGBFusion2BlackwellGPUControllers *
* *
* Detect GigabyteRGB Fusion2 controllers on the enumerated I2C busses. *
* *
* bus - pointer to i2c_smbus_interface where RGB Fusion2 device is connected *
* dev - I2C address of RGB Fusion2 device *
* *
\*******************************************************************************************/
void DetectGigabyteRGBFusion2BlackwellGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const std::string& name)
{
// Check for RGB Fusion2 controller
if(TestForGigabyteRGBFusion2BlackwellGPUController(bus, i2c_addr))
{
RGBFusion2BlackwellGPUController* controller = new RGBFusion2BlackwellGPUController(bus, i2c_addr);
RGBController_RGBFusion2BlackwellGPU* rgb_controller = new RGBController_RGBFusion2BlackwellGPU(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}
} /* DetectGigabyteRGBFusion2BlackwellGPUControllers() */
/*-----------------------------------------*\
| Nvidia GPUs |
\*-----------------------------------------*/
REGISTER_I2C_PCI_DETECTOR("Gigabyte GeForce RTX 5070 Ti Eagle OC", DetectGigabyteRGBFusion2BlackwellGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070TI_DEV, GIGABYTE_SUB_VEN, GIGABYTE_RTX5070TI_EAGLE_OC_16G_SUB_DEV, 0x75);
/*-----------------------------------------*\
| AMD GPUs |
\*-----------------------------------------*/

View file

@ -0,0 +1,12 @@
/*---------------------------------------------------------*\
| GigabyteRGBFusion2BlackwellGPUDefinitions.h |
| |
| Definitions for Gigabyte RGB Fusion 2 Blackwell GPU |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#pragma once
#define RGB_FUSION_2_BLACKWELL_GPU_NUMBER_OF_ZONES 1

View file

@ -0,0 +1,186 @@
/*---------------------------------------------------------*\
| RGBController_GigabyteRGBFusion2BlackwellGPU.cpp |
| |
| RGBController for Gigabyte RGB Fusion 2 Blackwell GPU |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#include "RGBController_GigabyteRGBFusion2BlackwellGPU.h"
#include "LogManager.h"
#include "GigabyteRGBFusion2BlackwellGPUDefinitions.h"
/**------------------------------------------------------------------*\
@name Gigabyte Fusion 2 Blackwell GPU
@category GPU
@type I2C
@save :white_check_mark:
@direct :white_check_mark:
@effects :white_check_mark:
@detectors DetectGigabyteRGBFusion2BlackwellGPUControllers
@comment
\*-------------------------------------------------------------------*/
RGBController_RGBFusion2BlackwellGPU::RGBController_RGBFusion2BlackwellGPU(RGBFusion2BlackwellGPUController* controller_ptr)
{
controller = controller_ptr;
name = "Gigabyte GPU";
vendor = "Gigabyte";
description = "Gigabyte RGB Fusion 2 Blackwell GPU";
location = controller->GetDeviceLocation();
type = DEVICE_TYPE_GPU;
mode Direct;
Direct.name = "Direct";
Direct.value = RGB_FUSION2_BLACKWELL_GPU_MODE_STATIC;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
Direct.color_mode = MODE_COLORS_PER_LED;
Direct.brightness_min = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MIN;
Direct.brightness_max = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX;
Direct.brightness = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX;
modes.push_back(Direct);
mode Breathing;
Breathing.name = "Pulse";
Breathing.value = RGB_FUSION2_BLACKWELL_GPU_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_MANUAL_SAVE;
Breathing.speed_min = RGB_FUSION2_BLACKWELL_GPU_SPEED_SLOWEST;
Breathing.speed_max = RGB_FUSION2_BLACKWELL_GPU_SPEED_FASTEST;
Breathing.speed = RGB_FUSION2_BLACKWELL_GPU_SPEED_NORMAL;
Breathing.color_mode = MODE_COLORS_PER_LED;
Breathing.brightness_min = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MIN;
Breathing.brightness_max = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX;
Breathing.brightness = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX;
modes.push_back(Breathing);
mode Flashing;
Flashing.name = "Flash";
Flashing.value = RGB_FUSION2_BLACKWELL_GPU_MODE_FLASHING;
Flashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
Flashing.speed_min = RGB_FUSION2_BLACKWELL_GPU_SPEED_SLOWEST;
Flashing.speed_max = RGB_FUSION2_BLACKWELL_GPU_SPEED_FASTEST;
Flashing.speed = RGB_FUSION2_BLACKWELL_GPU_SPEED_NORMAL;
Flashing.color_mode = MODE_COLORS_PER_LED;
Flashing.brightness_min = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MIN;
Flashing.brightness_max = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX;
Flashing.brightness = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX;
modes.push_back(Flashing);
mode DualFlashing;
DualFlashing.name = "Double Flash";
DualFlashing.value = RGB_FUSION2_BLACKWELL_GPU_MODE_DUAL_FLASHING;
DualFlashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_MANUAL_SAVE;
DualFlashing.speed_min = RGB_FUSION2_BLACKWELL_GPU_SPEED_SLOWEST;
DualFlashing.speed_max = RGB_FUSION2_BLACKWELL_GPU_SPEED_FASTEST;
DualFlashing.speed = RGB_FUSION2_BLACKWELL_GPU_SPEED_NORMAL;
DualFlashing.color_mode = MODE_COLORS_PER_LED;
DualFlashing.brightness_min = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MIN;
DualFlashing.brightness_max = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX;
DualFlashing.brightness = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX;
modes.push_back(DualFlashing);
mode SpectrumCycle;
SpectrumCycle.name = "Color Cycle";
SpectrumCycle.value = RGB_FUSION2_BLACKWELL_GPU_MODE_COLOR_CYCLE;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
SpectrumCycle.speed_min = RGB_FUSION2_BLACKWELL_GPU_SPEED_SLOWEST;
SpectrumCycle.speed_max = RGB_FUSION2_BLACKWELL_GPU_SPEED_FASTEST;
SpectrumCycle.speed = RGB_FUSION2_BLACKWELL_GPU_SPEED_NORMAL;
SpectrumCycle.color_mode = MODE_COLORS_NONE;
SpectrumCycle.brightness_min = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MIN;
SpectrumCycle.brightness_max = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX;
SpectrumCycle.brightness = RGB_FUSION2_BLACKWELL_GPU_BRIGHTNESS_MAX;
modes.push_back(SpectrumCycle);
SetupZones();
}
RGBController_RGBFusion2BlackwellGPU::~RGBController_RGBFusion2BlackwellGPU()
{
delete controller;
}
void RGBController_RGBFusion2BlackwellGPU::SetupZones()
{
/*---------------------------------------------------------*\
| This device only allows setting the entire zone for all |
| LED's in the zone and does not allow per LED control. |
\*---------------------------------------------------------*/
for(uint8_t zone_idx = 0; zone_idx < RGB_FUSION_2_BLACKWELL_GPU_NUMBER_OF_ZONES; zone_idx++)
{
zone new_zone;
led new_led;
new_zone.name = "GPU zone " + std::to_string(zone_idx + 1);
new_zone.type = ZONE_TYPE_SINGLE;
new_zone.leds_min = 1;
new_zone.leds_max = 1;
new_zone.leds_count = 1;
new_zone.matrix_map = NULL;
new_led.name = new_zone.name;
/*---------------------------------------------------------*\
| Push the zone and LED on to device vectors |
\*---------------------------------------------------------*/
leds.push_back(new_led);
zones.push_back(new_zone);
}
SetupColors();
}
void RGBController_RGBFusion2BlackwellGPU::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RGBFusion2BlackwellGPU::DeviceUpdateLEDs()
{
fusion2_config zone_config;
zone_config.brightness = modes[active_mode].brightness;
zone_config.speed = modes[active_mode].speed;
zone_config.direction = modes[active_mode].direction;
zone_config.numberOfColors = (uint8_t)modes[active_mode].colors.size();
for(uint8_t zone_idx = 0; zone_idx < RGB_FUSION_2_BLACKWELL_GPU_NUMBER_OF_ZONES; zone_idx++)
{
zone_config.colors[0] = colors[zone_idx];
if (modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
{
for (uint8_t i = 0; i < zone_config.numberOfColors; i++)
{
zone_config.colors[i] = modes[active_mode].colors[i];
}
}
controller->SetZone(zone_idx, modes[active_mode].value, zone_config);
}
}
void RGBController_RGBFusion2BlackwellGPU::UpdateZoneLEDs(int zone)
{
DeviceUpdateLEDs();
}
void RGBController_RGBFusion2BlackwellGPU::UpdateSingleLED(int led)
{
DeviceUpdateLEDs();
}
void RGBController_RGBFusion2BlackwellGPU::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}
void RGBController_RGBFusion2BlackwellGPU::DeviceSaveMode()
{
controller->SaveConfig();
}

View file

@ -0,0 +1,34 @@
/*---------------------------------------------------------*\
| RGBController_GigabyteRGBFusion2BlackwellGPU.h |
| |
| RGBController for Gigabyte RGB Fusion 2 Blackwell GPU |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-only |
\*---------------------------------------------------------*/
#pragma once
#include "RGBController.h"
#include "GigabyteRGBFusion2BlackwellGPUController.h"
class RGBController_RGBFusion2BlackwellGPU : public RGBController
{
public:
RGBController_RGBFusion2BlackwellGPU(RGBFusion2BlackwellGPUController* controller_ptr);
~RGBController_RGBFusion2BlackwellGPU();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateMode();
void DeviceSaveMode();
private:
RGBFusion2BlackwellGPUController* controller;
};