Skip to content

Commit 624e005

Browse files
committed
KMSDRM: Allow setting scaling sharpness with env var
By setting SDL_VIDEO_KMSDRM_SCALING_SHARPNESS to an integer value before flipping the buffers, it is now possible to control the sharpness of the scaling. 0: nearest-neighbour 1: bilinear filtering 2-32: bicubic filtering. If not provided, the default value is 8. Signed-off-by: Paul Cercueil <paul@crapouillou.net>
1 parent d92108d commit 624e005

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/video/kmsdrm/SDL_kmsdrmvideo.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,14 @@ static int KMSDRM_SetCrtcParams(_THIS, drmModeAtomicReqPtr req, Uint32 plane_id,
324324
Uint32 crtc_id, int width, int height,
325325
int mode_width, int mode_height, int bpp)
326326
{
327-
unsigned int crtc_w, crtc_h, scaling_mode = this->hidden->scaling_mode;
327+
unsigned int crtc_w, crtc_h, scaling_mode = this->hidden->scaling_mode, sharpness = 8;
328328
const char *env_mode = getenv("SDL_VIDEO_KMSDRM_SCALING_MODE");
329+
const char *env_sharpness = getenv("SDL_VIDEO_KMSDRM_SCALING_SHARPNESS");
329330

330331
if (env_mode)
331332
scaling_mode = atoi(env_mode);
333+
if (env_sharpness)
334+
sharpness = atoi(env_sharpness);
332335

333336
switch (scaling_mode) {
334337
case DRM_SCALING_MODE_ASPECT_RATIO:
@@ -362,6 +365,9 @@ static int KMSDRM_SetCrtcParams(_THIS, drmModeAtomicReqPtr req, Uint32 plane_id,
362365
return 1;
363366
}
364367

368+
if (!add_property(this, req, plane_id, "sharpness", 1, sharpness))
369+
return 1;
370+
365371
if (!add_property(this, req, plane_id, "CRTC_X", 0, (mode_width - crtc_w) / 2))
366372
return 1;
367373

0 commit comments

Comments
 (0)