Showing posts from April, 2021

setting a custom video mode using DRM/KMS in Linux (tested on raspberry pi 4)

Whether by design or by oversight, it turns out the kms/drm driver architecture used in linux to set the current video mode allows easy selection of custom modes as well. You just stuff the values you want into the mode structure returned by getConnector, and then tell drm to use that mode. Because this is close to the metal you can't just say height, width, and refresh, but need to specify the full timing info like you would using xorg's modelines. In fact, here's some code that takes a xorg compliant modeline and stuffs it into the proper fields of the mode structure. 

drmModeConnector *connector = getConnector(resources);
   connectorId = connector->connector_id;

    // choose a mode (resolution + refresh rate)

    mode_info = connector->modes[modenum]; // array of resolutions and refresh rates supported by this display
    mode = &mode_info;

  if (argc == 3)
    mode->type = DRM_MODE_TYPE_USERDEF;

     char flags[5][16] = {0,0,0,0,0};;
   float fclock;
// example: 13.514 720 739 801 858 480 488 494 525 -hsync -vsync interlace dblclk
    sscanf(argv[1], "%f %hd %hd %hd %hd %hd %hd %hd %hd %15s %15s %15s %15s",
   &mode->vtotal, flags[0], flags[1], flags[2], flags[3], flags[4]);
    mode->clock = fclock * 1000;

         mode->flags = 0;

for (int f = 0; f < 4; f++)  // this could use the array that's used to dump the flags
if (strcasecmp(flags[f], "+hsync") == 0)
                mode->flags |= DRM_MODE_FLAG_PHSYNC;
        if (strcasecmp(flags[f], "-hsync") == 0)
                mode->flags |= DRM_MODE_FLAG_NHSYNC;

        if (strcasecmp(flags[f], "+vsync") == 0)
                mode->flags |= DRM_MODE_FLAG_PVSYNC;
        if (strcasecmp(flags[f], "-vsync") == 0)
                mode->flags |= DRM_MODE_FLAG_NVSYNC;

        if (strcasecmp(flags[f], "interlace") == 0)
                mode->flags |= DRM_MODE_FLAG_INTERLACE;

if (strcasecmp(flags[f], "dblclk") == 0)
                mode->flags |= DRM_MODE_FLAG_DBLCLK;

  mode->vrefresh = .49 + drm_mode_vrefresh(mode); // looks like this is just for display, since it's an integer it's notused for any real display calculations
snprintf(mode->name, sizeof(mode->name),"%dx%d%c", 
mode->hdisplay, mode->vdisplay,
    (mode->flags & DRM_MODE_FLAG_INTERLACE ? 'i':0)); 

SANYO DP50749 Plasma TV: input lag and upscaling review tested using the piLagTesterPRO

This 720p Plasma TV from 2010 has a nice picture but very high lag, and extremely variable lag. It used to retail for about $1500. 

Overview/Image quality

This is a plasma TV, which generally means at least the following: nearly infinite viewing angles and jaw dropping weight. Both are true in this case as well. The 50" model weights 84lbs. 

1x1 pixel checkerboard at 720p
The TV can be set to only crop a little: 0 pixels off the top/bottom, and only about 5 pixels off the side. This is true for all modes: 480, 720, and 1080.  Sadly, even when set this way there's still noticeable aliasing. In 720p, a checkerboard with 1x1 pixel squares shows very bad aliasing. Honestly, with more natural stimuli it doesn't look so bad, BUT:  There's really no excuse for aliasing on a plasma TV: you know the panel was designed specifically to be a TV. Why not hit 720p exactly?  

Aliasing was less bad in other resolutions. 

As for 480p/i, with 50" to play with they could have at least offered a zoomed out mode with black borders and 1:1 pixel mapping. But no such luck. 

Burn in is a common concern on plasma TVs but I saw absolutely no evidence of it on this set, so I'm guessing SANYO solved that problem. You do see the image occasionally shift a little up/down/left/right which is presumably to prevent burn in. 

It has all the standard inputs, including 3 HDMI, VGA, and 2 yPbPr.  

Measuring Input Lag

This display does have a game "mode". But it does not change the lag any, so I guess it's just for marketing (maybe it changes the color balance or something). In fact I toggled all quality settings and none changed the lag. 

I used a piLagTesterPRO to measure input lag. This device sends a frame of video over HDMI and measures how long it takes to display it. I measure at the top and bottom of the screen, but as it turns out these produce the same results: the entire frame updates at the nearly same moment, top to bottom. Complicating things significantly, this TV is yet another display that does not actually sync to the input signal - instead it fills its own internal frame buffer from the video input and then draws that with an arbitrary extra delay. To give an example, input lag for 720p varies between 78 and 93ms each time your turn on the set (or change inputs).

Because lag varies over time, I've elected to report the average lag values here, since that seems fairest, but there's no right answer; for more discussion of this issue see the above link.  

Full Input Lag Results 

I report two kinds of values. 1st response measures how long it takes for the TV to start responding (I use a 5% change in display brightness). This overly optimistic value doesn't tell how long it takes to see anything useful, but matches what other reviewers call input lag. full response is a more realistic measure of lag, and requires the display to reach 80% of full brightness. This combines both input lag and response time, and is closer to what you would actually experience in a game.

