2003-11-14 16:48:57 +00:00
|
|
|
/*
|
2004-12-04 00:43:13 +00:00
|
|
|
* Copyright © 2002 Keith Packard
|
2003-11-14 16:48:57 +00:00
|
|
|
*
|
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
|
* documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
|
* the above copyright notice appear in all copies and that both that
|
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
|
|
|
|
* documentation, and that the name of Keith Packard not be used in
|
|
|
|
|
* advertising or publicity pertaining to distribution of the software without
|
|
|
|
|
* specific, written prior permission. Keith Packard makes no
|
|
|
|
|
* representations about the suitability of this software for any purpose. It
|
|
|
|
|
* is provided "as is" without express or implied warranty.
|
|
|
|
|
*
|
|
|
|
|
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
|
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
|
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
2005-07-03 07:02:09 +00:00
|
|
|
#include <dix-config.h>
|
|
|
|
|
|
2024-03-07 14:20:05 +01:00
|
|
|
#define XK_LATIN1
|
|
|
|
|
#include <X11/keysymdef.h>
|
|
|
|
|
|
2025-09-03 13:35:03 +02:00
|
|
|
#include "dix/screenint_priv.h"
|
|
|
|
|
|
2005-07-03 08:53:54 +00:00
|
|
|
#include "misc.h"
|
2003-11-14 16:48:57 +00:00
|
|
|
#include "scrnintstr.h"
|
2005-07-03 08:53:54 +00:00
|
|
|
#include "os.h"
|
2003-11-14 16:48:57 +00:00
|
|
|
#include "regionstr.h"
|
|
|
|
|
#include "validate.h"
|
|
|
|
|
#include "windowstr.h"
|
|
|
|
|
#include "input.h"
|
|
|
|
|
#include "resource.h"
|
|
|
|
|
#include "cursorstr.h"
|
|
|
|
|
#include "dixstruct.h"
|
|
|
|
|
#include "gcstruct.h"
|
|
|
|
|
#include "servermd.h"
|
|
|
|
|
#include "picturestr.h"
|
|
|
|
|
|
|
|
|
|
static char **filterNames;
|
|
|
|
|
static int nfilterNames;
|
|
|
|
|
|
2024-03-07 14:20:05 +01:00
|
|
|
/*
|
|
|
|
|
* ISO Latin-1 case conversion routine
|
|
|
|
|
*
|
|
|
|
|
* this routine always null-terminates the result, so
|
|
|
|
|
* beware of too-small buffers
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static unsigned char
|
|
|
|
|
ISOLatin1ToLower(unsigned char source)
|
|
|
|
|
{
|
|
|
|
|
unsigned char dest;
|
|
|
|
|
|
|
|
|
|
if ((source >= XK_A) && (source <= XK_Z))
|
|
|
|
|
dest = source + (XK_a - XK_A);
|
|
|
|
|
else if ((source >= XK_Agrave) && (source <= XK_Odiaeresis))
|
|
|
|
|
dest = source + (XK_agrave - XK_Agrave);
|
|
|
|
|
else if ((source >= XK_Ooblique) && (source <= XK_Thorn))
|
|
|
|
|
dest = source + (XK_oslash - XK_Ooblique);
|
|
|
|
|
else
|
|
|
|
|
dest = source;
|
|
|
|
|
return dest;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
CompareISOLatin1Lowered(const unsigned char *s1, int s1len,
|
|
|
|
|
const unsigned char *s2, int s2len)
|
|
|
|
|
{
|
|
|
|
|
unsigned char c1, c2;
|
|
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
|
/* note -- compare against zero so that -1 ignores len */
|
|
|
|
|
c1 = s1len-- ? *s1++ : '\0';
|
|
|
|
|
c2 = s2len-- ? *s2++ : '\0';
|
|
|
|
|
if (!c1 ||
|
|
|
|
|
(c1 != c2 &&
|
|
|
|
|
(c1 = ISOLatin1ToLower(c1)) != (c2 = ISOLatin1ToLower(c2))))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return (int) c1 - (int) c2;
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-29 18:37:54 +00:00
|
|
|
/*
|
|
|
|
|
* standard but not required filters don't have constant indices
|
|
|
|
|
*/
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
|
|
|
int
|
2011-11-04 23:21:34 -07:00
|
|
|
PictureGetFilterId(const char *filter, int len, Bool makeit)
|
2003-11-14 16:48:57 +00:00
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
char **names;
|
|
|
|
|
|
|
|
|
|
if (len < 0)
|
|
|
|
|
len = strlen(filter);
|
|
|
|
|
for (i = 0; i < nfilterNames; i++)
|
2011-12-12 16:49:34 -08:00
|
|
|
if (!CompareISOLatin1Lowered((const unsigned char *) filterNames[i], -1,
|
|
|
|
|
(const unsigned char *) filter, len))
|
2003-11-14 16:48:57 +00:00
|
|
|
return i;
|
|
|
|
|
if (!makeit)
|
|
|
|
|
return -1;
|
2025-04-10 19:45:12 +02:00
|
|
|
char *name = calloc(1, len + 1);
|
2003-11-14 16:48:57 +00:00
|
|
|
if (!name)
|
|
|
|
|
return -1;
|
2004-07-29 18:37:54 +00:00
|
|
|
memcpy(name, filter, len);
|
2003-11-14 16:48:57 +00:00
|
|
|
name[len] = '\0';
|
|
|
|
|
if (filterNames)
|
2015-03-21 13:42:12 -07:00
|
|
|
names = reallocarray(filterNames, nfilterNames + 1, sizeof(char *));
|
2003-11-14 16:48:57 +00:00
|
|
|
else
|
2025-04-10 19:45:12 +02:00
|
|
|
names = calloc(1, sizeof(char *));
|
2003-11-14 16:48:57 +00:00
|
|
|
if (!names) {
|
2010-05-06 01:44:06 +07:00
|
|
|
free(name);
|
2003-11-14 16:48:57 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
filterNames = names;
|
|
|
|
|
i = nfilterNames++;
|
|
|
|
|
filterNames[i] = name;
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
|
PictureSetDefaultIds(void)
|
|
|
|
|
{
|
|
|
|
|
/* careful here -- this list must match the #define values */
|
2005-06-13 14:40:25 +00:00
|
|
|
|
2003-11-14 16:48:57 +00:00
|
|
|
if (PictureGetFilterId(FilterNearest, -1, TRUE) != PictFilterNearest)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (PictureGetFilterId(FilterBilinear, -1, TRUE) != PictFilterBilinear)
|
|
|
|
|
return FALSE;
|
2005-06-13 14:40:25 +00:00
|
|
|
|
2003-11-14 16:48:57 +00:00
|
|
|
if (PictureGetFilterId(FilterFast, -1, TRUE) != PictFilterFast)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (PictureGetFilterId(FilterGood, -1, TRUE) != PictFilterGood)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (PictureGetFilterId(FilterBest, -1, TRUE) != PictFilterBest)
|
|
|
|
|
return FALSE;
|
2005-06-13 14:40:25 +00:00
|
|
|
|
|
|
|
|
if (PictureGetFilterId(FilterConvolution, -1, TRUE) !=
|
|
|
|
|
PictFilterConvolution)
|
|
|
|
|
return FALSE;
|
2003-11-14 16:48:57 +00:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
|
|
|
char *
|
2003-11-14 16:48:57 +00:00
|
|
|
PictureGetFilterName(int id)
|
|
|
|
|
{
|
|
|
|
|
if (0 <= id && id < nfilterNames)
|
|
|
|
|
return filterNames[id];
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
PictureFreeFilterIds(void)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nfilterNames; i++)
|
2010-05-06 01:44:06 +07:00
|
|
|
free(filterNames[i]);
|
|
|
|
|
free(filterNames);
|
2003-11-14 16:48:57 +00:00
|
|
|
nfilterNames = 0;
|
|
|
|
|
filterNames = 0;
|
|
|
|
|
}
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
|
|
|
int
|
2004-07-29 18:37:54 +00:00
|
|
|
PictureAddFilter(ScreenPtr pScreen,
|
2011-11-04 23:21:34 -07:00
|
|
|
const char *filter,
|
2008-03-17 15:19:17 -07:00
|
|
|
PictFilterValidateParamsProcPtr ValidateParams,
|
|
|
|
|
int width, int height)
|
2003-11-14 16:48:57 +00:00
|
|
|
{
|
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
|
int id = PictureGetFilterId(filter, -1, TRUE);
|
|
|
|
|
int i;
|
|
|
|
|
PictFilterPtr filters;
|
|
|
|
|
|
|
|
|
|
if (id < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
/*
|
|
|
|
|
* It's an error to attempt to reregister a filter
|
|
|
|
|
*/
|
|
|
|
|
for (i = 0; i < ps->nfilters; i++)
|
|
|
|
|
if (ps->filters[i].id == id)
|
|
|
|
|
return -1;
|
|
|
|
|
if (ps->filters)
|
2010-05-06 01:44:06 +07:00
|
|
|
filters =
|
2015-03-21 13:42:12 -07:00
|
|
|
reallocarray(ps->filters, ps->nfilters + 1, sizeof(PictFilterRec));
|
2003-11-14 16:48:57 +00:00
|
|
|
else
|
2025-04-10 19:45:12 +02:00
|
|
|
filters = calloc(1, sizeof(PictFilterRec));
|
2003-11-14 16:48:57 +00:00
|
|
|
if (!filters)
|
|
|
|
|
return -1;
|
|
|
|
|
ps->filters = filters;
|
|
|
|
|
i = ps->nfilters++;
|
|
|
|
|
ps->filters[i].name = PictureGetFilterName(id);
|
|
|
|
|
ps->filters[i].id = id;
|
2004-07-29 18:37:54 +00:00
|
|
|
ps->filters[i].ValidateParams = ValidateParams;
|
2008-03-17 15:19:17 -07:00
|
|
|
ps->filters[i].width = width;
|
|
|
|
|
ps->filters[i].height = height;
|
2003-11-14 16:48:57 +00:00
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
|
|
|
Bool
|
2011-11-04 23:21:34 -07:00
|
|
|
PictureSetFilterAlias(ScreenPtr pScreen, const char *filter, const char *alias)
|
2003-11-14 16:48:57 +00:00
|
|
|
{
|
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
|
int filter_id = PictureGetFilterId(filter, -1, FALSE);
|
|
|
|
|
int alias_id = PictureGetFilterId(alias, -1, TRUE);
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (filter_id < 0 || alias_id < 0)
|
|
|
|
|
return FALSE;
|
|
|
|
|
for (i = 0; i < ps->nfilterAliases; i++)
|
|
|
|
|
if (ps->filterAliases[i].alias_id == alias_id)
|
|
|
|
|
break;
|
|
|
|
|
if (i == ps->nfilterAliases) {
|
|
|
|
|
PictFilterAliasPtr aliases;
|
2012-03-21 12:55:09 -07:00
|
|
|
|
2003-11-14 16:48:57 +00:00
|
|
|
if (ps->filterAliases)
|
2015-03-21 13:42:12 -07:00
|
|
|
aliases = reallocarray(ps->filterAliases,
|
|
|
|
|
ps->nfilterAliases + 1,
|
|
|
|
|
sizeof(PictFilterAliasRec));
|
2003-11-14 16:48:57 +00:00
|
|
|
else
|
2025-04-10 19:45:12 +02:00
|
|
|
aliases = calloc(1, sizeof(PictFilterAliasRec));
|
2003-11-14 16:48:57 +00:00
|
|
|
if (!aliases)
|
|
|
|
|
return FALSE;
|
|
|
|
|
ps->filterAliases = aliases;
|
|
|
|
|
ps->filterAliases[i].alias = PictureGetFilterName(alias_id);
|
|
|
|
|
ps->filterAliases[i].alias_id = alias_id;
|
|
|
|
|
ps->nfilterAliases++;
|
|
|
|
|
}
|
|
|
|
|
ps->filterAliases[i].filter_id = filter_id;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
|
|
|
PictFilterPtr
|
2003-11-14 16:48:57 +00:00
|
|
|
PictureFindFilter(ScreenPtr pScreen, char *name, int len)
|
|
|
|
|
{
|
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
|
int id = PictureGetFilterId(name, len, FALSE);
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (id < 0)
|
|
|
|
|
return 0;
|
|
|
|
|
/* Check for an alias, allow them to recurse */
|
|
|
|
|
for (i = 0; i < ps->nfilterAliases; i++)
|
|
|
|
|
if (ps->filterAliases[i].alias_id == id) {
|
|
|
|
|
id = ps->filterAliases[i].filter_id;
|
|
|
|
|
i = 0;
|
|
|
|
|
}
|
|
|
|
|
/* find the filter */
|
|
|
|
|
for (i = 0; i < ps->nfilters; i++)
|
|
|
|
|
if (ps->filters[i].id == id)
|
|
|
|
|
return &ps->filters[i];
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-13 14:40:25 +00:00
|
|
|
static Bool
|
2008-03-14 13:46:30 -07:00
|
|
|
convolutionFilterValidateParams(ScreenPtr pScreen,
|
2005-06-13 14:40:25 +00:00
|
|
|
int filter,
|
|
|
|
|
xFixed * params,
|
2008-03-17 15:19:17 -07:00
|
|
|
int nparams, int *width, int *height)
|
2005-06-13 14:40:25 +00:00
|
|
|
{
|
2008-03-17 15:19:17 -07:00
|
|
|
int w, h;
|
2012-03-21 12:55:09 -07:00
|
|
|
|
2005-06-13 14:40:25 +00:00
|
|
|
if (nparams < 3)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (xFixedFrac(params[0]) || xFixedFrac(params[1]))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2008-03-17 15:19:17 -07:00
|
|
|
w = xFixedToInt(params[0]);
|
|
|
|
|
h = xFixedToInt(params[1]);
|
|
|
|
|
|
2005-06-13 14:40:25 +00:00
|
|
|
nparams -= 2;
|
2008-03-17 15:19:17 -07:00
|
|
|
if (w * h > nparams)
|
2005-06-13 14:40:25 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
2008-03-17 15:19:17 -07:00
|
|
|
*width = w;
|
|
|
|
|
*height = h;
|
2005-06-13 14:40:25 +00:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
|
|
|
Bool
|
2003-11-14 16:48:57 +00:00
|
|
|
PictureSetDefaultFilters(ScreenPtr pScreen)
|
|
|
|
|
{
|
|
|
|
|
if (!filterNames)
|
|
|
|
|
if (!PictureSetDefaultIds())
|
|
|
|
|
return FALSE;
|
2008-03-17 15:19:17 -07:00
|
|
|
if (PictureAddFilter(pScreen, FilterNearest, 0, 1, 1) < 0)
|
2003-11-14 16:48:57 +00:00
|
|
|
return FALSE;
|
2008-03-17 16:13:25 -07:00
|
|
|
if (PictureAddFilter(pScreen, FilterBilinear, 0, 2, 2) < 0)
|
2003-11-14 16:48:57 +00:00
|
|
|
return FALSE;
|
2012-03-21 12:55:09 -07:00
|
|
|
|
2003-11-14 16:48:57 +00:00
|
|
|
if (!PictureSetFilterAlias(pScreen, FilterNearest, FilterFast))
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (!PictureSetFilterAlias(pScreen, FilterBilinear, FilterGood))
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (!PictureSetFilterAlias(pScreen, FilterBilinear, FilterBest))
|
|
|
|
|
return FALSE;
|
2012-03-21 12:55:09 -07:00
|
|
|
|
2008-03-17 15:19:17 -07:00
|
|
|
if (PictureAddFilter
|
|
|
|
|
(pScreen, FilterConvolution, convolutionFilterValidateParams, 0, 0) < 0)
|
2005-06-13 14:40:25 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
2003-11-14 16:48:57 +00:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
|
|
|
void
|
2003-11-14 16:48:57 +00:00
|
|
|
PictureResetFilters(ScreenPtr pScreen)
|
|
|
|
|
{
|
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
|
|
2010-05-06 01:44:06 +07:00
|
|
|
free(ps->filters);
|
|
|
|
|
free(ps->filterAliases);
|
2012-08-07 17:49:46 -07:00
|
|
|
|
|
|
|
|
/* Free the filters when the last screen is closed */
|
|
|
|
|
if (pScreen->myNum == 0)
|
|
|
|
|
PictureFreeFilterIds();
|
2003-11-14 16:48:57 +00:00
|
|
|
}
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
|
|
|
int
|
2003-11-14 16:48:57 +00:00
|
|
|
SetPictureFilter(PicturePtr pPicture, char *name, int len, xFixed * params,
|
|
|
|
|
int nparams)
|
|
|
|
|
{
|
2006-06-30 12:03:47 +02:00
|
|
|
PictFilterPtr pFilter;
|
2008-03-14 13:46:30 -07:00
|
|
|
ScreenPtr pScreen;
|
2006-06-30 12:03:47 +02:00
|
|
|
|
2008-03-14 13:46:30 -07:00
|
|
|
if (pPicture->pDrawable != NULL)
|
|
|
|
|
pScreen = pPicture->pDrawable->pScreen;
|
|
|
|
|
else
|
treewide: rename dixGetFirstScreenPtr() to dixGetMasterScreen() for correct semantics
In Xinerama/Panoramix configuration there's one screen that's having special
meaning - it's used for simulating as the frontend for all client operations:
the clients (should) only talk to that screen, while panoramix subsystem is
proxying those operations to all the other screens (with certain changed
applied, eg. coordinate transformations).
Historically, this screen happens to be the first one in the system (some of
it's proc's are hooked up in order to achieve desired behaviour). That's why it
used to be accessed via screenInfo.screens[0] - that already had been encapsulated
into a tiny helper `dixGetFirstScreen()`.
a) the correct terminus technicus for a situation where one device (or SW entity)
entirely controlling others is a master-slave-relationship: the controlling
device/entity is `master`, the controlled ones are `slave` (to that specific
master).
b) the term "first screen" is inacurate and misleading here: what the caller's are
actually interest in isn't the first entry in the screen array, but the screen
that's controlling the others. With upcoming refactoring of the Xinerama/Panoramix
subsystem, this might well be a different array index than 0.
c) the term `default` also wouldn't match: `default` implies there's a real practical
choice, and such value applies when no explicit choice has been made. But in this
case, it practically doesn't make sense (except perhaps for debugging purpose)
for a client to use any different screen.
Therefore fixing the function name to the correct technical terminology.
(for sake of patch readability, renaming corresponding variables is left to
subsequent patches).
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-11 16:50:43 +02:00
|
|
|
pScreen = dixGetMasterScreen();
|
2008-03-14 13:46:30 -07:00
|
|
|
|
|
|
|
|
pFilter = PictureFindFilter(pScreen, name, len);
|
|
|
|
|
|
|
|
|
|
if (!pFilter)
|
|
|
|
|
return BadName;
|
2012-03-21 12:55:09 -07:00
|
|
|
|
2008-03-14 13:46:30 -07:00
|
|
|
if (pPicture->pDrawable == NULL) {
|
2006-07-03 19:22:26 +02:00
|
|
|
/* For source pictures, the picture isn't tied to a screen. So, ensure
|
|
|
|
|
* that all screens can handle a filter we set for the picture.
|
|
|
|
|
*/
|
2025-08-11 09:53:01 +02:00
|
|
|
DIX_FOR_EACH_SCREEN({
|
|
|
|
|
if (!walkScreenIdx)
|
|
|
|
|
continue; // skip the first screen
|
|
|
|
|
|
2025-09-03 16:28:37 +02:00
|
|
|
PictFilterPtr pScreenFilter = PictureFindFilter(walkScreen, name, len);
|
2008-03-14 13:46:30 -07:00
|
|
|
if (!pScreenFilter || pScreenFilter->id != pFilter->id)
|
2006-07-03 19:22:26 +02:00
|
|
|
return BadMatch;
|
2025-08-11 09:53:01 +02:00
|
|
|
});
|
2006-06-30 12:03:47 +02:00
|
|
|
}
|
2008-03-14 13:46:30 -07:00
|
|
|
return SetPicturePictFilter(pPicture, pFilter, params, nparams);
|
|
|
|
|
}
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
|
|
|
int
|
2008-03-14 13:46:30 -07:00
|
|
|
SetPicturePictFilter(PicturePtr pPicture, PictFilterPtr pFilter,
|
|
|
|
|
xFixed * params, int nparams)
|
|
|
|
|
{
|
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (pPicture->pDrawable)
|
|
|
|
|
pScreen = pPicture->pDrawable->pScreen;
|
|
|
|
|
else
|
treewide: rename dixGetFirstScreenPtr() to dixGetMasterScreen() for correct semantics
In Xinerama/Panoramix configuration there's one screen that's having special
meaning - it's used for simulating as the frontend for all client operations:
the clients (should) only talk to that screen, while panoramix subsystem is
proxying those operations to all the other screens (with certain changed
applied, eg. coordinate transformations).
Historically, this screen happens to be the first one in the system (some of
it's proc's are hooked up in order to achieve desired behaviour). That's why it
used to be accessed via screenInfo.screens[0] - that already had been encapsulated
into a tiny helper `dixGetFirstScreen()`.
a) the correct terminus technicus for a situation where one device (or SW entity)
entirely controlling others is a master-slave-relationship: the controlling
device/entity is `master`, the controlled ones are `slave` (to that specific
master).
b) the term "first screen" is inacurate and misleading here: what the caller's are
actually interest in isn't the first entry in the screen array, but the screen
that's controlling the others. With upcoming refactoring of the Xinerama/Panoramix
subsystem, this might well be a different array index than 0.
c) the term `default` also wouldn't match: `default` implies there's a real practical
choice, and such value applies when no explicit choice has been made. But in this
case, it practically doesn't make sense (except perhaps for debugging purpose)
for a client to use any different screen.
Therefore fixing the function name to the correct technical terminology.
(for sake of patch readability, renaming corresponding variables is left to
subsequent patches).
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-11 16:50:43 +02:00
|
|
|
pScreen = dixGetMasterScreen();
|
2012-03-21 12:55:09 -07:00
|
|
|
|
2004-07-29 18:37:54 +00:00
|
|
|
if (pFilter->ValidateParams) {
|
2008-03-17 15:19:17 -07:00
|
|
|
int width, height;
|
2003-11-14 16:48:57 +00:00
|
|
|
|
2008-03-17 15:19:17 -07:00
|
|
|
if (!(*pFilter->ValidateParams)
|
|
|
|
|
(pScreen, pFilter->id, params, nparams, &width, &height))
|
2004-07-29 18:37:54 +00:00
|
|
|
return BadMatch;
|
|
|
|
|
}
|
|
|
|
|
else if (nparams)
|
2003-11-14 16:48:57 +00:00
|
|
|
return BadMatch;
|
2012-03-21 12:55:09 -07:00
|
|
|
|
2004-07-29 18:37:54 +00:00
|
|
|
if (nparams != pPicture->filter_nparams) {
|
2025-02-24 12:15:01 +01:00
|
|
|
xFixed *new_params = calloc(nparams, sizeof(xFixed));
|
2012-03-21 12:55:09 -07:00
|
|
|
|
2008-07-22 17:34:37 -07:00
|
|
|
if (!new_params && nparams)
|
2003-11-14 16:48:57 +00:00
|
|
|
return BadAlloc;
|
2010-05-06 01:44:06 +07:00
|
|
|
free(pPicture->filter_params);
|
2003-11-14 16:48:57 +00:00
|
|
|
pPicture->filter_params = new_params;
|
2004-07-29 18:37:54 +00:00
|
|
|
pPicture->filter_nparams = nparams;
|
2003-11-14 16:48:57 +00:00
|
|
|
}
|
|
|
|
|
for (i = 0; i < nparams; i++)
|
2025-05-06 19:02:29 +02:00
|
|
|
if (pPicture->filter_params)
|
|
|
|
|
pPicture->filter_params[i] = params[i];
|
2003-11-14 16:48:57 +00:00
|
|
|
pPicture->filter = pFilter->id;
|
2005-12-28 11:48:14 +00:00
|
|
|
|
2008-03-14 13:46:30 -07:00
|
|
|
if (pPicture->pDrawable) {
|
|
|
|
|
PictureScreenPtr ps = GetPictureScreen(pScreen);
|
|
|
|
|
int result;
|
2006-06-30 12:03:47 +02:00
|
|
|
|
|
|
|
|
result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter,
|
|
|
|
|
params, nparams);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2003-11-14 16:48:57 +00:00
|
|
|
return Success;
|
|
|
|
|
}
|