mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
drm/vc4: Use the TPZ scaling filter for 1x1 source images
The documentation says that the TPZ filter can not upscale, and requesting a scaling factor > 1:1 will output the original image in the top left, and repeat the right/bottom most pixels thereafter. That fits perfectly with upscaling a 1x1 image which is done a fair amount by some compositors to give solid colour, and it saves a large amount of LBM (TPZ is based on src size, whilst PPF is based on dest size). Select TPZ filter for images with source rectangle <=1. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This commit is contained in:
committed by
Dom Cobley
parent
1d4fa8faee
commit
d88345b308
@@ -265,7 +265,11 @@ static enum vc4_scaling_mode vc4_get_scaling_mode(u32 src, u32 dst)
|
||||
{
|
||||
if (dst == src >> 16)
|
||||
return VC4_SCALING_NONE;
|
||||
if (3 * dst >= 2 * (src >> 16))
|
||||
|
||||
if (src <= (1 << 16))
|
||||
/* Source rectangle <= 1 pixel can use TPZ for resize/upscale */
|
||||
return VC4_SCALING_TPZ;
|
||||
else if (3 * dst >= 2 * (src >> 16))
|
||||
return VC4_SCALING_PPF;
|
||||
else
|
||||
return VC4_SCALING_TPZ;
|
||||
@@ -574,12 +578,17 @@ static void vc4_write_tpz(struct vc4_plane_state *vc4_state, u32 src, u32 dst)
|
||||
|
||||
WARN_ON_ONCE(vc4->gen > VC4_GEN_6_D);
|
||||
|
||||
scale = src / dst;
|
||||
if ((dst << 16) < src) {
|
||||
scale = src / dst;
|
||||
|
||||
/* The specs note that while the reciprocal would be defined
|
||||
* as (1<<32)/scale, ~0 is close enough.
|
||||
*/
|
||||
recip = ~0 / scale;
|
||||
/* The specs note that while the reciprocal would be defined
|
||||
* as (1<<32)/scale, ~0 is close enough.
|
||||
*/
|
||||
recip = ~0 / scale;
|
||||
} else {
|
||||
scale = (1 << 16) + 1;
|
||||
recip = (1 << 16) - 1;
|
||||
}
|
||||
|
||||
vc4_dlist_write(vc4_state,
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user