mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
cursor: Add an explicit getter for the gbm device
We want to move this to a new MetaCursorRenderer class.
This commit is contained in:
parent
adf0d08585
commit
18770aaa63
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <meta/meta-cursor-tracker.h>
|
#include <meta/meta-cursor-tracker.h>
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
|
#include <gbm.h>
|
||||||
|
|
||||||
#include "meta-cursor.h"
|
#include "meta-cursor.h"
|
||||||
|
|
||||||
@ -93,4 +94,6 @@ void meta_cursor_tracker_paint (MetaCursorTracker *tracker);
|
|||||||
|
|
||||||
void meta_cursor_tracker_force_update (MetaCursorTracker *tracker);
|
void meta_cursor_tracker_force_update (MetaCursorTracker *tracker);
|
||||||
|
|
||||||
|
struct gbm_device * meta_cursor_tracker_get_gbm_device (MetaCursorTracker *tracker);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
#include <cogl/cogl.h>
|
#include <cogl/cogl.h>
|
||||||
#include <cogl/cogl-wayland-server.h>
|
#include <cogl/cogl-wayland-server.h>
|
||||||
#include <clutter/clutter.h>
|
#include <clutter/clutter.h>
|
||||||
#include <gbm.h>
|
|
||||||
|
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
@ -729,3 +728,9 @@ meta_cursor_tracker_force_update (MetaCursorTracker *tracker)
|
|||||||
update_hw_cursor (tracker);
|
update_hw_cursor (tracker);
|
||||||
sync_cursor (tracker);
|
sync_cursor (tracker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct gbm_device *
|
||||||
|
meta_cursor_tracker_get_gbm_device (MetaCursorTracker *tracker)
|
||||||
|
{
|
||||||
|
return tracker->gbm;
|
||||||
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include "display-private.h"
|
#include "display-private.h"
|
||||||
#include "screen-private.h"
|
#include "screen-private.h"
|
||||||
#include "meta-cursor-tracker-private.h" /* for tracker->gbm */
|
#include "meta-cursor-tracker-private.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -234,6 +234,7 @@ meta_cursor_image_load_from_xcursor_image (MetaCursorTracker *tracker,
|
|||||||
uint32_t gbm_format;
|
uint32_t gbm_format;
|
||||||
ClutterBackend *clutter_backend;
|
ClutterBackend *clutter_backend;
|
||||||
CoglContext *cogl_context;
|
CoglContext *cogl_context;
|
||||||
|
struct gbm_device *gbm;
|
||||||
|
|
||||||
width = xc_image->width;
|
width = xc_image->width;
|
||||||
height = xc_image->height;
|
height = xc_image->height;
|
||||||
@ -258,8 +259,9 @@ meta_cursor_image_load_from_xcursor_image (MetaCursorTracker *tracker,
|
|||||||
(uint8_t *) xc_image->pixels,
|
(uint8_t *) xc_image->pixels,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (tracker->gbm)
|
gbm = meta_cursor_tracker_get_gbm_device (tracker);
|
||||||
meta_cursor_image_load_gbm_buffer (tracker->gbm,
|
if (gbm)
|
||||||
|
meta_cursor_image_load_gbm_buffer (gbm,
|
||||||
image,
|
image,
|
||||||
(uint8_t *) xc_image->pixels,
|
(uint8_t *) xc_image->pixels,
|
||||||
width, height, rowstride,
|
width, height, rowstride,
|
||||||
@ -297,6 +299,7 @@ meta_cursor_image_load_from_buffer (MetaCursorTracker *tracker,
|
|||||||
struct wl_shm_buffer *shm_buffer;
|
struct wl_shm_buffer *shm_buffer;
|
||||||
uint32_t gbm_format;
|
uint32_t gbm_format;
|
||||||
int width, height;
|
int width, height;
|
||||||
|
struct gbm_device *gbm = meta_cursor_tracker_get_gbm_device (tracker);
|
||||||
|
|
||||||
image->hot_x = hot_x;
|
image->hot_x = hot_x;
|
||||||
image->hot_y = hot_y;
|
image->hot_y = hot_y;
|
||||||
@ -312,7 +315,7 @@ meta_cursor_image_load_from_buffer (MetaCursorTracker *tracker,
|
|||||||
shm_buffer = wl_shm_buffer_get (buffer);
|
shm_buffer = wl_shm_buffer_get (buffer);
|
||||||
if (shm_buffer)
|
if (shm_buffer)
|
||||||
{
|
{
|
||||||
if (tracker->gbm)
|
if (gbm)
|
||||||
{
|
{
|
||||||
int rowstride = wl_shm_buffer_get_stride (shm_buffer);
|
int rowstride = wl_shm_buffer_get_stride (shm_buffer);
|
||||||
|
|
||||||
@ -338,7 +341,7 @@ meta_cursor_image_load_from_buffer (MetaCursorTracker *tracker,
|
|||||||
gbm_format = GBM_FORMAT_ARGB8888;
|
gbm_format = GBM_FORMAT_ARGB8888;
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_cursor_image_load_gbm_buffer (tracker->gbm,
|
meta_cursor_image_load_gbm_buffer (gbm,
|
||||||
image,
|
image,
|
||||||
(uint8_t *) wl_shm_buffer_get_data (shm_buffer),
|
(uint8_t *) wl_shm_buffer_get_data (shm_buffer),
|
||||||
width, height, rowstride,
|
width, height, rowstride,
|
||||||
@ -359,9 +362,9 @@ meta_cursor_image_load_from_buffer (MetaCursorTracker *tracker,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tracker->gbm)
|
if (gbm)
|
||||||
{
|
{
|
||||||
image->bo = gbm_bo_import (tracker->gbm, GBM_BO_IMPORT_WL_BUFFER,
|
image->bo = gbm_bo_import (gbm, GBM_BO_IMPORT_WL_BUFFER,
|
||||||
buffer, GBM_BO_USE_CURSOR_64X64);
|
buffer, GBM_BO_USE_CURSOR_64X64);
|
||||||
if (!image->bo)
|
if (!image->bo)
|
||||||
meta_warning ("Importing HW cursor from wl_buffer failed\n");
|
meta_warning ("Importing HW cursor from wl_buffer failed\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user