From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pekka Paalanen Subject: Re: [PATCH] Prevent zero sized wl_egl_window Date: Fri, 14 Feb 2014 09:31:45 +0200 Message-ID: <20140214093145.7847a53f@gmail.com> References: <1392250871-3224-1-git-send-email-sinclair.yeh@intel.com> <20140213101109.5bf7cb74@gmail.com> <1392315418.3247.29.camel@syeh2-linux1.fm.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1392315418.3247.29.camel-xjpeL9Jkt2k8a1ujtQqgMq2pdiUAq4bhAL8bYrjMMd8@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: wayland-devel-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: wayland-devel-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: "Yeh, Sinclair" Cc: "dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" , "wayland-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" List-Id: dri-devel@lists.freedesktop.org On Thu, 13 Feb 2014 18:18:23 +0000 "Yeh, Sinclair" wrote: > > The below seems fine, but I wonder if we could make this one cause an > > error to be returned later where we can, rather than silently ignoring. > > I'm not sure where or how, though. > > Would it make sense to change wl_egl_window_resize() so that it return a > value? Either that, or it should be documented somewhere in the API > spec that setting width/height <=0 will be ignored. I'm not sure we can change the function signature, it's public stable ABI. > > Surely drivers have maximum size limits, too, those must be catched > > somewhere already. But this might be worth looking into: if the window system produces a bad size, what do drivers do when they cannot allocate or render to it? In X11 it's all hidden from the app, but I don't think the gfx stack can guarantee valid sizes in all cases, can it? Anyway, my suggestion is just for convenience, and if drivers already just silently do whatever on a bad size, being silent here does not make it any worse. Thanks, pq > > > > > egl_window->width = width; > > > egl_window->height = height; > > > egl_window->dx = dx; > > > @@ -24,6 +27,9 @@ wl_egl_window_create(struct wl_surface *surface, > > > { > > > struct wl_egl_window *egl_window; > > > > > > + if (width <= 0 || height <= 0) > > > + return NULL; > > > + > > > egl_window = malloc(sizeof *egl_window); > > > if (!egl_window) > > > return NULL; > > > > Thanks, > > pq > > _______________________________________________ > > wayland-devel mailing list > > wayland-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org > > http://lists.freedesktop.org/mailman/listinfo/wayland-devel >