Resolution1st (average)full response1st responsefull responsescan out

This TV updates every pixel nearly simultaneously, from top to bottom, with at most 1ms more lag at the bottom - but due to the drifting lag it's hard to tell, it could be truly simultaneous. That's one the neat things about plasma displays, and why you really need to compare lag at the bottom of the screen to see how a plasma compares to a traditional LCD. The response time is also very low, around 7ms. 

Unfortunately, all that unique plasma tech can't make up for the fact that the set has a very long lag before it starts drawing at all - 41ms in the fast mode (native resolution 1366x768). So this isn't a good gamer set, unless you just play RPGs and the like. 

It gets progressively slower as you get further away from native resolution, suggesting that upscaling/downscaling makes a significant impact on the speed of this set. Even 720p, which is what this TV is sold as being for, is slower than than the actual native resolution, by a fairly significant 22ms! Of the standard TV resolutions, it's actually fastest downscaling from 1080p, by a small margin. 

It's also particularly bad for 480i content. While the other modes have variable lag of up to 16ms, 480i has variable lag up to 32ms! To put it another way, each time you turn on your tv/console you'll see lag somewhere between 81 and 109ms.  Truly awful.

Results compared to other displays

To allow quick comparison between many displays I've summarized the results across all the displays I've personally tested with the piLagTester Pro. Min lag is the first response at the top of the screen, real lag is the full response at the bottom. The min lag value is really unfair to this set, because it ignores the instantaneous update of the whole screen. I'm sorting here by how long it takes to finish drawing, eg, the true lag. For this TV I'm using it's performance at 1080p, since that's the fastest TV mode it supports, and I doubt anybody would use it for a computer monitor. 

DisplayYear made (TV?)Native Resnative min lagnative real lag480i real lag480p real lag720p real lag1080p real lagnative response timenative scan out
Dell E198FPb20081024p2.720.439.035.05.0012.70
Vizio VO370M20101080p2.523.683.
Dell U2410 (game)20101080p4.
TCL 40S32520211080p6.527.360.629.027.927.76.0014.83
AOC/Envision G19LWK2010900p3.131.239.538.738.437.815.5012.60
Dell E2211H20141080p3.033.634.734.534.133.815.0015.57
Panasonic TH-58PE75U2008720p28.
Dell 1907FPc20081024p3.034.035.934.815.0016.00
Corprit D157 (hdmi)20211080p3.134.534.934.834.633.916.2515.13
Samsung S27C23020141080p2.936.136.636.137.018.2514.97
Vizio E470VL (vga)20111080p22.
Dell U2410 (sRGB)20101080p20.542.862.445.
ACER AT326520121080p19.543.862.745.343.843.88.0016.27
RCA L40FHD4120101080p20.346.665.
Sony 40VL130 (game)20081080p22.847.366.349.047.347.39.0815.43
Polaroid FLM-373B2007720p28.
Philips 42PFL3603D/F720091080p29.
Emprex HD 32022007720p27.050.5126.
LG 42LC2D2006720p28.350.654.650.850.46.3015.95
GPX TDE3245W2016720p28.051.0102.
Sony KDL-46EX40020101080p28.
Toshiba 40L2200U20141080p30.
Vizio VO22L FHDTV10A2008720p28.
Vizio VX20L HDTV2007720p28.
Sharp LC-C3234U2009720p33.064.683.666.664.615.0016.60
Toshiba 46L5200U20131080p55.
Sony 40S20L12007720p48.472.090.172.973.49.6014.00
Samsung LN46C63020121080p54.572.190.790.388.572.310.007.63
SANYO DP507492010720p67.075.0103.
Samsung HP-T425420111080p69.775.794.
LG 47LW6500-UA20121080p66.680.7149.7149.081.780.92.2711.83
Vizio E470VL (hdmi)20111080p69.086.0128.

It's interesting to consider that one of the top performing TV on this list is also a plasma TV (Panasonic TH-58PE75U) and meanwhile this one is near the bottom. So don't get obsessed with the tech; pay attention to the empirical measurements instead!


These days there are a lot of cheap plasma TVs on the used market. But all plasma's are not the same. This one in particular is to be avoided. I don't have any other SANYO LCDs to compare against, but it's not a good sign that a $1500 TV of theirs performed so poorly, so I'd avoid other sets from that era as well unless there are published lag numbers. Although, if this was really made by LG (see below) then who knows how representative this is of other models).

Other models  

I only tested the DP50749.The mainboard for this TV also works in several other models so I suspect they would perform similarly: SANYO DP50719 and SANYO DP50740. Going further, it seems this may have been made by LG (again, overlapping motherboards) and sold under several other names: 50PQ20-UA AUSALHR , 50PQ30-UA AUSLLHR , 50PQ3000-ZA BEKLLJP , 50PQ30C-UA AUSLLHR, and 50PQ6000-ZA BEKLLJP. And also as an ELEMENT ELPCFT501. Again, no input lag warranty expressed or implied on that. I only tested the DP50749.

Email me


Email *

Message *