mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
KMSDRM: Add gamma support
This commit is contained in:
parent
72f7a10cef
commit
d2d834b990
@ -59,6 +59,10 @@ SDL_KMSDRM_SYM(drmModeCrtcPtr,drmModeGetCrtc,(int fd, uint32_t crtcId))
|
||||
SDL_KMSDRM_SYM(int,drmModeSetCrtc,(int fd, uint32_t crtcId, uint32_t bufferId,
|
||||
uint32_t x, uint32_t y, uint32_t *connectors, int count,
|
||||
drmModeModeInfoPtr mode))
|
||||
SDL_KMSDRM_SYM(int,drmModeCrtcGetGamma,(int fd, uint32_t crtc_id, uint32_t size,
|
||||
uint16_t *red, uint16_t *green, uint16_t *blue))
|
||||
SDL_KMSDRM_SYM(int,drmModeCrtcSetGamma,(int fd, uint32_t crtc_id, uint32_t size,
|
||||
uint16_t *red, uint16_t *green, uint16_t *blue))
|
||||
SDL_KMSDRM_SYM(int,drmModeSetCursor,(int fd, uint32_t crtcId, uint32_t bo_handle,
|
||||
uint32_t width, uint32_t height))
|
||||
SDL_KMSDRM_SYM(int,drmModeSetCursor2,(int fd, uint32_t crtcId, uint32_t bo_handle,
|
||||
|
@ -243,6 +243,8 @@ KMSDRM_CreateDevice(int devindex)
|
||||
device->SetWindowPosition = KMSDRM_SetWindowPosition;
|
||||
device->SetWindowSize = KMSDRM_SetWindowSize;
|
||||
device->SetWindowFullscreen = KMSDRM_SetWindowFullscreen;
|
||||
device->GetWindowGammaRamp = KMSDRM_GetWindowGammaRamp;
|
||||
device->SetWindowGammaRamp = KMSDRM_SetWindowGammaRamp;
|
||||
device->ShowWindow = KMSDRM_ShowWindow;
|
||||
device->HideWindow = KMSDRM_HideWindow;
|
||||
device->RaiseWindow = KMSDRM_RaiseWindow;
|
||||
@ -1348,6 +1350,34 @@ KMSDRM_ReconfigureWindow( _THIS, SDL_Window * window) {
|
||||
windata->surface_w, windata->surface_h);
|
||||
}
|
||||
|
||||
int
|
||||
KMSDRM_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp)
|
||||
{
|
||||
SDL_WindowData *windata = (SDL_WindowData*)window->driverdata;
|
||||
SDL_VideoData *viddata = (SDL_VideoData*)windata->viddata;
|
||||
SDL_VideoDisplay *disp = SDL_GetDisplayForWindow(window);
|
||||
SDL_DisplayData* dispdata = (SDL_DisplayData*)disp->driverdata;
|
||||
if (KMSDRM_drmModeCrtcGetGamma(viddata->drm_fd, dispdata->crtc->crtc_id, 256, &ramp[0*256], &ramp[1*256], &ramp[2*256]) == -1)
|
||||
{
|
||||
return SDL_SetError("Failed to get gamma ramp");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
KMSDRM_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
|
||||
{
|
||||
SDL_WindowData *windata = (SDL_WindowData*)window->driverdata;
|
||||
SDL_VideoData *viddata = (SDL_VideoData*)windata->viddata;
|
||||
SDL_VideoDisplay *disp = SDL_GetDisplayForWindow(window);
|
||||
SDL_DisplayData* dispdata = (SDL_DisplayData*)disp->driverdata;
|
||||
if (KMSDRM_drmModeCrtcSetGamma(viddata->drm_fd, dispdata->crtc->crtc_id, 256, &ramp[0*256], &ramp[1*256], &ramp[2*256]) == -1)
|
||||
{
|
||||
return SDL_SetError("Failed to set gamma ramp");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
KMSDRM_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
|
||||
{
|
||||
|
@ -133,6 +133,8 @@ void KMSDRM_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
|
||||
void KMSDRM_SetWindowPosition(_THIS, SDL_Window * window);
|
||||
void KMSDRM_SetWindowSize(_THIS, SDL_Window * window);
|
||||
void KMSDRM_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen);
|
||||
int KMSDRM_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp);
|
||||
int KMSDRM_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp);
|
||||
void KMSDRM_ShowWindow(_THIS, SDL_Window * window);
|
||||
void KMSDRM_HideWindow(_THIS, SDL_Window * window);
|
||||
void KMSDRM_RaiseWindow(_THIS, SDL_Window * window);
|
||||
|
Loading…
Reference in New Issue
Block a user