[PATCH xserver 2/3] modesetting/drmmode: Use glamor_pixmap_from_fds
Emil Velikov
emil.l.velikov at gmail.com
Mon Mar 26 15:11:38 UTC 2018
On 23 March 2018 at 13:50, Daniel Stone <daniels at collabora.com> wrote:
> glamor_pixmap_from_fds saves us the trouble of creating the pixmap and
> dealing with its header ourselves; instead we pass the whole thing off
> to Glamor.
>
> This requires us to provide FDs rather than handles for the import, but
> Glamor was already doing that internally, so no functional change.
>
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> ---
> hw/xfree86/drivers/modesetting/drmmode_display.c | 52 +++++++++++++++++++-----
> 1 file changed, 42 insertions(+), 10 deletions(-)
>
> diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
> index 4b22abd0f..39ed16f98 100644
> --- a/hw/xfree86/drivers/modesetting/drmmode_display.c
> +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
> @@ -30,6 +30,7 @@
> #endif
>
> #include <errno.h>
> +#include <fcntl.h>
> #include <sys/ioctl.h>
> #include <sys/mman.h>
> #include <unistd.h>
> @@ -1058,6 +1059,21 @@ drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
> drmmode_crtc->dpms_mode = mode;
> }
>
> +static int
> +handles_to_fds(drmmode_ptr drmmode, uint32_t *handles, int *fds)
Nit: Although uncommon in the xserver codebase, I can use uint32_t
handles[4] ;-)
> +{
> + int err;
> + int i;
> +
> + for (i = 0; i < 4 && handles[i]; i++) {
> + err = drmPrimeHandleToFD(drmmode->fd, handles[i], O_CLOEXEC, &fds[i]);
> + if (err != 0)
> + return 0;
Close the existing fds ones on error?
With the fd leak plugged (regardless of the nit)
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
Aside: there's plenty of duplication in the area + some partial depth
<> format mappings.
-Emil
More information about the xorg-devel
mailing list