mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
drm/mgag200: Set scale from DRM format
Replace the deprecated cpp value from struct drm_format_info with the format's 4CC code when setting the scale value in CRTCEXT3. While at it, remove the scale variable and add a mask constant. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patch.msgid.link/20260415152625.101710-3-tzimmermann@suse.de
This commit is contained in:
parent
44f352a2f4
commit
8d5ffd34c1
|
|
@ -343,24 +343,31 @@ static void mgag200_set_offset(struct mga_device *mdev,
|
|||
|
||||
void mgag200_set_format_regs(struct mga_device *mdev, const struct drm_format_info *format)
|
||||
{
|
||||
unsigned int bpp, bppshift, scale;
|
||||
u8 xmulctrl = 0;
|
||||
u8 crtcext3;
|
||||
|
||||
bpp = format->cpp[0] * 8;
|
||||
RREG_ECRT(3, crtcext3);
|
||||
|
||||
bppshift = mgag200_get_bpp_shift(format);
|
||||
switch (bpp) {
|
||||
case 24:
|
||||
scale = ((1 << bppshift) * 3) - 1;
|
||||
switch (format->format) {
|
||||
case DRM_FORMAT_C8:
|
||||
crtcext3 &= ~MGAREG_CRTCEXT3_SCALE_MASK;
|
||||
crtcext3 |= 0x0;
|
||||
break;
|
||||
default:
|
||||
scale = (1 << bppshift) - 1;
|
||||
case DRM_FORMAT_XRGB1555:
|
||||
case DRM_FORMAT_RGB565:
|
||||
crtcext3 &= ~MGAREG_CRTCEXT3_SCALE_MASK;
|
||||
crtcext3 |= 0x01;
|
||||
break;
|
||||
case DRM_FORMAT_RGB888:
|
||||
crtcext3 &= ~MGAREG_CRTCEXT3_SCALE_MASK;
|
||||
crtcext3 |= 0x02;
|
||||
break;
|
||||
case DRM_FORMAT_XRGB8888:
|
||||
crtcext3 &= ~MGAREG_CRTCEXT3_SCALE_MASK;
|
||||
crtcext3 |= 0x03;
|
||||
break;
|
||||
}
|
||||
|
||||
RREG_ECRT(3, crtcext3);
|
||||
|
||||
switch (format->format) {
|
||||
case DRM_FORMAT_C8:
|
||||
xmulctrl = MGA1064_MUL_CTL_8bits;
|
||||
|
|
@ -379,9 +386,6 @@ void mgag200_set_format_regs(struct mga_device *mdev, const struct drm_format_in
|
|||
break;
|
||||
}
|
||||
|
||||
crtcext3 &= ~GENMASK(2, 0);
|
||||
crtcext3 |= scale;
|
||||
|
||||
WREG_DAC(MGA1064_MUL_CTL, xmulctrl);
|
||||
|
||||
WREG_GFX(0, 0x00);
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@
|
|||
#define MGAREG_CRTCEXT1_HRSTEN BIT(3)
|
||||
|
||||
#define MGAREG_CRTCEXT3_MGAMODE BIT(7)
|
||||
#define MGAREG_CRTCEXT3_SCALE_MASK GENMASK(2, 0)
|
||||
|
||||
/* Cursor X and Y position */
|
||||
#define MGA_CURPOSXL 0x3c0c
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user