On Fri, Jan 20, 2012 at 1:30 AM, Brad <b...@comstyle.com> wrote: > On Sun, Jan 15, 2012 at 02:15:37PM +0100, Donovan Watteau wrote: >> Hello, >> >> I can confirm that the issue is still here on -current macppc >> (latest snapshot) unless I revert the patches added to "fix very >> dark screens with various SDL apps". >> >> I also have i386/loongson boxes running -current but this bug >> seems specific to macppc (or r128). Any macppc user out there >> to confirm that this bug is/is not specific to r128 on macppc? >> >> If the bug happens on all macppc setups, maybe the patches should >> (at least) not be applied for macppc? > > The patch should not have been added to the port. The author of SDL > made it pretty clear this would break with certain X server/driver > combinations and was the reason it wasn't commited upstream. It's > about time this is finally rolled back to un-break SDL.
Please, Can we discuss this? me too would like to remove this gamma ramp patch, since it broke SDL on at least macppc and amd64... ciao, David > Index: Makefile > =================================================================== > RCS file: /home/cvs/ports/devel/sdl/Makefile,v > retrieving revision 1.79 > diff -u -p -r1.79 Makefile > --- Makefile 13 May 2011 07:57:24 -0000 1.79 > +++ Makefile 16 Jan 2012 22:56:26 -0000 > @@ -5,7 +5,7 @@ COMMENT= cross-platform multimedia libra > VERSION= 1.2.13 > DISTNAME= SDL-${VERSION} > PKGNAME= ${DISTNAME:L} > -REVISION = 15 > +REVISION = 16 > CATEGORIES= devel > > HOMEPAGE= http://www.libsdl.org/ > Index: patches/patch-src_video_x11_SDL_x11sym_h > =================================================================== > RCS file: patches/patch-src_video_x11_SDL_x11sym_h > diff -N patches/patch-src_video_x11_SDL_x11sym_h > --- patches/patch-src_video_x11_SDL_x11sym_h 13 May 2011 07:57:24 -0000 > 1.1 > +++ /dev/null 1 Jan 1970 00:00:00 -0000 > @@ -1,24 +0,0 @@ > -$OpenBSD: patch-src_video_x11_SDL_x11sym_h,v 1.1 2011/05/13 07:57:24 jasper > Exp $ > - > -Add support for XRandR and VidMode gamma ramps. > -From upstream bz: http://bugzilla.libsdl.org/show_bug.cgi?id=971 > - > -Will not be part of SDL 1.3 to gamma API removal. > - > ---- src/video/x11/SDL_x11sym.h.orig Mon Dec 31 05:48:13 2007 > -+++ src/video/x11/SDL_x11sym.h Tue May 3 15:12:12 2011 > -@@ -190,6 +190,14 @@ SDL_X11_SYM(SizeID,XRRConfigCurrentConfiguration,(XRRS > - SDL_X11_SYM(XRRScreenSize *,XRRConfigSizes,(XRRScreenConfiguration *config, > int *nsizes),(config,nsizes),return) > - SDL_X11_SYM(Status,XRRSetScreenConfig,(Display *dpy, XRRScreenConfiguration > *config, Drawable draw, int size_index, Rotation rotation, Time > timestamp),(dpy,config,draw,size_index,rotation,timestamp),return) > - SDL_X11_SYM(void,XRRFreeScreenConfigInfo,(XRRScreenConfiguration > *config),(config),) > -+SDL_X11_SYM(XRRScreenResources *,XRRGetScreenResources,(Display *dpy, > Window window),(dpy,window),return) > -+SDL_X11_SYM(XRRScreenResources *,XRRGetScreenResourcesCurrent,(Display > *dpy, Window window),(dpy,window),return) > -+SDL_X11_SYM(void,XRRFreeScreenResources,(XRRScreenResources > *resources),(resources),) > -+SDL_X11_SYM(int,XRRGetCrtcGammaSize,(Display *dpy, RRCrtc > crtc),(dpy,crtc),return) > -+SDL_X11_SYM(XRRCrtcGamma *,XRRAllocGamma,(int size),(size),return) > -+SDL_X11_SYM(void,XRRFreeGamma,(XRRCrtcGamma *gamma),(gamma),) > -+SDL_X11_SYM(XRRCrtcGamma *,XRRGetCrtcGamma,(Display *dpy, RRCrtc > crtc),(dpy,crtc),return) > -+SDL_X11_SYM(void,XRRSetCrtcGamma,(Display *dpy, RRCrtc crtc, XRRCrtcGamma > *gamma),(dpy,crtc,gamma),) > - #endif > - > - /* DPMS support */ > Index: patches/patch-src_video_x11_SDL_x11video_c > =================================================================== > RCS file: patches/patch-src_video_x11_SDL_x11video_c > diff -N patches/patch-src_video_x11_SDL_x11video_c > --- patches/patch-src_video_x11_SDL_x11video_c 13 May 2011 07:57:24 -0000 > 1.1 > +++ /dev/null 1 Jan 1970 00:00:00 -0000 > @@ -1,288 +0,0 @@ > -$OpenBSD: patch-src_video_x11_SDL_x11video_c,v 1.1 2011/05/13 07:57:24 > jasper Exp $ > - > -Add support for XRandR and VidMode gamma ramps. > -From upstream bz: http://bugzilla.libsdl.org/show_bug.cgi?id=971 > - > -Will not be part of SDL 1.3 to gamma API removal. > - > ---- src/video/x11/SDL_x11video.c.orig Mon Dec 31 05:48:13 2007 > -+++ src/video/x11/SDL_x11video.c Tue May 3 15:12:12 2011 > -@@ -65,6 +65,9 @@ static int X11_ToggleFullScreen(_THIS, int on); > - static void X11_UpdateMouse(_THIS); > - static int X11_SetColors(_THIS, int firstcolor, int ncolors, > - SDL_Color *colors); > -+static void X11_FreeSavedGammaRamp(_THIS); > -+static int X11_RestoreGammaRamp(_THIS); > -+static int X11_SaveGammaRamp(_THIS); > - static int X11_SetGammaRamp(_THIS, Uint16 *ramp); > - static void X11_VideoQuit(_THIS); > - > -@@ -665,6 +668,7 @@ static int X11_VideoInit(_THIS, SDL_PixelFormat *vform > - if ( this->hidden->depth == 32 ) { > - vformat->Amask = (0xFFFFFFFF & > ~(vformat->Rmask|vformat->Gmask|vformat->Bmask)); > - } > -+ X11_SaveGammaRamp(this); > - X11_SaveVidModeGamma(this); > - > - /* Allow environment override of screensaver disable. */ > -@@ -1429,11 +1433,249 @@ int X11_SetColors(_THIS, int firstcolor, int > ncolors, > - return nrej == 0; > - } > - > -+void X11_FreeSavedGammaRamp(_THIS) > -+{ > -+ int i; > -+ > -+#if SDL_VIDEO_DRIVER_X11_XRANDR > -+ if (gamma_ramp_saved_xrr) { > -+ for ( i=0; i<gamma_ramp_saved_xrr_size; ++i ) { > -+ XRRFreeGamma(gamma_ramp_saved_xrr[i]); > -+ } > -+ SDL_free(gamma_ramp_saved_xrr); > -+ gamma_ramp_saved_xrr = NULL; > -+ } > -+#endif > -+ > -+#if SDL_VIDEO_DRIVER_X11_VIDMODE > -+ if (gamma_ramp_saved_vm) { > -+ SDL_free(gamma_ramp_saved_vm); > -+ gamma_ramp_saved_vm = NULL; > -+ } > -+#endif > -+} > -+ > -+int X11_SaveGammaRamp(_THIS) > -+{ > -+ int i; > -+ Bool succeeded; > -+ > -+ X11_FreeSavedGammaRamp(this); > -+ > -+#if SDL_VIDEO_DRIVER_X11_XRANDR > -+ if (use_xrandr) { > -+ XRRScreenResources *resrc; > -+ > -+ if (use_xrandr >= 103) { > -+ resrc = XRRGetScreenResourcesCurrent(SDL_Display, > SDL_Root); > -+ } else { > -+ resrc = XRRGetScreenResources(SDL_Display, SDL_Root); > -+ } > -+ > -+ if (resrc != NULL) { > -+ gamma_ramp_saved_xrr_size = resrc->ncrtc; > -+ gamma_ramp_saved_xrr = SDL_malloc( > -+ sizeof(gamma_ramp_saved_xrr[0]) * > -+ gamma_ramp_saved_xrr_size); > -+ } > -+ > -+ for ( i=0; resrc != NULL && i<resrc->ncrtc; ++i ) { > -+ gamma_ramp_saved_xrr[i] = XRRGetCrtcGamma(SDL_Display, > -+ resrc->crtcs[i]); > -+ } > -+ > -+ if (resrc != NULL) { > -+ XRRFreeScreenResources(resrc); > -+ return(0); > -+ } > -+ } > -+#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ > -+ > -+#if SDL_VIDEO_DRIVER_X11_VIDMODE > -+ if (use_vidmode >= 200 && gamma_ramp_size == 0) { > -+ succeeded = SDL_NAME(XF86VidModeGetGammaRampSize)( > -+ SDL_Display, SDL_Screen, > -+ &gamma_ramp_size); > -+ > -+ if (!succeeded) { > -+ gamma_ramp_size = 0; > -+ } > -+ } > -+ > -+ if (use_vidmode >= 200 && gamma_ramp_size > 0) { > -+ gamma_ramp_saved_vm = SDL_malloc( > -+ sizeof(gamma_ramp_saved_vm[0]) * > -+ 3 * gamma_ramp_size); > -+ > -+ succeeded = SDL_NAME(XF86VidModeGetGammaRamp)( > -+ SDL_Display, SDL_Screen, > -+ gamma_ramp_size, > -+ gamma_ramp_saved_vm + 0*gamma_ramp_size, > -+ gamma_ramp_saved_vm + 1*gamma_ramp_size, > -+ gamma_ramp_saved_vm + 2*gamma_ramp_size); > -+ > -+ if (!succeeded) { > -+ SDL_free(gamma_ramp_saved_vm); > -+ gamma_ramp_saved_vm = NULL; > -+ } else { > -+ return(0); > -+ } > -+ } > -+#endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ > -+ > -+ return(-1); > -+} > -+ > -+int X11_RestoreGammaRamp(_THIS) > -+{ > -+ int i; > -+ Bool succeeded; > -+ > -+#if SDL_VIDEO_DRIVER_X11_XRANDR > -+ if (use_xrandr && gamma_ramp_saved_xrr != NULL) { > -+ XRRScreenResources *resrc; > -+ > -+ if (use_xrandr >= 103) { > -+ resrc = XRRGetScreenResourcesCurrent(SDL_Display, > SDL_Root); > -+ } else { > -+ resrc = XRRGetScreenResources(SDL_Display, SDL_Root); > -+ } > -+ > -+ for ( i=0; resrc != NULL && i<resrc->ncrtc && > i<gamma_ramp_saved_xrr_size; ++i ) { > -+ XRRSetCrtcGamma(SDL_Display, resrc->crtcs[i], > -+ gamma_ramp_saved_xrr[i]); > -+ } > -+ > -+ if (resrc != NULL) { > -+ XRRFreeScreenResources(resrc); > -+ return(0); > -+ } > -+ } > -+#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ > -+ > -+#if SDL_VIDEO_DRIVER_X11_VIDMODE > -+ if (use_vidmode >= 200 && gamma_ramp_saved_vm != NULL) { > -+ succeeded = SDL_NAME(XF86VidModeSetGammaRamp)( > -+ SDL_Display, SDL_Screen, > -+ gamma_ramp_size, > -+ gamma_ramp_saved_vm + 0*gamma_ramp_size, > -+ gamma_ramp_saved_vm + 1*gamma_ramp_size, > -+ gamma_ramp_saved_vm + 2*gamma_ramp_size); > -+ > -+ if (succeeded) > -+ return(0); > -+ } > -+#endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ > -+ > -+ return(-1); > -+} > -+ > - int X11_SetGammaRamp(_THIS, Uint16 *ramp) > - { > -- int i, ncolors; > -+ int i, j, ncolors; > - XColor xcmap[256]; > -+ Bool succeeded; > - > -+#if SDL_VIDEO_DRIVER_X11_XRANDR > -+ if (use_xrandr) { > -+ XRRCrtcGamma *gamma = NULL; > -+ int gammasize = 0; > -+ XRRScreenResources *resrc; > -+ > -+ if (use_xrandr >= 103) { > -+ resrc = XRRGetScreenResourcesCurrent(SDL_Display, > SDL_Root); > -+ } else { > -+ resrc = XRRGetScreenResources(SDL_Display, SDL_Root); > -+ } > -+ > -+ /* Implementation Note: > -+ * We try to make few assumptions here, notably: > -+ * - Ramp size can vary between crtcs > -+ * (which can happen when using multiple video cards) > -+ * - Ramp size (by index) can vary between calls > -+ * (which can happen if the window is moved to a new crtc) > -+ */ > -+ for ( i=0; resrc != NULL && i<resrc->ncrtc; ++i ) { > -+ int crtcgs; > -+ > -+ crtcgs = XRRGetCrtcGammaSize(SDL_Display, > -+ resrc->crtcs[i]); > -+ if (crtcgs != gammasize) { > -+ /* Size in this CRTC differs from last */ > -+ if (gamma != NULL) { > -+ XRRFreeGamma(gamma); > -+ } > -+ > -+ gammasize = crtcgs; > -+ gamma = XRRAllocGamma(gammasize); > -+ > -+ for ( j=0; j<gammasize; ++j ) { > -+ gamma->red[j] = > -+ ramp[0*256+j*256/gammasize]; > -+ gamma->green[j] = > -+ ramp[1*256+j*256/gammasize]; > -+ gamma->blue[j] = > -+ ramp[2*256+j*256/gammasize]; > -+ } > -+ } > -+ > -+ XRRSetCrtcGamma(SDL_Display, resrc->crtcs[i], gamma); > -+ } > -+ > -+ if (gamma != NULL) { > -+ XRRFreeGamma(gamma); > -+ } > -+ > -+ if (resrc != NULL) { > -+ XRRFreeScreenResources(resrc); > -+ return(0); > -+ } > -+ } > -+#endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ > -+ > -+#if SDL_VIDEO_DRIVER_X11_VIDMODE > -+ if (use_vidmode >= 200 && gamma_ramp_size == 0) { > -+ succeeded = SDL_NAME(XF86VidModeGetGammaRampSize)( > -+ SDL_Display, SDL_Screen, > -+ &gamma_ramp_size); > -+ > -+ if (!succeeded) { > -+ gamma_ramp_size = 0; > -+ } > -+ } > -+ > -+ if (use_vidmode >= 200 && gamma_ramp_size > 0) { > -+ Uint16 *sizedramp; > -+ > -+ if (gamma_ramp_size == 256) { > -+ sizedramp = ramp; > -+ } else { > -+ sizedramp = SDL_stack_alloc(Uint16, > 3*gamma_ramp_size); > -+ if (sizedramp == NULL) { > -+ SDL_OutOfMemory(); > -+ return(-1); > -+ } > -+ > -+ for ( i=0; i<gamma_ramp_size*3; ++i ) { > -+ sizedramp[i] = ramp[i * 256 / > gamma_ramp_size]; > -+ } > -+ } > -+ > -+ succeeded = SDL_NAME(XF86VidModeSetGammaRamp)( > -+ SDL_Display, SDL_Screen, > -+ gamma_ramp_size, > -+ sizedramp+0*256, > -+ sizedramp+1*256, > -+ sizedramp+2*256); > -+ > -+ if (gamma_ramp_size != 256) { > -+ SDL_stack_free(sizedramp); > -+ } > -+ > -+ return(succeeded ? 0 : -1); > -+ } > -+#endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ > -+ > - /* See if actually setting the gamma is supported */ > - if ( SDL_Visual->class != DirectColor ) { > - SDL_SetError("Gamma correction not supported on this visual"); > -@@ -1504,7 +1746,9 @@ void X11_VideoQuit(_THIS) > - /* Restore gamma settings if they've changed */ > - if ( SDL_GetAppState() & SDL_APPACTIVE ) { > - X11_SwapVidModeGamma(this); > -+ X11_RestoreGammaRamp(this); > - } > -+ X11_FreeSavedGammaRamp(this); > - > - /* Restore DPMS and screensaver settings */ > - X11_RestoreScreenSaver(this, SDL_Display, > screensaver_timeout, dpms_enabled); > Index: patches/patch-src_video_x11_SDL_x11video_h > =================================================================== > RCS file: patches/patch-src_video_x11_SDL_x11video_h > diff -N patches/patch-src_video_x11_SDL_x11video_h > --- patches/patch-src_video_x11_SDL_x11video_h 13 May 2011 07:57:24 -0000 > 1.1 > +++ /dev/null 1 Jan 1970 00:00:00 -0000 > @@ -1,37 +0,0 @@ > -$OpenBSD: patch-src_video_x11_SDL_x11video_h,v 1.1 2011/05/13 07:57:24 > jasper Exp $ > - > -Add support for XRandR and VidMode gamma ramps. > -From upstream bz: http://bugzilla.libsdl.org/show_bug.cgi?id=971 > - > -Will not be part of SDL 1.3 to gamma API removal. > - > ---- src/video/x11/SDL_x11video.h.orig Mon Dec 31 05:48:13 2007 > -+++ src/video/x11/SDL_x11video.h Tue May 3 15:12:12 2011 > -@@ -122,12 +122,16 @@ struct SDL_PrivateVideoData { > - XRRScreenConfiguration* screen_config; > - int saved_size_id; > - Rotation saved_rotation; > -+ XRRCrtcGamma** gamma_ramp_saved_xrr; > -+ int gamma_ramp_saved_xrr_size; > - #endif > - #if SDL_VIDEO_DRIVER_X11_VIDMODE > - SDL_NAME(XF86VidModeModeInfo) saved_mode; > - struct { > - int x, y; > - } saved_view; > -+ int gamma_ramp_size; > -+ Uint16* gamma_ramp_saved_vm; > - #endif > - #if SDL_VIDEO_DRIVER_X11_XME /* XiG XME fullscreen */ > - XiGMiscResolutionInfo saved_res; > -@@ -188,6 +192,10 @@ struct SDL_PrivateVideoData { > - #define mouse_accel (this->hidden->mouse_accel) > - #define mouse_relative (this->hidden->mouse_relative) > - #define SDL_modelist (this->hidden->modelist) > -+#define gamma_ramp_size (this->hidden->gamma_ramp_size) > -+#define gamma_ramp_saved_vm (this->hidden->gamma_ramp_saved_vm) > -+#define gamma_ramp_saved_xrr (this->hidden->gamma_ramp_saved_xrr) > -+#define gamma_ramp_saved_xrr_size > (this->hidden->gamma_ramp_saved_xrr_size) > - #define xinerama_info (this->hidden->xinerama_info) > - #define saved_mode (this->hidden->saved_mode) > - #define saved_view (this->hidden->saved_view) > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. >