configure.ac | 2 src/via_ch7xxx.c | 1 src/via_display.c | 316 +++++++++++------------------------------------------- src/via_ums.c | 4 src/via_ums.h | 3 5 files changed, 72 insertions(+), 254 deletions(-)
New commits: commit 9721ba4664902dc3a5f3cc0f142195dbab57b925 Author: Kevin Brace <kevinbr...@gmx.com> Date: Fri May 28 15:17:01 2021 -0700 Version bumped to 0.6.403 Mostly code refactoring, but there was one fix for VX900 chipset's IGA2 not being able to properly handle a horizontal resolution > 2048. Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/configure.ac b/configure.ac index 5ae93bd..70b0190 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-video-openchrome], - [0.6.402], + [0.6.403], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome], [xf86-video-openchrome]) commit f65ee550945e6ad594d9ecfac29455b1891a4b47 Author: Kevin Brace <kevinbr...@gmx.com> Date: Fri May 28 15:12:59 2021 -0700 Rename iga_crtc_*() to via_crtc_*() Also, rename iga_crtc_funcs{} to via_crtc_funcs{}. Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_display.c b/src/via_display.c index 3b290c9..66d6142 100644 --- a/src/via_display.c +++ b/src/via_display.c @@ -3075,7 +3075,7 @@ ViaShadowCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) } static void -iga_crtc_dpms(xf86CrtcPtr crtc, int mode) +via_crtc_dpms(xf86CrtcPtr crtc, int mode) { ScrnInfoPtr pScrn = crtc->scrn; drmmode_crtc_private_ptr iga = crtc->driver_private; @@ -3116,7 +3116,7 @@ iga_crtc_dpms(xf86CrtcPtr crtc, int mode) } static void -iga_crtc_save(xf86CrtcPtr crtc) +via_crtc_save(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; drmmode_crtc_private_ptr iga = crtc->driver_private; @@ -3135,7 +3135,7 @@ iga_crtc_save(xf86CrtcPtr crtc) } static void -iga_crtc_restore(xf86CrtcPtr crtc) +via_crtc_restore(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; drmmode_crtc_private_ptr iga = crtc->driver_private; @@ -3154,7 +3154,7 @@ iga_crtc_restore(xf86CrtcPtr crtc) } static Bool -iga_crtc_lock(xf86CrtcPtr crtc) +via_crtc_lock(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; @@ -3168,7 +3168,7 @@ iga_crtc_lock(xf86CrtcPtr crtc) } static void -iga_crtc_unlock(xf86CrtcPtr crtc) +via_crtc_unlock(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; @@ -3180,7 +3180,7 @@ iga_crtc_unlock(xf86CrtcPtr crtc) } static Bool -iga_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode, +via_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mode) { ScrnInfoPtr pScrn = crtc->scrn; @@ -3237,7 +3237,7 @@ iga_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode, } static void -iga_crtc_prepare(xf86CrtcPtr crtc) +via_crtc_prepare(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; drmmode_crtc_private_ptr iga = crtc->driver_private; @@ -3258,7 +3258,7 @@ iga_crtc_prepare(xf86CrtcPtr crtc) } static void -iga_crtc_mode_set(xf86CrtcPtr crtc, +via_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mode, int x, int y) { @@ -3336,7 +3336,7 @@ iga_crtc_mode_set(xf86CrtcPtr crtc, } static void -iga_crtc_commit(xf86CrtcPtr crtc) +via_crtc_commit(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; drmmode_crtc_private_ptr iga = crtc->driver_private; @@ -3357,7 +3357,7 @@ iga_crtc_commit(xf86CrtcPtr crtc) } static void -iga_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, +via_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, int size) { ScrnInfoPtr pScrn = crtc->scrn; @@ -3407,7 +3407,7 @@ iga_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, and in all other bpps the fg and bg are in 8-8-8 RGB format. */ static void -iga_crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg) +via_crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg) { ScrnInfoPtr pScrn = crtc->scrn; drmmode_crtc_private_ptr iga = crtc->driver_private; @@ -3435,7 +3435,7 @@ iga_crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg) } static void -iga_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y) +via_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y) { ScrnInfoPtr pScrn = crtc->scrn; drmmode_crtc_private_ptr iga = crtc->driver_private; @@ -3463,7 +3463,7 @@ iga_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y) } static void -iga_crtc_show_cursor(xf86CrtcPtr crtc) +via_crtc_show_cursor(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; drmmode_crtc_private_ptr iga = crtc->driver_private; @@ -3476,7 +3476,7 @@ iga_crtc_show_cursor(xf86CrtcPtr crtc) } static void -iga_crtc_hide_cursor(xf86CrtcPtr crtc) +via_crtc_hide_cursor(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; drmmode_crtc_private_ptr iga = crtc->driver_private; @@ -3489,7 +3489,7 @@ iga_crtc_hide_cursor(xf86CrtcPtr crtc) } static void -iga_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image) +via_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image) { ScrnInfoPtr pScrn = crtc->scrn; drmmode_crtc_private_ptr iga = crtc->driver_private; @@ -3510,7 +3510,7 @@ iga_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image) } static void -iga_crtc_destroy(xf86CrtcPtr crtc) +via_crtc_destroy(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; @@ -3526,7 +3526,7 @@ iga_crtc_destroy(xf86CrtcPtr crtc) #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2 static void -iga_crtc_set_origin(xf86CrtcPtr crtc, int x, int y) +via_crtc_set_origin(xf86CrtcPtr crtc, int x, int y) { ScrnInfoPtr pScrn = crtc->scrn; drmmode_crtc_private_ptr iga = crtc->driver_private; @@ -3547,24 +3547,24 @@ iga_crtc_set_origin(xf86CrtcPtr crtc, int x, int y) } #endif /* GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2 */ -const xf86CrtcFuncsRec iga_crtc_funcs = { - .dpms = iga_crtc_dpms, - .save = iga_crtc_save, - .restore = iga_crtc_restore, - .lock = iga_crtc_lock, - .unlock = iga_crtc_unlock, - .mode_fixup = iga_crtc_mode_fixup, - .prepare = iga_crtc_prepare, - .mode_set = iga_crtc_mode_set, - .commit = iga_crtc_commit, - .gamma_set = iga_crtc_gamma_set, - .set_cursor_colors = iga_crtc_set_cursor_colors, - .set_cursor_position = iga_crtc_set_cursor_position, - .show_cursor = iga_crtc_show_cursor, - .hide_cursor = iga_crtc_hide_cursor, - .load_cursor_argb = iga_crtc_load_cursor_argb, - .destroy = iga_crtc_destroy, +const xf86CrtcFuncsRec via_crtc_funcs = { + .dpms = via_crtc_dpms, + .save = via_crtc_save, + .restore = via_crtc_restore, + .lock = via_crtc_lock, + .unlock = via_crtc_unlock, + .mode_fixup = via_crtc_mode_fixup, + .prepare = via_crtc_prepare, + .mode_set = via_crtc_mode_set, + .commit = via_crtc_commit, + .gamma_set = via_crtc_gamma_set, + .set_cursor_colors = via_crtc_set_cursor_colors, + .set_cursor_position = via_crtc_set_cursor_position, + .show_cursor = via_crtc_show_cursor, + .hide_cursor = via_crtc_hide_cursor, + .load_cursor_argb = via_crtc_load_cursor_argb, + .destroy = via_crtc_destroy, #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2 - .set_origin = iga_crtc_set_origin, + .set_origin = via_crtc_set_origin, #endif /* GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2 */ }; diff --git a/src/via_ums.c b/src/via_ums.c index 44b1225..c7e5d56 100644 --- a/src/via_ums.c +++ b/src/via_ums.c @@ -1477,7 +1477,7 @@ viaUMSPreInit(ScrnInfoPtr pScrn) goto free_mmio; } - iga1 = xf86CrtcCreate(pScrn, &iga_crtc_funcs); + iga1 = xf86CrtcCreate(pScrn, &via_crtc_funcs); if (!iga1) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86CrtcCreate failed.\n"); free(iga1_rec); @@ -1495,7 +1495,7 @@ viaUMSPreInit(ScrnInfoPtr pScrn) goto free_mmio; } - iga2 = xf86CrtcCreate(pScrn, &iga_crtc_funcs); + iga2 = xf86CrtcCreate(pScrn, &via_crtc_funcs); if (!iga2) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86CrtcCreate failed.\n"); xf86CrtcDestroy(iga1); diff --git a/src/via_ums.h b/src/via_ums.h index 8391745..d77d0a5 100644 --- a/src/via_ums.h +++ b/src/via_ums.h @@ -1621,7 +1621,7 @@ void viaIGA2SetDisplayRegister(ScrnInfoPtr pScrn, DisplayModePtr mode); void viaIGA2Save(ScrnInfoPtr pScrn); void viaIGA2Restore(ScrnInfoPtr pScrn); void ViaShadowCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode); -extern const xf86CrtcFuncsRec iga_crtc_funcs; +extern const xf86CrtcFuncsRec via_crtc_funcs; /* via_analog.c */ void viaAnalogProbe(ScrnInfoPtr pScrn); commit e8165d3b91a039b2d75355c4fb0dd2f2d941e908 Author: Kevin Brace <kevinbr...@gmx.com> Date: Fri May 28 15:03:36 2021 -0700 Minor modifications to iga_crtc_destroy() Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_display.c b/src/via_display.c index 290e497..3b290c9 100644 --- a/src/via_display.c +++ b/src/via_display.c @@ -3509,6 +3509,21 @@ iga_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image) } } +static void +iga_crtc_destroy(xf86CrtcPtr crtc) +{ + ScrnInfoPtr pScrn = crtc->scrn; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Entered %s.\n", __func__)); + + if (crtc->driver_private) + free(crtc->driver_private); + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Exiting %s.\n", __func__)); +} + #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2 static void iga_crtc_set_origin(xf86CrtcPtr crtc, int x, int y) @@ -3532,13 +3547,6 @@ iga_crtc_set_origin(xf86CrtcPtr crtc, int x, int y) } #endif /* GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2 */ -static void -iga_crtc_destroy(xf86CrtcPtr crtc) -{ - if (crtc->driver_private) - free(crtc->driver_private); -} - const xf86CrtcFuncsRec iga_crtc_funcs = { .dpms = iga_crtc_dpms, .save = iga_crtc_save, @@ -3555,8 +3563,8 @@ const xf86CrtcFuncsRec iga_crtc_funcs = { .show_cursor = iga_crtc_show_cursor, .hide_cursor = iga_crtc_hide_cursor, .load_cursor_argb = iga_crtc_load_cursor_argb, + .destroy = iga_crtc_destroy, #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2 .set_origin = iga_crtc_set_origin, #endif /* GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2 */ - .destroy = iga_crtc_destroy, }; commit 6eaef9ed173ad7e032919c97dce5bf7132c1af17 Author: Kevin Brace <kevinbr...@gmx.com> Date: Fri May 28 14:59:51 2021 -0700 Streamline iga*_crtc_funcs{} into iga_crtc_funcs{} Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_display.c b/src/via_display.c index d05ecb6..290e497 100644 --- a/src/via_display.c +++ b/src/via_display.c @@ -3539,29 +3539,7 @@ iga_crtc_destroy(xf86CrtcPtr crtc) free(crtc->driver_private); } -const xf86CrtcFuncsRec iga1_crtc_funcs = { - .dpms = iga_crtc_dpms, - .save = iga_crtc_save, - .restore = iga_crtc_restore, - .lock = iga_crtc_lock, - .unlock = iga_crtc_unlock, - .mode_fixup = iga_crtc_mode_fixup, - .prepare = iga_crtc_prepare, - .mode_set = iga_crtc_mode_set, - .commit = iga_crtc_commit, - .gamma_set = iga_crtc_gamma_set, - .set_cursor_colors = iga_crtc_set_cursor_colors, - .set_cursor_position = iga_crtc_set_cursor_position, - .show_cursor = iga_crtc_show_cursor, - .hide_cursor = iga_crtc_hide_cursor, - .load_cursor_argb = iga_crtc_load_cursor_argb, -#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2 - .set_origin = iga_crtc_set_origin, -#endif /* GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 2 */ - .destroy = iga_crtc_destroy, -}; - -const xf86CrtcFuncsRec iga2_crtc_funcs = { +const xf86CrtcFuncsRec iga_crtc_funcs = { .dpms = iga_crtc_dpms, .save = iga_crtc_save, .restore = iga_crtc_restore, diff --git a/src/via_ums.c b/src/via_ums.c index 9f1a216..44b1225 100644 --- a/src/via_ums.c +++ b/src/via_ums.c @@ -1477,7 +1477,7 @@ viaUMSPreInit(ScrnInfoPtr pScrn) goto free_mmio; } - iga1 = xf86CrtcCreate(pScrn, &iga1_crtc_funcs); + iga1 = xf86CrtcCreate(pScrn, &iga_crtc_funcs); if (!iga1) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86CrtcCreate failed.\n"); free(iga1_rec); @@ -1495,7 +1495,7 @@ viaUMSPreInit(ScrnInfoPtr pScrn) goto free_mmio; } - iga2 = xf86CrtcCreate(pScrn, &iga2_crtc_funcs); + iga2 = xf86CrtcCreate(pScrn, &iga_crtc_funcs); if (!iga2) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86CrtcCreate failed.\n"); xf86CrtcDestroy(iga1); diff --git a/src/via_ums.h b/src/via_ums.h index ef3a856..8391745 100644 --- a/src/via_ums.h +++ b/src/via_ums.h @@ -1621,8 +1621,7 @@ void viaIGA2SetDisplayRegister(ScrnInfoPtr pScrn, DisplayModePtr mode); void viaIGA2Save(ScrnInfoPtr pScrn); void viaIGA2Restore(ScrnInfoPtr pScrn); void ViaShadowCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode); -extern const xf86CrtcFuncsRec iga1_crtc_funcs; -extern const xf86CrtcFuncsRec iga2_crtc_funcs; +extern const xf86CrtcFuncsRec iga_crtc_funcs; /* via_analog.c */ void viaAnalogProbe(ScrnInfoPtr pScrn); commit b2479a3833e87beb2c4bb6f98dbe09c3ddda2294 Author: Kevin Brace <kevinbr...@gmx.com> Date: Fri May 28 14:47:04 2021 -0700 Delete iga*_crtc_shadow_*() Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_display.c b/src/via_display.c index 32ae026..d05ecb6 100644 --- a/src/via_display.c +++ b/src/via_display.c @@ -3400,23 +3400,6 @@ iga_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, "Exiting %s.\n", __func__)); } -static void * -iga1_crtc_shadow_allocate (xf86CrtcPtr crtc, int width, int height) -{ - return NULL; -} - -static PixmapPtr -iga1_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height) -{ - return NULL; -} - -static void -iga1_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) -{ -} - /* Set the cursor foreground and background colors. In 8bpp, fg and bg are indices into the current colormap unless the @@ -3567,9 +3550,6 @@ const xf86CrtcFuncsRec iga1_crtc_funcs = { .mode_set = iga_crtc_mode_set, .commit = iga_crtc_commit, .gamma_set = iga_crtc_gamma_set, - .shadow_create = iga1_crtc_shadow_create, - .shadow_allocate = iga1_crtc_shadow_allocate, - .shadow_destroy = iga1_crtc_shadow_destroy, .set_cursor_colors = iga_crtc_set_cursor_colors, .set_cursor_position = iga_crtc_set_cursor_position, .show_cursor = iga_crtc_show_cursor, @@ -3581,23 +3561,6 @@ const xf86CrtcFuncsRec iga1_crtc_funcs = { .destroy = iga_crtc_destroy, }; -static void * -iga2_crtc_shadow_allocate (xf86CrtcPtr crtc, int width, int height) -{ - return NULL; -} - -static PixmapPtr -iga2_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height) -{ - return NULL; -} - -static void -iga2_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) -{ -} - const xf86CrtcFuncsRec iga2_crtc_funcs = { .dpms = iga_crtc_dpms, .save = iga_crtc_save, @@ -3609,9 +3572,6 @@ const xf86CrtcFuncsRec iga2_crtc_funcs = { .mode_set = iga_crtc_mode_set, .commit = iga_crtc_commit, .gamma_set = iga_crtc_gamma_set, - .shadow_create = iga2_crtc_shadow_create, - .shadow_allocate = iga2_crtc_shadow_allocate, - .shadow_destroy = iga2_crtc_shadow_destroy, .set_cursor_colors = iga_crtc_set_cursor_colors, .set_cursor_position = iga_crtc_set_cursor_position, .show_cursor = iga_crtc_show_cursor, commit 02e83dbf242fea1a0a703a0f08df0f00f1f94fd9 Author: Kevin Brace <kevinbr...@gmx.com> Date: Fri May 28 14:25:01 2021 -0700 Code simplification and correction for iga_crtc_gamma_set() Palette will be loaded after palette related control registers are set (i.e., VIALoadRgbLut() is now going to be called at the end). viaIGA2SetPaletteLUTResolution() will be called with a bool type parameter instead for a value. Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_display.c b/src/via_display.c index b9d9df7..32ae026 100644 --- a/src/via_display.c +++ b/src/via_display.c @@ -3378,80 +3378,24 @@ iga_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, /* Set palette LUT to 8-bit mode. */ viaIGA1SetPaletteLUTResolution(pScrn, TRUE); - switch (pScrn->bitsPerPixel) { - case 8: - /* IGA1 will access the palette LUT. */ - viaSetPaletteLUTAccess(pScrn, 0x00); - - VIALoadRgbLut(pScrn, 0, size, colors); - - /* Turn gamma correction off. */ - viaIGA1SetGamma(pScrn, FALSE); - break; - case 16: - /* IGA1 will access the palette LUT. */ - viaSetPaletteLUTAccess(pScrn, 0x00); - - VIALoadRgbLut(pScrn, 0, size, colors); - - /* Turn gamma correction off. */ - viaIGA1SetGamma(pScrn, FALSE); - break; - case 32: - /* IGA1 will access the palette LUT. */ - viaSetPaletteLUTAccess(pScrn, 0x00); - - VIALoadRgbLut(pScrn, 0, size, colors); + /* IGA1 will access the palette LUT. */ + viaSetPaletteLUTAccess(pScrn, 0x00); - /* Turn gamma correction off. */ - viaIGA1SetGamma(pScrn, FALSE); - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unsupported color depth: %d\n", - pScrn->bitsPerPixel); - break; - } + /* Turn gamma correction off. */ + viaIGA1SetGamma(pScrn, FALSE); } else { /* Set palette LUT to 8-bit mode. */ - viaIGA2SetPaletteLUTResolution(pScrn, 0x01); + viaIGA2SetPaletteLUTResolution(pScrn, TRUE); - switch (pScrn->bitsPerPixel) { - case 8: - /* IGA2 will access the palette LUT. */ - viaSetPaletteLUTAccess(pScrn, 0x01); + /* IGA2 will access the palette LUT. */ + viaSetPaletteLUTAccess(pScrn, 0x01); - VIALoadRgbLut(pScrn, 0, size, colors); - - /* Turn gamma correction off. */ - viaIGA2SetGamma(pScrn, FALSE); - break; - case 16: - /* IGA2 will access the palette LUT. */ - viaSetPaletteLUTAccess(pScrn, 0x01); - - VIALoadRgbLut(pScrn, 0, size, colors); - - /* Turn gamma correction off. */ - viaIGA2SetGamma(pScrn, FALSE); - break; - case 32: - /* IGA2 will access the palette LUT. */ - viaSetPaletteLUTAccess(pScrn, 0x01); - - VIALoadRgbLut(pScrn, 0, size, colors); - - /* Turn gamma correction off. */ - viaIGA2SetGamma(pScrn, FALSE); - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unsupported color depth: %d\n", - pScrn->bitsPerPixel); - break; - } + /* Turn gamma correction off. */ + viaIGA2SetGamma(pScrn, FALSE); } + VIALoadRgbLut(pScrn, 0, size, colors); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Exiting %s.\n", __func__)); } commit 5fd106e1b04a9b19b8905bb61a42a309e7eb8feb Author: Kevin Brace <kevinbr...@gmx.com> Date: Fri May 28 14:14:15 2021 -0700 Merge iga*_crtc_gamma_set() into iga_crtc_gamma_set() Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_display.c b/src/via_display.c index a3919ff..b9d9df7 100644 --- a/src/via_display.c +++ b/src/via_display.c @@ -3357,15 +3357,16 @@ iga_crtc_commit(xf86CrtcPtr crtc) } static void -iga1_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, +iga_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, int size) { ScrnInfoPtr pScrn = crtc->scrn; + drmmode_crtc_private_ptr iga = crtc->driver_private; LOCO colors[size]; int i; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Entering iga1_crtc_gamma_set.\n")); + "Entered %s.\n", __func__)); for (i = 0; i < size; i++) { colors[i].red = red[i] >> 8; @@ -3373,46 +3374,86 @@ iga1_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, colors[i].blue = blue[i] >> 8; } - /* Set palette LUT to 8-bit mode. */ - viaIGA1SetPaletteLUTResolution(pScrn, TRUE); + if (!iga->index) { + /* Set palette LUT to 8-bit mode. */ + viaIGA1SetPaletteLUTResolution(pScrn, TRUE); - switch (pScrn->bitsPerPixel) { - case 8: - /* IGA1 will access the palette LUT. */ - viaSetPaletteLUTAccess(pScrn, 0x00); + switch (pScrn->bitsPerPixel) { + case 8: + /* IGA1 will access the palette LUT. */ + viaSetPaletteLUTAccess(pScrn, 0x00); - VIALoadRgbLut(pScrn, 0, size, colors); + VIALoadRgbLut(pScrn, 0, size, colors); - /* Turn gamma correction off. */ - viaIGA1SetGamma(pScrn, FALSE); - break; - case 16: - /* IGA1 will access the palette LUT. */ - viaSetPaletteLUTAccess(pScrn, 0x00); + /* Turn gamma correction off. */ + viaIGA1SetGamma(pScrn, FALSE); + break; + case 16: + /* IGA1 will access the palette LUT. */ + viaSetPaletteLUTAccess(pScrn, 0x00); - VIALoadRgbLut(pScrn, 0, size, colors); + VIALoadRgbLut(pScrn, 0, size, colors); - /* Turn gamma correction off. */ - viaIGA1SetGamma(pScrn, FALSE); - break; - case 32: - /* IGA1 will access the palette LUT. */ - viaSetPaletteLUTAccess(pScrn, 0x00); + /* Turn gamma correction off. */ + viaIGA1SetGamma(pScrn, FALSE); + break; + case 32: + /* IGA1 will access the palette LUT. */ + viaSetPaletteLUTAccess(pScrn, 0x00); - VIALoadRgbLut(pScrn, 0, size, colors); + VIALoadRgbLut(pScrn, 0, size, colors); - /* Turn gamma correction off. */ - viaIGA1SetGamma(pScrn, FALSE); - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unsupported color depth: %d\n", - pScrn->bitsPerPixel); - break; + /* Turn gamma correction off. */ + viaIGA1SetGamma(pScrn, FALSE); + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Unsupported color depth: %d\n", + pScrn->bitsPerPixel); + break; + } + } else { + /* Set palette LUT to 8-bit mode. */ + viaIGA2SetPaletteLUTResolution(pScrn, 0x01); + + switch (pScrn->bitsPerPixel) { + case 8: + /* IGA2 will access the palette LUT. */ + viaSetPaletteLUTAccess(pScrn, 0x01); + + VIALoadRgbLut(pScrn, 0, size, colors); + + /* Turn gamma correction off. */ + viaIGA2SetGamma(pScrn, FALSE); + break; + case 16: + /* IGA2 will access the palette LUT. */ + viaSetPaletteLUTAccess(pScrn, 0x01); + + VIALoadRgbLut(pScrn, 0, size, colors); + + /* Turn gamma correction off. */ + viaIGA2SetGamma(pScrn, FALSE); + break; + case 32: + /* IGA2 will access the palette LUT. */ + viaSetPaletteLUTAccess(pScrn, 0x01); + + VIALoadRgbLut(pScrn, 0, size, colors); + + /* Turn gamma correction off. */ + viaIGA2SetGamma(pScrn, FALSE); + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Unsupported color depth: %d\n", + pScrn->bitsPerPixel); + break; + } } DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Exiting iga1_crtc_gamma_set.\n")); + "Exiting %s.\n", __func__)); } static void * @@ -3581,7 +3622,7 @@ const xf86CrtcFuncsRec iga1_crtc_funcs = { .prepare = iga_crtc_prepare, .mode_set = iga_crtc_mode_set, .commit = iga_crtc_commit, - .gamma_set = iga1_crtc_gamma_set, + .gamma_set = iga_crtc_gamma_set, .shadow_create = iga1_crtc_shadow_create, .shadow_allocate = iga1_crtc_shadow_allocate, .shadow_destroy = iga1_crtc_shadow_destroy, @@ -3596,65 +3637,6 @@ const xf86CrtcFuncsRec iga1_crtc_funcs = { .destroy = iga_crtc_destroy, }; -static void -iga2_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, - int size) -{ - ScrnInfoPtr pScrn = crtc->scrn; - LOCO colors[size]; - int i; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Entering iga2_crtc_gamma_set.\n")); - - for (i = 0; i < size; i++) { - colors[i].red = red[i] >> 8; - colors[i].green = green[i] >> 8; - colors[i].blue = blue[i] >> 8; - } - - /* Set palette LUT to 8-bit mode. */ - viaIGA2SetPaletteLUTResolution(pScrn, 0x01); - - switch (pScrn->bitsPerPixel) { - case 8: - /* IGA2 will access the palette LUT. */ - viaSetPaletteLUTAccess(pScrn, 0x01); - - VIALoadRgbLut(pScrn, 0, size, colors); - - /* Turn gamma correction off. */ - viaIGA2SetGamma(pScrn, FALSE); - break; - case 16: - /* IGA2 will access the palette LUT. */ - viaSetPaletteLUTAccess(pScrn, 0x01); - - VIALoadRgbLut(pScrn, 0, size, colors); - - /* Turn gamma correction off. */ - viaIGA2SetGamma(pScrn, FALSE); - break; - case 32: - /* IGA2 will access the palette LUT. */ - viaSetPaletteLUTAccess(pScrn, 0x01); - - VIALoadRgbLut(pScrn, 0, size, colors); - - /* Turn gamma correction off. */ - viaIGA2SetGamma(pScrn, FALSE); - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unsupported color depth: %d\n", - pScrn->bitsPerPixel); - break; - } - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Exiting iga2_crtc_gamma_set.\n")); -} - static void * iga2_crtc_shadow_allocate (xf86CrtcPtr crtc, int width, int height) { @@ -3682,7 +3664,7 @@ const xf86CrtcFuncsRec iga2_crtc_funcs = { .prepare = iga_crtc_prepare, .mode_set = iga_crtc_mode_set, .commit = iga_crtc_commit, - .gamma_set = iga2_crtc_gamma_set, + .gamma_set = iga_crtc_gamma_set, .shadow_create = iga2_crtc_shadow_create, .shadow_allocate = iga2_crtc_shadow_allocate, .shadow_destroy = iga2_crtc_shadow_destroy, commit 8d22ccb81421182ee5c0172f6c297c28ab1f8521 Author: Kevin Brace <kevinbr...@gmx.com> Date: Fri May 28 14:03:24 2021 -0700 24 bpp (Bits Per Pixel) is not supported by Chrome IGP However, 32 bpp is supported instead. Drop almost all references to 24 bpp. Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_ch7xxx.c b/src/via_ch7xxx.c index 20c15b9..b60e598 100644 --- a/src/via_ch7xxx.c +++ b/src/via_ch7xxx.c @@ -430,7 +430,6 @@ CH7xxxModeCrtc(xf86CrtcPtr crtc, DisplayModePtr mode) case 16: CRTC = Table.CRTC2_16BPP; break; - case 24: case 32: CRTC = Table.CRTC2_32BPP; break; diff --git a/src/via_display.c b/src/via_display.c index 98e9c62..a3919ff 100644 --- a/src/via_display.c +++ b/src/via_display.c @@ -115,7 +115,6 @@ viaIGA1SetColorDepth(ScrnInfoPtr pScrn, CARD8 bitsPerPixel) case 16: ViaSeqMask(hwp, 0x15, 0x14, 0x1C); break; - case 24: case 32: ViaSeqMask(hwp, 0x15, 0x1C, 0x1C); break; @@ -125,7 +124,6 @@ viaIGA1SetColorDepth(ScrnInfoPtr pScrn, CARD8 bitsPerPixel) if ((bitsPerPixel == 8) || (bitsPerPixel == 16) - || (bitsPerPixel == 24) || (bitsPerPixel == 32)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -314,7 +312,6 @@ viaIGA2SetColorDepth(ScrnInfoPtr pScrn, CARD8 bitsPerPixel) case 16: ViaCrtcMask(hwp, 0x67, 0x40, 0xC0); break; - case 24: case 32: ViaCrtcMask(hwp, 0x67, 0xC0, 0xC0); break; @@ -324,7 +321,6 @@ viaIGA2SetColorDepth(ScrnInfoPtr pScrn, CARD8 bitsPerPixel) if ((bitsPerPixel == 8) || (bitsPerPixel == 16) - || (bitsPerPixel == 24) || (bitsPerPixel == 32)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -487,7 +483,6 @@ VIALoadRgbLut(ScrnInfoPtr pScrn, int start, int numColors, LOCO *colors) break; case 8: case 16: - case 24: case 32: for (i = start; i < numColors; i++) { hwp->writeDacWriteAddr(hwp, i); @@ -2664,7 +2659,7 @@ ViaSetSecondaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode) hwp->writeCrtc(hwp, 0x68, 0x67);/* depth 6, threshold 7 */ } } else { - if ((pScrn->bitsPerPixel >= 24) + if ((pScrn->bitsPerPixel == 32) && (((mode->VDisplay > 768) && (pVia->MemClk <= VIA_MEM_DDR200)) || ((mode->HDisplay > 1280) @@ -3400,7 +3395,6 @@ iga1_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, /* Turn gamma correction off. */ viaIGA1SetGamma(pScrn, FALSE); break; - case 24: case 32: /* IGA1 will access the palette LUT. */ viaSetPaletteLUTAccess(pScrn, 0x00); @@ -3641,7 +3635,6 @@ iga2_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, /* Turn gamma correction off. */ viaIGA2SetGamma(pScrn, FALSE); break; - case 24: case 32: /* IGA2 will access the palette LUT. */ viaSetPaletteLUTAccess(pScrn, 0x01); commit 306a763f62b2e4ca4ed1e5d55d1cf4327443b95b Author: Kevin Brace <kevinbr...@gmx.com> Date: Fri May 28 13:52:57 2021 -0700 Merge iga*_crtc_mode_fixup() into iga_crtc_mode_fixup() Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_display.c b/src/via_display.c index 6550869..98e9c62 100644 --- a/src/via_display.c +++ b/src/via_display.c @@ -3185,10 +3185,11 @@ iga_crtc_unlock(xf86CrtcPtr crtc) } static Bool -iga1_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode, +iga_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjusted_mode) { ScrnInfoPtr pScrn = crtc->scrn; + drmmode_crtc_private_ptr iga = crtc->driver_private; VIAPtr pVia = VIAPTR(pScrn); CARD32 temp; ModeStatus modestatus; @@ -3202,7 +3203,12 @@ iga1_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode, return FALSE; } - modestatus = viaIGA1ModeValid(pScrn, mode); + if (!iga->index) { + modestatus = viaIGA1ModeValid(pScrn, mode); + } else { + modestatus = viaIGA2ModeValid(pScrn, mode); + } + if (modestatus != MODE_OK) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Not using mode \"%s\" : %s.\n", mode->name, xf86ModeStatusToString(modestatus)); @@ -3577,7 +3583,7 @@ const xf86CrtcFuncsRec iga1_crtc_funcs = { .restore = iga_crtc_restore, .lock = iga_crtc_lock, .unlock = iga_crtc_unlock, - .mode_fixup = iga1_crtc_mode_fixup, + .mode_fixup = iga_crtc_mode_fixup, .prepare = iga_crtc_prepare, .mode_set = iga_crtc_mode_set, .commit = iga_crtc_commit, @@ -3596,57 +3602,6 @@ const xf86CrtcFuncsRec iga1_crtc_funcs = { .destroy = iga_crtc_destroy, }; -static Bool -iga2_crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode, - DisplayModePtr adjusted_mode) -{ - ScrnInfoPtr pScrn = crtc->scrn; - VIAPtr pVia = VIAPTR(pScrn); - CARD32 temp; - ModeStatus modestatus; - - if ((mode->Clock < pScrn->clockRanges->minClock) || - (mode->Clock > pScrn->clockRanges->maxClock)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Clock for mode \"%s\" outside of allowed range (%u (%u - %u))\n", - mode->name, mode->Clock, pScrn->clockRanges->minClock, - pScrn->clockRanges->maxClock); - return FALSE; - } - - modestatus = viaIGA2ModeValid(pScrn, mode); - if (modestatus != MODE_OK) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Not using mode \"%s\" : %s.\n", - mode->name, xf86ModeStatusToString(modestatus)); - return FALSE; - } - - temp = mode->CrtcHDisplay * mode->CrtcVDisplay * mode->VRefresh * - (pScrn->bitsPerPixel >> 3); - if (pVia->pVIADisplay->Bandwidth < temp) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Required bandwidth is not available. (%u > %u)\n", - (unsigned)temp, (unsigned)pVia->pVIADisplay->Bandwidth); - return FALSE; - } - - if (!pScrn->bitsPerPixel) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Invalid bpp information.\n"); - return FALSE; - } - - /* 16 is the Chrome IGP display controller memory alignment. */ - if (crtc->x % (16 / ((pScrn->bitsPerPixel + 7) >> 3))) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "The X location specified is not properly aligned " - "to Chrome IGP's memory alignment.\n"); - return FALSE; - } - - return TRUE; -} - static void iga2_crtc_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, int size) @@ -3730,7 +3685,7 @@ const xf86CrtcFuncsRec iga2_crtc_funcs = { .restore = iga_crtc_restore, .lock = iga_crtc_lock, .unlock = iga_crtc_unlock, - .mode_fixup = iga2_crtc_mode_fixup, + .mode_fixup = iga_crtc_mode_fixup, .prepare = iga_crtc_prepare, .mode_set = iga_crtc_mode_set, .commit = iga_crtc_commit, _______________________________________________ openchrome-devel mailing list openchrome-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/openchrome-devel