sna: stop using obsolete type aliases
PATCH v2 1/6 sna: stop using obsolete type aliases
The Xserver has been moved to using pixman for all matrix operations, back in 2008, but left some #define's so drivers still compile. Since 1.5 decades have passed now, it's time to fix remaining drivers still using the old name, so we can drop these #define's from the Xserver includes.
--- src/sna/sna_display.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
src/sna/sna_display.c +4 -4
@@ -208,7 +208,7 @@ struct sna_crtc {bool hwcursor;bool flip_pending; -struct pict_f_transform cursor_to_fb, fb_to_cursor; +struct pixman_f_transform cursor_to_fb, fb_to_cursor;RegionRec crtc_damage;uint16_t shadow_bo_width, shadow_bo_height;
@@ -2376,7 +2376,7 @@ static bool use_shadow(struct sna *sna, xf86CrtcPtr crtc) {RRTransformPtr transform;PictTransform crtc_to_fb; -struct pict_f_transform f_crtc_to_fb, f_fb_to_crtc; +struct pixman_f_transform f_crtc_to_fb, f_fb_to_crtc;unsigned pitch_limit;BoxRec b;
@@ -2846,7 +2846,7 @@ affine_is_pixel_exact(const struct pixman_f_transform *t)static void sna_crtc_randr (xf86CrtcPtr crtc) {struct sna_crtc *sna_crtc =to_sna_crtc (crtc); -struct pict_f_transform f_crtc_to_fb, f_fb_to_crtc; +struct pixman_f_transform f_crtc_to_fb, f_fb_to_crtc;PictTransform crtc_to_fb;PictFilterPtr filter;xFixed *params;
@@ -6666,7 +6666,7 @@ sna_set_cursor_position(ScrnInfoPtr scrn, int x, int y)if (crtc->transform_in_use) {int xhot = sna->cursor.ref->bits->xhot;int yhot = sna->cursor.ref->bits->yhot; -struct pict_f_vector v, hot; +struct pixman_f_vector v, hot; v.v[0 ] = x + xhot +.5 ; v.v[1 ] = y + yhot +.5 ;
--
2.39.2
PATCH v2 2/6 sna: use GCPtr instead of GC *
Xserver includes have explicit pointer types for quite all kind of structs (at least those used by drivers), which are used all over the Xserver. Thus it's much cleaner to use those everywhere.
This commit also clears the road to fix a horrible nightmare of hacks just needed to circumvent naming clashes between Xserver and Xlib (affecting all DDXes that are painting on another Xserver): we can simply rename Xserver's own "GC" type to "GCRec" (the usual naming convention here) and so no trouble with Xlib's "GC" type anymore. Once this has landed, we're free to do that without breaking this driver.
--- src/sna/sna_accel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
src/sna/sna_accel.c +2 -2
@@ -14300,7 +14300,7 @@ static void sna_poly_fill_rect_stippled_n_box__imm(struct sna *sna, struct kgem_bo *bo, uint32_t br00, uint32_t br13, - const GC *gc, + const GCPtr gc, const BoxRec *box, const DDXPointRec *origin) {
@@ -14412,7 +14412,7 @@ sna_poly_fill_rect_stippled_n_box(struct sna *sna,struct kgem_bo *bo, struct kgem_bo **tile, uint32_t br00, uint32_t br13, - const GC *gc, + const GCPtr gc, const BoxRec *box, const DDXPointRec *origin) {
--
2.39.2
PATCH v2 3/6 backlight: use system() instead of System()
In reply to Enrico Weigelt, metux IT consultThe Xserver's System() function is a special wrapper for calling a program (xkbcomp) as an unprivileged user, when the Xserver is running as suid-root. (which today only needed on a few platforms, eg. Solaris). Therefore it's not suited for being called by arbitrary drivers.
In this specific context it doesn't even much sense, since it's just used for checking whether pkexec command is present at all (and just should be used), while the actual exec'ing of the helper is done directly by fork() and exec() syscalls.
Thus we can safely use standard system() call instead - clearing the road for dropping System() from Xserver's public/driver API.
--- src/backlight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/backlight.c +1 -1
@@ -366,7 +366,7 @@ static int __backlight_helper_init(struct backlight *b, char *iface)return 0 ;if ((st.st_mode & (S_IFREG |S_ISUID |S_IXUSR )) != (S_IFREG |S_ISUID |S_IXUSR )) { -if (System ("pkexec --version" )) +if (system ("pkexec --version" ))return 0 ; use_pkexec =1 ;
--
2.39.2
PATCH v2 4/6 intel_device: fix warning on possible buffer overlflow on sprintf() calls
In reply to Enrico Weigelt, metux IT consult--- src/intel_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/intel_device.c +1 -1
@@ -335,7 +335,7 @@ static int __intel_open_device__major_minor(int _major, int _minor)static int __intel_open_device__pci (const struct pci_device *pci) {struct stat st; -char path[256 ]; +char path[PATH_MAX ];DIR *dir;struct dirent *de;int base;
--
2.39.2
Re: [PATCH v2 4/6] intel_device: fix warning on possible buffer overlflow on sprintf() calls
On Wed, Feb 21, 2024 at 07:55:48PM +0100, Enrico Weigelt, metux IT consult wrote:
Please write an actual commit message.
Quoted 20 lines
Signed-off-by Enrico Weigelt, metux IT consult <[email protected]>--- src/intel_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/intel_device.c +1
-2@@ -335,7 +335,7 @@ static int __intel_open_device__major_minor(int _major, int _minor)static int __intel_open_device__pci (const struct pci_device *pci) {struct stat st; -char path[256 ]; +char path[PATH_MAX ];DIR *dir;struct dirent *de;int base; --2.39.2
Signature · 2 lines
Ville Syrjälä Intel
Re: [PATCH v2 4/6] intel_device: fix warning on possible buffer overlflow on sprintf() calls
In reply to Enrico Weigelt, metux IT consultQuoted 10 lines · metux IT consult
Signed-off-by Enrico Weigelt, metux IT consult <[email protected]>--- src/intel_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/intel_device.c +0
-0
src/intel_device.c static int __intel_open_device__major_minor(int _major, int _minor) · line 338
Quoted 5 lines
src/intel_device.c +1
-1@@ -335,7 +335,7 @@ static int __intel_open_device__major_minor(int _major, int _minor)static int __intel_open_device__pci (const struct pci_device *pci) {struct stat st; -char path[256 ]; +char path[PATH_MAX ];
I had a slightly different take on this in
https://patchwork.freedesktop.org/series/115348/
I suppose I should actually push that stuff...
Quoted 5 lines
src/intel_device.c +0
-1DIR *dir;struct dirent *de;int base; --2.39.2
Signature · 2 lines
Ville Syrjälä Intel
PATCH v2 5/6 stop using obsolete xf86BlockSIGIO() and xf86UnblockSIGIO()
In reply to Enrico Weigelt, metux IT consultThese are just wrappers for calling input_lock()/input_unlock() and marked deprecated for quite a while now.
--- src/sna/sna_display.c | 5 +++-- src/uxa/intel_driver.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)
src/sna/sna_display.c +3 -2
@@ -1156,11 +1156,12 @@ static inline void sigio_unblock(int was_blocked)#include <xf86_OSproc.h> static inline int sigio_block (void ) { -return xf86BlockSIGIO (); +input_lock (); +return 0 ; }static inline void sigio_unblock (int was_blocked) { -xf86UnblockSIGIO (was_blocked); +input_unlock (); }#endif
src/uxa/intel_driver.c +2 -2
@@ -641,10 +641,10 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)intel_flush (intel);if (!intel->has_prime_vmap_flush) {drm_intel_bo *bo =intel_uxa_get_pixmap_bo (PixmapDirtyPrimary (dirty)); - was_blocked =xf86BlockSIGIO (); +input_lock ();drm_intel_bo_map (bo, FALSE);drm_intel_bo_unmap (bo); -xf86UnblockSIGIO (was_blocked); +input_unlock (); }DamageRegionProcessPending (&PixmapDirtyDst (dirty)->drawable);
--
2.39.2
Re: [PATCH v2 5/6] stop using obsolete xf86BlockSIGIO() and xf86UnblockSIGIO()
Quoted 1 line · metux IT consult
These
Please spell out what "these" are.
Quoted 47 lines
are just wrappers for calling input_lock()/input_unlock() and marked deprecated for quite a while now.
Signed-off-by Enrico Weigelt, metux IT consult <[email protected]>--- src/sna/sna_display.c | 5 +++-- src/uxa/intel_driver.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)src/sna/sna_display.c +3
-2@@ -1156,11 +1156,12 @@ static inline void sigio_unblock(int was_blocked)#include <xf86_OSproc.h> static inline int sigio_block (void ) { -return xf86BlockSIGIO (); +input_lock (); +return 0 ; }static inline void sigio_unblock (int was_blocked) { -xf86UnblockSIGIO (was_blocked); +input_unlock (); }#endif src/uxa/intel_driver.c +2
-3@@ -641,10 +641,10 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)intel_flush (intel);if (!intel->has_prime_vmap_flush) {drm_intel_bo *bo =intel_uxa_get_pixmap_bo (PixmapDirtyPrimary (dirty)); - was_blocked =xf86BlockSIGIO (); +input_lock ();drm_intel_bo_map (bo, FALSE);drm_intel_bo_unmap (bo); -xf86UnblockSIGIO (was_blocked); +input_unlock (); }DamageRegionProcessPending (&PixmapDirtyDst (dirty)->drawable); --2.39.2
Signature · 2 lines
Ville Syrjälä Intel
PATCH v2 6/6 uxa: stop calling deprecated xf86_reload_cursors()
In reply to Enrico Weigelt, metux IT consultthe function has become a no-op, it's former duties are done automatically.
--- src/uxa/intel_display.c | 3 --- 1 file changed, 3 deletions(-)
src/uxa/intel_display.c +0 -3
@@ -393,9 +393,6 @@ intel_crtc_apply(xf86CrtcPtr crtc) } } -if (scrn->pScreen) -xf86_reload_cursors (scrn->pScreen); - done:free (output_ids);return ret;
--
2.39.2
Re: [PATCH v2 6/6] uxa: stop calling deprecated xf86_reload_cursors()
On Wed, Feb 21, 2024 at 07:55:50PM +0100, Enrico Weigelt, metux IT consult wrote:
<Start of the sentence missing here>
Quoted 23 lines
the function has become a no-op, it's former duties are done automatically.
Signed-off-by Enrico Weigelt, metux IT consult <[email protected]>--- src/uxa/intel_display.c | 3 --- 1 file changed, 3 deletions(-)src/uxa/intel_display.c +0
-4@@ -393,9 +393,6 @@ intel_crtc_apply(xf86CrtcPtr crtc) } } -if (scrn->pScreen) -xf86_reload_cursors (scrn->pScreen); - done:free (output_ids);return ret; --2.39.2
Signature · 2 lines
Ville Syrjälä Intel
Patchwork
CI✗ Fi.CI.BUILD: failure for series starting with [v2,1/6] sna: stop using obsolete type aliases
In reply to Enrico Weigelt, metux IT consult== Series Details ==
== Series Details ==
Series: series starting with [v2,1/6] sna: stop using obsolete type aliases
URL : https://patchwork.freedesktop.org/series/130225/
State : failure
== Summary ==
Error: patch https://patchwork.freedesktop.org/api/1.0/series/130225/revisions/1/mbox/ not applied
Applying: sna: stop using obsolete type aliases
error: sha1 information is lacking or useless (src/sna/sna_display.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 sna: stop using obsolete type aliases
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Build failed, no error log produced
Quoted 2 lines · metux IT consult
The Xserver has been moved to using pixman for all matrix operations, back in 2008, but left some #define's so drivers still compile.
Reference to the actual commit would help.
Quoted 51 lines
Since 1.5 decades have
passed now, it's time to fix remaining drivers still using the old name, so we can drop these #define's from the Xserver includes.Signed-off-by Enrico Weigelt, metux IT consult <[email protected]>--- src/sna/sna_display.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)src/sna/sna_display.c +4
-5@@ -208,7 +208,7 @@ struct sna_crtc {bool hwcursor;bool flip_pending; -struct pict_f_transform cursor_to_fb, fb_to_cursor; +struct pixman_f_transform cursor_to_fb, fb_to_cursor;RegionRec crtc_damage;uint16_t shadow_bo_width, shadow_bo_height;@@ -2376,7 +2376,7 @@ static bool use_shadow(struct sna *sna, xf86CrtcPtr crtc) {RRTransformPtr transform;PictTransform crtc_to_fb; -struct pict_f_transform f_crtc_to_fb, f_fb_to_crtc; +struct pixman_f_transform f_crtc_to_fb, f_fb_to_crtc;unsigned pitch_limit;BoxRec b;@@ -2846,7 +2846,7 @@ affine_is_pixel_exact(const struct pixman_f_transform *t)static void sna_crtc_randr (xf86CrtcPtr crtc) {struct sna_crtc *sna_crtc =to_sna_crtc (crtc); -struct pict_f_transform f_crtc_to_fb, f_fb_to_crtc; +struct pixman_f_transform f_crtc_to_fb, f_fb_to_crtc;PictTransform crtc_to_fb;PictFilterPtr filter;xFixed *params;@@ -6666,7 +6666,7 @@ sna_set_cursor_position(ScrnInfoPtr scrn, int x, int y)if (crtc->transform_in_use) {int xhot = sna->cursor.ref->bits->xhot;int yhot = sna->cursor.ref->bits->yhot; -struct pict_f_vector v, hot; +struct pixman_f_vector v, hot; v.v[0 ] = x + xhot +.5 ; v.v[1 ] = y + yhot +.5 ; --2.39.2
Signature · 2 lines
Ville Syrjälä Intel